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 */
332 alc889_coef_init(codec);
335 alc888_coef_init(codec);
337 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
340 snd_hda_codec_write(codec, 0x20, 0,
341 AC_VERB_SET_COEF_INDEX, 7);
342 tmp = snd_hda_codec_read(codec, 0x20, 0,
343 AC_VERB_GET_PROC_COEF, 0);
344 snd_hda_codec_write(codec, 0x20, 0,
345 AC_VERB_SET_COEF_INDEX, 7);
346 snd_hda_codec_write(codec, 0x20, 0,
347 AC_VERB_SET_PROC_COEF,
358 * Realtek SSID verification
361 /* Could be any non-zero and even value. When used as fixup, tells
362 * the driver to ignore any present sku defines.
364 #define ALC_FIXUP_SKU_IGNORE (2)
366 static void alc_fixup_sku_ignore(struct hda_codec *codec,
367 const struct hda_fixup *fix, int action)
369 struct alc_spec *spec = codec->spec;
370 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
371 spec->cdefine.fixup = 1;
372 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
376 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
377 const struct hda_fixup *fix, int action)
379 struct alc_spec *spec = codec->spec;
381 if (action == HDA_FIXUP_ACT_PROBE) {
382 spec->no_depop_delay = 1;
383 codec->depop_delay = 0;
387 static int alc_auto_parse_customize_define(struct hda_codec *codec)
389 unsigned int ass, tmp, i;
391 struct alc_spec *spec = codec->spec;
393 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
395 if (spec->cdefine.fixup) {
396 ass = spec->cdefine.sku_cfg;
397 if (ass == ALC_FIXUP_SKU_IGNORE)
402 if (!codec->bus->pci)
404 ass = codec->subsystem_id & 0xffff;
405 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
409 if (codec->vendor_id == 0x10ec0260)
411 ass = snd_hda_codec_get_pincfg(codec, nid);
414 codec_info(codec, "%s: SKU not ready 0x%08x\n",
415 codec->chip_name, ass);
421 for (i = 1; i < 16; i++) {
425 if (((ass >> 16) & 0xf) != tmp)
428 spec->cdefine.port_connectivity = ass >> 30;
429 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
430 spec->cdefine.check_sum = (ass >> 16) & 0xf;
431 spec->cdefine.customization = ass >> 8;
433 spec->cdefine.sku_cfg = ass;
434 spec->cdefine.external_amp = (ass & 0x38) >> 3;
435 spec->cdefine.platform_type = (ass & 0x4) >> 2;
436 spec->cdefine.swap = (ass & 0x2) >> 1;
437 spec->cdefine.override = ass & 0x1;
439 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
440 nid, spec->cdefine.sku_cfg);
441 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
442 spec->cdefine.port_connectivity);
443 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
444 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
445 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
446 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
447 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
448 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
449 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
454 /* return the position of NID in the list, or -1 if not found */
455 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
458 for (i = 0; i < nums; i++)
463 /* return true if the given NID is found in the list */
464 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
466 return find_idx_in_nid_list(nid, list, nums) >= 0;
469 /* check subsystem ID and set up device-specific initialization;
470 * return 1 if initialized, 0 if invalid SSID
472 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
473 * 31 ~ 16 : Manufacture ID
475 * 7 ~ 0 : Assembly ID
476 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
478 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
480 unsigned int ass, tmp, i;
482 struct alc_spec *spec = codec->spec;
484 if (spec->cdefine.fixup) {
485 ass = spec->cdefine.sku_cfg;
486 if (ass == ALC_FIXUP_SKU_IGNORE)
491 ass = codec->subsystem_id & 0xffff;
492 if (codec->bus->pci &&
493 ass != codec->bus->pci->subsystem_device && (ass & 1))
496 /* invalid SSID, check the special NID pin defcfg instead */
498 * 31~30 : port connectivity
501 * 19~16 : Check sum (15:1)
506 if (codec->vendor_id == 0x10ec0260)
508 ass = snd_hda_codec_get_pincfg(codec, nid);
510 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
514 if ((ass >> 30) != 1) /* no physical connection */
519 for (i = 1; i < 16; i++) {
523 if (((ass >> 16) & 0xf) != tmp)
526 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
527 ass & 0xffff, codec->vendor_id);
531 * 2 : 0 --> Desktop, 1 --> Laptop
532 * 3~5 : External Amplifier control
535 tmp = (ass & 0x38) >> 3; /* external Amp control */
538 spec->init_amp = ALC_INIT_GPIO1;
541 spec->init_amp = ALC_INIT_GPIO2;
544 spec->init_amp = ALC_INIT_GPIO3;
548 spec->init_amp = ALC_INIT_DEFAULT;
552 /* is laptop or Desktop and enable the function "Mute internal speaker
553 * when the external headphone out jack is plugged"
558 * 10~8 : Jack location
559 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
561 * 15 : 1 --> enable the function "Mute internal speaker
562 * when the external headphone out jack is plugged"
564 if (!spec->gen.autocfg.hp_pins[0] &&
565 !(spec->gen.autocfg.line_out_pins[0] &&
566 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
568 tmp = (ass >> 11) & 0x3; /* HP to chassis */
570 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
571 spec->gen.autocfg.line_outs))
573 spec->gen.autocfg.hp_pins[0] = nid;
578 /* Check the validity of ALC subsystem-id
579 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
580 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
582 if (!alc_subsystem_id(codec, ports)) {
583 struct alc_spec *spec = codec->spec;
585 "realtek: Enable default setup for auto mode as fallback\n");
586 spec->init_amp = ALC_INIT_DEFAULT;
591 * COEF access helper functions
594 static int alc_read_coefex_idx(struct hda_codec *codec,
596 unsigned int coef_idx)
599 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
601 val = snd_hda_codec_read(codec, nid, 0,
602 AC_VERB_GET_PROC_COEF, 0);
606 #define alc_read_coef_idx(codec, coef_idx) \
607 alc_read_coefex_idx(codec, 0x20, coef_idx)
609 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
610 unsigned int coef_idx,
611 unsigned int coef_val)
613 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
615 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF,
619 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
620 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
622 /* a special bypass for COEF 0; read the cached value at the second time */
623 static unsigned int alc_get_coef0(struct hda_codec *codec)
625 struct alc_spec *spec = codec->spec;
627 spec->coef0 = alc_read_coef_idx(codec, 0);
634 static hda_nid_t get_adc_nid(struct hda_codec *codec, int adc_idx, int imux_idx)
636 struct hda_gen_spec *spec = codec->spec;
637 if (spec->dyn_adc_switch)
638 adc_idx = spec->dyn_adc_idx[imux_idx];
639 return spec->adc_nids[adc_idx];
642 static void alc_inv_dmic_sync_adc(struct hda_codec *codec, int adc_idx)
644 struct alc_spec *spec = codec->spec;
645 struct hda_input_mux *imux = &spec->gen.input_mux;
646 struct nid_path *path;
651 for (i = 0; i < imux->num_items; i++) {
652 if (spec->gen.imux_pins[i] == spec->inv_dmic_pin)
655 if (i >= imux->num_items)
658 path = snd_hda_get_nid_path(codec, spec->inv_dmic_pin,
659 get_adc_nid(codec, adc_idx, i));
660 val = path->ctls[NID_PATH_MUTE_CTL];
663 nid = get_amp_nid_(val);
664 dir = get_amp_direction_(val);
665 parm = AC_AMP_SET_RIGHT |
666 (dir == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT);
668 /* flush all cached amps at first */
669 snd_hda_codec_flush_cache(codec);
671 /* we care only right channel */
672 val = snd_hda_codec_amp_read(codec, nid, 1, dir, 0);
673 if (val & 0x80) /* if already muted, we don't need to touch */
676 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
681 * Inverted digital-mic handling
683 * First off, it's a bit tricky. The "Inverted Internal Mic Capture Switch"
684 * gives the additional mute only to the right channel of the digital mic
685 * capture stream. This is a workaround for avoiding the almost silence
686 * by summing the stereo stream from some (known to be ForteMedia)
689 * The logic is to call alc_inv_dmic_sync() after each action (possibly)
690 * modifying ADC amp. When the mute flag is set, it mutes the R-channel
691 * without caching so that the cache can still keep the original value.
692 * The cached value is then restored when the flag is set off or any other
693 * than d-mic is used as the current input source.
695 static void alc_inv_dmic_sync(struct hda_codec *codec, bool force)
697 struct alc_spec *spec = codec->spec;
700 if (!spec->inv_dmic_fixup)
702 if (!spec->inv_dmic_muted && !force)
704 nums = spec->gen.dyn_adc_switch ? 1 : spec->gen.num_adc_nids;
705 for (src = 0; src < nums; src++) {
706 bool dmic_fixup = false;
708 if (spec->inv_dmic_muted &&
709 spec->gen.imux_pins[spec->gen.cur_mux[src]] == spec->inv_dmic_pin)
711 if (!dmic_fixup && !force)
713 alc_inv_dmic_sync_adc(codec, src);
717 static void alc_inv_dmic_hook(struct hda_codec *codec,
718 struct snd_kcontrol *kcontrol,
719 struct snd_ctl_elem_value *ucontrol)
721 alc_inv_dmic_sync(codec, false);
724 static int alc_inv_dmic_sw_get(struct snd_kcontrol *kcontrol,
725 struct snd_ctl_elem_value *ucontrol)
727 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
728 struct alc_spec *spec = codec->spec;
730 ucontrol->value.integer.value[0] = !spec->inv_dmic_muted;
734 static int alc_inv_dmic_sw_put(struct snd_kcontrol *kcontrol,
735 struct snd_ctl_elem_value *ucontrol)
737 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
738 struct alc_spec *spec = codec->spec;
739 unsigned int val = !ucontrol->value.integer.value[0];
741 if (val == spec->inv_dmic_muted)
743 spec->inv_dmic_muted = val;
744 alc_inv_dmic_sync(codec, true);
748 static const struct snd_kcontrol_new alc_inv_dmic_sw = {
749 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
750 .name = "Inverted Internal Mic Capture Switch",
751 .info = snd_ctl_boolean_mono_info,
752 .get = alc_inv_dmic_sw_get,
753 .put = alc_inv_dmic_sw_put,
756 static int alc_add_inv_dmic_mixer(struct hda_codec *codec, hda_nid_t nid)
758 struct alc_spec *spec = codec->spec;
760 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &alc_inv_dmic_sw))
762 spec->inv_dmic_fixup = 1;
763 spec->inv_dmic_muted = 0;
764 spec->inv_dmic_pin = nid;
765 spec->gen.cap_sync_hook = alc_inv_dmic_hook;
769 /* typically the digital mic is put at node 0x12 */
770 static void alc_fixup_inv_dmic_0x12(struct hda_codec *codec,
771 const struct hda_fixup *fix, int action)
773 if (action == HDA_FIXUP_ACT_PROBE)
774 alc_add_inv_dmic_mixer(codec, 0x12);
778 #ifdef CONFIG_SND_HDA_INPUT_BEEP
779 /* additional beep mixers; the actual parameters are overwritten at build */
780 static const struct snd_kcontrol_new alc_beep_mixer[] = {
781 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
782 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
787 static int alc_build_controls(struct hda_codec *codec)
789 struct alc_spec *spec = codec->spec;
792 err = snd_hda_gen_build_controls(codec);
796 for (i = 0; i < spec->num_mixers; i++) {
797 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
802 #ifdef CONFIG_SND_HDA_INPUT_BEEP
803 /* create beep controls if needed */
804 if (spec->beep_amp) {
805 const struct snd_kcontrol_new *knew;
806 for (knew = alc_beep_mixer; knew->name; knew++) {
807 struct snd_kcontrol *kctl;
808 kctl = snd_ctl_new1(knew, codec);
811 kctl->private_value = spec->beep_amp;
812 err = snd_hda_ctl_add(codec, 0, kctl);
819 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
828 static int alc_init(struct hda_codec *codec)
830 struct alc_spec *spec = codec->spec;
833 spec->init_hook(codec);
836 alc_auto_init_amp(codec, spec->init_amp);
838 snd_hda_gen_init(codec);
840 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
845 static inline void alc_shutup(struct hda_codec *codec)
847 struct alc_spec *spec = codec->spec;
849 if (spec && spec->shutup)
852 snd_hda_shutup_pins(codec);
855 #define alc_free snd_hda_gen_free
858 static void alc_power_eapd(struct hda_codec *codec)
860 alc_auto_setup_eapd(codec, false);
863 static int alc_suspend(struct hda_codec *codec)
865 struct alc_spec *spec = codec->spec;
867 if (spec && spec->power_hook)
868 spec->power_hook(codec);
874 static int alc_resume(struct hda_codec *codec)
876 struct alc_spec *spec = codec->spec;
878 if (!spec->no_depop_delay)
879 msleep(150); /* to avoid pop noise */
880 codec->patch_ops.init(codec);
881 snd_hda_codec_resume_amp(codec);
882 snd_hda_codec_resume_cache(codec);
883 alc_inv_dmic_sync(codec, true);
884 hda_call_check_power_status(codec, 0x01);
891 static const struct hda_codec_ops alc_patch_ops = {
892 .build_controls = alc_build_controls,
893 .build_pcms = snd_hda_gen_build_pcms,
896 .unsol_event = snd_hda_jack_unsol_event,
898 .resume = alc_resume,
899 .suspend = alc_suspend,
900 .check_power_status = snd_hda_gen_check_power_status,
902 .reboot_notify = alc_shutup,
906 /* replace the codec chip_name with the given string */
907 static int alc_codec_rename(struct hda_codec *codec, const char *name)
909 kfree(codec->chip_name);
910 codec->chip_name = kstrdup(name, GFP_KERNEL);
911 if (!codec->chip_name) {
919 * Rename codecs appropriately from COEF value or subvendor id
921 struct alc_codec_rename_table {
922 unsigned int vendor_id;
923 unsigned short coef_mask;
924 unsigned short coef_bits;
928 struct alc_codec_rename_pci_table {
929 unsigned int codec_vendor_id;
930 unsigned short pci_subvendor;
931 unsigned short pci_subdevice;
935 static struct alc_codec_rename_table rename_tbl[] = {
936 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
937 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
938 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
939 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
940 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
941 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
942 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
943 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
944 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
945 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
946 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
947 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
948 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
949 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
950 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
951 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
952 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
956 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
957 { 0x10ec0280, 0x1028, 0, "ALC3220" },
958 { 0x10ec0282, 0x1028, 0, "ALC3221" },
959 { 0x10ec0283, 0x1028, 0, "ALC3223" },
960 { 0x10ec0288, 0x1028, 0, "ALC3263" },
961 { 0x10ec0292, 0x1028, 0, "ALC3226" },
962 { 0x10ec0293, 0x1028, 0, "ALC3235" },
963 { 0x10ec0255, 0x1028, 0, "ALC3234" },
964 { 0x10ec0668, 0x1028, 0, "ALC3661" },
965 { 0x10ec0275, 0x1028, 0, "ALC3260" },
966 { 0x10ec0899, 0x1028, 0, "ALC3861" },
967 { 0x10ec0670, 0x1025, 0, "ALC669X" },
968 { 0x10ec0676, 0x1025, 0, "ALC679X" },
969 { 0x10ec0282, 0x1043, 0, "ALC3229" },
970 { 0x10ec0233, 0x1043, 0, "ALC3236" },
971 { 0x10ec0280, 0x103c, 0, "ALC3228" },
972 { 0x10ec0282, 0x103c, 0, "ALC3227" },
973 { 0x10ec0286, 0x103c, 0, "ALC3242" },
974 { 0x10ec0290, 0x103c, 0, "ALC3241" },
975 { 0x10ec0668, 0x103c, 0, "ALC3662" },
976 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
977 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
981 static int alc_codec_rename_from_preset(struct hda_codec *codec)
983 const struct alc_codec_rename_table *p;
984 const struct alc_codec_rename_pci_table *q;
986 for (p = rename_tbl; p->vendor_id; p++) {
987 if (p->vendor_id != codec->vendor_id)
989 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
990 return alc_codec_rename(codec, p->name);
993 if (!codec->bus->pci)
995 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
996 if (q->codec_vendor_id != codec->vendor_id)
998 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1000 if (!q->pci_subdevice ||
1001 q->pci_subdevice == codec->bus->pci->subsystem_device)
1002 return alc_codec_rename(codec, q->name);
1010 * Digital-beep handlers
1012 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1013 #define set_beep_amp(spec, nid, idx, dir) \
1014 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
1016 static const struct snd_pci_quirk beep_white_list[] = {
1017 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1018 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1019 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1020 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1021 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1022 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1023 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1024 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1025 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1029 static inline int has_cdefine_beep(struct hda_codec *codec)
1031 struct alc_spec *spec = codec->spec;
1032 const struct snd_pci_quirk *q;
1033 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
1036 return spec->cdefine.enable_pcbeep;
1039 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
1040 #define has_cdefine_beep(codec) 0
1043 /* parse the BIOS configuration and set up the alc_spec */
1044 /* return 1 if successful, 0 if the proper config is not found,
1045 * or a negative error code
1047 static int alc_parse_auto_config(struct hda_codec *codec,
1048 const hda_nid_t *ignore_nids,
1049 const hda_nid_t *ssid_nids)
1051 struct alc_spec *spec = codec->spec;
1052 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1055 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1061 alc_ssid_check(codec, ssid_nids);
1063 err = snd_hda_gen_parse_auto_config(codec, cfg);
1070 /* common preparation job for alc_spec */
1071 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1073 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1079 snd_hda_gen_spec_init(&spec->gen);
1080 spec->gen.mixer_nid = mixer_nid;
1081 spec->gen.own_eapd_ctl = 1;
1082 codec->single_adc_amp = 1;
1083 /* FIXME: do we need this for all Realtek codec models? */
1084 codec->spdif_status_reset = 1;
1086 err = alc_codec_rename_from_preset(codec);
1094 static int alc880_parse_auto_config(struct hda_codec *codec)
1096 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1097 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1098 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1107 ALC880_FIXUP_MEDION_RIM,
1109 ALC880_FIXUP_LG_LW25,
1111 ALC880_FIXUP_EAPD_COEF,
1112 ALC880_FIXUP_TCL_S700,
1113 ALC880_FIXUP_VOL_KNOB,
1114 ALC880_FIXUP_FUJITSU,
1116 ALC880_FIXUP_UNIWILL,
1117 ALC880_FIXUP_UNIWILL_DIG,
1119 ALC880_FIXUP_ASUS_W5A,
1120 ALC880_FIXUP_3ST_BASE,
1122 ALC880_FIXUP_3ST_DIG,
1123 ALC880_FIXUP_5ST_BASE,
1125 ALC880_FIXUP_5ST_DIG,
1126 ALC880_FIXUP_6ST_BASE,
1128 ALC880_FIXUP_6ST_DIG,
1129 ALC880_FIXUP_6ST_AUTOMUTE,
1132 /* enable the volume-knob widget support on NID 0x21 */
1133 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1134 const struct hda_fixup *fix, int action)
1136 if (action == HDA_FIXUP_ACT_PROBE)
1137 snd_hda_jack_detect_enable_callback(codec, 0x21, ALC_DCVOL_EVENT, alc_update_knob_master);
1140 static const struct hda_fixup alc880_fixups[] = {
1141 [ALC880_FIXUP_GPIO1] = {
1142 .type = HDA_FIXUP_VERBS,
1143 .v.verbs = alc_gpio1_init_verbs,
1145 [ALC880_FIXUP_GPIO2] = {
1146 .type = HDA_FIXUP_VERBS,
1147 .v.verbs = alc_gpio2_init_verbs,
1149 [ALC880_FIXUP_MEDION_RIM] = {
1150 .type = HDA_FIXUP_VERBS,
1151 .v.verbs = (const struct hda_verb[]) {
1152 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1153 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1157 .chain_id = ALC880_FIXUP_GPIO2,
1159 [ALC880_FIXUP_LG] = {
1160 .type = HDA_FIXUP_PINS,
1161 .v.pins = (const struct hda_pintbl[]) {
1162 /* disable bogus unused pins */
1163 { 0x16, 0x411111f0 },
1164 { 0x18, 0x411111f0 },
1165 { 0x1a, 0x411111f0 },
1169 [ALC880_FIXUP_LG_LW25] = {
1170 .type = HDA_FIXUP_PINS,
1171 .v.pins = (const struct hda_pintbl[]) {
1172 { 0x1a, 0x0181344f }, /* line-in */
1173 { 0x1b, 0x0321403f }, /* headphone */
1177 [ALC880_FIXUP_W810] = {
1178 .type = HDA_FIXUP_PINS,
1179 .v.pins = (const struct hda_pintbl[]) {
1180 /* disable bogus unused pins */
1181 { 0x17, 0x411111f0 },
1185 .chain_id = ALC880_FIXUP_GPIO2,
1187 [ALC880_FIXUP_EAPD_COEF] = {
1188 .type = HDA_FIXUP_VERBS,
1189 .v.verbs = (const struct hda_verb[]) {
1190 /* change to EAPD mode */
1191 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1192 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1196 [ALC880_FIXUP_TCL_S700] = {
1197 .type = HDA_FIXUP_VERBS,
1198 .v.verbs = (const struct hda_verb[]) {
1199 /* change to EAPD mode */
1200 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1201 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1205 .chain_id = ALC880_FIXUP_GPIO2,
1207 [ALC880_FIXUP_VOL_KNOB] = {
1208 .type = HDA_FIXUP_FUNC,
1209 .v.func = alc880_fixup_vol_knob,
1211 [ALC880_FIXUP_FUJITSU] = {
1212 /* override all pins as BIOS on old Amilo is broken */
1213 .type = HDA_FIXUP_PINS,
1214 .v.pins = (const struct hda_pintbl[]) {
1215 { 0x14, 0x0121411f }, /* HP */
1216 { 0x15, 0x99030120 }, /* speaker */
1217 { 0x16, 0x99030130 }, /* bass speaker */
1218 { 0x17, 0x411111f0 }, /* N/A */
1219 { 0x18, 0x411111f0 }, /* N/A */
1220 { 0x19, 0x01a19950 }, /* mic-in */
1221 { 0x1a, 0x411111f0 }, /* N/A */
1222 { 0x1b, 0x411111f0 }, /* N/A */
1223 { 0x1c, 0x411111f0 }, /* N/A */
1224 { 0x1d, 0x411111f0 }, /* N/A */
1225 { 0x1e, 0x01454140 }, /* SPDIF out */
1229 .chain_id = ALC880_FIXUP_VOL_KNOB,
1231 [ALC880_FIXUP_F1734] = {
1232 /* almost compatible with FUJITSU, but no bass and SPDIF */
1233 .type = HDA_FIXUP_PINS,
1234 .v.pins = (const struct hda_pintbl[]) {
1235 { 0x14, 0x0121411f }, /* HP */
1236 { 0x15, 0x99030120 }, /* speaker */
1237 { 0x16, 0x411111f0 }, /* N/A */
1238 { 0x17, 0x411111f0 }, /* N/A */
1239 { 0x18, 0x411111f0 }, /* N/A */
1240 { 0x19, 0x01a19950 }, /* mic-in */
1241 { 0x1a, 0x411111f0 }, /* N/A */
1242 { 0x1b, 0x411111f0 }, /* N/A */
1243 { 0x1c, 0x411111f0 }, /* N/A */
1244 { 0x1d, 0x411111f0 }, /* N/A */
1245 { 0x1e, 0x411111f0 }, /* N/A */
1249 .chain_id = ALC880_FIXUP_VOL_KNOB,
1251 [ALC880_FIXUP_UNIWILL] = {
1252 /* need to fix HP and speaker pins to be parsed correctly */
1253 .type = HDA_FIXUP_PINS,
1254 .v.pins = (const struct hda_pintbl[]) {
1255 { 0x14, 0x0121411f }, /* HP */
1256 { 0x15, 0x99030120 }, /* speaker */
1257 { 0x16, 0x99030130 }, /* bass speaker */
1261 [ALC880_FIXUP_UNIWILL_DIG] = {
1262 .type = HDA_FIXUP_PINS,
1263 .v.pins = (const struct hda_pintbl[]) {
1264 /* disable bogus unused pins */
1265 { 0x17, 0x411111f0 },
1266 { 0x19, 0x411111f0 },
1267 { 0x1b, 0x411111f0 },
1268 { 0x1f, 0x411111f0 },
1272 [ALC880_FIXUP_Z71V] = {
1273 .type = HDA_FIXUP_PINS,
1274 .v.pins = (const struct hda_pintbl[]) {
1275 /* set up the whole pins as BIOS is utterly broken */
1276 { 0x14, 0x99030120 }, /* speaker */
1277 { 0x15, 0x0121411f }, /* HP */
1278 { 0x16, 0x411111f0 }, /* N/A */
1279 { 0x17, 0x411111f0 }, /* N/A */
1280 { 0x18, 0x01a19950 }, /* mic-in */
1281 { 0x19, 0x411111f0 }, /* N/A */
1282 { 0x1a, 0x01813031 }, /* line-in */
1283 { 0x1b, 0x411111f0 }, /* N/A */
1284 { 0x1c, 0x411111f0 }, /* N/A */
1285 { 0x1d, 0x411111f0 }, /* N/A */
1286 { 0x1e, 0x0144111e }, /* SPDIF */
1290 [ALC880_FIXUP_ASUS_W5A] = {
1291 .type = HDA_FIXUP_PINS,
1292 .v.pins = (const struct hda_pintbl[]) {
1293 /* set up the whole pins as BIOS is utterly broken */
1294 { 0x14, 0x0121411f }, /* HP */
1295 { 0x15, 0x411111f0 }, /* N/A */
1296 { 0x16, 0x411111f0 }, /* N/A */
1297 { 0x17, 0x411111f0 }, /* N/A */
1298 { 0x18, 0x90a60160 }, /* mic */
1299 { 0x19, 0x411111f0 }, /* N/A */
1300 { 0x1a, 0x411111f0 }, /* N/A */
1301 { 0x1b, 0x411111f0 }, /* N/A */
1302 { 0x1c, 0x411111f0 }, /* N/A */
1303 { 0x1d, 0x411111f0 }, /* N/A */
1304 { 0x1e, 0xb743111e }, /* SPDIF out */
1308 .chain_id = ALC880_FIXUP_GPIO1,
1310 [ALC880_FIXUP_3ST_BASE] = {
1311 .type = HDA_FIXUP_PINS,
1312 .v.pins = (const struct hda_pintbl[]) {
1313 { 0x14, 0x01014010 }, /* line-out */
1314 { 0x15, 0x411111f0 }, /* N/A */
1315 { 0x16, 0x411111f0 }, /* N/A */
1316 { 0x17, 0x411111f0 }, /* N/A */
1317 { 0x18, 0x01a19c30 }, /* mic-in */
1318 { 0x19, 0x0121411f }, /* HP */
1319 { 0x1a, 0x01813031 }, /* line-in */
1320 { 0x1b, 0x02a19c40 }, /* front-mic */
1321 { 0x1c, 0x411111f0 }, /* N/A */
1322 { 0x1d, 0x411111f0 }, /* N/A */
1323 /* 0x1e is filled in below */
1324 { 0x1f, 0x411111f0 }, /* N/A */
1328 [ALC880_FIXUP_3ST] = {
1329 .type = HDA_FIXUP_PINS,
1330 .v.pins = (const struct hda_pintbl[]) {
1331 { 0x1e, 0x411111f0 }, /* N/A */
1335 .chain_id = ALC880_FIXUP_3ST_BASE,
1337 [ALC880_FIXUP_3ST_DIG] = {
1338 .type = HDA_FIXUP_PINS,
1339 .v.pins = (const struct hda_pintbl[]) {
1340 { 0x1e, 0x0144111e }, /* SPDIF */
1344 .chain_id = ALC880_FIXUP_3ST_BASE,
1346 [ALC880_FIXUP_5ST_BASE] = {
1347 .type = HDA_FIXUP_PINS,
1348 .v.pins = (const struct hda_pintbl[]) {
1349 { 0x14, 0x01014010 }, /* front */
1350 { 0x15, 0x411111f0 }, /* N/A */
1351 { 0x16, 0x01011411 }, /* CLFE */
1352 { 0x17, 0x01016412 }, /* surr */
1353 { 0x18, 0x01a19c30 }, /* mic-in */
1354 { 0x19, 0x0121411f }, /* HP */
1355 { 0x1a, 0x01813031 }, /* line-in */
1356 { 0x1b, 0x02a19c40 }, /* front-mic */
1357 { 0x1c, 0x411111f0 }, /* N/A */
1358 { 0x1d, 0x411111f0 }, /* N/A */
1359 /* 0x1e is filled in below */
1360 { 0x1f, 0x411111f0 }, /* N/A */
1364 [ALC880_FIXUP_5ST] = {
1365 .type = HDA_FIXUP_PINS,
1366 .v.pins = (const struct hda_pintbl[]) {
1367 { 0x1e, 0x411111f0 }, /* N/A */
1371 .chain_id = ALC880_FIXUP_5ST_BASE,
1373 [ALC880_FIXUP_5ST_DIG] = {
1374 .type = HDA_FIXUP_PINS,
1375 .v.pins = (const struct hda_pintbl[]) {
1376 { 0x1e, 0x0144111e }, /* SPDIF */
1380 .chain_id = ALC880_FIXUP_5ST_BASE,
1382 [ALC880_FIXUP_6ST_BASE] = {
1383 .type = HDA_FIXUP_PINS,
1384 .v.pins = (const struct hda_pintbl[]) {
1385 { 0x14, 0x01014010 }, /* front */
1386 { 0x15, 0x01016412 }, /* surr */
1387 { 0x16, 0x01011411 }, /* CLFE */
1388 { 0x17, 0x01012414 }, /* side */
1389 { 0x18, 0x01a19c30 }, /* mic-in */
1390 { 0x19, 0x02a19c40 }, /* front-mic */
1391 { 0x1a, 0x01813031 }, /* line-in */
1392 { 0x1b, 0x0121411f }, /* HP */
1393 { 0x1c, 0x411111f0 }, /* N/A */
1394 { 0x1d, 0x411111f0 }, /* N/A */
1395 /* 0x1e is filled in below */
1396 { 0x1f, 0x411111f0 }, /* N/A */
1400 [ALC880_FIXUP_6ST] = {
1401 .type = HDA_FIXUP_PINS,
1402 .v.pins = (const struct hda_pintbl[]) {
1403 { 0x1e, 0x411111f0 }, /* N/A */
1407 .chain_id = ALC880_FIXUP_6ST_BASE,
1409 [ALC880_FIXUP_6ST_DIG] = {
1410 .type = HDA_FIXUP_PINS,
1411 .v.pins = (const struct hda_pintbl[]) {
1412 { 0x1e, 0x0144111e }, /* SPDIF */
1416 .chain_id = ALC880_FIXUP_6ST_BASE,
1418 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1419 .type = HDA_FIXUP_PINS,
1420 .v.pins = (const struct hda_pintbl[]) {
1421 { 0x1b, 0x0121401f }, /* HP with jack detect */
1424 .chained_before = true,
1425 .chain_id = ALC880_FIXUP_6ST_BASE,
1429 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1430 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1431 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1432 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1433 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1434 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1435 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1436 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1437 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1438 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1439 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1440 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1441 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1442 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1443 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1444 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734),
1445 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1446 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1447 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1448 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1449 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1450 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1451 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1452 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1454 /* Below is the copied entries from alc880_quirks.c.
1455 * It's not quite sure whether BIOS sets the correct pin-config table
1456 * on these machines, thus they are kept to be compatible with
1457 * the old static quirks. Once when it's confirmed to work without
1458 * these overrides, it'd be better to remove.
1460 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1461 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1462 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1463 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1464 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1465 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1466 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1467 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1468 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1469 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1470 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1471 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1472 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1473 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1474 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1475 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1476 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1477 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1478 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1479 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1480 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1481 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1482 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1483 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1484 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1485 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1486 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1487 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1488 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1489 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1490 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1491 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1492 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1494 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1495 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1496 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1500 static const struct hda_model_fixup alc880_fixup_models[] = {
1501 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1502 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1503 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1504 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1505 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1506 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1507 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1513 * OK, here we have finally the patch for ALC880
1515 static int patch_alc880(struct hda_codec *codec)
1517 struct alc_spec *spec;
1520 err = alc_alloc_spec(codec, 0x0b);
1525 spec->gen.need_dac_fix = 1;
1526 spec->gen.beep_nid = 0x01;
1528 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1530 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1532 /* automatic parse from the BIOS config */
1533 err = alc880_parse_auto_config(codec);
1537 if (!spec->gen.no_analog)
1538 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1540 codec->patch_ops = alc_patch_ops;
1541 codec->patch_ops.unsol_event = alc880_unsol_event;
1544 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1557 static int alc260_parse_auto_config(struct hda_codec *codec)
1559 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1560 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1561 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1568 ALC260_FIXUP_HP_DC5750,
1569 ALC260_FIXUP_HP_PIN_0F,
1572 ALC260_FIXUP_GPIO1_TOGGLE,
1573 ALC260_FIXUP_REPLACER,
1574 ALC260_FIXUP_HP_B1900,
1576 ALC260_FIXUP_FSC_S7020,
1577 ALC260_FIXUP_FSC_S7020_JWSE,
1578 ALC260_FIXUP_VAIO_PINS,
1581 static void alc260_gpio1_automute(struct hda_codec *codec)
1583 struct alc_spec *spec = codec->spec;
1584 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
1585 spec->gen.hp_jack_present);
1588 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1589 const struct hda_fixup *fix, int action)
1591 struct alc_spec *spec = codec->spec;
1592 if (action == HDA_FIXUP_ACT_PROBE) {
1593 /* although the machine has only one output pin, we need to
1594 * toggle GPIO1 according to the jack state
1596 spec->gen.automute_hook = alc260_gpio1_automute;
1597 spec->gen.detect_hp = 1;
1598 spec->gen.automute_speaker = 1;
1599 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1600 snd_hda_jack_detect_enable_callback(codec, 0x0f, HDA_GEN_HP_EVENT,
1601 snd_hda_gen_hp_automute);
1602 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
1606 static void alc260_fixup_kn1(struct hda_codec *codec,
1607 const struct hda_fixup *fix, int action)
1609 struct alc_spec *spec = codec->spec;
1610 static const struct hda_pintbl pincfgs[] = {
1611 { 0x0f, 0x02214000 }, /* HP/speaker */
1612 { 0x12, 0x90a60160 }, /* int mic */
1613 { 0x13, 0x02a19000 }, /* ext mic */
1614 { 0x18, 0x01446000 }, /* SPDIF out */
1615 /* disable bogus I/O pins */
1616 { 0x10, 0x411111f0 },
1617 { 0x11, 0x411111f0 },
1618 { 0x14, 0x411111f0 },
1619 { 0x15, 0x411111f0 },
1620 { 0x16, 0x411111f0 },
1621 { 0x17, 0x411111f0 },
1622 { 0x19, 0x411111f0 },
1627 case HDA_FIXUP_ACT_PRE_PROBE:
1628 snd_hda_apply_pincfgs(codec, pincfgs);
1630 case HDA_FIXUP_ACT_PROBE:
1631 spec->init_amp = ALC_INIT_NONE;
1636 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1637 const struct hda_fixup *fix, int action)
1639 struct alc_spec *spec = codec->spec;
1640 if (action == HDA_FIXUP_ACT_PROBE)
1641 spec->init_amp = ALC_INIT_NONE;
1644 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1645 const struct hda_fixup *fix, int action)
1647 struct alc_spec *spec = codec->spec;
1648 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1649 spec->gen.add_jack_modes = 1;
1650 spec->gen.hp_mic = 1;
1654 static const struct hda_fixup alc260_fixups[] = {
1655 [ALC260_FIXUP_HP_DC5750] = {
1656 .type = HDA_FIXUP_PINS,
1657 .v.pins = (const struct hda_pintbl[]) {
1658 { 0x11, 0x90130110 }, /* speaker */
1662 [ALC260_FIXUP_HP_PIN_0F] = {
1663 .type = HDA_FIXUP_PINS,
1664 .v.pins = (const struct hda_pintbl[]) {
1665 { 0x0f, 0x01214000 }, /* HP */
1669 [ALC260_FIXUP_COEF] = {
1670 .type = HDA_FIXUP_VERBS,
1671 .v.verbs = (const struct hda_verb[]) {
1672 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1673 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1677 [ALC260_FIXUP_GPIO1] = {
1678 .type = HDA_FIXUP_VERBS,
1679 .v.verbs = alc_gpio1_init_verbs,
1681 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1682 .type = HDA_FIXUP_FUNC,
1683 .v.func = alc260_fixup_gpio1_toggle,
1685 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1687 [ALC260_FIXUP_REPLACER] = {
1688 .type = HDA_FIXUP_VERBS,
1689 .v.verbs = (const struct hda_verb[]) {
1690 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1691 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1695 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1697 [ALC260_FIXUP_HP_B1900] = {
1698 .type = HDA_FIXUP_FUNC,
1699 .v.func = alc260_fixup_gpio1_toggle,
1701 .chain_id = ALC260_FIXUP_COEF,
1703 [ALC260_FIXUP_KN1] = {
1704 .type = HDA_FIXUP_FUNC,
1705 .v.func = alc260_fixup_kn1,
1707 [ALC260_FIXUP_FSC_S7020] = {
1708 .type = HDA_FIXUP_FUNC,
1709 .v.func = alc260_fixup_fsc_s7020,
1711 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1712 .type = HDA_FIXUP_FUNC,
1713 .v.func = alc260_fixup_fsc_s7020_jwse,
1715 .chain_id = ALC260_FIXUP_FSC_S7020,
1717 [ALC260_FIXUP_VAIO_PINS] = {
1718 .type = HDA_FIXUP_PINS,
1719 .v.pins = (const struct hda_pintbl[]) {
1720 /* Pin configs are missing completely on some VAIOs */
1721 { 0x0f, 0x01211020 },
1722 { 0x10, 0x0001003f },
1723 { 0x11, 0x411111f0 },
1724 { 0x12, 0x01a15930 },
1725 { 0x13, 0x411111f0 },
1726 { 0x14, 0x411111f0 },
1727 { 0x15, 0x411111f0 },
1728 { 0x16, 0x411111f0 },
1729 { 0x17, 0x411111f0 },
1730 { 0x18, 0x411111f0 },
1731 { 0x19, 0x411111f0 },
1737 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1738 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1739 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1740 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1741 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1742 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1743 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1744 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1745 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1746 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1747 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1748 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1749 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1753 static const struct hda_model_fixup alc260_fixup_models[] = {
1754 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1755 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1756 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1757 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1763 static int patch_alc260(struct hda_codec *codec)
1765 struct alc_spec *spec;
1768 err = alc_alloc_spec(codec, 0x07);
1773 /* as quite a few machines require HP amp for speaker outputs,
1774 * it's easier to enable it unconditionally; even if it's unneeded,
1775 * it's almost harmless.
1777 spec->gen.prefer_hp_amp = 1;
1778 spec->gen.beep_nid = 0x01;
1780 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1782 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1784 /* automatic parse from the BIOS config */
1785 err = alc260_parse_auto_config(codec);
1789 if (!spec->gen.no_analog)
1790 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1792 codec->patch_ops = alc_patch_ops;
1793 spec->shutup = alc_eapd_shutup;
1795 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1806 * ALC882/883/885/888/889 support
1808 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1809 * configuration. Each pin widget can choose any input DACs and a mixer.
1810 * Each ADC is connected from a mixer of all inputs. This makes possible
1811 * 6-channel independent captures.
1813 * In addition, an independent DAC for the multi-playback (not used in this
1821 ALC882_FIXUP_ABIT_AW9D_MAX,
1822 ALC882_FIXUP_LENOVO_Y530,
1823 ALC882_FIXUP_PB_M5210,
1824 ALC882_FIXUP_ACER_ASPIRE_7736,
1825 ALC882_FIXUP_ASUS_W90V,
1827 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1828 ALC889_FIXUP_VAIO_TT,
1829 ALC888_FIXUP_EEE1601,
1832 ALC883_FIXUP_ACER_EAPD,
1837 ALC882_FIXUP_ASUS_W2JC,
1838 ALC882_FIXUP_ACER_ASPIRE_4930G,
1839 ALC882_FIXUP_ACER_ASPIRE_8930G,
1840 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1841 ALC885_FIXUP_MACPRO_GPIO,
1842 ALC889_FIXUP_DAC_ROUTE,
1843 ALC889_FIXUP_MBP_VREF,
1844 ALC889_FIXUP_IMAC91_VREF,
1845 ALC889_FIXUP_MBA11_VREF,
1846 ALC889_FIXUP_MBA21_VREF,
1847 ALC889_FIXUP_MP11_VREF,
1848 ALC882_FIXUP_INV_DMIC,
1849 ALC882_FIXUP_NO_PRIMARY_HP,
1850 ALC887_FIXUP_ASUS_BASS,
1851 ALC887_FIXUP_BASS_CHMAP,
1854 static void alc889_fixup_coef(struct hda_codec *codec,
1855 const struct hda_fixup *fix, int action)
1857 if (action != HDA_FIXUP_ACT_INIT)
1859 alc889_coef_init(codec);
1862 /* toggle speaker-output according to the hp-jack state */
1863 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1865 unsigned int gpiostate, gpiomask, gpiodir;
1867 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1868 AC_VERB_GET_GPIO_DATA, 0);
1871 gpiostate |= (1 << pin);
1873 gpiostate &= ~(1 << pin);
1875 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1876 AC_VERB_GET_GPIO_MASK, 0);
1877 gpiomask |= (1 << pin);
1879 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1880 AC_VERB_GET_GPIO_DIRECTION, 0);
1881 gpiodir |= (1 << pin);
1884 snd_hda_codec_write(codec, codec->afg, 0,
1885 AC_VERB_SET_GPIO_MASK, gpiomask);
1886 snd_hda_codec_write(codec, codec->afg, 0,
1887 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1891 snd_hda_codec_write(codec, codec->afg, 0,
1892 AC_VERB_SET_GPIO_DATA, gpiostate);
1895 /* set up GPIO at initialization */
1896 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1897 const struct hda_fixup *fix, int action)
1899 if (action != HDA_FIXUP_ACT_INIT)
1901 alc882_gpio_mute(codec, 0, 0);
1902 alc882_gpio_mute(codec, 1, 0);
1905 /* Fix the connection of some pins for ALC889:
1906 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1907 * work correctly (bko#42740)
1909 static void alc889_fixup_dac_route(struct hda_codec *codec,
1910 const struct hda_fixup *fix, int action)
1912 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1913 /* fake the connections during parsing the tree */
1914 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1915 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1916 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1917 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1918 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1919 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1920 } else if (action == HDA_FIXUP_ACT_PROBE) {
1921 /* restore the connections */
1922 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1923 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1924 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1925 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1926 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1930 /* Set VREF on HP pin */
1931 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1932 const struct hda_fixup *fix, int action)
1934 struct alc_spec *spec = codec->spec;
1935 static hda_nid_t nids[2] = { 0x14, 0x15 };
1938 if (action != HDA_FIXUP_ACT_INIT)
1940 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1941 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1942 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1944 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1945 val |= AC_PINCTL_VREF_80;
1946 snd_hda_set_pin_ctl(codec, nids[i], val);
1947 spec->gen.keep_vref_in_automute = 1;
1952 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1953 const hda_nid_t *nids, int num_nids)
1955 struct alc_spec *spec = codec->spec;
1958 for (i = 0; i < num_nids; i++) {
1960 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1961 val |= AC_PINCTL_VREF_50;
1962 snd_hda_set_pin_ctl(codec, nids[i], val);
1964 spec->gen.keep_vref_in_automute = 1;
1967 /* Set VREF on speaker pins on imac91 */
1968 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1969 const struct hda_fixup *fix, int action)
1971 static hda_nid_t nids[2] = { 0x18, 0x1a };
1973 if (action == HDA_FIXUP_ACT_INIT)
1974 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1977 /* Set VREF on speaker pins on mba11 */
1978 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1979 const struct hda_fixup *fix, int action)
1981 static hda_nid_t nids[1] = { 0x18 };
1983 if (action == HDA_FIXUP_ACT_INIT)
1984 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1987 /* Set VREF on speaker pins on mba21 */
1988 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1989 const struct hda_fixup *fix, int action)
1991 static hda_nid_t nids[2] = { 0x18, 0x19 };
1993 if (action == HDA_FIXUP_ACT_INIT)
1994 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1997 /* Don't take HP output as primary
1998 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1999 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2001 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2002 const struct hda_fixup *fix, int action)
2004 struct alc_spec *spec = codec->spec;
2005 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2006 spec->gen.no_primary_hp = 1;
2007 spec->gen.no_multi_io = 1;
2011 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2012 const struct hda_fixup *fix, int action);
2014 static const struct hda_fixup alc882_fixups[] = {
2015 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2016 .type = HDA_FIXUP_PINS,
2017 .v.pins = (const struct hda_pintbl[]) {
2018 { 0x15, 0x01080104 }, /* side */
2019 { 0x16, 0x01011012 }, /* rear */
2020 { 0x17, 0x01016011 }, /* clfe */
2024 [ALC882_FIXUP_LENOVO_Y530] = {
2025 .type = HDA_FIXUP_PINS,
2026 .v.pins = (const struct hda_pintbl[]) {
2027 { 0x15, 0x99130112 }, /* rear int speakers */
2028 { 0x16, 0x99130111 }, /* subwoofer */
2032 [ALC882_FIXUP_PB_M5210] = {
2033 .type = HDA_FIXUP_PINCTLS,
2034 .v.pins = (const struct hda_pintbl[]) {
2035 { 0x19, PIN_VREF50 },
2039 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2040 .type = HDA_FIXUP_FUNC,
2041 .v.func = alc_fixup_sku_ignore,
2043 [ALC882_FIXUP_ASUS_W90V] = {
2044 .type = HDA_FIXUP_PINS,
2045 .v.pins = (const struct hda_pintbl[]) {
2046 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2050 [ALC889_FIXUP_CD] = {
2051 .type = HDA_FIXUP_PINS,
2052 .v.pins = (const struct hda_pintbl[]) {
2053 { 0x1c, 0x993301f0 }, /* CD */
2057 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2058 .type = HDA_FIXUP_PINS,
2059 .v.pins = (const struct hda_pintbl[]) {
2060 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2064 .chain_id = ALC889_FIXUP_CD,
2066 [ALC889_FIXUP_VAIO_TT] = {
2067 .type = HDA_FIXUP_PINS,
2068 .v.pins = (const struct hda_pintbl[]) {
2069 { 0x17, 0x90170111 }, /* hidden surround speaker */
2073 [ALC888_FIXUP_EEE1601] = {
2074 .type = HDA_FIXUP_VERBS,
2075 .v.verbs = (const struct hda_verb[]) {
2076 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2077 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2081 [ALC882_FIXUP_EAPD] = {
2082 .type = HDA_FIXUP_VERBS,
2083 .v.verbs = (const struct hda_verb[]) {
2084 /* change to EAPD mode */
2085 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2086 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2090 [ALC883_FIXUP_EAPD] = {
2091 .type = HDA_FIXUP_VERBS,
2092 .v.verbs = (const struct hda_verb[]) {
2093 /* change to EAPD mode */
2094 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2095 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2099 [ALC883_FIXUP_ACER_EAPD] = {
2100 .type = HDA_FIXUP_VERBS,
2101 .v.verbs = (const struct hda_verb[]) {
2102 /* eanable EAPD on Acer laptops */
2103 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2104 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2108 [ALC882_FIXUP_GPIO1] = {
2109 .type = HDA_FIXUP_VERBS,
2110 .v.verbs = alc_gpio1_init_verbs,
2112 [ALC882_FIXUP_GPIO2] = {
2113 .type = HDA_FIXUP_VERBS,
2114 .v.verbs = alc_gpio2_init_verbs,
2116 [ALC882_FIXUP_GPIO3] = {
2117 .type = HDA_FIXUP_VERBS,
2118 .v.verbs = alc_gpio3_init_verbs,
2120 [ALC882_FIXUP_ASUS_W2JC] = {
2121 .type = HDA_FIXUP_VERBS,
2122 .v.verbs = alc_gpio1_init_verbs,
2124 .chain_id = ALC882_FIXUP_EAPD,
2126 [ALC889_FIXUP_COEF] = {
2127 .type = HDA_FIXUP_FUNC,
2128 .v.func = alc889_fixup_coef,
2130 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2131 .type = HDA_FIXUP_PINS,
2132 .v.pins = (const struct hda_pintbl[]) {
2133 { 0x16, 0x99130111 }, /* CLFE speaker */
2134 { 0x17, 0x99130112 }, /* surround speaker */
2138 .chain_id = ALC882_FIXUP_GPIO1,
2140 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2141 .type = HDA_FIXUP_PINS,
2142 .v.pins = (const struct hda_pintbl[]) {
2143 { 0x16, 0x99130111 }, /* CLFE speaker */
2144 { 0x1b, 0x99130112 }, /* surround speaker */
2148 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2150 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2151 /* additional init verbs for Acer Aspire 8930G */
2152 .type = HDA_FIXUP_VERBS,
2153 .v.verbs = (const struct hda_verb[]) {
2154 /* Enable all DACs */
2155 /* DAC DISABLE/MUTE 1? */
2156 /* setting bits 1-5 disables DAC nids 0x02-0x06
2157 * apparently. Init=0x38 */
2158 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2159 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2160 /* DAC DISABLE/MUTE 2? */
2161 /* some bit here disables the other DACs.
2163 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2164 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2166 * This laptop has a stereo digital microphone.
2167 * The mics are only 1cm apart which makes the stereo
2168 * useless. However, either the mic or the ALC889
2169 * makes the signal become a difference/sum signal
2170 * instead of standard stereo, which is annoying.
2171 * So instead we flip this bit which makes the
2172 * codec replicate the sum signal to both channels,
2173 * turning it into a normal mono mic.
2175 /* DMIC_CONTROL? Init value = 0x0001 */
2176 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2177 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2178 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2179 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2183 .chain_id = ALC882_FIXUP_GPIO1,
2185 [ALC885_FIXUP_MACPRO_GPIO] = {
2186 .type = HDA_FIXUP_FUNC,
2187 .v.func = alc885_fixup_macpro_gpio,
2189 [ALC889_FIXUP_DAC_ROUTE] = {
2190 .type = HDA_FIXUP_FUNC,
2191 .v.func = alc889_fixup_dac_route,
2193 [ALC889_FIXUP_MBP_VREF] = {
2194 .type = HDA_FIXUP_FUNC,
2195 .v.func = alc889_fixup_mbp_vref,
2197 .chain_id = ALC882_FIXUP_GPIO1,
2199 [ALC889_FIXUP_IMAC91_VREF] = {
2200 .type = HDA_FIXUP_FUNC,
2201 .v.func = alc889_fixup_imac91_vref,
2203 .chain_id = ALC882_FIXUP_GPIO1,
2205 [ALC889_FIXUP_MBA11_VREF] = {
2206 .type = HDA_FIXUP_FUNC,
2207 .v.func = alc889_fixup_mba11_vref,
2209 .chain_id = ALC889_FIXUP_MBP_VREF,
2211 [ALC889_FIXUP_MBA21_VREF] = {
2212 .type = HDA_FIXUP_FUNC,
2213 .v.func = alc889_fixup_mba21_vref,
2215 .chain_id = ALC889_FIXUP_MBP_VREF,
2217 [ALC889_FIXUP_MP11_VREF] = {
2218 .type = HDA_FIXUP_FUNC,
2219 .v.func = alc889_fixup_mba11_vref,
2221 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2223 [ALC882_FIXUP_INV_DMIC] = {
2224 .type = HDA_FIXUP_FUNC,
2225 .v.func = alc_fixup_inv_dmic_0x12,
2227 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2228 .type = HDA_FIXUP_FUNC,
2229 .v.func = alc882_fixup_no_primary_hp,
2231 [ALC887_FIXUP_ASUS_BASS] = {
2232 .type = HDA_FIXUP_PINS,
2233 .v.pins = (const struct hda_pintbl[]) {
2234 {0x16, 0x99130130}, /* bass speaker */
2238 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2240 [ALC887_FIXUP_BASS_CHMAP] = {
2241 .type = HDA_FIXUP_FUNC,
2242 .v.func = alc_fixup_bass_chmap,
2246 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2247 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2248 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2249 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2250 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2251 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2252 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2253 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2254 ALC882_FIXUP_ACER_ASPIRE_4930G),
2255 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2256 ALC882_FIXUP_ACER_ASPIRE_4930G),
2257 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2258 ALC882_FIXUP_ACER_ASPIRE_8930G),
2259 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2260 ALC882_FIXUP_ACER_ASPIRE_8930G),
2261 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2262 ALC882_FIXUP_ACER_ASPIRE_4930G),
2263 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2264 ALC882_FIXUP_ACER_ASPIRE_4930G),
2265 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2266 ALC882_FIXUP_ACER_ASPIRE_4930G),
2267 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2268 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2269 ALC882_FIXUP_ACER_ASPIRE_4930G),
2270 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2271 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2272 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2273 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2274 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2275 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2276 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2277 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2278 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2279 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2280 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2282 /* All Apple entries are in codec SSIDs */
2283 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2284 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2285 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2286 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2287 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2288 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2289 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2290 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2291 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2292 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2293 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2294 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2295 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2296 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2297 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2298 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2299 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2300 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
2301 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2302 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2303 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2304 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
2306 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2307 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2308 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2309 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2310 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2311 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2312 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2313 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2314 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2318 static const struct hda_model_fixup alc882_fixup_models[] = {
2319 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2320 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2321 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2322 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2323 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2328 * BIOS auto configuration
2330 /* almost identical with ALC880 parser... */
2331 static int alc882_parse_auto_config(struct hda_codec *codec)
2333 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2334 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2335 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2340 static int patch_alc882(struct hda_codec *codec)
2342 struct alc_spec *spec;
2345 err = alc_alloc_spec(codec, 0x0b);
2351 switch (codec->vendor_id) {
2357 /* ALC883 and variants */
2358 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2362 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2364 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2366 alc_auto_parse_customize_define(codec);
2368 if (has_cdefine_beep(codec))
2369 spec->gen.beep_nid = 0x01;
2371 /* automatic parse from the BIOS config */
2372 err = alc882_parse_auto_config(codec);
2376 if (!spec->gen.no_analog && spec->gen.beep_nid)
2377 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2379 codec->patch_ops = alc_patch_ops;
2381 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2394 static int alc262_parse_auto_config(struct hda_codec *codec)
2396 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2397 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2398 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2405 ALC262_FIXUP_FSC_H270,
2406 ALC262_FIXUP_FSC_S7110,
2407 ALC262_FIXUP_HP_Z200,
2409 ALC262_FIXUP_LENOVO_3000,
2411 ALC262_FIXUP_BENQ_T31,
2412 ALC262_FIXUP_INV_DMIC,
2413 ALC262_FIXUP_INTEL_BAYLEYBAY,
2416 static const struct hda_fixup alc262_fixups[] = {
2417 [ALC262_FIXUP_FSC_H270] = {
2418 .type = HDA_FIXUP_PINS,
2419 .v.pins = (const struct hda_pintbl[]) {
2420 { 0x14, 0x99130110 }, /* speaker */
2421 { 0x15, 0x0221142f }, /* front HP */
2422 { 0x1b, 0x0121141f }, /* rear HP */
2426 [ALC262_FIXUP_FSC_S7110] = {
2427 .type = HDA_FIXUP_PINS,
2428 .v.pins = (const struct hda_pintbl[]) {
2429 { 0x15, 0x90170110 }, /* speaker */
2433 .chain_id = ALC262_FIXUP_BENQ,
2435 [ALC262_FIXUP_HP_Z200] = {
2436 .type = HDA_FIXUP_PINS,
2437 .v.pins = (const struct hda_pintbl[]) {
2438 { 0x16, 0x99130120 }, /* internal speaker */
2442 [ALC262_FIXUP_TYAN] = {
2443 .type = HDA_FIXUP_PINS,
2444 .v.pins = (const struct hda_pintbl[]) {
2445 { 0x14, 0x1993e1f0 }, /* int AUX */
2449 [ALC262_FIXUP_LENOVO_3000] = {
2450 .type = HDA_FIXUP_PINCTLS,
2451 .v.pins = (const struct hda_pintbl[]) {
2452 { 0x19, PIN_VREF50 },
2456 .chain_id = ALC262_FIXUP_BENQ,
2458 [ALC262_FIXUP_BENQ] = {
2459 .type = HDA_FIXUP_VERBS,
2460 .v.verbs = (const struct hda_verb[]) {
2461 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2462 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2466 [ALC262_FIXUP_BENQ_T31] = {
2467 .type = HDA_FIXUP_VERBS,
2468 .v.verbs = (const struct hda_verb[]) {
2469 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2470 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2474 [ALC262_FIXUP_INV_DMIC] = {
2475 .type = HDA_FIXUP_FUNC,
2476 .v.func = alc_fixup_inv_dmic_0x12,
2478 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2479 .type = HDA_FIXUP_FUNC,
2480 .v.func = alc_fixup_no_depop_delay,
2484 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2485 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2486 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2487 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2488 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2489 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2490 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2491 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2492 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2493 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2497 static const struct hda_model_fixup alc262_fixup_models[] = {
2498 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2504 static int patch_alc262(struct hda_codec *codec)
2506 struct alc_spec *spec;
2509 err = alc_alloc_spec(codec, 0x0b);
2514 spec->gen.shared_mic_vref_pin = 0x18;
2517 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2522 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
2523 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
2524 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
2525 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
2528 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2530 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2532 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2534 alc_auto_parse_customize_define(codec);
2536 if (has_cdefine_beep(codec))
2537 spec->gen.beep_nid = 0x01;
2539 /* automatic parse from the BIOS config */
2540 err = alc262_parse_auto_config(codec);
2544 if (!spec->gen.no_analog && spec->gen.beep_nid)
2545 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2547 codec->patch_ops = alc_patch_ops;
2548 spec->shutup = alc_eapd_shutup;
2550 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2562 /* bind Beep switches of both NID 0x0f and 0x10 */
2563 static const struct hda_bind_ctls alc268_bind_beep_sw = {
2564 .ops = &snd_hda_bind_sw,
2566 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
2567 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
2572 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2573 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2574 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
2578 /* set PCBEEP vol = 0, mute connections */
2579 static const struct hda_verb alc268_beep_init_verbs[] = {
2580 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2581 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2582 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2587 ALC268_FIXUP_INV_DMIC,
2588 ALC268_FIXUP_HP_EAPD,
2592 static const struct hda_fixup alc268_fixups[] = {
2593 [ALC268_FIXUP_INV_DMIC] = {
2594 .type = HDA_FIXUP_FUNC,
2595 .v.func = alc_fixup_inv_dmic_0x12,
2597 [ALC268_FIXUP_HP_EAPD] = {
2598 .type = HDA_FIXUP_VERBS,
2599 .v.verbs = (const struct hda_verb[]) {
2600 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2604 [ALC268_FIXUP_SPDIF] = {
2605 .type = HDA_FIXUP_PINS,
2606 .v.pins = (const struct hda_pintbl[]) {
2607 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2613 static const struct hda_model_fixup alc268_fixup_models[] = {
2614 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2615 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2619 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2620 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2621 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2622 /* below is codec SSID since multiple Toshiba laptops have the
2623 * same PCI SSID 1179:ff00
2625 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2630 * BIOS auto configuration
2632 static int alc268_parse_auto_config(struct hda_codec *codec)
2634 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2635 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2640 static int patch_alc268(struct hda_codec *codec)
2642 struct alc_spec *spec;
2645 /* ALC268 has no aa-loopback mixer */
2646 err = alc_alloc_spec(codec, 0);
2651 spec->gen.beep_nid = 0x01;
2653 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2654 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2656 /* automatic parse from the BIOS config */
2657 err = alc268_parse_auto_config(codec);
2661 if (err > 0 && !spec->gen.no_analog &&
2662 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2663 add_mixer(spec, alc268_beep_mixer);
2664 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2665 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2666 /* override the amp caps for beep generator */
2667 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2668 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2669 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2670 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2671 (0 << AC_AMPCAP_MUTE_SHIFT));
2674 codec->patch_ops = alc_patch_ops;
2675 spec->shutup = alc_eapd_shutup;
2677 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2690 static int playback_pcm_open(struct hda_pcm_stream *hinfo,
2691 struct hda_codec *codec,
2692 struct snd_pcm_substream *substream)
2694 struct hda_gen_spec *spec = codec->spec;
2695 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2699 static int playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2700 struct hda_codec *codec,
2701 unsigned int stream_tag,
2702 unsigned int format,
2703 struct snd_pcm_substream *substream)
2705 struct hda_gen_spec *spec = codec->spec;
2706 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2707 stream_tag, format, substream);
2710 static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2711 struct hda_codec *codec,
2712 struct snd_pcm_substream *substream)
2714 struct hda_gen_spec *spec = codec->spec;
2715 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2718 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2722 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2723 /* NID is set in alc_build_pcms */
2725 .open = playback_pcm_open,
2726 .prepare = playback_pcm_prepare,
2727 .cleanup = playback_pcm_cleanup
2731 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2735 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2736 /* NID is set in alc_build_pcms */
2739 /* different alc269-variants */
2741 ALC269_TYPE_ALC269VA,
2742 ALC269_TYPE_ALC269VB,
2743 ALC269_TYPE_ALC269VC,
2744 ALC269_TYPE_ALC269VD,
2755 * BIOS auto configuration
2757 static int alc269_parse_auto_config(struct hda_codec *codec)
2759 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2760 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2761 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2762 struct alc_spec *spec = codec->spec;
2763 const hda_nid_t *ssids;
2765 switch (spec->codec_variant) {
2766 case ALC269_TYPE_ALC269VA:
2767 case ALC269_TYPE_ALC269VC:
2768 case ALC269_TYPE_ALC280:
2769 case ALC269_TYPE_ALC284:
2770 case ALC269_TYPE_ALC285:
2771 ssids = alc269va_ssids;
2773 case ALC269_TYPE_ALC269VB:
2774 case ALC269_TYPE_ALC269VD:
2775 case ALC269_TYPE_ALC282:
2776 case ALC269_TYPE_ALC283:
2777 case ALC269_TYPE_ALC286:
2778 case ALC269_TYPE_ALC255:
2779 ssids = alc269_ssids;
2782 ssids = alc269_ssids;
2786 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2789 static int find_ext_mic_pin(struct hda_codec *codec);
2791 static void alc286_shutup(struct hda_codec *codec)
2794 int mic_pin = find_ext_mic_pin(codec);
2795 /* don't shut up pins when unloading the driver; otherwise it breaks
2796 * the default pin setup at the next load of the driver
2798 if (codec->bus->shutdown)
2800 for (i = 0; i < codec->init_pins.used; i++) {
2801 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
2802 /* use read here for syncing after issuing each verb */
2803 if (pin->nid != mic_pin)
2804 snd_hda_codec_read(codec, pin->nid, 0,
2805 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2807 codec->pins_shutup = 1;
2810 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2812 int val = alc_read_coef_idx(codec, 0x04);
2819 alc_write_coef_idx(codec, 0x04, val);
2822 static void alc269_shutup(struct hda_codec *codec)
2824 struct alc_spec *spec = codec->spec;
2826 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2827 alc269vb_toggle_power_output(codec, 0);
2828 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2829 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2832 snd_hda_shutup_pins(codec);
2835 static void alc282_restore_default_value(struct hda_codec *codec)
2839 /* Power Down Control */
2840 alc_write_coef_idx(codec, 0x03, 0x0002);
2841 /* FIFO and filter clock */
2842 alc_write_coef_idx(codec, 0x05, 0x0700);
2844 alc_write_coef_idx(codec, 0x07, 0x0200);
2846 val = alc_read_coef_idx(codec, 0x06);
2847 alc_write_coef_idx(codec, 0x06, (val & ~0x00f0) | 0x0);
2849 val = alc_read_coef_idx(codec, 0x08);
2850 alc_write_coef_idx(codec, 0x08, (val & ~0xfffc) | 0x0c2c);
2852 alc_write_coef_idx(codec, 0x0a, 0xcccc);
2854 alc_write_coef_idx(codec, 0x0b, 0xcccc);
2855 /* LDO1/2/3, DAC/ADC */
2856 alc_write_coef_idx(codec, 0x0e, 0x6e00);
2858 val = alc_read_coef_idx(codec, 0x0f);
2859 alc_write_coef_idx(codec, 0x0f, (val & ~0xf800) | 0x1000);
2861 val = alc_read_coef_idx(codec, 0x10);
2862 alc_write_coef_idx(codec, 0x10, (val & ~0xfc00) | 0x0c00);
2863 /* Class D test 4 */
2864 alc_write_coef_idx(codec, 0x6f, 0x0);
2865 /* IO power down directly */
2866 val = alc_read_coef_idx(codec, 0x0c);
2867 alc_write_coef_idx(codec, 0x0c, (val & ~0xfe00) | 0x0);
2869 alc_write_coef_idx(codec, 0x34, 0xa0c0);
2871 val = alc_read_coef_idx(codec, 0x16);
2872 alc_write_coef_idx(codec, 0x16, (val & ~0x0008) | 0x0);
2873 /* DAC simple content protection */
2874 val = alc_read_coef_idx(codec, 0x1d);
2875 alc_write_coef_idx(codec, 0x1d, (val & ~0x00e0) | 0x0);
2876 /* ADC simple content protection */
2877 val = alc_read_coef_idx(codec, 0x1f);
2878 alc_write_coef_idx(codec, 0x1f, (val & ~0x00e0) | 0x0);
2879 /* DAC ADC Zero Detection */
2880 alc_write_coef_idx(codec, 0x21, 0x8804);
2882 alc_write_coef_idx(codec, 0x63, 0x2902);
2883 /* capless control 2 */
2884 alc_write_coef_idx(codec, 0x68, 0xa080);
2885 /* capless control 3 */
2886 alc_write_coef_idx(codec, 0x69, 0x3400);
2887 /* capless control 4 */
2888 alc_write_coef_idx(codec, 0x6a, 0x2f3e);
2889 /* capless control 5 */
2890 alc_write_coef_idx(codec, 0x6b, 0x0);
2891 /* class D test 2 */
2892 val = alc_read_coef_idx(codec, 0x6d);
2893 alc_write_coef_idx(codec, 0x6d, (val & ~0x0fff) | 0x0900);
2894 /* class D test 3 */
2895 alc_write_coef_idx(codec, 0x6e, 0x110a);
2896 /* class D test 5 */
2897 val = alc_read_coef_idx(codec, 0x70);
2898 alc_write_coef_idx(codec, 0x70, (val & ~0x00f8) | 0x00d8);
2899 /* class D test 6 */
2900 alc_write_coef_idx(codec, 0x71, 0x0014);
2902 alc_write_coef_idx(codec, 0x72, 0xc2ba);
2903 /* classD pure DC test */
2904 val = alc_read_coef_idx(codec, 0x77);
2905 alc_write_coef_idx(codec, 0x77, (val & ~0x0f80) | 0x0);
2906 /* Class D amp control */
2907 alc_write_coef_idx(codec, 0x6c, 0xfc06);
2910 static void alc282_init(struct hda_codec *codec)
2912 struct alc_spec *spec = codec->spec;
2913 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2917 alc282_restore_default_value(codec);
2921 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2922 coef78 = alc_read_coef_idx(codec, 0x78);
2924 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2925 /* Headphone capless set to high power mode */
2926 alc_write_coef_idx(codec, 0x78, 0x9004);
2931 snd_hda_codec_write(codec, hp_pin, 0,
2932 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2937 snd_hda_codec_write(codec, hp_pin, 0,
2938 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2943 /* Headphone capless set to normal mode */
2944 alc_write_coef_idx(codec, 0x78, coef78);
2947 static void alc282_shutup(struct hda_codec *codec)
2949 struct alc_spec *spec = codec->spec;
2950 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2955 alc269_shutup(codec);
2959 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2960 coef78 = alc_read_coef_idx(codec, 0x78);
2961 alc_write_coef_idx(codec, 0x78, 0x9004);
2966 snd_hda_codec_write(codec, hp_pin, 0,
2967 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2972 snd_hda_codec_write(codec, hp_pin, 0,
2973 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2978 alc_auto_setup_eapd(codec, false);
2979 snd_hda_shutup_pins(codec);
2980 alc_write_coef_idx(codec, 0x78, coef78);
2983 static void alc283_restore_default_value(struct hda_codec *codec)
2987 /* Power Down Control */
2988 alc_write_coef_idx(codec, 0x03, 0x0002);
2989 /* FIFO and filter clock */
2990 alc_write_coef_idx(codec, 0x05, 0x0700);
2992 alc_write_coef_idx(codec, 0x07, 0x0200);
2994 val = alc_read_coef_idx(codec, 0x06);
2995 alc_write_coef_idx(codec, 0x06, (val & ~0x00f0) | 0x0);
2997 val = alc_read_coef_idx(codec, 0x08);
2998 alc_write_coef_idx(codec, 0x08, (val & ~0xfffc) | 0x0c2c);
3000 alc_write_coef_idx(codec, 0x0a, 0xcccc);
3002 alc_write_coef_idx(codec, 0x0b, 0xcccc);
3003 /* LDO1/2/3, DAC/ADC */
3004 alc_write_coef_idx(codec, 0x0e, 0x6fc0);
3006 val = alc_read_coef_idx(codec, 0x0f);
3007 alc_write_coef_idx(codec, 0x0f, (val & ~0xf800) | 0x1000);
3009 val = alc_read_coef_idx(codec, 0x10);
3010 alc_write_coef_idx(codec, 0x10, (val & ~0xfc00) | 0x0c00);
3011 /* Class D test 4 */
3012 alc_write_coef_idx(codec, 0x3a, 0x0);
3013 /* IO power down directly */
3014 val = alc_read_coef_idx(codec, 0x0c);
3015 alc_write_coef_idx(codec, 0x0c, (val & ~0xfe00) | 0x0);
3017 alc_write_coef_idx(codec, 0x22, 0xa0c0);
3019 val = alc_read_coefex_idx(codec, 0x53, 0x01);
3020 alc_write_coefex_idx(codec, 0x53, 0x01, (val & ~0x000f) | 0x0008);
3021 /* DAC simple content protection */
3022 val = alc_read_coef_idx(codec, 0x1d);
3023 alc_write_coef_idx(codec, 0x1d, (val & ~0x00e0) | 0x0);
3024 /* ADC simple content protection */
3025 val = alc_read_coef_idx(codec, 0x1f);
3026 alc_write_coef_idx(codec, 0x1f, (val & ~0x00e0) | 0x0);
3027 /* DAC ADC Zero Detection */
3028 alc_write_coef_idx(codec, 0x21, 0x8804);
3030 alc_write_coef_idx(codec, 0x2e, 0x2902);
3031 /* capless control 2 */
3032 alc_write_coef_idx(codec, 0x33, 0xa080);
3033 /* capless control 3 */
3034 alc_write_coef_idx(codec, 0x34, 0x3400);
3035 /* capless control 4 */
3036 alc_write_coef_idx(codec, 0x35, 0x2f3e);
3037 /* capless control 5 */
3038 alc_write_coef_idx(codec, 0x36, 0x0);
3039 /* class D test 2 */
3040 val = alc_read_coef_idx(codec, 0x38);
3041 alc_write_coef_idx(codec, 0x38, (val & ~0x0fff) | 0x0900);
3042 /* class D test 3 */
3043 alc_write_coef_idx(codec, 0x39, 0x110a);
3044 /* class D test 5 */
3045 val = alc_read_coef_idx(codec, 0x3b);
3046 alc_write_coef_idx(codec, 0x3b, (val & ~0x00f8) | 0x00d8);
3047 /* class D test 6 */
3048 alc_write_coef_idx(codec, 0x3c, 0x0014);
3050 alc_write_coef_idx(codec, 0x3d, 0xc2ba);
3051 /* classD pure DC test */
3052 val = alc_read_coef_idx(codec, 0x42);
3053 alc_write_coef_idx(codec, 0x42, (val & ~0x0f80) | 0x0);
3055 alc_write_coef_idx(codec, 0x49, 0x0);
3056 /* Class D DC enable */
3057 val = alc_read_coef_idx(codec, 0x40);
3058 alc_write_coef_idx(codec, 0x40, (val & ~0xf800) | 0x9800);
3060 val = alc_read_coef_idx(codec, 0x42);
3061 alc_write_coef_idx(codec, 0x42, (val & ~0xf000) | 0x2000);
3062 /* Class D amp control */
3063 alc_write_coef_idx(codec, 0x37, 0xfc06);
3066 static void alc283_init(struct hda_codec *codec)
3068 struct alc_spec *spec = codec->spec;
3069 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3073 if (!spec->gen.autocfg.hp_outs) {
3074 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3075 hp_pin = spec->gen.autocfg.line_out_pins[0];
3078 alc283_restore_default_value(codec);
3082 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3084 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3085 /* Headphone capless set to high power mode */
3086 alc_write_coef_idx(codec, 0x43, 0x9004);
3088 snd_hda_codec_write(codec, hp_pin, 0,
3089 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3094 snd_hda_codec_write(codec, hp_pin, 0,
3095 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3099 /* Index 0x46 Combo jack auto switch control 2 */
3100 /* 3k pull low control for Headset jack. */
3101 val = alc_read_coef_idx(codec, 0x46);
3102 alc_write_coef_idx(codec, 0x46, val & ~(3 << 12));
3103 /* Headphone capless set to normal mode */
3104 alc_write_coef_idx(codec, 0x43, 0x9614);
3107 static void alc283_shutup(struct hda_codec *codec)
3109 struct alc_spec *spec = codec->spec;
3110 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3114 if (!spec->gen.autocfg.hp_outs) {
3115 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3116 hp_pin = spec->gen.autocfg.line_out_pins[0];
3120 alc269_shutup(codec);
3124 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3126 alc_write_coef_idx(codec, 0x43, 0x9004);
3128 snd_hda_codec_write(codec, hp_pin, 0,
3129 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3134 snd_hda_codec_write(codec, hp_pin, 0,
3135 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3137 val = alc_read_coef_idx(codec, 0x46);
3138 alc_write_coef_idx(codec, 0x46, val | (3 << 12));
3142 alc_auto_setup_eapd(codec, false);
3143 snd_hda_shutup_pins(codec);
3144 alc_write_coef_idx(codec, 0x43, 0x9614);
3147 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3150 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3151 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3152 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3155 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3159 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3160 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3162 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3167 static void alc5505_dsp_halt(struct hda_codec *codec)
3171 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3172 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3173 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3174 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3175 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3176 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3177 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3178 val = alc5505_coef_get(codec, 0x6220);
3179 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3182 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3184 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3185 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3186 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3187 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3188 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3189 alc5505_coef_set(codec, 0x880c, 0x00000004);
3192 static void alc5505_dsp_init(struct hda_codec *codec)
3196 alc5505_dsp_halt(codec);
3197 alc5505_dsp_back_from_halt(codec);
3198 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3199 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3200 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3201 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3202 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3203 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3204 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3205 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3206 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3207 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3208 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3209 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3210 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3212 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3214 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3216 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3218 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3219 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3220 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3221 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3222 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3223 alc5505_coef_set(codec, 0x880c, 0x00000003);
3224 alc5505_coef_set(codec, 0x880c, 0x00000010);
3226 #ifdef HALT_REALTEK_ALC5505
3227 alc5505_dsp_halt(codec);
3231 #ifdef HALT_REALTEK_ALC5505
3232 #define alc5505_dsp_suspend(codec) /* NOP */
3233 #define alc5505_dsp_resume(codec) /* NOP */
3235 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3236 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3240 static int alc269_suspend(struct hda_codec *codec)
3242 struct alc_spec *spec = codec->spec;
3244 if (spec->has_alc5505_dsp)
3245 alc5505_dsp_suspend(codec);
3246 return alc_suspend(codec);
3249 static int alc269_resume(struct hda_codec *codec)
3251 struct alc_spec *spec = codec->spec;
3253 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3254 alc269vb_toggle_power_output(codec, 0);
3255 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3256 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3260 codec->patch_ops.init(codec);
3262 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3263 alc269vb_toggle_power_output(codec, 1);
3264 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3265 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3269 snd_hda_codec_resume_amp(codec);
3270 snd_hda_codec_resume_cache(codec);
3271 alc_inv_dmic_sync(codec, true);
3272 hda_call_check_power_status(codec, 0x01);
3274 /* on some machine, the BIOS will clear the codec gpio data when enter
3275 * suspend, and won't restore the data after resume, so we restore it
3279 snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA,
3282 if (spec->has_alc5505_dsp)
3283 alc5505_dsp_resume(codec);
3287 #endif /* CONFIG_PM */
3289 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3290 const struct hda_fixup *fix, int action)
3292 struct alc_spec *spec = codec->spec;
3294 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3295 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3298 static void alc269_fixup_hweq(struct hda_codec *codec,
3299 const struct hda_fixup *fix, int action)
3303 if (action != HDA_FIXUP_ACT_INIT)
3305 coef = alc_read_coef_idx(codec, 0x1e);
3306 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
3309 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3310 const struct hda_fixup *fix, int action)
3312 struct alc_spec *spec = codec->spec;
3314 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3315 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3318 static void alc271_fixup_dmic(struct hda_codec *codec,
3319 const struct hda_fixup *fix, int action)
3321 static const struct hda_verb verbs[] = {
3322 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3323 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3328 if (strcmp(codec->chip_name, "ALC271X") &&
3329 strcmp(codec->chip_name, "ALC269VB"))
3331 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3332 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3333 snd_hda_sequence_write(codec, verbs);
3336 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3337 const struct hda_fixup *fix, int action)
3339 struct alc_spec *spec = codec->spec;
3341 if (action != HDA_FIXUP_ACT_PROBE)
3344 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3345 * fix the sample rate of analog I/O to 44.1kHz
3347 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3348 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3351 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3352 const struct hda_fixup *fix, int action)
3356 if (action != HDA_FIXUP_ACT_INIT)
3358 /* The digital-mic unit sends PDM (differential signal) instead of
3359 * the standard PCM, thus you can't record a valid mono stream as is.
3360 * Below is a workaround specific to ALC269 to control the dmic
3361 * signal source as mono.
3363 coef = alc_read_coef_idx(codec, 0x07);
3364 alc_write_coef_idx(codec, 0x07, coef | 0x80);
3367 static void alc269_quanta_automute(struct hda_codec *codec)
3369 snd_hda_gen_update_outputs(codec);
3371 snd_hda_codec_write(codec, 0x20, 0,
3372 AC_VERB_SET_COEF_INDEX, 0x0c);
3373 snd_hda_codec_write(codec, 0x20, 0,
3374 AC_VERB_SET_PROC_COEF, 0x680);
3376 snd_hda_codec_write(codec, 0x20, 0,
3377 AC_VERB_SET_COEF_INDEX, 0x0c);
3378 snd_hda_codec_write(codec, 0x20, 0,
3379 AC_VERB_SET_PROC_COEF, 0x480);
3382 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3383 const struct hda_fixup *fix, int action)
3385 struct alc_spec *spec = codec->spec;
3386 if (action != HDA_FIXUP_ACT_PROBE)
3388 spec->gen.automute_hook = alc269_quanta_automute;
3391 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3392 struct hda_jack_tbl *jack)
3394 struct alc_spec *spec = codec->spec;
3397 snd_hda_gen_hp_automute(codec, jack);
3399 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3401 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3404 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3408 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3409 const struct hda_fixup *fix, int action)
3411 struct alc_spec *spec = codec->spec;
3412 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3413 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3414 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3419 /* update mute-LED according to the speaker mute state via mic VREF pin */
3420 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3422 struct hda_codec *codec = private_data;
3423 struct alc_spec *spec = codec->spec;
3424 unsigned int pinval;
3426 if (spec->mute_led_polarity)
3428 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3429 pinval &= ~AC_PINCTL_VREFEN;
3430 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3431 if (spec->mute_led_nid)
3432 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3435 /* Make sure the led works even in runtime suspend */
3436 static unsigned int led_power_filter(struct hda_codec *codec,
3438 unsigned int power_state)
3440 struct alc_spec *spec = codec->spec;
3442 if (power_state != AC_PWRST_D3 || nid == 0 ||
3443 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3446 /* Set pin ctl again, it might have just been set to 0 */
3447 snd_hda_set_pin_ctl(codec, nid,
3448 snd_hda_codec_get_pin_target(codec, nid));
3453 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3454 const struct hda_fixup *fix, int action)
3456 struct alc_spec *spec = codec->spec;
3457 const struct dmi_device *dev = NULL;
3459 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3462 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3464 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3466 if (pin < 0x0a || pin >= 0x10)
3468 spec->mute_led_polarity = pol;
3469 spec->mute_led_nid = pin - 0x0a + 0x18;
3470 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3471 spec->gen.vmaster_mute_enum = 1;
3472 codec->power_filter = led_power_filter;
3474 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3475 spec->mute_led_polarity);
3480 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3481 const struct hda_fixup *fix, int action)
3483 struct alc_spec *spec = codec->spec;
3484 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3485 spec->mute_led_polarity = 0;
3486 spec->mute_led_nid = 0x18;
3487 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3488 spec->gen.vmaster_mute_enum = 1;
3489 codec->power_filter = led_power_filter;
3493 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3494 const struct hda_fixup *fix, int action)
3496 struct alc_spec *spec = codec->spec;
3497 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3498 spec->mute_led_polarity = 0;
3499 spec->mute_led_nid = 0x19;
3500 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3501 spec->gen.vmaster_mute_enum = 1;
3502 codec->power_filter = led_power_filter;
3506 /* turn on/off mute LED per vmaster hook */
3507 static void alc269_fixup_hp_gpio_mute_hook(void *private_data, int enabled)
3509 struct hda_codec *codec = private_data;
3510 struct alc_spec *spec = codec->spec;
3511 unsigned int oldval = spec->gpio_led;
3514 spec->gpio_led &= ~0x08;
3516 spec->gpio_led |= 0x08;
3517 if (spec->gpio_led != oldval)
3518 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3522 /* turn on/off mic-mute LED per capture hook */
3523 static void alc269_fixup_hp_gpio_mic_mute_hook(struct hda_codec *codec,
3524 struct snd_kcontrol *kcontrol,
3525 struct snd_ctl_elem_value *ucontrol)
3527 struct alc_spec *spec = codec->spec;
3528 unsigned int oldval = spec->gpio_led;
3533 if (ucontrol->value.integer.value[0] ||
3534 ucontrol->value.integer.value[1])
3535 spec->gpio_led &= ~0x10;
3537 spec->gpio_led |= 0x10;
3538 if (spec->gpio_led != oldval)
3539 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3543 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3544 const struct hda_fixup *fix, int action)
3546 struct alc_spec *spec = codec->spec;
3547 static const struct hda_verb gpio_init[] = {
3548 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3549 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3553 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3554 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3555 spec->gen.cap_sync_hook = alc269_fixup_hp_gpio_mic_mute_hook;
3557 snd_hda_add_verbs(codec, gpio_init);
3561 /* turn on/off mic-mute LED per capture hook */
3562 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3563 struct snd_kcontrol *kcontrol,
3564 struct snd_ctl_elem_value *ucontrol)
3566 struct alc_spec *spec = codec->spec;
3567 unsigned int pinval, enable, disable;
3569 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3570 pinval &= ~AC_PINCTL_VREFEN;
3571 enable = pinval | AC_PINCTL_VREF_80;
3572 disable = pinval | AC_PINCTL_VREF_HIZ;
3577 if (ucontrol->value.integer.value[0] ||
3578 ucontrol->value.integer.value[1])
3583 if (spec->cap_mute_led_nid)
3584 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3587 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3588 const struct hda_fixup *fix, int action)
3590 struct alc_spec *spec = codec->spec;
3591 static const struct hda_verb gpio_init[] = {
3592 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3593 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3597 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3598 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3599 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3601 spec->cap_mute_led_nid = 0x18;
3602 snd_hda_add_verbs(codec, gpio_init);
3603 codec->power_filter = led_power_filter;
3607 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3608 const struct hda_fixup *fix, int action)
3610 struct alc_spec *spec = codec->spec;
3612 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3613 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3614 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3615 spec->mute_led_polarity = 0;
3616 spec->mute_led_nid = 0x1a;
3617 spec->cap_mute_led_nid = 0x18;
3618 spec->gen.vmaster_mute_enum = 1;
3619 codec->power_filter = led_power_filter;
3623 static void alc_headset_mode_unplugged(struct hda_codec *codec)
3627 switch (codec->vendor_id) {
3629 /* LDO and MISC control */
3630 alc_write_coef_idx(codec, 0x1b, 0x0c0b);
3631 /* UAJ function set to menual mode */
3632 alc_write_coef_idx(codec, 0x45, 0xd089);
3633 /* Direct Drive HP Amp control(Set to verb control)*/
3634 val = alc_read_coefex_idx(codec, 0x57, 0x05);
3635 alc_write_coefex_idx(codec, 0x57, 0x05, val & ~(1<<14));
3636 /* Set MIC2 Vref gate with HP */
3637 alc_write_coef_idx(codec, 0x06, 0x6104);
3638 /* Direct Drive HP Amp control */
3639 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6);
3643 alc_write_coef_idx(codec, 0x1b, 0x0c0b);
3644 alc_write_coef_idx(codec, 0x45, 0xc429);
3645 val = alc_read_coef_idx(codec, 0x35);
3646 alc_write_coef_idx(codec, 0x35, val & 0xbfff);
3647 alc_write_coef_idx(codec, 0x06, 0x2104);
3648 alc_write_coef_idx(codec, 0x1a, 0x0001);
3649 alc_write_coef_idx(codec, 0x26, 0x0004);
3650 alc_write_coef_idx(codec, 0x32, 0x42a3);
3653 alc_write_coef_idx(codec, 0x76, 0x000e);
3654 alc_write_coef_idx(codec, 0x6c, 0x2400);
3655 alc_write_coef_idx(codec, 0x18, 0x7308);
3656 alc_write_coef_idx(codec, 0x6b, 0xc429);
3659 /* SET Line1 JD to 0 */
3660 val = alc_read_coef_idx(codec, 0x10);
3661 alc_write_coef_idx(codec, 0x10, (val & ~(7<<8)) | 6<<8);
3662 /* SET charge pump by verb */
3663 val = alc_read_coefex_idx(codec, 0x57, 0x05);
3664 alc_write_coefex_idx(codec, 0x57, 0x05, (val & ~(1<<15|1<<13)) | 0x0);
3665 /* SET EN_OSW to 1 */
3666 val = alc_read_coefex_idx(codec, 0x57, 0x03);
3667 alc_write_coefex_idx(codec, 0x57, 0x03, (val & ~(1<<10)) | (1<<10) );
3668 /* Combo JD gating with LINE1-VREFO */
3669 val = alc_read_coef_idx(codec, 0x1a);
3670 alc_write_coef_idx(codec, 0x1a, (val & ~(1<<3)) | (1<<3));
3671 /* Set to TRS type */
3672 alc_write_coef_idx(codec, 0x45, 0xc429);
3673 /* Combo Jack auto detect */
3674 val = alc_read_coef_idx(codec, 0x4a);
3675 alc_write_coef_idx(codec, 0x4a, (val & 0xfff0) | 0x000e);
3678 alc_write_coef_idx(codec, 0x15, 0x0d40);
3679 alc_write_coef_idx(codec, 0xb7, 0x802b);
3682 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
3686 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3691 switch (codec->vendor_id) {
3693 alc_write_coef_idx(codec, 0x45, 0xc489);
3694 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3695 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6);
3696 /* Set MIC2 Vref gate to normal */
3697 alc_write_coef_idx(codec, 0x06, 0x6100);
3698 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3702 alc_write_coef_idx(codec, 0x45, 0xc429);
3703 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3704 val = alc_read_coef_idx(codec, 0x35);
3705 alc_write_coef_idx(codec, 0x35, val | 1<<14);
3706 alc_write_coef_idx(codec, 0x06, 0x2100);
3707 alc_write_coef_idx(codec, 0x1a, 0x0021);
3708 alc_write_coef_idx(codec, 0x26, 0x008c);
3709 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3712 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3713 alc_write_coef_idx(codec, 0x19, 0xa208);
3714 alc_write_coef_idx(codec, 0x2e, 0xacf0);
3717 /* Set to TRS mode */
3718 alc_write_coef_idx(codec, 0x45, 0xc429);
3719 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3720 /* SET charge pump by verb */
3721 val = alc_read_coefex_idx(codec, 0x57, 0x05);
3722 alc_write_coefex_idx(codec, 0x57, 0x05, (val & ~(1<<15|1<<13)) | (1<<15|1<<13));
3723 /* SET EN_OSW to 0 */
3724 val = alc_read_coefex_idx(codec, 0x57, 0x03);
3725 alc_write_coefex_idx(codec, 0x57, 0x03, (val & ~(1<<10)) | 0x0);
3726 /* Combo JD gating without LINE1-VREFO */
3727 val = alc_read_coef_idx(codec, 0x1a);
3728 alc_write_coef_idx(codec, 0x1a, (val & ~(1<<3)) | 0x0);
3729 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3732 alc_write_coef_idx(codec, 0x11, 0x0001);
3733 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3734 alc_write_coef_idx(codec, 0xb7, 0x802b);
3735 alc_write_coef_idx(codec, 0xb5, 0x1040);
3736 val = alc_read_coef_idx(codec, 0xc3);
3737 alc_write_coef_idx(codec, 0xc3, val | 1<<12);
3738 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3741 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
3744 static void alc_headset_mode_default(struct hda_codec *codec)
3748 switch (codec->vendor_id) {
3750 alc_write_coef_idx(codec, 0x45, 0xc089);
3751 alc_write_coef_idx(codec, 0x45, 0xc489);
3752 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
3753 alc_write_coef_idx(codec, 0x49, 0x0049);
3757 alc_write_coef_idx(codec, 0x06, 0x2100);
3758 alc_write_coef_idx(codec, 0x32, 0x4ea3);
3761 alc_write_coef_idx(codec, 0x76, 0x000e);
3762 alc_write_coef_idx(codec, 0x6c, 0x2400);
3763 alc_write_coef_idx(codec, 0x6b, 0xc429);
3764 alc_write_coef_idx(codec, 0x18, 0x7308);
3767 /* Combo Jack auto detect */
3768 val = alc_read_coef_idx(codec, 0x4a);
3769 alc_write_coef_idx(codec, 0x4a, (val & 0xfff0) | 0x000e);
3770 /* Set to TRS type */
3771 alc_write_coef_idx(codec, 0x45, 0xC429);
3772 /* Combo JD gating without LINE1-VREFO */
3773 val = alc_read_coef_idx(codec, 0x1a);
3774 alc_write_coef_idx(codec, 0x1a, (val & ~(1<<3)) | 0x0);
3777 alc_write_coef_idx(codec, 0x11, 0x0041);
3778 alc_write_coef_idx(codec, 0x15, 0x0d40);
3779 alc_write_coef_idx(codec, 0xb7, 0x802b);
3782 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
3786 static void alc_headset_mode_ctia(struct hda_codec *codec)
3790 switch (codec->vendor_id) {
3792 /* Set to CTIA type */
3793 alc_write_coef_idx(codec, 0x45, 0xd489);
3794 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
3795 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
3799 alc_write_coef_idx(codec, 0x45, 0xd429);
3800 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
3801 alc_write_coef_idx(codec, 0x32, 0x4ea3);
3804 alc_write_coef_idx(codec, 0x6b, 0xd429);
3805 alc_write_coef_idx(codec, 0x76, 0x0008);
3806 alc_write_coef_idx(codec, 0x18, 0x7388);
3809 /* Set to ctia type */
3810 alc_write_coef_idx(codec, 0x45, 0xd429);
3811 /* SET Line1 JD to 1 */
3812 val = alc_read_coef_idx(codec, 0x10);
3813 alc_write_coef_idx(codec, 0x10, (val & ~(7<<8)) | 7<<8);
3816 alc_write_coef_idx(codec, 0x11, 0x0001);
3817 alc_write_coef_idx(codec, 0x15, 0x0d60);
3818 alc_write_coef_idx(codec, 0xc3, 0x0000);
3821 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
3825 static void alc_headset_mode_omtp(struct hda_codec *codec)
3829 switch (codec->vendor_id) {
3831 /* Set to OMTP Type */
3832 alc_write_coef_idx(codec, 0x45, 0xe489);
3833 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
3834 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
3838 alc_write_coef_idx(codec, 0x45, 0xe429);
3839 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
3840 alc_write_coef_idx(codec, 0x32, 0x4ea3);
3843 alc_write_coef_idx(codec, 0x6b, 0xe429);
3844 alc_write_coef_idx(codec, 0x76, 0x0008);
3845 alc_write_coef_idx(codec, 0x18, 0x7388);
3848 /* Set to omtp type */
3849 alc_write_coef_idx(codec, 0x45, 0xe429);
3850 /* SET Line1 JD to 1 */
3851 val = alc_read_coef_idx(codec, 0x10);
3852 alc_write_coef_idx(codec, 0x10, (val & ~(7<<8)) | 7<<8);
3855 alc_write_coef_idx(codec, 0x11, 0x0001);
3856 alc_write_coef_idx(codec, 0x15, 0x0d50);
3857 alc_write_coef_idx(codec, 0xc3, 0x0000);
3860 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
3863 static void alc_determine_headset_type(struct hda_codec *codec)
3866 bool is_ctia = false;
3867 struct alc_spec *spec = codec->spec;
3869 switch (codec->vendor_id) {
3871 /* combo jack auto switch control(Check type)*/
3872 alc_write_coef_idx(codec, 0x45, 0xd089);
3873 /* combo jack auto switch control(Vref conteol) */
3874 alc_write_coef_idx(codec, 0x49, 0x0149);
3876 val = alc_read_coef_idx(codec, 0x46);
3877 is_ctia = (val & 0x0070) == 0x0070;
3881 alc_write_coef_idx(codec, 0x45, 0xd029);
3883 val = alc_read_coef_idx(codec, 0x46);
3884 is_ctia = (val & 0x0070) == 0x0070;
3887 alc_write_coef_idx(codec, 0x6b, 0xd429);
3889 val = alc_read_coef_idx(codec, 0x6c);
3890 is_ctia = (val & 0x001c) == 0x001c;
3893 /* Combo Jack auto detect */
3894 val = alc_read_coef_idx(codec, 0x4a);
3895 alc_write_coef_idx(codec, 0x4a, (val & 0xfff0) | 0x0008);
3896 /* Set to ctia type */
3897 alc_write_coef_idx(codec, 0x45, 0xD429);
3899 val = alc_read_coef_idx(codec, 0x46);
3900 is_ctia = (val & 0x0070) == 0x0070;
3903 alc_write_coef_idx(codec, 0x11, 0x0001);
3904 alc_write_coef_idx(codec, 0xb7, 0x802b);
3905 alc_write_coef_idx(codec, 0x15, 0x0d60);
3906 alc_write_coef_idx(codec, 0xc3, 0x0c00);
3908 val = alc_read_coef_idx(codec, 0xbe);
3909 is_ctia = (val & 0x1c02) == 0x1c02;
3913 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
3914 is_ctia ? "yes" : "no");
3915 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
3918 static void alc_update_headset_mode(struct hda_codec *codec)
3920 struct alc_spec *spec = codec->spec;
3922 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
3923 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3925 int new_headset_mode;
3927 if (!snd_hda_jack_detect(codec, hp_pin))
3928 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
3929 else if (mux_pin == spec->headset_mic_pin)
3930 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
3931 else if (mux_pin == spec->headphone_mic_pin)
3932 new_headset_mode = ALC_HEADSET_MODE_MIC;
3934 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
3936 if (new_headset_mode == spec->current_headset_mode) {
3937 snd_hda_gen_update_outputs(codec);
3941 switch (new_headset_mode) {
3942 case ALC_HEADSET_MODE_UNPLUGGED:
3943 alc_headset_mode_unplugged(codec);
3944 spec->gen.hp_jack_present = false;
3946 case ALC_HEADSET_MODE_HEADSET:
3947 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
3948 alc_determine_headset_type(codec);
3949 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
3950 alc_headset_mode_ctia(codec);
3951 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
3952 alc_headset_mode_omtp(codec);
3953 spec->gen.hp_jack_present = true;
3955 case ALC_HEADSET_MODE_MIC:
3956 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
3957 spec->gen.hp_jack_present = false;
3959 case ALC_HEADSET_MODE_HEADPHONE:
3960 alc_headset_mode_default(codec);
3961 spec->gen.hp_jack_present = true;
3964 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
3965 snd_hda_set_pin_ctl_cache(codec, hp_pin,
3966 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3967 if (spec->headphone_mic_pin)
3968 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
3971 spec->current_headset_mode = new_headset_mode;
3973 snd_hda_gen_update_outputs(codec);
3976 static void alc_update_headset_mode_hook(struct hda_codec *codec,
3977 struct snd_kcontrol *kcontrol,
3978 struct snd_ctl_elem_value *ucontrol)
3980 alc_update_headset_mode(codec);
3983 static void alc_update_headset_jack_cb(struct hda_codec *codec, struct hda_jack_tbl *jack)
3985 struct alc_spec *spec = codec->spec;
3986 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
3987 snd_hda_gen_hp_automute(codec, jack);
3990 static void alc_probe_headset_mode(struct hda_codec *codec)
3993 struct alc_spec *spec = codec->spec;
3994 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
3997 for (i = 0; i < cfg->num_inputs; i++) {
3998 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
3999 spec->headset_mic_pin = cfg->inputs[i].pin;
4000 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4001 spec->headphone_mic_pin = cfg->inputs[i].pin;
4004 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4005 spec->gen.automute_hook = alc_update_headset_mode;
4006 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4009 static void alc_fixup_headset_mode(struct hda_codec *codec,
4010 const struct hda_fixup *fix, int action)
4012 struct alc_spec *spec = codec->spec;
4015 case HDA_FIXUP_ACT_PRE_PROBE:
4016 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4018 case HDA_FIXUP_ACT_PROBE:
4019 alc_probe_headset_mode(codec);
4021 case HDA_FIXUP_ACT_INIT:
4022 spec->current_headset_mode = 0;
4023 alc_update_headset_mode(codec);
4028 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4029 const struct hda_fixup *fix, int action)
4031 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4032 struct alc_spec *spec = codec->spec;
4033 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4036 alc_fixup_headset_mode(codec, fix, action);
4039 static void alc255_set_default_jack_type(struct hda_codec *codec)
4041 /* Set to iphone type */
4042 alc_write_coef_idx(codec, 0x1b, 0x880b);
4043 alc_write_coef_idx(codec, 0x45, 0xd089);
4044 alc_write_coef_idx(codec, 0x1b, 0x080b);
4045 alc_write_coef_idx(codec, 0x46, 0x0004);
4046 alc_write_coef_idx(codec, 0x1b, 0x0c0b);
4050 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4051 const struct hda_fixup *fix, int action)
4053 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4054 alc255_set_default_jack_type(codec);
4056 alc_fixup_headset_mode(codec, fix, action);
4059 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4060 const struct hda_fixup *fix, int action)
4062 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4063 struct alc_spec *spec = codec->spec;
4064 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4065 alc255_set_default_jack_type(codec);
4068 alc_fixup_headset_mode(codec, fix, action);
4071 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4072 const struct hda_fixup *fix, int action)
4074 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4075 struct alc_spec *spec = codec->spec;
4076 spec->gen.auto_mute_via_amp = 1;
4080 static void alc_no_shutup(struct hda_codec *codec)
4084 static void alc_fixup_no_shutup(struct hda_codec *codec,
4085 const struct hda_fixup *fix, int action)
4087 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4088 struct alc_spec *spec = codec->spec;
4089 spec->shutup = alc_no_shutup;
4093 static void alc_fixup_disable_aamix(struct hda_codec *codec,
4094 const struct hda_fixup *fix, int action)
4096 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4097 struct alc_spec *spec = codec->spec;
4098 /* Disable AA-loopback as it causes white noise */
4099 spec->gen.mixer_nid = 0;
4103 static unsigned int alc_power_filter_xps13(struct hda_codec *codec,
4105 unsigned int power_state)
4107 struct alc_spec *spec = codec->spec;
4109 /* Avoid pop noises when headphones are plugged in */
4110 if (spec->gen.hp_jack_present)
4111 if (nid == codec->afg || nid == 0x02 || nid == 0x15)
4116 static void alc_fixup_dell_xps13(struct hda_codec *codec,
4117 const struct hda_fixup *fix, int action)
4119 if (action == HDA_FIXUP_ACT_PROBE) {
4120 struct alc_spec *spec = codec->spec;
4121 struct hda_input_mux *imux = &spec->gen.input_mux;
4124 spec->shutup = alc_no_shutup;
4125 codec->power_filter = alc_power_filter_xps13;
4127 /* Make the internal mic the default input source. */
4128 for (i = 0; i < imux->num_items; i++) {
4129 if (spec->gen.imux_pins[i] == 0x12) {
4130 spec->gen.cur_mux[0] = i;
4137 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
4138 const struct hda_fixup *fix, int action)
4140 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4142 alc_write_coef_idx(codec, 0xc4, 0x8000);
4143 val = alc_read_coef_idx(codec, 0xc2);
4144 alc_write_coef_idx(codec, 0xc2, val & 0xfe);
4145 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
4147 alc_fixup_headset_mode(codec, fix, action);
4150 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
4151 static int find_ext_mic_pin(struct hda_codec *codec)
4153 struct alc_spec *spec = codec->spec;
4154 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4156 unsigned int defcfg;
4159 for (i = 0; i < cfg->num_inputs; i++) {
4160 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4162 nid = cfg->inputs[i].pin;
4163 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4164 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
4172 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
4173 const struct hda_fixup *fix,
4176 struct alc_spec *spec = codec->spec;
4178 if (action == HDA_FIXUP_ACT_PROBE) {
4179 int mic_pin = find_ext_mic_pin(codec);
4180 int hp_pin = spec->gen.autocfg.hp_pins[0];
4182 if (snd_BUG_ON(!mic_pin || !hp_pin))
4184 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
4188 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
4189 const struct hda_fixup *fix,
4192 struct alc_spec *spec = codec->spec;
4193 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4196 /* The mic boosts on level 2 and 3 are too noisy
4197 on the internal mic input.
4198 Therefore limit the boost to 0 or 1. */
4200 if (action != HDA_FIXUP_ACT_PROBE)
4203 for (i = 0; i < cfg->num_inputs; i++) {
4204 hda_nid_t nid = cfg->inputs[i].pin;
4205 unsigned int defcfg;
4206 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4208 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4209 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
4212 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
4213 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
4214 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4215 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
4216 (0 << AC_AMPCAP_MUTE_SHIFT));
4220 static void alc283_hp_automute_hook(struct hda_codec *codec,
4221 struct hda_jack_tbl *jack)
4223 struct alc_spec *spec = codec->spec;
4227 snd_hda_gen_hp_automute(codec, jack);
4229 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4232 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4236 static void alc283_fixup_chromebook(struct hda_codec *codec,
4237 const struct hda_fixup *fix, int action)
4239 struct alc_spec *spec = codec->spec;
4243 case HDA_FIXUP_ACT_PRE_PROBE:
4244 snd_hda_override_wcaps(codec, 0x03, 0);
4245 /* Disable AA-loopback as it causes white noise */
4246 spec->gen.mixer_nid = 0;
4248 case HDA_FIXUP_ACT_INIT:
4249 /* MIC2-VREF control */
4250 /* Set to manual mode */
4251 val = alc_read_coef_idx(codec, 0x06);
4252 alc_write_coef_idx(codec, 0x06, val & ~0x000c);
4253 /* Enable Line1 input control by verb */
4254 val = alc_read_coef_idx(codec, 0x1a);
4255 alc_write_coef_idx(codec, 0x1a, val | (1 << 4));
4260 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
4261 const struct hda_fixup *fix, int action)
4263 struct alc_spec *spec = codec->spec;
4267 case HDA_FIXUP_ACT_PRE_PROBE:
4268 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
4270 case HDA_FIXUP_ACT_INIT:
4271 /* MIC2-VREF control */
4272 /* Set to manual mode */
4273 val = alc_read_coef_idx(codec, 0x06);
4274 alc_write_coef_idx(codec, 0x06, val & ~0x000c);
4279 /* mute tablet speaker pin (0x14) via dock plugging in addition */
4280 static void asus_tx300_automute(struct hda_codec *codec)
4282 struct alc_spec *spec = codec->spec;
4283 snd_hda_gen_update_outputs(codec);
4284 if (snd_hda_jack_detect(codec, 0x1b))
4285 spec->gen.mute_bits |= (1ULL << 0x14);
4288 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
4289 const struct hda_fixup *fix, int action)
4291 struct alc_spec *spec = codec->spec;
4292 /* TX300 needs to set up GPIO2 for the speaker amp */
4293 static const struct hda_verb gpio2_verbs[] = {
4294 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
4295 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
4296 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
4299 static const struct hda_pintbl dock_pins[] = {
4300 { 0x1b, 0x21114000 }, /* dock speaker pin */
4303 struct snd_kcontrol *kctl;
4306 case HDA_FIXUP_ACT_PRE_PROBE:
4307 snd_hda_add_verbs(codec, gpio2_verbs);
4308 snd_hda_apply_pincfgs(codec, dock_pins);
4309 spec->gen.auto_mute_via_amp = 1;
4310 spec->gen.automute_hook = asus_tx300_automute;
4311 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4313 snd_hda_gen_hp_automute);
4315 case HDA_FIXUP_ACT_BUILD:
4316 /* this is a bit tricky; give more sane names for the main
4317 * (tablet) speaker and the dock speaker, respectively
4319 kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch");
4321 strcpy(kctl->id.name, "Dock Speaker Playback Switch");
4322 kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch");
4324 strcpy(kctl->id.name, "Speaker Playback Switch");
4329 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
4330 const struct hda_fixup *fix, int action)
4332 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4333 /* DAC node 0x03 is giving mono output. We therefore want to
4334 make sure 0x14 (front speaker) and 0x15 (headphones) use the
4335 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
4336 hda_nid_t conn1[2] = { 0x0c };
4337 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
4338 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
4342 /* for hda_fixup_thinkpad_acpi() */
4343 #include "thinkpad_helper.c"
4345 /* for dell wmi mic mute led */
4346 #include "dell_wmi_helper.c"
4349 ALC269_FIXUP_SONY_VAIO,
4350 ALC275_FIXUP_SONY_VAIO_GPIO2,
4351 ALC269_FIXUP_DELL_M101Z,
4352 ALC269_FIXUP_SKU_IGNORE,
4353 ALC269_FIXUP_ASUS_G73JW,
4354 ALC269_FIXUP_LENOVO_EAPD,
4355 ALC275_FIXUP_SONY_HWEQ,
4356 ALC275_FIXUP_SONY_DISABLE_AAMIX,
4358 ALC269_FIXUP_PCM_44K,
4359 ALC269_FIXUP_STEREO_DMIC,
4360 ALC269_FIXUP_HEADSET_MIC,
4361 ALC269_FIXUP_QUANTA_MUTE,
4362 ALC269_FIXUP_LIFEBOOK,
4363 ALC269_FIXUP_LIFEBOOK_EXTMIC,
4366 ALC269VB_FIXUP_AMIC,
4367 ALC269VB_FIXUP_DMIC,
4368 ALC269_FIXUP_HP_MUTE_LED,
4369 ALC269_FIXUP_HP_MUTE_LED_MIC1,
4370 ALC269_FIXUP_HP_MUTE_LED_MIC2,
4371 ALC269_FIXUP_HP_GPIO_LED,
4372 ALC269_FIXUP_HP_GPIO_MIC1_LED,
4373 ALC269_FIXUP_HP_LINE1_MIC1_LED,
4374 ALC269_FIXUP_INV_DMIC,
4375 ALC269_FIXUP_LENOVO_DOCK,
4376 ALC269_FIXUP_NO_SHUTUP,
4377 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
4378 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
4379 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
4380 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
4381 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4382 ALC269_FIXUP_HEADSET_MODE,
4383 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
4384 ALC269_FIXUP_ASUS_X101_FUNC,
4385 ALC269_FIXUP_ASUS_X101_VERB,
4386 ALC269_FIXUP_ASUS_X101,
4387 ALC271_FIXUP_AMIC_MIC2,
4388 ALC271_FIXUP_HP_GATE_MIC_JACK,
4389 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
4390 ALC269_FIXUP_ACER_AC700,
4391 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
4392 ALC269VB_FIXUP_ASUS_ZENBOOK,
4393 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
4394 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
4395 ALC269VB_FIXUP_ORDISSIMO_EVE2,
4396 ALC283_FIXUP_CHROME_BOOK,
4397 ALC283_FIXUP_SENSE_COMBO_JACK,
4398 ALC282_FIXUP_ASUS_TX300,
4399 ALC283_FIXUP_INT_MIC,
4400 ALC290_FIXUP_MONO_SPEAKERS,
4401 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4402 ALC290_FIXUP_SUBWOOFER,
4403 ALC290_FIXUP_SUBWOOFER_HSJACK,
4404 ALC269_FIXUP_THINKPAD_ACPI,
4405 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4406 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
4407 ALC255_FIXUP_HEADSET_MODE,
4408 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
4409 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
4410 ALC292_FIXUP_TPT440_DOCK,
4411 ALC283_FIXUP_BXBT2807_MIC,
4412 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4413 ALC282_FIXUP_ASPIRE_V5_PINS,
4416 static const struct hda_fixup alc269_fixups[] = {
4417 [ALC269_FIXUP_SONY_VAIO] = {
4418 .type = HDA_FIXUP_PINCTLS,
4419 .v.pins = (const struct hda_pintbl[]) {
4420 {0x19, PIN_VREFGRD},
4424 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
4425 .type = HDA_FIXUP_VERBS,
4426 .v.verbs = (const struct hda_verb[]) {
4427 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
4428 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
4429 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4433 .chain_id = ALC269_FIXUP_SONY_VAIO
4435 [ALC269_FIXUP_DELL_M101Z] = {
4436 .type = HDA_FIXUP_VERBS,
4437 .v.verbs = (const struct hda_verb[]) {
4438 /* Enables internal speaker */
4439 {0x20, AC_VERB_SET_COEF_INDEX, 13},
4440 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
4444 [ALC269_FIXUP_SKU_IGNORE] = {
4445 .type = HDA_FIXUP_FUNC,
4446 .v.func = alc_fixup_sku_ignore,
4448 [ALC269_FIXUP_ASUS_G73JW] = {
4449 .type = HDA_FIXUP_PINS,
4450 .v.pins = (const struct hda_pintbl[]) {
4451 { 0x17, 0x99130111 }, /* subwoofer */
4455 [ALC269_FIXUP_LENOVO_EAPD] = {
4456 .type = HDA_FIXUP_VERBS,
4457 .v.verbs = (const struct hda_verb[]) {
4458 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
4462 [ALC275_FIXUP_SONY_HWEQ] = {
4463 .type = HDA_FIXUP_FUNC,
4464 .v.func = alc269_fixup_hweq,
4466 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
4468 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
4469 .type = HDA_FIXUP_FUNC,
4470 .v.func = alc_fixup_disable_aamix,
4472 .chain_id = ALC269_FIXUP_SONY_VAIO
4474 [ALC271_FIXUP_DMIC] = {
4475 .type = HDA_FIXUP_FUNC,
4476 .v.func = alc271_fixup_dmic,
4478 [ALC269_FIXUP_PCM_44K] = {
4479 .type = HDA_FIXUP_FUNC,
4480 .v.func = alc269_fixup_pcm_44k,
4482 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4484 [ALC269_FIXUP_STEREO_DMIC] = {
4485 .type = HDA_FIXUP_FUNC,
4486 .v.func = alc269_fixup_stereo_dmic,
4488 [ALC269_FIXUP_HEADSET_MIC] = {
4489 .type = HDA_FIXUP_FUNC,
4490 .v.func = alc269_fixup_headset_mic,
4492 [ALC269_FIXUP_QUANTA_MUTE] = {
4493 .type = HDA_FIXUP_FUNC,
4494 .v.func = alc269_fixup_quanta_mute,
4496 [ALC269_FIXUP_LIFEBOOK] = {
4497 .type = HDA_FIXUP_PINS,
4498 .v.pins = (const struct hda_pintbl[]) {
4499 { 0x1a, 0x2101103f }, /* dock line-out */
4500 { 0x1b, 0x23a11040 }, /* dock mic-in */
4504 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4506 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
4507 .type = HDA_FIXUP_PINS,
4508 .v.pins = (const struct hda_pintbl[]) {
4509 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
4513 [ALC269_FIXUP_AMIC] = {
4514 .type = HDA_FIXUP_PINS,
4515 .v.pins = (const struct hda_pintbl[]) {
4516 { 0x14, 0x99130110 }, /* speaker */
4517 { 0x15, 0x0121401f }, /* HP out */
4518 { 0x18, 0x01a19c20 }, /* mic */
4519 { 0x19, 0x99a3092f }, /* int-mic */
4523 [ALC269_FIXUP_DMIC] = {
4524 .type = HDA_FIXUP_PINS,
4525 .v.pins = (const struct hda_pintbl[]) {
4526 { 0x12, 0x99a3092f }, /* int-mic */
4527 { 0x14, 0x99130110 }, /* speaker */
4528 { 0x15, 0x0121401f }, /* HP out */
4529 { 0x18, 0x01a19c20 }, /* mic */
4533 [ALC269VB_FIXUP_AMIC] = {
4534 .type = HDA_FIXUP_PINS,
4535 .v.pins = (const struct hda_pintbl[]) {
4536 { 0x14, 0x99130110 }, /* speaker */
4537 { 0x18, 0x01a19c20 }, /* mic */
4538 { 0x19, 0x99a3092f }, /* int-mic */
4539 { 0x21, 0x0121401f }, /* HP out */
4543 [ALC269VB_FIXUP_DMIC] = {
4544 .type = HDA_FIXUP_PINS,
4545 .v.pins = (const struct hda_pintbl[]) {
4546 { 0x12, 0x99a3092f }, /* int-mic */
4547 { 0x14, 0x99130110 }, /* speaker */
4548 { 0x18, 0x01a19c20 }, /* mic */
4549 { 0x21, 0x0121401f }, /* HP out */
4553 [ALC269_FIXUP_HP_MUTE_LED] = {
4554 .type = HDA_FIXUP_FUNC,
4555 .v.func = alc269_fixup_hp_mute_led,
4557 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
4558 .type = HDA_FIXUP_FUNC,
4559 .v.func = alc269_fixup_hp_mute_led_mic1,
4561 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
4562 .type = HDA_FIXUP_FUNC,
4563 .v.func = alc269_fixup_hp_mute_led_mic2,
4565 [ALC269_FIXUP_HP_GPIO_LED] = {
4566 .type = HDA_FIXUP_FUNC,
4567 .v.func = alc269_fixup_hp_gpio_led,
4569 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
4570 .type = HDA_FIXUP_FUNC,
4571 .v.func = alc269_fixup_hp_gpio_mic1_led,
4573 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
4574 .type = HDA_FIXUP_FUNC,
4575 .v.func = alc269_fixup_hp_line1_mic1_led,
4577 [ALC269_FIXUP_INV_DMIC] = {
4578 .type = HDA_FIXUP_FUNC,
4579 .v.func = alc_fixup_inv_dmic_0x12,
4581 [ALC269_FIXUP_NO_SHUTUP] = {
4582 .type = HDA_FIXUP_FUNC,
4583 .v.func = alc_fixup_no_shutup,
4585 [ALC269_FIXUP_LENOVO_DOCK] = {
4586 .type = HDA_FIXUP_PINS,
4587 .v.pins = (const struct hda_pintbl[]) {
4588 { 0x19, 0x23a11040 }, /* dock mic */
4589 { 0x1b, 0x2121103f }, /* dock headphone */
4593 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
4595 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
4596 .type = HDA_FIXUP_FUNC,
4597 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
4599 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4601 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4602 .type = HDA_FIXUP_PINS,
4603 .v.pins = (const struct hda_pintbl[]) {
4604 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4605 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4609 .chain_id = ALC269_FIXUP_HEADSET_MODE
4611 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4612 .type = HDA_FIXUP_PINS,
4613 .v.pins = (const struct hda_pintbl[]) {
4614 { 0x16, 0x21014020 }, /* dock line out */
4615 { 0x19, 0x21a19030 }, /* dock mic */
4616 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4620 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4622 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
4623 .type = HDA_FIXUP_PINS,
4624 .v.pins = (const struct hda_pintbl[]) {
4625 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4629 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4631 [ALC269_FIXUP_HEADSET_MODE] = {
4632 .type = HDA_FIXUP_FUNC,
4633 .v.func = alc_fixup_headset_mode,
4635 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4636 .type = HDA_FIXUP_FUNC,
4637 .v.func = alc_fixup_headset_mode_no_hp_mic,
4639 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
4640 .type = HDA_FIXUP_PINS,
4641 .v.pins = (const struct hda_pintbl[]) {
4642 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4646 .chain_id = ALC269_FIXUP_HEADSET_MIC
4648 [ALC269_FIXUP_ASUS_X101_FUNC] = {
4649 .type = HDA_FIXUP_FUNC,
4650 .v.func = alc269_fixup_x101_headset_mic,
4652 [ALC269_FIXUP_ASUS_X101_VERB] = {
4653 .type = HDA_FIXUP_VERBS,
4654 .v.verbs = (const struct hda_verb[]) {
4655 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4656 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
4657 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
4661 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
4663 [ALC269_FIXUP_ASUS_X101] = {
4664 .type = HDA_FIXUP_PINS,
4665 .v.pins = (const struct hda_pintbl[]) {
4666 { 0x18, 0x04a1182c }, /* Headset mic */
4670 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
4672 [ALC271_FIXUP_AMIC_MIC2] = {
4673 .type = HDA_FIXUP_PINS,
4674 .v.pins = (const struct hda_pintbl[]) {
4675 { 0x14, 0x99130110 }, /* speaker */
4676 { 0x19, 0x01a19c20 }, /* mic */
4677 { 0x1b, 0x99a7012f }, /* int-mic */
4678 { 0x21, 0x0121401f }, /* HP out */
4682 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
4683 .type = HDA_FIXUP_FUNC,
4684 .v.func = alc271_hp_gate_mic_jack,
4686 .chain_id = ALC271_FIXUP_AMIC_MIC2,
4688 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
4689 .type = HDA_FIXUP_FUNC,
4690 .v.func = alc269_fixup_limit_int_mic_boost,
4692 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
4694 [ALC269_FIXUP_ACER_AC700] = {
4695 .type = HDA_FIXUP_PINS,
4696 .v.pins = (const struct hda_pintbl[]) {
4697 { 0x12, 0x99a3092f }, /* int-mic */
4698 { 0x14, 0x99130110 }, /* speaker */
4699 { 0x18, 0x03a11c20 }, /* mic */
4700 { 0x1e, 0x0346101e }, /* SPDIF1 */
4701 { 0x21, 0x0321101f }, /* HP out */
4705 .chain_id = ALC271_FIXUP_DMIC,
4707 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
4708 .type = HDA_FIXUP_FUNC,
4709 .v.func = alc269_fixup_limit_int_mic_boost,
4711 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4713 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
4714 .type = HDA_FIXUP_FUNC,
4715 .v.func = alc269_fixup_limit_int_mic_boost,
4717 .chain_id = ALC269VB_FIXUP_DMIC,
4719 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
4720 .type = HDA_FIXUP_VERBS,
4721 .v.verbs = (const struct hda_verb[]) {
4722 /* class-D output amp +5dB */
4723 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
4724 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
4728 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
4730 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
4731 .type = HDA_FIXUP_FUNC,
4732 .v.func = alc269_fixup_limit_int_mic_boost,
4734 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
4736 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
4737 .type = HDA_FIXUP_PINS,
4738 .v.pins = (const struct hda_pintbl[]) {
4739 { 0x12, 0x99a3092f }, /* int-mic */
4740 { 0x18, 0x03a11d20 }, /* mic */
4741 { 0x19, 0x411111f0 }, /* Unused bogus pin */
4745 [ALC283_FIXUP_CHROME_BOOK] = {
4746 .type = HDA_FIXUP_FUNC,
4747 .v.func = alc283_fixup_chromebook,
4749 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
4750 .type = HDA_FIXUP_FUNC,
4751 .v.func = alc283_fixup_sense_combo_jack,
4753 .chain_id = ALC283_FIXUP_CHROME_BOOK,
4755 [ALC282_FIXUP_ASUS_TX300] = {
4756 .type = HDA_FIXUP_FUNC,
4757 .v.func = alc282_fixup_asus_tx300,
4759 [ALC283_FIXUP_INT_MIC] = {
4760 .type = HDA_FIXUP_VERBS,
4761 .v.verbs = (const struct hda_verb[]) {
4762 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
4763 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
4767 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4769 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
4770 .type = HDA_FIXUP_PINS,
4771 .v.pins = (const struct hda_pintbl[]) {
4772 { 0x17, 0x90170112 }, /* subwoofer */
4776 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4778 [ALC290_FIXUP_SUBWOOFER] = {
4779 .type = HDA_FIXUP_PINS,
4780 .v.pins = (const struct hda_pintbl[]) {
4781 { 0x17, 0x90170112 }, /* subwoofer */
4785 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
4787 [ALC290_FIXUP_MONO_SPEAKERS] = {
4788 .type = HDA_FIXUP_FUNC,
4789 .v.func = alc290_fixup_mono_speakers,
4791 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
4792 .type = HDA_FIXUP_FUNC,
4793 .v.func = alc290_fixup_mono_speakers,
4795 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4797 [ALC269_FIXUP_THINKPAD_ACPI] = {
4798 .type = HDA_FIXUP_FUNC,
4799 .v.func = hda_fixup_thinkpad_acpi,
4801 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4802 .type = HDA_FIXUP_PINS,
4803 .v.pins = (const struct hda_pintbl[]) {
4804 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4805 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4809 .chain_id = ALC255_FIXUP_HEADSET_MODE
4811 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4812 .type = HDA_FIXUP_PINS,
4813 .v.pins = (const struct hda_pintbl[]) {
4814 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4818 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
4820 [ALC255_FIXUP_HEADSET_MODE] = {
4821 .type = HDA_FIXUP_FUNC,
4822 .v.func = alc_fixup_headset_mode_alc255,
4824 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4825 .type = HDA_FIXUP_FUNC,
4826 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
4828 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4829 .type = HDA_FIXUP_PINS,
4830 .v.pins = (const struct hda_pintbl[]) {
4831 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4832 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4836 .chain_id = ALC269_FIXUP_HEADSET_MODE
4838 [ALC292_FIXUP_TPT440_DOCK] = {
4839 .type = HDA_FIXUP_PINS,
4840 .v.pins = (const struct hda_pintbl[]) {
4841 { 0x16, 0x21211010 }, /* dock headphone */
4842 { 0x19, 0x21a11010 }, /* dock mic */
4846 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4848 [ALC283_FIXUP_BXBT2807_MIC] = {
4849 .type = HDA_FIXUP_PINS,
4850 .v.pins = (const struct hda_pintbl[]) {
4851 { 0x19, 0x04a110f0 },
4855 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
4856 .type = HDA_FIXUP_FUNC,
4857 .v.func = alc_fixup_dell_wmi,
4858 .chained_before = true,
4859 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
4861 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
4862 .type = HDA_FIXUP_PINS,
4863 .v.pins = (const struct hda_pintbl[]) {
4864 { 0x12, 0x90a60130 },
4865 { 0x14, 0x90170110 },
4866 { 0x17, 0x40000008 },
4867 { 0x18, 0x411111f0 },
4868 { 0x19, 0x411111f0 },
4869 { 0x1a, 0x411111f0 },
4870 { 0x1b, 0x411111f0 },
4871 { 0x1d, 0x40f89b2d },
4872 { 0x1e, 0x411111f0 },
4873 { 0x21, 0x0321101f },
4880 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4881 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
4882 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
4883 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
4884 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
4885 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
4886 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
4887 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
4888 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
4889 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
4890 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4891 SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4892 SND_PCI_QUIRK(0x1028, 0x05c4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4893 SND_PCI_QUIRK(0x1028, 0x05c5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4894 SND_PCI_QUIRK(0x1028, 0x05c6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4895 SND_PCI_QUIRK(0x1028, 0x05c7, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4896 SND_PCI_QUIRK(0x1028, 0x05c8, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4897 SND_PCI_QUIRK(0x1028, 0x05c9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4898 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4899 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4900 SND_PCI_QUIRK(0x1028, 0x05cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4901 SND_PCI_QUIRK(0x1028, 0x05cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4902 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
4903 SND_PCI_QUIRK(0x1028, 0x05de, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4904 SND_PCI_QUIRK(0x1028, 0x05e0, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4905 SND_PCI_QUIRK(0x1028, 0x05e9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4906 SND_PCI_QUIRK(0x1028, 0x05ea, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4907 SND_PCI_QUIRK(0x1028, 0x05eb, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4908 SND_PCI_QUIRK(0x1028, 0x05ec, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4909 SND_PCI_QUIRK(0x1028, 0x05ed, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4910 SND_PCI_QUIRK(0x1028, 0x05ee, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4911 SND_PCI_QUIRK(0x1028, 0x05f3, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4912 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4913 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4914 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4915 SND_PCI_QUIRK(0x1028, 0x05f8, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4916 SND_PCI_QUIRK(0x1028, 0x05f9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4917 SND_PCI_QUIRK(0x1028, 0x05fb, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4918 SND_PCI_QUIRK(0x1028, 0x0606, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4919 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4920 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4921 SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4922 SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4923 SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4924 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4925 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4926 SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4927 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
4928 SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4929 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4930 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4931 SND_PCI_QUIRK(0x1028, 0x0668, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
4932 SND_PCI_QUIRK(0x1028, 0x0669, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
4933 SND_PCI_QUIRK(0x1028, 0x0684, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4934 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4935 SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4936 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4937 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4938 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
4939 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
4940 SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4941 SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4942 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
4944 SND_PCI_QUIRK(0x103c, 0x21f8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4945 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4946 SND_PCI_QUIRK(0x103c, 0x220d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4947 SND_PCI_QUIRK(0x103c, 0x220e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4948 SND_PCI_QUIRK(0x103c, 0x220f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4949 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4950 SND_PCI_QUIRK(0x103c, 0x2211, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4951 SND_PCI_QUIRK(0x103c, 0x2212, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4952 SND_PCI_QUIRK(0x103c, 0x2213, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4953 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4954 SND_PCI_QUIRK(0x103c, 0x2234, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4955 SND_PCI_QUIRK(0x103c, 0x2235, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4956 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4957 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4958 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4959 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4960 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4961 SND_PCI_QUIRK(0x103c, 0x2247, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4962 SND_PCI_QUIRK(0x103c, 0x2248, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4963 SND_PCI_QUIRK(0x103c, 0x2249, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4964 SND_PCI_QUIRK(0x103c, 0x224a, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4965 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4966 SND_PCI_QUIRK(0x103c, 0x224c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4967 SND_PCI_QUIRK(0x103c, 0x224d, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4968 SND_PCI_QUIRK(0x103c, 0x2266, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4969 SND_PCI_QUIRK(0x103c, 0x2267, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4970 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4971 SND_PCI_QUIRK(0x103c, 0x2269, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4972 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4973 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4974 SND_PCI_QUIRK(0x103c, 0x226c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4975 SND_PCI_QUIRK(0x103c, 0x226d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4976 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4977 SND_PCI_QUIRK(0x103c, 0x226f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4978 SND_PCI_QUIRK(0x103c, 0x227a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4979 SND_PCI_QUIRK(0x103c, 0x227b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4980 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4981 SND_PCI_QUIRK(0x103c, 0x22a0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4982 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4983 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4984 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4985 SND_PCI_QUIRK(0x103c, 0x22c0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4986 SND_PCI_QUIRK(0x103c, 0x22c1, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4987 SND_PCI_QUIRK(0x103c, 0x22c2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4988 SND_PCI_QUIRK(0x103c, 0x22cd, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4989 SND_PCI_QUIRK(0x103c, 0x22ce, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4990 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4991 SND_PCI_QUIRK(0x103c, 0x22d0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4992 SND_PCI_QUIRK(0x103c, 0x22da, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4993 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4994 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4995 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4996 SND_PCI_QUIRK(0x103c, 0x8004, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4998 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4999 SND_PCI_QUIRK(0x103c, 0x221c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5000 SND_PCI_QUIRK(0x103c, 0x221d, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5001 SND_PCI_QUIRK(0x103c, 0x2220, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5002 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5003 SND_PCI_QUIRK(0x103c, 0x2222, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5004 SND_PCI_QUIRK(0x103c, 0x2223, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5005 SND_PCI_QUIRK(0x103c, 0x2224, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5006 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5007 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5008 SND_PCI_QUIRK(0x103c, 0x2247, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5009 SND_PCI_QUIRK(0x103c, 0x2248, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5010 SND_PCI_QUIRK(0x103c, 0x2249, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5011 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5012 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5013 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5014 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5015 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5016 SND_PCI_QUIRK(0x103c, 0x2258, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5017 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5018 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5019 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5020 SND_PCI_QUIRK(0x103c, 0x2261, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5021 SND_PCI_QUIRK(0x103c, 0x2262, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5022 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5023 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5024 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5025 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5026 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5027 SND_PCI_QUIRK(0x103c, 0x2277, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5028 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5029 SND_PCI_QUIRK(0x103c, 0x227d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5030 SND_PCI_QUIRK(0x103c, 0x227e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5031 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5032 SND_PCI_QUIRK(0x103c, 0x2280, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5033 SND_PCI_QUIRK(0x103c, 0x2281, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5034 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5035 SND_PCI_QUIRK(0x103c, 0x2289, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5036 SND_PCI_QUIRK(0x103c, 0x228a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5037 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5038 SND_PCI_QUIRK(0x103c, 0x228c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5039 SND_PCI_QUIRK(0x103c, 0x228d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5040 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5041 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5042 SND_PCI_QUIRK(0x103c, 0x22c6, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5043 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5044 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5045 SND_PCI_QUIRK(0x103c, 0x22c3, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5046 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5047 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5048 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5049 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5050 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5051 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
5052 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5053 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5054 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
5055 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
5056 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
5057 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
5058 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
5059 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5060 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
5061 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
5062 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
5063 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
5064 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
5065 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
5066 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
5067 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
5068 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
5069 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
5070 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
5071 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
5072 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
5073 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC),
5074 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
5075 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
5076 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
5077 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
5078 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
5079 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
5080 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
5081 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
5082 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
5083 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
5084 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
5085 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK),
5086 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
5087 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
5088 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5089 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5090 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5091 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
5092 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5093 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
5094 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5095 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5096 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
5097 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
5098 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
5101 /* Below is a quirk table taken from the old code.
5102 * Basically the device should work as is without the fixup table.
5103 * If BIOS doesn't give a proper info, enable the corresponding
5106 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
5108 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
5109 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
5110 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
5111 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
5112 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
5113 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
5114 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
5115 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
5116 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
5117 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
5118 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
5119 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
5120 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
5121 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
5122 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
5123 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
5124 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
5125 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
5126 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
5127 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
5128 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
5129 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
5130 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
5131 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
5132 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
5133 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
5134 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
5135 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
5136 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
5137 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
5138 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
5139 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
5140 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
5141 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
5142 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
5143 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
5144 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
5145 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
5146 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
5151 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
5152 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
5153 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
5154 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
5155 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
5159 static const struct hda_model_fixup alc269_fixup_models[] = {
5160 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
5161 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
5162 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
5163 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
5164 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
5165 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
5166 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
5167 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
5168 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
5169 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
5170 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
5171 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
5172 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
5176 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
5177 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5187 {0x21, 0x02211020}),
5188 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5198 {0x21, 0x02211030}),
5199 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5209 {0x21, 0x0321102f}),
5210 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5220 {0x21, 0x02211040}),
5221 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5231 {0x21, 0x02211050}),
5232 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5242 {0x21, 0x02211030}),
5243 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5253 {0x21, 0x02211040}),
5254 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5264 {0x21, 0x0321101f}),
5265 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5275 {0x21, 0x0321101f}),
5276 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5286 {0x21, 0x02211030}),
5287 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5298 {0x1e, 0x411111f0}),
5299 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5310 {0x1e, 0x411111f0}),
5311 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5322 {0x1e, 0x411111f0}),
5326 static void alc269_fill_coef(struct hda_codec *codec)
5328 struct alc_spec *spec = codec->spec;
5331 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
5334 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
5335 alc_write_coef_idx(codec, 0xf, 0x960b);
5336 alc_write_coef_idx(codec, 0xe, 0x8817);
5339 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
5340 alc_write_coef_idx(codec, 0xf, 0x960b);
5341 alc_write_coef_idx(codec, 0xe, 0x8814);
5344 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
5345 val = alc_read_coef_idx(codec, 0x04);
5346 /* Power up output pin */
5348 alc_write_coef_idx(codec, 0x04, val | (1<<11));
5351 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
5352 val = alc_read_coef_idx(codec, 0xd);
5353 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
5354 /* Capless ramp up clock control */
5355 alc_write_coef_idx(codec, 0xd, val | (1<<10));
5357 val = alc_read_coef_idx(codec, 0x17);
5358 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
5359 /* Class D power on reset */
5360 alc_write_coef_idx(codec, 0x17, val | (1<<7));
5364 val = alc_read_coef_idx(codec, 0xd); /* Class D */
5366 alc_write_coef_idx(codec, 0xd, val | (1<<14));
5368 val = alc_read_coef_idx(codec, 0x4); /* HP */
5370 alc_write_coef_idx(codec, 0x4, val | (1<<11));
5375 static int patch_alc269(struct hda_codec *codec)
5377 struct alc_spec *spec;
5380 err = alc_alloc_spec(codec, 0x0b);
5385 spec->gen.shared_mic_vref_pin = 0x18;
5387 snd_hda_pick_fixup(codec, alc269_fixup_models,
5388 alc269_fixup_tbl, alc269_fixups);
5389 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
5390 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
5392 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5394 alc_auto_parse_customize_define(codec);
5396 if (has_cdefine_beep(codec))
5397 spec->gen.beep_nid = 0x01;
5399 switch (codec->vendor_id) {
5401 spec->codec_variant = ALC269_TYPE_ALC269VA;
5402 switch (alc_get_coef0(codec) & 0x00f0) {
5404 if (codec->bus->pci &&
5405 codec->bus->pci->subsystem_vendor == 0x1025 &&
5406 spec->cdefine.platform_type == 1)
5407 err = alc_codec_rename(codec, "ALC271X");
5408 spec->codec_variant = ALC269_TYPE_ALC269VB;
5411 if (codec->bus->pci &&
5412 codec->bus->pci->subsystem_vendor == 0x17aa &&
5413 codec->bus->pci->subsystem_device == 0x21f3)
5414 err = alc_codec_rename(codec, "ALC3202");
5415 spec->codec_variant = ALC269_TYPE_ALC269VC;
5418 spec->codec_variant = ALC269_TYPE_ALC269VD;
5421 alc_fix_pll_init(codec, 0x20, 0x04, 15);
5425 spec->init_hook = alc269_fill_coef;
5426 alc269_fill_coef(codec);
5431 spec->codec_variant = ALC269_TYPE_ALC280;
5434 spec->codec_variant = ALC269_TYPE_ALC282;
5435 spec->shutup = alc282_shutup;
5436 spec->init_hook = alc282_init;
5440 spec->codec_variant = ALC269_TYPE_ALC283;
5441 spec->shutup = alc283_shutup;
5442 spec->init_hook = alc283_init;
5446 spec->codec_variant = ALC269_TYPE_ALC284;
5450 spec->codec_variant = ALC269_TYPE_ALC285;
5454 spec->codec_variant = ALC269_TYPE_ALC286;
5455 spec->shutup = alc286_shutup;
5458 spec->codec_variant = ALC269_TYPE_ALC255;
5462 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
5463 spec->has_alc5505_dsp = 1;
5464 spec->init_hook = alc5505_dsp_init;
5467 /* automatic parse from the BIOS config */
5468 err = alc269_parse_auto_config(codec);
5472 if (!spec->gen.no_analog && spec->gen.beep_nid)
5473 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
5475 codec->patch_ops = alc_patch_ops;
5477 codec->patch_ops.suspend = alc269_suspend;
5478 codec->patch_ops.resume = alc269_resume;
5481 spec->shutup = alc269_shutup;
5483 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5496 static int alc861_parse_auto_config(struct hda_codec *codec)
5498 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
5499 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
5500 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
5503 /* Pin config fixes */
5505 ALC861_FIXUP_FSC_AMILO_PI1505,
5506 ALC861_FIXUP_AMP_VREF_0F,
5507 ALC861_FIXUP_NO_JACK_DETECT,
5508 ALC861_FIXUP_ASUS_A6RP,
5509 ALC660_FIXUP_ASUS_W7J,
5512 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
5513 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
5514 const struct hda_fixup *fix, int action)
5516 struct alc_spec *spec = codec->spec;
5519 if (action != HDA_FIXUP_ACT_INIT)
5521 val = snd_hda_codec_get_pin_target(codec, 0x0f);
5522 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
5523 val |= AC_PINCTL_IN_EN;
5524 val |= AC_PINCTL_VREF_50;
5525 snd_hda_set_pin_ctl(codec, 0x0f, val);
5526 spec->gen.keep_vref_in_automute = 1;
5529 /* suppress the jack-detection */
5530 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
5531 const struct hda_fixup *fix, int action)
5533 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5534 codec->no_jack_detect = 1;
5537 static const struct hda_fixup alc861_fixups[] = {
5538 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
5539 .type = HDA_FIXUP_PINS,
5540 .v.pins = (const struct hda_pintbl[]) {
5541 { 0x0b, 0x0221101f }, /* HP */
5542 { 0x0f, 0x90170310 }, /* speaker */
5546 [ALC861_FIXUP_AMP_VREF_0F] = {
5547 .type = HDA_FIXUP_FUNC,
5548 .v.func = alc861_fixup_asus_amp_vref_0f,
5550 [ALC861_FIXUP_NO_JACK_DETECT] = {
5551 .type = HDA_FIXUP_FUNC,
5552 .v.func = alc_fixup_no_jack_detect,
5554 [ALC861_FIXUP_ASUS_A6RP] = {
5555 .type = HDA_FIXUP_FUNC,
5556 .v.func = alc861_fixup_asus_amp_vref_0f,
5558 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
5560 [ALC660_FIXUP_ASUS_W7J] = {
5561 .type = HDA_FIXUP_VERBS,
5562 .v.verbs = (const struct hda_verb[]) {
5563 /* ASUS W7J needs a magic pin setup on unused NID 0x10
5564 * for enabling outputs
5566 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5572 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
5573 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
5574 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
5575 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
5576 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
5577 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
5578 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
5579 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
5580 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
5586 static int patch_alc861(struct hda_codec *codec)
5588 struct alc_spec *spec;
5591 err = alc_alloc_spec(codec, 0x15);
5596 spec->gen.beep_nid = 0x23;
5598 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
5599 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5601 /* automatic parse from the BIOS config */
5602 err = alc861_parse_auto_config(codec);
5606 if (!spec->gen.no_analog)
5607 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
5609 codec->patch_ops = alc_patch_ops;
5611 spec->power_hook = alc_power_eapd;
5614 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5628 * In addition, an independent DAC
5630 static int alc861vd_parse_auto_config(struct hda_codec *codec)
5632 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
5633 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5634 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
5638 ALC660VD_FIX_ASUS_GPIO1,
5639 ALC861VD_FIX_DALLAS,
5642 /* exclude VREF80 */
5643 static void alc861vd_fixup_dallas(struct hda_codec *codec,
5644 const struct hda_fixup *fix, int action)
5646 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5647 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
5648 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
5652 static const struct hda_fixup alc861vd_fixups[] = {
5653 [ALC660VD_FIX_ASUS_GPIO1] = {
5654 .type = HDA_FIXUP_VERBS,
5655 .v.verbs = (const struct hda_verb[]) {
5657 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5658 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5659 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5663 [ALC861VD_FIX_DALLAS] = {
5664 .type = HDA_FIXUP_FUNC,
5665 .v.func = alc861vd_fixup_dallas,
5669 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
5670 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
5671 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
5672 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
5678 static int patch_alc861vd(struct hda_codec *codec)
5680 struct alc_spec *spec;
5683 err = alc_alloc_spec(codec, 0x0b);
5688 spec->gen.beep_nid = 0x23;
5690 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
5691 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5693 /* automatic parse from the BIOS config */
5694 err = alc861vd_parse_auto_config(codec);
5698 if (!spec->gen.no_analog)
5699 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5701 codec->patch_ops = alc_patch_ops;
5703 spec->shutup = alc_eapd_shutup;
5705 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5717 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
5718 * configuration. Each pin widget can choose any input DACs and a mixer.
5719 * Each ADC is connected from a mixer of all inputs. This makes possible
5720 * 6-channel independent captures.
5722 * In addition, an independent DAC for the multi-playback (not used in this
5727 * BIOS auto configuration
5730 static int alc662_parse_auto_config(struct hda_codec *codec)
5732 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
5733 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
5734 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5735 const hda_nid_t *ssids;
5737 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
5738 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
5739 codec->vendor_id == 0x10ec0671)
5740 ssids = alc663_ssids;
5742 ssids = alc662_ssids;
5743 return alc_parse_auto_config(codec, alc662_ignore, ssids);
5746 static void alc272_fixup_mario(struct hda_codec *codec,
5747 const struct hda_fixup *fix, int action)
5749 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5751 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
5752 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
5753 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
5754 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
5755 (0 << AC_AMPCAP_MUTE_SHIFT)))
5756 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
5759 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
5761 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
5763 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
5764 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
5768 /* override the 2.1 chmap */
5769 static void alc_fixup_bass_chmap(struct hda_codec *codec,
5770 const struct hda_fixup *fix, int action)
5772 if (action == HDA_FIXUP_ACT_BUILD) {
5773 struct alc_spec *spec = codec->spec;
5774 spec->gen.pcm_rec[0].stream[0].chmap = asus_pcm_2_1_chmaps;
5778 /* turn on/off mute LED per vmaster hook */
5779 static void alc662_led_gpio1_mute_hook(void *private_data, int enabled)
5781 struct hda_codec *codec = private_data;
5782 struct alc_spec *spec = codec->spec;
5783 unsigned int oldval = spec->gpio_led;
5786 spec->gpio_led &= ~0x01;
5788 spec->gpio_led |= 0x01;
5789 if (spec->gpio_led != oldval)
5790 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
5794 /* avoid D3 for keeping GPIO up */
5795 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
5797 unsigned int power_state)
5799 struct alc_spec *spec = codec->spec;
5800 if (nid == codec->afg && power_state == AC_PWRST_D3 && spec->gpio_led)
5805 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
5806 const struct hda_fixup *fix, int action)
5808 struct alc_spec *spec = codec->spec;
5809 static const struct hda_verb gpio_init[] = {
5810 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
5811 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
5815 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5816 spec->gen.vmaster_mute.hook = alc662_led_gpio1_mute_hook;
5818 snd_hda_add_verbs(codec, gpio_init);
5819 codec->power_filter = gpio_led_power_filter;
5824 ALC662_FIXUP_ASPIRE,
5825 ALC662_FIXUP_LED_GPIO1,
5826 ALC662_FIXUP_IDEAPAD,
5828 ALC662_FIXUP_CZC_P10T,
5829 ALC662_FIXUP_SKU_IGNORE,
5830 ALC662_FIXUP_HP_RP5800,
5831 ALC662_FIXUP_ASUS_MODE1,
5832 ALC662_FIXUP_ASUS_MODE2,
5833 ALC662_FIXUP_ASUS_MODE3,
5834 ALC662_FIXUP_ASUS_MODE4,
5835 ALC662_FIXUP_ASUS_MODE5,
5836 ALC662_FIXUP_ASUS_MODE6,
5837 ALC662_FIXUP_ASUS_MODE7,
5838 ALC662_FIXUP_ASUS_MODE8,
5839 ALC662_FIXUP_NO_JACK_DETECT,
5840 ALC662_FIXUP_ZOTAC_Z68,
5841 ALC662_FIXUP_INV_DMIC,
5842 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
5843 ALC668_FIXUP_HEADSET_MODE,
5844 ALC662_FIXUP_BASS_MODE4_CHMAP,
5845 ALC662_FIXUP_BASS_16,
5846 ALC662_FIXUP_BASS_1A,
5847 ALC662_FIXUP_BASS_CHMAP,
5848 ALC668_FIXUP_AUTO_MUTE,
5849 ALC668_FIXUP_DELL_DISABLE_AAMIX,
5850 ALC668_FIXUP_DELL_XPS13,
5853 static const struct hda_fixup alc662_fixups[] = {
5854 [ALC662_FIXUP_ASPIRE] = {
5855 .type = HDA_FIXUP_PINS,
5856 .v.pins = (const struct hda_pintbl[]) {
5857 { 0x15, 0x99130112 }, /* subwoofer */
5861 [ALC662_FIXUP_LED_GPIO1] = {
5862 .type = HDA_FIXUP_FUNC,
5863 .v.func = alc662_fixup_led_gpio1,
5865 [ALC662_FIXUP_IDEAPAD] = {
5866 .type = HDA_FIXUP_PINS,
5867 .v.pins = (const struct hda_pintbl[]) {
5868 { 0x17, 0x99130112 }, /* subwoofer */
5872 .chain_id = ALC662_FIXUP_LED_GPIO1,
5874 [ALC272_FIXUP_MARIO] = {
5875 .type = HDA_FIXUP_FUNC,
5876 .v.func = alc272_fixup_mario,
5878 [ALC662_FIXUP_CZC_P10T] = {
5879 .type = HDA_FIXUP_VERBS,
5880 .v.verbs = (const struct hda_verb[]) {
5881 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5885 [ALC662_FIXUP_SKU_IGNORE] = {
5886 .type = HDA_FIXUP_FUNC,
5887 .v.func = alc_fixup_sku_ignore,
5889 [ALC662_FIXUP_HP_RP5800] = {
5890 .type = HDA_FIXUP_PINS,
5891 .v.pins = (const struct hda_pintbl[]) {
5892 { 0x14, 0x0221201f }, /* HP out */
5896 .chain_id = ALC662_FIXUP_SKU_IGNORE
5898 [ALC662_FIXUP_ASUS_MODE1] = {
5899 .type = HDA_FIXUP_PINS,
5900 .v.pins = (const struct hda_pintbl[]) {
5901 { 0x14, 0x99130110 }, /* speaker */
5902 { 0x18, 0x01a19c20 }, /* mic */
5903 { 0x19, 0x99a3092f }, /* int-mic */
5904 { 0x21, 0x0121401f }, /* HP out */
5908 .chain_id = ALC662_FIXUP_SKU_IGNORE
5910 [ALC662_FIXUP_ASUS_MODE2] = {
5911 .type = HDA_FIXUP_PINS,
5912 .v.pins = (const struct hda_pintbl[]) {
5913 { 0x14, 0x99130110 }, /* speaker */
5914 { 0x18, 0x01a19820 }, /* mic */
5915 { 0x19, 0x99a3092f }, /* int-mic */
5916 { 0x1b, 0x0121401f }, /* HP out */
5920 .chain_id = ALC662_FIXUP_SKU_IGNORE
5922 [ALC662_FIXUP_ASUS_MODE3] = {
5923 .type = HDA_FIXUP_PINS,
5924 .v.pins = (const struct hda_pintbl[]) {
5925 { 0x14, 0x99130110 }, /* speaker */
5926 { 0x15, 0x0121441f }, /* HP */
5927 { 0x18, 0x01a19840 }, /* mic */
5928 { 0x19, 0x99a3094f }, /* int-mic */
5929 { 0x21, 0x01211420 }, /* HP2 */
5933 .chain_id = ALC662_FIXUP_SKU_IGNORE
5935 [ALC662_FIXUP_ASUS_MODE4] = {
5936 .type = HDA_FIXUP_PINS,
5937 .v.pins = (const struct hda_pintbl[]) {
5938 { 0x14, 0x99130110 }, /* speaker */
5939 { 0x16, 0x99130111 }, /* speaker */
5940 { 0x18, 0x01a19840 }, /* mic */
5941 { 0x19, 0x99a3094f }, /* int-mic */
5942 { 0x21, 0x0121441f }, /* HP */
5946 .chain_id = ALC662_FIXUP_SKU_IGNORE
5948 [ALC662_FIXUP_ASUS_MODE5] = {
5949 .type = HDA_FIXUP_PINS,
5950 .v.pins = (const struct hda_pintbl[]) {
5951 { 0x14, 0x99130110 }, /* speaker */
5952 { 0x15, 0x0121441f }, /* HP */
5953 { 0x16, 0x99130111 }, /* speaker */
5954 { 0x18, 0x01a19840 }, /* mic */
5955 { 0x19, 0x99a3094f }, /* int-mic */
5959 .chain_id = ALC662_FIXUP_SKU_IGNORE
5961 [ALC662_FIXUP_ASUS_MODE6] = {
5962 .type = HDA_FIXUP_PINS,
5963 .v.pins = (const struct hda_pintbl[]) {
5964 { 0x14, 0x99130110 }, /* speaker */
5965 { 0x15, 0x01211420 }, /* HP2 */
5966 { 0x18, 0x01a19840 }, /* mic */
5967 { 0x19, 0x99a3094f }, /* int-mic */
5968 { 0x1b, 0x0121441f }, /* HP */
5972 .chain_id = ALC662_FIXUP_SKU_IGNORE
5974 [ALC662_FIXUP_ASUS_MODE7] = {
5975 .type = HDA_FIXUP_PINS,
5976 .v.pins = (const struct hda_pintbl[]) {
5977 { 0x14, 0x99130110 }, /* speaker */
5978 { 0x17, 0x99130111 }, /* speaker */
5979 { 0x18, 0x01a19840 }, /* mic */
5980 { 0x19, 0x99a3094f }, /* int-mic */
5981 { 0x1b, 0x01214020 }, /* HP */
5982 { 0x21, 0x0121401f }, /* HP */
5986 .chain_id = ALC662_FIXUP_SKU_IGNORE
5988 [ALC662_FIXUP_ASUS_MODE8] = {
5989 .type = HDA_FIXUP_PINS,
5990 .v.pins = (const struct hda_pintbl[]) {
5991 { 0x14, 0x99130110 }, /* speaker */
5992 { 0x12, 0x99a30970 }, /* int-mic */
5993 { 0x15, 0x01214020 }, /* HP */
5994 { 0x17, 0x99130111 }, /* speaker */
5995 { 0x18, 0x01a19840 }, /* mic */
5996 { 0x21, 0x0121401f }, /* HP */
6000 .chain_id = ALC662_FIXUP_SKU_IGNORE
6002 [ALC662_FIXUP_NO_JACK_DETECT] = {
6003 .type = HDA_FIXUP_FUNC,
6004 .v.func = alc_fixup_no_jack_detect,
6006 [ALC662_FIXUP_ZOTAC_Z68] = {
6007 .type = HDA_FIXUP_PINS,
6008 .v.pins = (const struct hda_pintbl[]) {
6009 { 0x1b, 0x02214020 }, /* Front HP */
6013 [ALC662_FIXUP_INV_DMIC] = {
6014 .type = HDA_FIXUP_FUNC,
6015 .v.func = alc_fixup_inv_dmic_0x12,
6017 [ALC668_FIXUP_DELL_XPS13] = {
6018 .type = HDA_FIXUP_FUNC,
6019 .v.func = alc_fixup_dell_xps13,
6021 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
6023 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
6024 .type = HDA_FIXUP_FUNC,
6025 .v.func = alc_fixup_disable_aamix,
6027 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
6029 [ALC668_FIXUP_AUTO_MUTE] = {
6030 .type = HDA_FIXUP_FUNC,
6031 .v.func = alc_fixup_auto_mute_via_amp,
6033 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
6035 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
6036 .type = HDA_FIXUP_PINS,
6037 .v.pins = (const struct hda_pintbl[]) {
6038 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
6039 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
6043 .chain_id = ALC668_FIXUP_HEADSET_MODE
6045 [ALC668_FIXUP_HEADSET_MODE] = {
6046 .type = HDA_FIXUP_FUNC,
6047 .v.func = alc_fixup_headset_mode_alc668,
6049 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
6050 .type = HDA_FIXUP_FUNC,
6051 .v.func = alc_fixup_bass_chmap,
6053 .chain_id = ALC662_FIXUP_ASUS_MODE4
6055 [ALC662_FIXUP_BASS_16] = {
6056 .type = HDA_FIXUP_PINS,
6057 .v.pins = (const struct hda_pintbl[]) {
6058 {0x16, 0x80106111}, /* bass speaker */
6062 .chain_id = ALC662_FIXUP_BASS_CHMAP,
6064 [ALC662_FIXUP_BASS_1A] = {
6065 .type = HDA_FIXUP_PINS,
6066 .v.pins = (const struct hda_pintbl[]) {
6067 {0x1a, 0x80106111}, /* bass speaker */
6071 .chain_id = ALC662_FIXUP_BASS_CHMAP,
6073 [ALC662_FIXUP_BASS_CHMAP] = {
6074 .type = HDA_FIXUP_FUNC,
6075 .v.func = alc_fixup_bass_chmap,
6079 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
6080 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
6081 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
6082 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
6083 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
6084 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
6085 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
6086 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
6087 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6088 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6089 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
6090 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
6091 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6092 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6093 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6094 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6095 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
6096 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A),
6097 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
6098 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
6099 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
6100 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
6101 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
6102 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
6103 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
6104 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6105 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
6106 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
6107 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
6110 /* Below is a quirk table taken from the old code.
6111 * Basically the device should work as is without the fixup table.
6112 * If BIOS doesn't give a proper info, enable the corresponding
6115 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
6116 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
6117 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
6118 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
6119 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6120 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6121 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6122 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
6123 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
6124 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6125 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
6126 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
6127 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
6128 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
6129 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
6130 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6131 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
6132 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
6133 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6134 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6135 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6136 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6137 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
6138 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
6139 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
6140 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6141 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
6142 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6143 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6144 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
6145 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6146 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6147 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
6148 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
6149 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
6150 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
6151 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
6152 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
6153 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
6154 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6155 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
6156 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
6157 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6158 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
6159 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
6160 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
6161 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
6162 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
6163 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6164 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
6169 static const struct hda_model_fixup alc662_fixup_models[] = {
6170 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
6171 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
6172 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
6173 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
6174 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
6175 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
6176 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
6177 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
6178 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
6179 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
6180 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6184 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
6185 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6196 {0x1f, 0x411111f0}),
6197 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6208 {0x1f, 0x411111f0}),
6209 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6220 {0x1f, 0x411111f0}),
6221 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6232 {0x1f, 0x411111f0}),
6233 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
6244 {0x1f, 0x411111f0}),
6248 static void alc662_fill_coef(struct hda_codec *codec)
6252 coef = alc_get_coef0(codec);
6254 switch (codec->vendor_id) {
6256 if ((coef & 0x00f0) == 0x0030) {
6257 val = alc_read_coef_idx(codec, 0x4); /* EAPD Ctrl */
6258 alc_write_coef_idx(codec, 0x4, val & ~(1<<10));
6268 val = alc_read_coef_idx(codec, 0xd); /* EAPD Ctrl */
6269 alc_write_coef_idx(codec, 0xd, val | (1<<14));
6276 static int patch_alc662(struct hda_codec *codec)
6278 struct alc_spec *spec;
6281 err = alc_alloc_spec(codec, 0x0b);
6287 /* handle multiple HPs as is */
6288 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6290 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6292 spec->init_hook = alc662_fill_coef;
6293 alc662_fill_coef(codec);
6295 snd_hda_pick_fixup(codec, alc662_fixup_models,
6296 alc662_fixup_tbl, alc662_fixups);
6297 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
6298 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6300 alc_auto_parse_customize_define(codec);
6302 if (has_cdefine_beep(codec))
6303 spec->gen.beep_nid = 0x01;
6305 if ((alc_get_coef0(codec) & (1 << 14)) &&
6306 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
6307 spec->cdefine.platform_type == 1) {
6308 err = alc_codec_rename(codec, "ALC272X");
6313 /* automatic parse from the BIOS config */
6314 err = alc662_parse_auto_config(codec);
6318 if (!spec->gen.no_analog && spec->gen.beep_nid) {
6319 switch (codec->vendor_id) {
6321 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6327 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
6330 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
6335 codec->patch_ops = alc_patch_ops;
6336 spec->shutup = alc_eapd_shutup;
6338 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6351 static int alc680_parse_auto_config(struct hda_codec *codec)
6353 return alc_parse_auto_config(codec, NULL, NULL);
6358 static int patch_alc680(struct hda_codec *codec)
6362 /* ALC680 has no aa-loopback mixer */
6363 err = alc_alloc_spec(codec, 0);
6367 /* automatic parse from the BIOS config */
6368 err = alc680_parse_auto_config(codec);
6374 codec->patch_ops = alc_patch_ops;
6382 static const struct hda_codec_preset snd_hda_preset_realtek[] = {
6383 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
6384 { .id = 0x10ec0231, .name = "ALC231", .patch = patch_alc269 },
6385 { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 },
6386 { .id = 0x10ec0235, .name = "ALC233", .patch = patch_alc269 },
6387 { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 },
6388 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
6389 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
6390 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
6391 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
6392 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
6393 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
6394 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
6395 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
6396 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
6397 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
6398 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
6399 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 },
6400 { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 },
6401 { .id = 0x10ec0285, .name = "ALC285", .patch = patch_alc269 },
6402 { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 },
6403 { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 },
6404 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 },
6405 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 },
6406 { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 },
6407 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
6408 .patch = patch_alc861 },
6409 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
6410 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
6411 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
6412 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
6413 .patch = patch_alc882 },
6414 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
6415 .patch = patch_alc662 },
6416 { .id = 0x10ec0662, .rev = 0x100300, .name = "ALC662 rev3",
6417 .patch = patch_alc662 },
6418 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
6419 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
6420 { .id = 0x10ec0667, .name = "ALC667", .patch = patch_alc662 },
6421 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
6422 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
6423 { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
6424 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
6425 { .id = 0x10ec0867, .name = "ALC891", .patch = patch_alc882 },
6426 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
6427 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
6428 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
6429 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
6430 .patch = patch_alc882 },
6431 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
6432 .patch = patch_alc882 },
6433 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
6434 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
6435 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
6436 .patch = patch_alc882 },
6437 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
6438 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
6439 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
6440 { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 },
6441 { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 },
6445 MODULE_ALIAS("snd-hda-codec-id:10ec*");
6447 MODULE_LICENSE("GPL");
6448 MODULE_DESCRIPTION("Realtek HD-audio codec");
6450 static struct hda_codec_preset_list realtek_list = {
6451 .preset = snd_hda_preset_realtek,
6452 .owner = THIS_MODULE,
6455 static int __init patch_realtek_init(void)
6457 return snd_hda_add_codec_preset(&realtek_list);
6460 static void __exit patch_realtek_exit(void)
6462 snd_hda_delete_codec_preset(&realtek_list);
6465 module_init(patch_realtek_init)
6466 module_exit(patch_realtek_exit)