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 /* unsol event tags */
41 #define ALC_DCVOL_EVENT 0x08
44 #define GPIO_MASK 0x03
46 /* extra amp-initialization sequence types */
56 ALC_HEADSET_MODE_UNKNOWN
,
57 ALC_HEADSET_MODE_UNPLUGGED
,
58 ALC_HEADSET_MODE_HEADSET
,
60 ALC_HEADSET_MODE_HEADPHONE
,
64 ALC_HEADSET_TYPE_UNKNOWN
,
65 ALC_HEADSET_TYPE_CTIA
,
66 ALC_HEADSET_TYPE_OMTP
,
69 struct alc_customize_define
{
71 unsigned char port_connectivity
;
72 unsigned char check_sum
;
73 unsigned char customization
;
74 unsigned char external_amp
;
75 unsigned int enable_pcbeep
:1;
76 unsigned int platform_type
:1;
78 unsigned int override
:1;
79 unsigned int fixup
:1; /* Means that this sku is set by driver, not read from hw */
83 struct hda_gen_spec gen
; /* must be at head */
85 /* codec parameterization */
86 const struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
87 unsigned int num_mixers
;
88 unsigned int beep_amp
; /* beep amp value, set via set_beep_amp() */
90 struct alc_customize_define cdefine
;
91 unsigned int parse_flags
; /* flag for snd_hda_parse_pin_defcfg() */
93 /* inverted dmic fix */
94 unsigned int inv_dmic_fixup
:1; /* has inverted digital-mic workaround */
95 unsigned int inv_dmic_muted
:1; /* R-ch of inv d-mic is muted? */
96 hda_nid_t inv_dmic_pin
;
98 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
99 int mute_led_polarity
;
100 hda_nid_t mute_led_nid
;
102 unsigned int gpio_led
; /* used for alc269_fixup_hp_gpio_led() */
104 hda_nid_t headset_mic_pin
;
105 hda_nid_t headphone_mic_pin
;
106 int current_headset_mode
;
107 int current_headset_type
;
110 void (*init_hook
)(struct hda_codec
*codec
);
112 void (*power_hook
)(struct hda_codec
*codec
);
114 void (*shutup
)(struct hda_codec
*codec
);
117 int codec_variant
; /* flag for other variants */
121 unsigned int pll_coef_idx
, pll_coef_bit
;
126 * Append the given mixer and verb elements for the later use
127 * The mixer array is referred in build_controls(), and init_verbs are
130 static void add_mixer(struct alc_spec
*spec
, const struct snd_kcontrol_new
*mix
)
132 if (snd_BUG_ON(spec
->num_mixers
>= ARRAY_SIZE(spec
->mixers
)))
134 spec
->mixers
[spec
->num_mixers
++] = mix
;
138 * GPIO setup tables, used in initialization
140 /* Enable GPIO mask and set output */
141 static const struct hda_verb alc_gpio1_init_verbs
[] = {
142 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
143 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
144 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
148 static const struct hda_verb alc_gpio2_init_verbs
[] = {
149 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
150 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
151 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
155 static const struct hda_verb alc_gpio3_init_verbs
[] = {
156 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
157 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
158 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
163 * Fix hardware PLL issue
164 * On some codecs, the analog PLL gating control must be off while
165 * the default value is 1.
167 static void alc_fix_pll(struct hda_codec
*codec
)
169 struct alc_spec
*spec
= codec
->spec
;
174 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
176 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
177 AC_VERB_GET_PROC_COEF
, 0);
180 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
182 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
183 val
& ~(1 << spec
->pll_coef_bit
));
186 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
187 unsigned int coef_idx
, unsigned int coef_bit
)
189 struct alc_spec
*spec
= codec
->spec
;
191 spec
->pll_coef_idx
= coef_idx
;
192 spec
->pll_coef_bit
= coef_bit
;
196 /* update the master volume per volume-knob's unsol event */
197 static void alc_update_knob_master(struct hda_codec
*codec
, struct hda_jack_tbl
*jack
)
200 struct snd_kcontrol
*kctl
;
201 struct snd_ctl_elem_value
*uctl
;
203 kctl
= snd_hda_find_mixer_ctl(codec
, "Master Playback Volume");
206 uctl
= kzalloc(sizeof(*uctl
), GFP_KERNEL
);
209 val
= snd_hda_codec_read(codec
, jack
->nid
, 0,
210 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
211 val
&= HDA_AMP_VOLMASK
;
212 uctl
->value
.integer
.value
[0] = val
;
213 uctl
->value
.integer
.value
[1] = val
;
214 kctl
->put(kctl
, uctl
);
218 static void alc880_unsol_event(struct hda_codec
*codec
, unsigned int res
)
220 /* For some reason, the res given from ALC880 is broken.
221 Here we adjust it properly. */
222 snd_hda_jack_unsol_event(codec
, res
>> 2);
225 /* additional initialization for ALC888 variants */
226 static void alc888_coef_init(struct hda_codec
*codec
)
230 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
231 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
232 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
233 if ((tmp
& 0xf0) == 0x20)
235 snd_hda_codec_read(codec
, 0x20, 0,
236 AC_VERB_SET_PROC_COEF
, 0x830);
239 snd_hda_codec_read(codec
, 0x20, 0,
240 AC_VERB_SET_PROC_COEF
, 0x3030);
243 /* additional initialization for ALC889 variants */
244 static void alc889_coef_init(struct hda_codec
*codec
)
248 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
249 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
250 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
251 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
, tmp
|0x2010);
254 /* turn on/off EAPD control (only if available) */
255 static void set_eapd(struct hda_codec
*codec
, hda_nid_t nid
, int on
)
257 if (get_wcaps_type(get_wcaps(codec
, nid
)) != AC_WID_PIN
)
259 if (snd_hda_query_pin_caps(codec
, nid
) & AC_PINCAP_EAPD
)
260 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
264 /* turn on/off EAPD controls of the codec */
265 static void alc_auto_setup_eapd(struct hda_codec
*codec
, bool on
)
267 /* We currently only handle front, HP */
268 static hda_nid_t pins
[] = {
269 0x0f, 0x10, 0x14, 0x15, 0x17, 0
272 for (p
= pins
; *p
; p
++)
273 set_eapd(codec
, *p
, on
);
276 /* generic shutup callback;
277 * just turning off EPAD and a little pause for avoiding pop-noise
279 static void alc_eapd_shutup(struct hda_codec
*codec
)
281 alc_auto_setup_eapd(codec
, false);
285 /* generic EAPD initialization */
286 static void alc_auto_init_amp(struct hda_codec
*codec
, int type
)
290 alc_auto_setup_eapd(codec
, true);
293 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
296 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
299 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
301 case ALC_INIT_DEFAULT
:
302 switch (codec
->vendor_id
) {
304 snd_hda_codec_write(codec
, 0x1a, 0,
305 AC_VERB_SET_COEF_INDEX
, 7);
306 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
307 AC_VERB_GET_PROC_COEF
, 0);
308 snd_hda_codec_write(codec
, 0x1a, 0,
309 AC_VERB_SET_COEF_INDEX
, 7);
310 snd_hda_codec_write(codec
, 0x1a, 0,
311 AC_VERB_SET_PROC_COEF
,
320 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
322 alc889_coef_init(codec
);
325 alc888_coef_init(codec
);
327 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
330 snd_hda_codec_write(codec
, 0x20, 0,
331 AC_VERB_SET_COEF_INDEX
, 7);
332 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
333 AC_VERB_GET_PROC_COEF
, 0);
334 snd_hda_codec_write(codec
, 0x20, 0,
335 AC_VERB_SET_COEF_INDEX
, 7);
336 snd_hda_codec_write(codec
, 0x20, 0,
337 AC_VERB_SET_PROC_COEF
,
348 * Realtek SSID verification
351 /* Could be any non-zero and even value. When used as fixup, tells
352 * the driver to ignore any present sku defines.
354 #define ALC_FIXUP_SKU_IGNORE (2)
356 static void alc_fixup_sku_ignore(struct hda_codec
*codec
,
357 const struct hda_fixup
*fix
, int action
)
359 struct alc_spec
*spec
= codec
->spec
;
360 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
361 spec
->cdefine
.fixup
= 1;
362 spec
->cdefine
.sku_cfg
= ALC_FIXUP_SKU_IGNORE
;
366 static int alc_auto_parse_customize_define(struct hda_codec
*codec
)
368 unsigned int ass
, tmp
, i
;
370 struct alc_spec
*spec
= codec
->spec
;
372 spec
->cdefine
.enable_pcbeep
= 1; /* assume always enabled */
374 if (spec
->cdefine
.fixup
) {
375 ass
= spec
->cdefine
.sku_cfg
;
376 if (ass
== ALC_FIXUP_SKU_IGNORE
)
381 ass
= codec
->subsystem_id
& 0xffff;
382 if (ass
!= codec
->bus
->pci
->subsystem_device
&& (ass
& 1))
386 if (codec
->vendor_id
== 0x10ec0260)
388 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
391 printk(KERN_INFO
"hda_codec: %s: SKU not ready 0x%08x\n",
392 codec
->chip_name
, ass
);
398 for (i
= 1; i
< 16; i
++) {
402 if (((ass
>> 16) & 0xf) != tmp
)
405 spec
->cdefine
.port_connectivity
= ass
>> 30;
406 spec
->cdefine
.enable_pcbeep
= (ass
& 0x100000) >> 20;
407 spec
->cdefine
.check_sum
= (ass
>> 16) & 0xf;
408 spec
->cdefine
.customization
= ass
>> 8;
410 spec
->cdefine
.sku_cfg
= ass
;
411 spec
->cdefine
.external_amp
= (ass
& 0x38) >> 3;
412 spec
->cdefine
.platform_type
= (ass
& 0x4) >> 2;
413 spec
->cdefine
.swap
= (ass
& 0x2) >> 1;
414 spec
->cdefine
.override
= ass
& 0x1;
416 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
417 nid
, spec
->cdefine
.sku_cfg
);
418 snd_printd("SKU: port_connectivity=0x%x\n",
419 spec
->cdefine
.port_connectivity
);
420 snd_printd("SKU: enable_pcbeep=0x%x\n", spec
->cdefine
.enable_pcbeep
);
421 snd_printd("SKU: check_sum=0x%08x\n", spec
->cdefine
.check_sum
);
422 snd_printd("SKU: customization=0x%08x\n", spec
->cdefine
.customization
);
423 snd_printd("SKU: external_amp=0x%x\n", spec
->cdefine
.external_amp
);
424 snd_printd("SKU: platform_type=0x%x\n", spec
->cdefine
.platform_type
);
425 snd_printd("SKU: swap=0x%x\n", spec
->cdefine
.swap
);
426 snd_printd("SKU: override=0x%x\n", spec
->cdefine
.override
);
431 /* return the position of NID in the list, or -1 if not found */
432 static int find_idx_in_nid_list(hda_nid_t nid
, const hda_nid_t
*list
, int nums
)
435 for (i
= 0; i
< nums
; i
++)
440 /* return true if the given NID is found in the list */
441 static bool found_in_nid_list(hda_nid_t nid
, const hda_nid_t
*list
, int nums
)
443 return find_idx_in_nid_list(nid
, list
, nums
) >= 0;
446 /* check subsystem ID and set up device-specific initialization;
447 * return 1 if initialized, 0 if invalid SSID
449 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
450 * 31 ~ 16 : Manufacture ID
452 * 7 ~ 0 : Assembly ID
453 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
455 static int alc_subsystem_id(struct hda_codec
*codec
,
456 hda_nid_t porta
, hda_nid_t porte
,
457 hda_nid_t portd
, hda_nid_t porti
)
459 unsigned int ass
, tmp
, i
;
461 struct alc_spec
*spec
= codec
->spec
;
463 if (spec
->cdefine
.fixup
) {
464 ass
= spec
->cdefine
.sku_cfg
;
465 if (ass
== ALC_FIXUP_SKU_IGNORE
)
470 ass
= codec
->subsystem_id
& 0xffff;
471 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
474 /* invalid SSID, check the special NID pin defcfg instead */
476 * 31~30 : port connectivity
479 * 19~16 : Check sum (15:1)
484 if (codec
->vendor_id
== 0x10ec0260)
486 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
487 snd_printd("realtek: No valid SSID, "
488 "checking pincfg 0x%08x for NID 0x%x\n",
492 if ((ass
>> 30) != 1) /* no physical connection */
497 for (i
= 1; i
< 16; i
++) {
501 if (((ass
>> 16) & 0xf) != tmp
)
504 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
505 ass
& 0xffff, codec
->vendor_id
);
509 * 2 : 0 --> Desktop, 1 --> Laptop
510 * 3~5 : External Amplifier control
513 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
516 spec
->init_amp
= ALC_INIT_GPIO1
;
519 spec
->init_amp
= ALC_INIT_GPIO2
;
522 spec
->init_amp
= ALC_INIT_GPIO3
;
526 spec
->init_amp
= ALC_INIT_DEFAULT
;
530 /* is laptop or Desktop and enable the function "Mute internal speaker
531 * when the external headphone out jack is plugged"
536 * 10~8 : Jack location
537 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
539 * 15 : 1 --> enable the function "Mute internal speaker
540 * when the external headphone out jack is plugged"
542 if (!spec
->gen
.autocfg
.hp_pins
[0] &&
543 !(spec
->gen
.autocfg
.line_out_pins
[0] &&
544 spec
->gen
.autocfg
.line_out_type
== AUTO_PIN_HP_OUT
)) {
546 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
557 if (found_in_nid_list(nid
, spec
->gen
.autocfg
.line_out_pins
,
558 spec
->gen
.autocfg
.line_outs
))
560 spec
->gen
.autocfg
.hp_pins
[0] = nid
;
565 /* Check the validity of ALC subsystem-id
566 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
567 static void alc_ssid_check(struct hda_codec
*codec
, const hda_nid_t
*ports
)
569 if (!alc_subsystem_id(codec
, ports
[0], ports
[1], ports
[2], ports
[3])) {
570 struct alc_spec
*spec
= codec
->spec
;
571 snd_printd("realtek: "
572 "Enable default setup for auto mode as fallback\n");
573 spec
->init_amp
= ALC_INIT_DEFAULT
;
578 * COEF access helper functions
580 static int alc_read_coef_idx(struct hda_codec
*codec
,
581 unsigned int coef_idx
)
584 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
586 val
= snd_hda_codec_read(codec
, 0x20, 0,
587 AC_VERB_GET_PROC_COEF
, 0);
591 static void alc_write_coef_idx(struct hda_codec
*codec
, unsigned int coef_idx
,
592 unsigned int coef_val
)
594 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
596 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
,
600 /* a special bypass for COEF 0; read the cached value at the second time */
601 static unsigned int alc_get_coef0(struct hda_codec
*codec
)
603 struct alc_spec
*spec
= codec
->spec
;
605 spec
->coef0
= alc_read_coef_idx(codec
, 0);
612 static hda_nid_t
get_adc_nid(struct hda_codec
*codec
, int adc_idx
, int imux_idx
)
614 struct hda_gen_spec
*spec
= codec
->spec
;
615 if (spec
->dyn_adc_switch
)
616 adc_idx
= spec
->dyn_adc_idx
[imux_idx
];
617 return spec
->adc_nids
[adc_idx
];
620 static void alc_inv_dmic_sync_adc(struct hda_codec
*codec
, int adc_idx
)
622 struct alc_spec
*spec
= codec
->spec
;
623 struct hda_input_mux
*imux
= &spec
->gen
.input_mux
;
624 struct nid_path
*path
;
629 for (i
= 0; i
< imux
->num_items
; i
++) {
630 if (spec
->gen
.imux_pins
[i
] == spec
->inv_dmic_pin
)
633 if (i
>= imux
->num_items
)
636 path
= snd_hda_get_nid_path(codec
, spec
->inv_dmic_pin
,
637 get_adc_nid(codec
, adc_idx
, i
));
638 val
= path
->ctls
[NID_PATH_MUTE_CTL
];
641 nid
= get_amp_nid_(val
);
642 dir
= get_amp_direction_(val
);
643 parm
= AC_AMP_SET_RIGHT
|
644 (dir
== HDA_OUTPUT
? AC_AMP_SET_OUTPUT
: AC_AMP_SET_INPUT
);
646 /* flush all cached amps at first */
647 snd_hda_codec_flush_cache(codec
);
649 /* we care only right channel */
650 val
= snd_hda_codec_amp_read(codec
, nid
, 1, dir
, 0);
651 if (val
& 0x80) /* if already muted, we don't need to touch */
654 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
659 * Inverted digital-mic handling
661 * First off, it's a bit tricky. The "Inverted Internal Mic Capture Switch"
662 * gives the additional mute only to the right channel of the digital mic
663 * capture stream. This is a workaround for avoiding the almost silence
664 * by summing the stereo stream from some (known to be ForteMedia)
667 * The logic is to call alc_inv_dmic_sync() after each action (possibly)
668 * modifying ADC amp. When the mute flag is set, it mutes the R-channel
669 * without caching so that the cache can still keep the original value.
670 * The cached value is then restored when the flag is set off or any other
671 * than d-mic is used as the current input source.
673 static void alc_inv_dmic_sync(struct hda_codec
*codec
, bool force
)
675 struct alc_spec
*spec
= codec
->spec
;
678 if (!spec
->inv_dmic_fixup
)
680 if (!spec
->inv_dmic_muted
&& !force
)
682 nums
= spec
->gen
.dyn_adc_switch
? 1 : spec
->gen
.num_adc_nids
;
683 for (src
= 0; src
< nums
; src
++) {
684 bool dmic_fixup
= false;
686 if (spec
->inv_dmic_muted
&&
687 spec
->gen
.imux_pins
[spec
->gen
.cur_mux
[src
]] == spec
->inv_dmic_pin
)
689 if (!dmic_fixup
&& !force
)
691 alc_inv_dmic_sync_adc(codec
, src
);
695 static void alc_inv_dmic_hook(struct hda_codec
*codec
,
696 struct snd_ctl_elem_value
*ucontrol
)
698 alc_inv_dmic_sync(codec
, false);
701 static int alc_inv_dmic_sw_get(struct snd_kcontrol
*kcontrol
,
702 struct snd_ctl_elem_value
*ucontrol
)
704 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
705 struct alc_spec
*spec
= codec
->spec
;
707 ucontrol
->value
.integer
.value
[0] = !spec
->inv_dmic_muted
;
711 static int alc_inv_dmic_sw_put(struct snd_kcontrol
*kcontrol
,
712 struct snd_ctl_elem_value
*ucontrol
)
714 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
715 struct alc_spec
*spec
= codec
->spec
;
716 unsigned int val
= !ucontrol
->value
.integer
.value
[0];
718 if (val
== spec
->inv_dmic_muted
)
720 spec
->inv_dmic_muted
= val
;
721 alc_inv_dmic_sync(codec
, true);
725 static const struct snd_kcontrol_new alc_inv_dmic_sw
= {
726 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
727 .name
= "Inverted Internal Mic Capture Switch",
728 .info
= snd_ctl_boolean_mono_info
,
729 .get
= alc_inv_dmic_sw_get
,
730 .put
= alc_inv_dmic_sw_put
,
733 static int alc_add_inv_dmic_mixer(struct hda_codec
*codec
, hda_nid_t nid
)
735 struct alc_spec
*spec
= codec
->spec
;
737 if (!snd_hda_gen_add_kctl(&spec
->gen
, NULL
, &alc_inv_dmic_sw
))
739 spec
->inv_dmic_fixup
= 1;
740 spec
->inv_dmic_muted
= 0;
741 spec
->inv_dmic_pin
= nid
;
742 spec
->gen
.cap_sync_hook
= alc_inv_dmic_hook
;
746 /* typically the digital mic is put at node 0x12 */
747 static void alc_fixup_inv_dmic_0x12(struct hda_codec
*codec
,
748 const struct hda_fixup
*fix
, int action
)
750 if (action
== HDA_FIXUP_ACT_PROBE
)
751 alc_add_inv_dmic_mixer(codec
, 0x12);
755 #ifdef CONFIG_SND_HDA_INPUT_BEEP
756 /* additional beep mixers; the actual parameters are overwritten at build */
757 static const struct snd_kcontrol_new alc_beep_mixer
[] = {
758 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT
),
759 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT
),
764 static int alc_build_controls(struct hda_codec
*codec
)
766 struct alc_spec
*spec
= codec
->spec
;
769 err
= snd_hda_gen_build_controls(codec
);
773 for (i
= 0; i
< spec
->num_mixers
; i
++) {
774 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
779 #ifdef CONFIG_SND_HDA_INPUT_BEEP
780 /* create beep controls if needed */
781 if (spec
->beep_amp
) {
782 const struct snd_kcontrol_new
*knew
;
783 for (knew
= alc_beep_mixer
; knew
->name
; knew
++) {
784 struct snd_kcontrol
*kctl
;
785 kctl
= snd_ctl_new1(knew
, codec
);
788 kctl
->private_value
= spec
->beep_amp
;
789 err
= snd_hda_ctl_add(codec
, 0, kctl
);
796 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_BUILD
);
805 static int alc_init(struct hda_codec
*codec
)
807 struct alc_spec
*spec
= codec
->spec
;
810 spec
->init_hook(codec
);
813 alc_auto_init_amp(codec
, spec
->init_amp
);
815 snd_hda_gen_init(codec
);
817 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_INIT
);
822 static inline void alc_shutup(struct hda_codec
*codec
)
824 struct alc_spec
*spec
= codec
->spec
;
826 if (spec
&& spec
->shutup
)
828 snd_hda_shutup_pins(codec
);
831 #define alc_free snd_hda_gen_free
834 static void alc_power_eapd(struct hda_codec
*codec
)
836 alc_auto_setup_eapd(codec
, false);
839 static int alc_suspend(struct hda_codec
*codec
)
841 struct alc_spec
*spec
= codec
->spec
;
843 if (spec
&& spec
->power_hook
)
844 spec
->power_hook(codec
);
850 static int alc_resume(struct hda_codec
*codec
)
852 msleep(150); /* to avoid pop noise */
853 codec
->patch_ops
.init(codec
);
854 snd_hda_codec_resume_amp(codec
);
855 snd_hda_codec_resume_cache(codec
);
856 alc_inv_dmic_sync(codec
, true);
857 hda_call_check_power_status(codec
, 0x01);
864 static const struct hda_codec_ops alc_patch_ops
= {
865 .build_controls
= alc_build_controls
,
866 .build_pcms
= snd_hda_gen_build_pcms
,
869 .unsol_event
= snd_hda_jack_unsol_event
,
871 .resume
= alc_resume
,
872 .suspend
= alc_suspend
,
873 .check_power_status
= snd_hda_gen_check_power_status
,
875 .reboot_notify
= alc_shutup
,
879 /* replace the codec chip_name with the given string */
880 static int alc_codec_rename(struct hda_codec
*codec
, const char *name
)
882 kfree(codec
->chip_name
);
883 codec
->chip_name
= kstrdup(name
, GFP_KERNEL
);
884 if (!codec
->chip_name
) {
892 * Rename codecs appropriately from COEF value
894 struct alc_codec_rename_table
{
895 unsigned int vendor_id
;
896 unsigned short coef_mask
;
897 unsigned short coef_bits
;
901 static struct alc_codec_rename_table rename_tbl
[] = {
902 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
903 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
904 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
905 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
906 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
907 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
908 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
909 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
910 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
911 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
912 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
913 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
914 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
915 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
916 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
920 static int alc_codec_rename_from_preset(struct hda_codec
*codec
)
922 const struct alc_codec_rename_table
*p
;
924 for (p
= rename_tbl
; p
->vendor_id
; p
++) {
925 if (p
->vendor_id
!= codec
->vendor_id
)
927 if ((alc_get_coef0(codec
) & p
->coef_mask
) == p
->coef_bits
)
928 return alc_codec_rename(codec
, p
->name
);
935 * Digital-beep handlers
937 #ifdef CONFIG_SND_HDA_INPUT_BEEP
938 #define set_beep_amp(spec, nid, idx, dir) \
939 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
941 static const struct snd_pci_quirk beep_white_list
[] = {
942 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
943 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
944 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
945 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
946 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
947 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
948 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
949 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
950 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
954 static inline int has_cdefine_beep(struct hda_codec
*codec
)
956 struct alc_spec
*spec
= codec
->spec
;
957 const struct snd_pci_quirk
*q
;
958 q
= snd_pci_quirk_lookup(codec
->bus
->pci
, beep_white_list
);
961 return spec
->cdefine
.enable_pcbeep
;
964 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
965 #define has_cdefine_beep(codec) 0
968 /* parse the BIOS configuration and set up the alc_spec */
969 /* return 1 if successful, 0 if the proper config is not found,
970 * or a negative error code
972 static int alc_parse_auto_config(struct hda_codec
*codec
,
973 const hda_nid_t
*ignore_nids
,
974 const hda_nid_t
*ssid_nids
)
976 struct alc_spec
*spec
= codec
->spec
;
977 struct auto_pin_cfg
*cfg
= &spec
->gen
.autocfg
;
980 err
= snd_hda_parse_pin_defcfg(codec
, cfg
, ignore_nids
,
986 alc_ssid_check(codec
, ssid_nids
);
988 err
= snd_hda_gen_parse_auto_config(codec
, cfg
);
995 /* common preparation job for alc_spec */
996 static int alc_alloc_spec(struct hda_codec
*codec
, hda_nid_t mixer_nid
)
998 struct alc_spec
*spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
1004 snd_hda_gen_spec_init(&spec
->gen
);
1005 spec
->gen
.mixer_nid
= mixer_nid
;
1006 spec
->gen
.own_eapd_ctl
= 1;
1007 codec
->single_adc_amp
= 1;
1008 /* FIXME: do we need this for all Realtek codec models? */
1009 codec
->spdif_status_reset
= 1;
1011 err
= alc_codec_rename_from_preset(codec
);
1019 static int alc880_parse_auto_config(struct hda_codec
*codec
)
1021 static const hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
1022 static const hda_nid_t alc880_ssids
[] = { 0x15, 0x1b, 0x14, 0 };
1023 return alc_parse_auto_config(codec
, alc880_ignore
, alc880_ssids
);
1032 ALC880_FIXUP_MEDION_RIM
,
1034 ALC880_FIXUP_LG_LW25
,
1036 ALC880_FIXUP_EAPD_COEF
,
1037 ALC880_FIXUP_TCL_S700
,
1038 ALC880_FIXUP_VOL_KNOB
,
1039 ALC880_FIXUP_FUJITSU
,
1041 ALC880_FIXUP_UNIWILL
,
1042 ALC880_FIXUP_UNIWILL_DIG
,
1044 ALC880_FIXUP_ASUS_W5A
,
1045 ALC880_FIXUP_3ST_BASE
,
1047 ALC880_FIXUP_3ST_DIG
,
1048 ALC880_FIXUP_5ST_BASE
,
1050 ALC880_FIXUP_5ST_DIG
,
1051 ALC880_FIXUP_6ST_BASE
,
1053 ALC880_FIXUP_6ST_DIG
,
1054 ALC880_FIXUP_6ST_AUTOMUTE
,
1057 /* enable the volume-knob widget support on NID 0x21 */
1058 static void alc880_fixup_vol_knob(struct hda_codec
*codec
,
1059 const struct hda_fixup
*fix
, int action
)
1061 if (action
== HDA_FIXUP_ACT_PROBE
)
1062 snd_hda_jack_detect_enable_callback(codec
, 0x21, ALC_DCVOL_EVENT
, alc_update_knob_master
);
1065 static const struct hda_fixup alc880_fixups
[] = {
1066 [ALC880_FIXUP_GPIO1
] = {
1067 .type
= HDA_FIXUP_VERBS
,
1068 .v
.verbs
= alc_gpio1_init_verbs
,
1070 [ALC880_FIXUP_GPIO2
] = {
1071 .type
= HDA_FIXUP_VERBS
,
1072 .v
.verbs
= alc_gpio2_init_verbs
,
1074 [ALC880_FIXUP_MEDION_RIM
] = {
1075 .type
= HDA_FIXUP_VERBS
,
1076 .v
.verbs
= (const struct hda_verb
[]) {
1077 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x07 },
1078 { 0x20, AC_VERB_SET_PROC_COEF
, 0x3060 },
1082 .chain_id
= ALC880_FIXUP_GPIO2
,
1084 [ALC880_FIXUP_LG
] = {
1085 .type
= HDA_FIXUP_PINS
,
1086 .v
.pins
= (const struct hda_pintbl
[]) {
1087 /* disable bogus unused pins */
1088 { 0x16, 0x411111f0 },
1089 { 0x18, 0x411111f0 },
1090 { 0x1a, 0x411111f0 },
1094 [ALC880_FIXUP_LG_LW25
] = {
1095 .type
= HDA_FIXUP_PINS
,
1096 .v
.pins
= (const struct hda_pintbl
[]) {
1097 { 0x1a, 0x0181344f }, /* line-in */
1098 { 0x1b, 0x0321403f }, /* headphone */
1102 [ALC880_FIXUP_W810
] = {
1103 .type
= HDA_FIXUP_PINS
,
1104 .v
.pins
= (const struct hda_pintbl
[]) {
1105 /* disable bogus unused pins */
1106 { 0x17, 0x411111f0 },
1110 .chain_id
= ALC880_FIXUP_GPIO2
,
1112 [ALC880_FIXUP_EAPD_COEF
] = {
1113 .type
= HDA_FIXUP_VERBS
,
1114 .v
.verbs
= (const struct hda_verb
[]) {
1115 /* change to EAPD mode */
1116 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x07 },
1117 { 0x20, AC_VERB_SET_PROC_COEF
, 0x3060 },
1121 [ALC880_FIXUP_TCL_S700
] = {
1122 .type
= HDA_FIXUP_VERBS
,
1123 .v
.verbs
= (const struct hda_verb
[]) {
1124 /* change to EAPD mode */
1125 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x07 },
1126 { 0x20, AC_VERB_SET_PROC_COEF
, 0x3070 },
1130 .chain_id
= ALC880_FIXUP_GPIO2
,
1132 [ALC880_FIXUP_VOL_KNOB
] = {
1133 .type
= HDA_FIXUP_FUNC
,
1134 .v
.func
= alc880_fixup_vol_knob
,
1136 [ALC880_FIXUP_FUJITSU
] = {
1137 /* override all pins as BIOS on old Amilo is broken */
1138 .type
= HDA_FIXUP_PINS
,
1139 .v
.pins
= (const struct hda_pintbl
[]) {
1140 { 0x14, 0x0121401f }, /* HP */
1141 { 0x15, 0x99030120 }, /* speaker */
1142 { 0x16, 0x99030130 }, /* bass speaker */
1143 { 0x17, 0x411111f0 }, /* N/A */
1144 { 0x18, 0x411111f0 }, /* N/A */
1145 { 0x19, 0x01a19950 }, /* mic-in */
1146 { 0x1a, 0x411111f0 }, /* N/A */
1147 { 0x1b, 0x411111f0 }, /* N/A */
1148 { 0x1c, 0x411111f0 }, /* N/A */
1149 { 0x1d, 0x411111f0 }, /* N/A */
1150 { 0x1e, 0x01454140 }, /* SPDIF out */
1154 .chain_id
= ALC880_FIXUP_VOL_KNOB
,
1156 [ALC880_FIXUP_F1734
] = {
1157 /* almost compatible with FUJITSU, but no bass and SPDIF */
1158 .type
= HDA_FIXUP_PINS
,
1159 .v
.pins
= (const struct hda_pintbl
[]) {
1160 { 0x14, 0x0121401f }, /* HP */
1161 { 0x15, 0x99030120 }, /* speaker */
1162 { 0x16, 0x411111f0 }, /* N/A */
1163 { 0x17, 0x411111f0 }, /* N/A */
1164 { 0x18, 0x411111f0 }, /* N/A */
1165 { 0x19, 0x01a19950 }, /* mic-in */
1166 { 0x1a, 0x411111f0 }, /* N/A */
1167 { 0x1b, 0x411111f0 }, /* N/A */
1168 { 0x1c, 0x411111f0 }, /* N/A */
1169 { 0x1d, 0x411111f0 }, /* N/A */
1170 { 0x1e, 0x411111f0 }, /* N/A */
1174 .chain_id
= ALC880_FIXUP_VOL_KNOB
,
1176 [ALC880_FIXUP_UNIWILL
] = {
1177 /* need to fix HP and speaker pins to be parsed correctly */
1178 .type
= HDA_FIXUP_PINS
,
1179 .v
.pins
= (const struct hda_pintbl
[]) {
1180 { 0x14, 0x0121411f }, /* HP */
1181 { 0x15, 0x99030120 }, /* speaker */
1182 { 0x16, 0x99030130 }, /* bass speaker */
1186 [ALC880_FIXUP_UNIWILL_DIG
] = {
1187 .type
= HDA_FIXUP_PINS
,
1188 .v
.pins
= (const struct hda_pintbl
[]) {
1189 /* disable bogus unused pins */
1190 { 0x17, 0x411111f0 },
1191 { 0x19, 0x411111f0 },
1192 { 0x1b, 0x411111f0 },
1193 { 0x1f, 0x411111f0 },
1197 [ALC880_FIXUP_Z71V
] = {
1198 .type
= HDA_FIXUP_PINS
,
1199 .v
.pins
= (const struct hda_pintbl
[]) {
1200 /* set up the whole pins as BIOS is utterly broken */
1201 { 0x14, 0x99030120 }, /* speaker */
1202 { 0x15, 0x0121411f }, /* HP */
1203 { 0x16, 0x411111f0 }, /* N/A */
1204 { 0x17, 0x411111f0 }, /* N/A */
1205 { 0x18, 0x01a19950 }, /* mic-in */
1206 { 0x19, 0x411111f0 }, /* N/A */
1207 { 0x1a, 0x01813031 }, /* line-in */
1208 { 0x1b, 0x411111f0 }, /* N/A */
1209 { 0x1c, 0x411111f0 }, /* N/A */
1210 { 0x1d, 0x411111f0 }, /* N/A */
1211 { 0x1e, 0x0144111e }, /* SPDIF */
1215 [ALC880_FIXUP_ASUS_W5A
] = {
1216 .type
= HDA_FIXUP_PINS
,
1217 .v
.pins
= (const struct hda_pintbl
[]) {
1218 /* set up the whole pins as BIOS is utterly broken */
1219 { 0x14, 0x0121411f }, /* HP */
1220 { 0x15, 0x411111f0 }, /* N/A */
1221 { 0x16, 0x411111f0 }, /* N/A */
1222 { 0x17, 0x411111f0 }, /* N/A */
1223 { 0x18, 0x90a60160 }, /* mic */
1224 { 0x19, 0x411111f0 }, /* N/A */
1225 { 0x1a, 0x411111f0 }, /* N/A */
1226 { 0x1b, 0x411111f0 }, /* N/A */
1227 { 0x1c, 0x411111f0 }, /* N/A */
1228 { 0x1d, 0x411111f0 }, /* N/A */
1229 { 0x1e, 0xb743111e }, /* SPDIF out */
1233 .chain_id
= ALC880_FIXUP_GPIO1
,
1235 [ALC880_FIXUP_3ST_BASE
] = {
1236 .type
= HDA_FIXUP_PINS
,
1237 .v
.pins
= (const struct hda_pintbl
[]) {
1238 { 0x14, 0x01014010 }, /* line-out */
1239 { 0x15, 0x411111f0 }, /* N/A */
1240 { 0x16, 0x411111f0 }, /* N/A */
1241 { 0x17, 0x411111f0 }, /* N/A */
1242 { 0x18, 0x01a19c30 }, /* mic-in */
1243 { 0x19, 0x0121411f }, /* HP */
1244 { 0x1a, 0x01813031 }, /* line-in */
1245 { 0x1b, 0x02a19c40 }, /* front-mic */
1246 { 0x1c, 0x411111f0 }, /* N/A */
1247 { 0x1d, 0x411111f0 }, /* N/A */
1248 /* 0x1e is filled in below */
1249 { 0x1f, 0x411111f0 }, /* N/A */
1253 [ALC880_FIXUP_3ST
] = {
1254 .type
= HDA_FIXUP_PINS
,
1255 .v
.pins
= (const struct hda_pintbl
[]) {
1256 { 0x1e, 0x411111f0 }, /* N/A */
1260 .chain_id
= ALC880_FIXUP_3ST_BASE
,
1262 [ALC880_FIXUP_3ST_DIG
] = {
1263 .type
= HDA_FIXUP_PINS
,
1264 .v
.pins
= (const struct hda_pintbl
[]) {
1265 { 0x1e, 0x0144111e }, /* SPDIF */
1269 .chain_id
= ALC880_FIXUP_3ST_BASE
,
1271 [ALC880_FIXUP_5ST_BASE
] = {
1272 .type
= HDA_FIXUP_PINS
,
1273 .v
.pins
= (const struct hda_pintbl
[]) {
1274 { 0x14, 0x01014010 }, /* front */
1275 { 0x15, 0x411111f0 }, /* N/A */
1276 { 0x16, 0x01011411 }, /* CLFE */
1277 { 0x17, 0x01016412 }, /* surr */
1278 { 0x18, 0x01a19c30 }, /* mic-in */
1279 { 0x19, 0x0121411f }, /* HP */
1280 { 0x1a, 0x01813031 }, /* line-in */
1281 { 0x1b, 0x02a19c40 }, /* front-mic */
1282 { 0x1c, 0x411111f0 }, /* N/A */
1283 { 0x1d, 0x411111f0 }, /* N/A */
1284 /* 0x1e is filled in below */
1285 { 0x1f, 0x411111f0 }, /* N/A */
1289 [ALC880_FIXUP_5ST
] = {
1290 .type
= HDA_FIXUP_PINS
,
1291 .v
.pins
= (const struct hda_pintbl
[]) {
1292 { 0x1e, 0x411111f0 }, /* N/A */
1296 .chain_id
= ALC880_FIXUP_5ST_BASE
,
1298 [ALC880_FIXUP_5ST_DIG
] = {
1299 .type
= HDA_FIXUP_PINS
,
1300 .v
.pins
= (const struct hda_pintbl
[]) {
1301 { 0x1e, 0x0144111e }, /* SPDIF */
1305 .chain_id
= ALC880_FIXUP_5ST_BASE
,
1307 [ALC880_FIXUP_6ST_BASE
] = {
1308 .type
= HDA_FIXUP_PINS
,
1309 .v
.pins
= (const struct hda_pintbl
[]) {
1310 { 0x14, 0x01014010 }, /* front */
1311 { 0x15, 0x01016412 }, /* surr */
1312 { 0x16, 0x01011411 }, /* CLFE */
1313 { 0x17, 0x01012414 }, /* side */
1314 { 0x18, 0x01a19c30 }, /* mic-in */
1315 { 0x19, 0x02a19c40 }, /* front-mic */
1316 { 0x1a, 0x01813031 }, /* line-in */
1317 { 0x1b, 0x0121411f }, /* HP */
1318 { 0x1c, 0x411111f0 }, /* N/A */
1319 { 0x1d, 0x411111f0 }, /* N/A */
1320 /* 0x1e is filled in below */
1321 { 0x1f, 0x411111f0 }, /* N/A */
1325 [ALC880_FIXUP_6ST
] = {
1326 .type
= HDA_FIXUP_PINS
,
1327 .v
.pins
= (const struct hda_pintbl
[]) {
1328 { 0x1e, 0x411111f0 }, /* N/A */
1332 .chain_id
= ALC880_FIXUP_6ST_BASE
,
1334 [ALC880_FIXUP_6ST_DIG
] = {
1335 .type
= HDA_FIXUP_PINS
,
1336 .v
.pins
= (const struct hda_pintbl
[]) {
1337 { 0x1e, 0x0144111e }, /* SPDIF */
1341 .chain_id
= ALC880_FIXUP_6ST_BASE
,
1343 [ALC880_FIXUP_6ST_AUTOMUTE
] = {
1344 .type
= HDA_FIXUP_PINS
,
1345 .v
.pins
= (const struct hda_pintbl
[]) {
1346 { 0x1b, 0x0121401f }, /* HP with jack detect */
1349 .chained_before
= true,
1350 .chain_id
= ALC880_FIXUP_6ST_BASE
,
1354 static const struct snd_pci_quirk alc880_fixup_tbl
[] = {
1355 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810
),
1356 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A
),
1357 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V
),
1358 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1
),
1359 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2
),
1360 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF
),
1361 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG
),
1362 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734
),
1363 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL
),
1364 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB
),
1365 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810
),
1366 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM
),
1367 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE
),
1368 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU
),
1369 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU
),
1370 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734
),
1371 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU
),
1372 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG
),
1373 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG
),
1374 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG
),
1375 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25
),
1376 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700
),
1378 /* Below is the copied entries from alc880_quirks.c.
1379 * It's not quite sure whether BIOS sets the correct pin-config table
1380 * on these machines, thus they are kept to be compatible with
1381 * the old static quirks. Once when it's confirmed to work without
1382 * these overrides, it'd be better to remove.
1384 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG
),
1385 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST
),
1386 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG
),
1387 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG
),
1388 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG
),
1389 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG
),
1390 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG
),
1391 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST
),
1392 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_FIXUP_6ST_DIG
),
1393 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST
),
1394 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST
),
1395 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST
),
1396 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST
),
1397 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST
),
1398 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG
),
1399 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG
),
1400 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG
),
1401 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG
),
1402 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG
),
1403 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG
),
1404 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG
),
1405 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_FIXUP_6ST_DIG
), /* broken BIOS */
1406 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_FIXUP_6ST_DIG
),
1407 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG
),
1408 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG
),
1409 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG
),
1410 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG
),
1411 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG
),
1412 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG
),
1413 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG
),
1414 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG
),
1415 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG
),
1416 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG
),
1418 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST
),
1419 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG
),
1420 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_FIXUP_6ST_DIG
),
1424 static const struct hda_model_fixup alc880_fixup_models
[] = {
1425 {.id
= ALC880_FIXUP_3ST
, .name
= "3stack"},
1426 {.id
= ALC880_FIXUP_3ST_DIG
, .name
= "3stack-digout"},
1427 {.id
= ALC880_FIXUP_5ST
, .name
= "5stack"},
1428 {.id
= ALC880_FIXUP_5ST_DIG
, .name
= "5stack-digout"},
1429 {.id
= ALC880_FIXUP_6ST
, .name
= "6stack"},
1430 {.id
= ALC880_FIXUP_6ST_DIG
, .name
= "6stack-digout"},
1431 {.id
= ALC880_FIXUP_6ST_AUTOMUTE
, .name
= "6stack-automute"},
1437 * OK, here we have finally the patch for ALC880
1439 static int patch_alc880(struct hda_codec
*codec
)
1441 struct alc_spec
*spec
;
1444 err
= alc_alloc_spec(codec
, 0x0b);
1449 spec
->gen
.need_dac_fix
= 1;
1450 spec
->gen
.beep_nid
= 0x01;
1452 snd_hda_pick_fixup(codec
, alc880_fixup_models
, alc880_fixup_tbl
,
1454 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
1456 /* automatic parse from the BIOS config */
1457 err
= alc880_parse_auto_config(codec
);
1461 if (!spec
->gen
.no_analog
)
1462 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
1464 codec
->patch_ops
= alc_patch_ops
;
1465 codec
->patch_ops
.unsol_event
= alc880_unsol_event
;
1468 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
1481 static int alc260_parse_auto_config(struct hda_codec
*codec
)
1483 static const hda_nid_t alc260_ignore
[] = { 0x17, 0 };
1484 static const hda_nid_t alc260_ssids
[] = { 0x10, 0x15, 0x0f, 0 };
1485 return alc_parse_auto_config(codec
, alc260_ignore
, alc260_ssids
);
1492 ALC260_FIXUP_HP_DC5750
,
1493 ALC260_FIXUP_HP_PIN_0F
,
1496 ALC260_FIXUP_GPIO1_TOGGLE
,
1497 ALC260_FIXUP_REPLACER
,
1498 ALC260_FIXUP_HP_B1900
,
1500 ALC260_FIXUP_FSC_S7020
,
1501 ALC260_FIXUP_FSC_S7020_JWSE
,
1502 ALC260_FIXUP_VAIO_PINS
,
1505 static void alc260_gpio1_automute(struct hda_codec
*codec
)
1507 struct alc_spec
*spec
= codec
->spec
;
1508 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
,
1509 spec
->gen
.hp_jack_present
);
1512 static void alc260_fixup_gpio1_toggle(struct hda_codec
*codec
,
1513 const struct hda_fixup
*fix
, int action
)
1515 struct alc_spec
*spec
= codec
->spec
;
1516 if (action
== HDA_FIXUP_ACT_PROBE
) {
1517 /* although the machine has only one output pin, we need to
1518 * toggle GPIO1 according to the jack state
1520 spec
->gen
.automute_hook
= alc260_gpio1_automute
;
1521 spec
->gen
.detect_hp
= 1;
1522 spec
->gen
.automute_speaker
= 1;
1523 spec
->gen
.autocfg
.hp_pins
[0] = 0x0f; /* copy it for automute */
1524 snd_hda_jack_detect_enable_callback(codec
, 0x0f, HDA_GEN_HP_EVENT
,
1525 snd_hda_gen_hp_automute
);
1526 snd_hda_add_verbs(codec
, alc_gpio1_init_verbs
);
1530 static void alc260_fixup_kn1(struct hda_codec
*codec
,
1531 const struct hda_fixup
*fix
, int action
)
1533 struct alc_spec
*spec
= codec
->spec
;
1534 static const struct hda_pintbl pincfgs
[] = {
1535 { 0x0f, 0x02214000 }, /* HP/speaker */
1536 { 0x12, 0x90a60160 }, /* int mic */
1537 { 0x13, 0x02a19000 }, /* ext mic */
1538 { 0x18, 0x01446000 }, /* SPDIF out */
1539 /* disable bogus I/O pins */
1540 { 0x10, 0x411111f0 },
1541 { 0x11, 0x411111f0 },
1542 { 0x14, 0x411111f0 },
1543 { 0x15, 0x411111f0 },
1544 { 0x16, 0x411111f0 },
1545 { 0x17, 0x411111f0 },
1546 { 0x19, 0x411111f0 },
1551 case HDA_FIXUP_ACT_PRE_PROBE
:
1552 snd_hda_apply_pincfgs(codec
, pincfgs
);
1554 case HDA_FIXUP_ACT_PROBE
:
1555 spec
->init_amp
= ALC_INIT_NONE
;
1560 static void alc260_fixup_fsc_s7020(struct hda_codec
*codec
,
1561 const struct hda_fixup
*fix
, int action
)
1563 struct alc_spec
*spec
= codec
->spec
;
1564 if (action
== HDA_FIXUP_ACT_PROBE
)
1565 spec
->init_amp
= ALC_INIT_NONE
;
1568 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec
*codec
,
1569 const struct hda_fixup
*fix
, int action
)
1571 struct alc_spec
*spec
= codec
->spec
;
1572 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
1573 spec
->gen
.add_jack_modes
= 1;
1574 spec
->gen
.hp_mic
= 1;
1578 static const struct hda_fixup alc260_fixups
[] = {
1579 [ALC260_FIXUP_HP_DC5750
] = {
1580 .type
= HDA_FIXUP_PINS
,
1581 .v
.pins
= (const struct hda_pintbl
[]) {
1582 { 0x11, 0x90130110 }, /* speaker */
1586 [ALC260_FIXUP_HP_PIN_0F
] = {
1587 .type
= HDA_FIXUP_PINS
,
1588 .v
.pins
= (const struct hda_pintbl
[]) {
1589 { 0x0f, 0x01214000 }, /* HP */
1593 [ALC260_FIXUP_COEF
] = {
1594 .type
= HDA_FIXUP_VERBS
,
1595 .v
.verbs
= (const struct hda_verb
[]) {
1596 { 0x1a, AC_VERB_SET_COEF_INDEX
, 0x07 },
1597 { 0x1a, AC_VERB_SET_PROC_COEF
, 0x3040 },
1601 [ALC260_FIXUP_GPIO1
] = {
1602 .type
= HDA_FIXUP_VERBS
,
1603 .v
.verbs
= alc_gpio1_init_verbs
,
1605 [ALC260_FIXUP_GPIO1_TOGGLE
] = {
1606 .type
= HDA_FIXUP_FUNC
,
1607 .v
.func
= alc260_fixup_gpio1_toggle
,
1609 .chain_id
= ALC260_FIXUP_HP_PIN_0F
,
1611 [ALC260_FIXUP_REPLACER
] = {
1612 .type
= HDA_FIXUP_VERBS
,
1613 .v
.verbs
= (const struct hda_verb
[]) {
1614 { 0x1a, AC_VERB_SET_COEF_INDEX
, 0x07 },
1615 { 0x1a, AC_VERB_SET_PROC_COEF
, 0x3050 },
1619 .chain_id
= ALC260_FIXUP_GPIO1_TOGGLE
,
1621 [ALC260_FIXUP_HP_B1900
] = {
1622 .type
= HDA_FIXUP_FUNC
,
1623 .v
.func
= alc260_fixup_gpio1_toggle
,
1625 .chain_id
= ALC260_FIXUP_COEF
,
1627 [ALC260_FIXUP_KN1
] = {
1628 .type
= HDA_FIXUP_FUNC
,
1629 .v
.func
= alc260_fixup_kn1
,
1631 [ALC260_FIXUP_FSC_S7020
] = {
1632 .type
= HDA_FIXUP_FUNC
,
1633 .v
.func
= alc260_fixup_fsc_s7020
,
1635 [ALC260_FIXUP_FSC_S7020_JWSE
] = {
1636 .type
= HDA_FIXUP_FUNC
,
1637 .v
.func
= alc260_fixup_fsc_s7020_jwse
,
1639 .chain_id
= ALC260_FIXUP_FSC_S7020
,
1641 [ALC260_FIXUP_VAIO_PINS
] = {
1642 .type
= HDA_FIXUP_PINS
,
1643 .v
.pins
= (const struct hda_pintbl
[]) {
1644 /* Pin configs are missing completely on some VAIOs */
1645 { 0x0f, 0x01211020 },
1646 { 0x10, 0x0001003f },
1647 { 0x11, 0x411111f0 },
1648 { 0x12, 0x01a15930 },
1649 { 0x13, 0x411111f0 },
1650 { 0x14, 0x411111f0 },
1651 { 0x15, 0x411111f0 },
1652 { 0x16, 0x411111f0 },
1653 { 0x17, 0x411111f0 },
1654 { 0x18, 0x411111f0 },
1655 { 0x19, 0x411111f0 },
1661 static const struct snd_pci_quirk alc260_fixup_tbl
[] = {
1662 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1
),
1663 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF
),
1664 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1
),
1665 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750
),
1666 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900
),
1667 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS
),
1668 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F
),
1669 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020
),
1670 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1
),
1671 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1
),
1672 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER
),
1673 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF
),
1677 static const struct hda_model_fixup alc260_fixup_models
[] = {
1678 {.id
= ALC260_FIXUP_GPIO1
, .name
= "gpio1"},
1679 {.id
= ALC260_FIXUP_COEF
, .name
= "coef"},
1680 {.id
= ALC260_FIXUP_FSC_S7020
, .name
= "fujitsu"},
1681 {.id
= ALC260_FIXUP_FSC_S7020_JWSE
, .name
= "fujitsu-jwse"},
1687 static int patch_alc260(struct hda_codec
*codec
)
1689 struct alc_spec
*spec
;
1692 err
= alc_alloc_spec(codec
, 0x07);
1697 /* as quite a few machines require HP amp for speaker outputs,
1698 * it's easier to enable it unconditionally; even if it's unneeded,
1699 * it's almost harmless.
1701 spec
->gen
.prefer_hp_amp
= 1;
1702 spec
->gen
.beep_nid
= 0x01;
1704 snd_hda_pick_fixup(codec
, alc260_fixup_models
, alc260_fixup_tbl
,
1706 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
1708 /* automatic parse from the BIOS config */
1709 err
= alc260_parse_auto_config(codec
);
1713 if (!spec
->gen
.no_analog
)
1714 set_beep_amp(spec
, 0x07, 0x05, HDA_INPUT
);
1716 codec
->patch_ops
= alc_patch_ops
;
1717 spec
->shutup
= alc_eapd_shutup
;
1719 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
1730 * ALC882/883/885/888/889 support
1732 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1733 * configuration. Each pin widget can choose any input DACs and a mixer.
1734 * Each ADC is connected from a mixer of all inputs. This makes possible
1735 * 6-channel independent captures.
1737 * In addition, an independent DAC for the multi-playback (not used in this
1745 ALC882_FIXUP_ABIT_AW9D_MAX
,
1746 ALC882_FIXUP_LENOVO_Y530
,
1747 ALC882_FIXUP_PB_M5210
,
1748 ALC882_FIXUP_ACER_ASPIRE_7736
,
1749 ALC882_FIXUP_ASUS_W90V
,
1751 ALC889_FIXUP_VAIO_TT
,
1752 ALC888_FIXUP_EEE1601
,
1755 ALC883_FIXUP_ACER_EAPD
,
1760 ALC882_FIXUP_ASUS_W2JC
,
1761 ALC882_FIXUP_ACER_ASPIRE_4930G
,
1762 ALC882_FIXUP_ACER_ASPIRE_8930G
,
1763 ALC882_FIXUP_ASPIRE_8930G_VERBS
,
1764 ALC885_FIXUP_MACPRO_GPIO
,
1765 ALC889_FIXUP_DAC_ROUTE
,
1766 ALC889_FIXUP_MBP_VREF
,
1767 ALC889_FIXUP_IMAC91_VREF
,
1768 ALC889_FIXUP_MBA11_VREF
,
1769 ALC889_FIXUP_MBA21_VREF
,
1770 ALC889_FIXUP_MP11_VREF
,
1771 ALC889_FIXUP_MP41_VREF
,
1772 ALC882_FIXUP_INV_DMIC
,
1773 ALC882_FIXUP_NO_PRIMARY_HP
,
1774 ALC887_FIXUP_ASUS_BASS
,
1777 static void alc889_fixup_coef(struct hda_codec
*codec
,
1778 const struct hda_fixup
*fix
, int action
)
1780 if (action
!= HDA_FIXUP_ACT_INIT
)
1782 alc889_coef_init(codec
);
1785 /* toggle speaker-output according to the hp-jack state */
1786 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
1788 unsigned int gpiostate
, gpiomask
, gpiodir
;
1790 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
1791 AC_VERB_GET_GPIO_DATA
, 0);
1794 gpiostate
|= (1 << pin
);
1796 gpiostate
&= ~(1 << pin
);
1798 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
1799 AC_VERB_GET_GPIO_MASK
, 0);
1800 gpiomask
|= (1 << pin
);
1802 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
1803 AC_VERB_GET_GPIO_DIRECTION
, 0);
1804 gpiodir
|= (1 << pin
);
1807 snd_hda_codec_write(codec
, codec
->afg
, 0,
1808 AC_VERB_SET_GPIO_MASK
, gpiomask
);
1809 snd_hda_codec_write(codec
, codec
->afg
, 0,
1810 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
1814 snd_hda_codec_write(codec
, codec
->afg
, 0,
1815 AC_VERB_SET_GPIO_DATA
, gpiostate
);
1818 /* set up GPIO at initialization */
1819 static void alc885_fixup_macpro_gpio(struct hda_codec
*codec
,
1820 const struct hda_fixup
*fix
, int action
)
1822 if (action
!= HDA_FIXUP_ACT_INIT
)
1824 alc882_gpio_mute(codec
, 0, 0);
1825 alc882_gpio_mute(codec
, 1, 0);
1828 /* Fix the connection of some pins for ALC889:
1829 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1830 * work correctly (bko#42740)
1832 static void alc889_fixup_dac_route(struct hda_codec
*codec
,
1833 const struct hda_fixup
*fix
, int action
)
1835 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
1836 /* fake the connections during parsing the tree */
1837 hda_nid_t conn1
[2] = { 0x0c, 0x0d };
1838 hda_nid_t conn2
[2] = { 0x0e, 0x0f };
1839 snd_hda_override_conn_list(codec
, 0x14, 2, conn1
);
1840 snd_hda_override_conn_list(codec
, 0x15, 2, conn1
);
1841 snd_hda_override_conn_list(codec
, 0x18, 2, conn2
);
1842 snd_hda_override_conn_list(codec
, 0x1a, 2, conn2
);
1843 } else if (action
== HDA_FIXUP_ACT_PROBE
) {
1844 /* restore the connections */
1845 hda_nid_t conn
[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1846 snd_hda_override_conn_list(codec
, 0x14, 5, conn
);
1847 snd_hda_override_conn_list(codec
, 0x15, 5, conn
);
1848 snd_hda_override_conn_list(codec
, 0x18, 5, conn
);
1849 snd_hda_override_conn_list(codec
, 0x1a, 5, conn
);
1853 /* Set VREF on HP pin */
1854 static void alc889_fixup_mbp_vref(struct hda_codec
*codec
,
1855 const struct hda_fixup
*fix
, int action
)
1857 struct alc_spec
*spec
= codec
->spec
;
1858 static hda_nid_t nids
[3] = { 0x14, 0x15, 0x19 };
1861 if (action
!= HDA_FIXUP_ACT_INIT
)
1863 for (i
= 0; i
< ARRAY_SIZE(nids
); i
++) {
1864 unsigned int val
= snd_hda_codec_get_pincfg(codec
, nids
[i
]);
1865 if (get_defcfg_device(val
) != AC_JACK_HP_OUT
)
1867 val
= snd_hda_codec_get_pin_target(codec
, nids
[i
]);
1868 val
|= AC_PINCTL_VREF_80
;
1869 snd_hda_set_pin_ctl(codec
, nids
[i
], val
);
1870 spec
->gen
.keep_vref_in_automute
= 1;
1875 static void alc889_fixup_mac_pins(struct hda_codec
*codec
,
1876 const hda_nid_t
*nids
, int num_nids
)
1878 struct alc_spec
*spec
= codec
->spec
;
1881 for (i
= 0; i
< num_nids
; i
++) {
1883 val
= snd_hda_codec_get_pin_target(codec
, nids
[i
]);
1884 val
|= AC_PINCTL_VREF_50
;
1885 snd_hda_set_pin_ctl(codec
, nids
[i
], val
);
1887 spec
->gen
.keep_vref_in_automute
= 1;
1890 /* Set VREF on speaker pins on imac91 */
1891 static void alc889_fixup_imac91_vref(struct hda_codec
*codec
,
1892 const struct hda_fixup
*fix
, int action
)
1894 static hda_nid_t nids
[2] = { 0x18, 0x1a };
1896 if (action
== HDA_FIXUP_ACT_INIT
)
1897 alc889_fixup_mac_pins(codec
, nids
, ARRAY_SIZE(nids
));
1900 /* Set VREF on speaker pins on mba11 */
1901 static void alc889_fixup_mba11_vref(struct hda_codec
*codec
,
1902 const struct hda_fixup
*fix
, int action
)
1904 static hda_nid_t nids
[1] = { 0x18 };
1906 if (action
== HDA_FIXUP_ACT_INIT
)
1907 alc889_fixup_mac_pins(codec
, nids
, ARRAY_SIZE(nids
));
1910 /* Set VREF on speaker pins on mba21 */
1911 static void alc889_fixup_mba21_vref(struct hda_codec
*codec
,
1912 const struct hda_fixup
*fix
, int action
)
1914 static hda_nid_t nids
[2] = { 0x18, 0x19 };
1916 if (action
== HDA_FIXUP_ACT_INIT
)
1917 alc889_fixup_mac_pins(codec
, nids
, ARRAY_SIZE(nids
));
1920 /* Don't take HP output as primary
1921 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1922 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
1924 static void alc882_fixup_no_primary_hp(struct hda_codec
*codec
,
1925 const struct hda_fixup
*fix
, int action
)
1927 struct alc_spec
*spec
= codec
->spec
;
1928 if (action
== HDA_FIXUP_ACT_PRE_PROBE
)
1929 spec
->gen
.no_primary_hp
= 1;
1932 static const struct hda_fixup alc882_fixups
[] = {
1933 [ALC882_FIXUP_ABIT_AW9D_MAX
] = {
1934 .type
= HDA_FIXUP_PINS
,
1935 .v
.pins
= (const struct hda_pintbl
[]) {
1936 { 0x15, 0x01080104 }, /* side */
1937 { 0x16, 0x01011012 }, /* rear */
1938 { 0x17, 0x01016011 }, /* clfe */
1942 [ALC882_FIXUP_LENOVO_Y530
] = {
1943 .type
= HDA_FIXUP_PINS
,
1944 .v
.pins
= (const struct hda_pintbl
[]) {
1945 { 0x15, 0x99130112 }, /* rear int speakers */
1946 { 0x16, 0x99130111 }, /* subwoofer */
1950 [ALC882_FIXUP_PB_M5210
] = {
1951 .type
= HDA_FIXUP_PINCTLS
,
1952 .v
.pins
= (const struct hda_pintbl
[]) {
1953 { 0x19, PIN_VREF50
},
1957 [ALC882_FIXUP_ACER_ASPIRE_7736
] = {
1958 .type
= HDA_FIXUP_FUNC
,
1959 .v
.func
= alc_fixup_sku_ignore
,
1961 [ALC882_FIXUP_ASUS_W90V
] = {
1962 .type
= HDA_FIXUP_PINS
,
1963 .v
.pins
= (const struct hda_pintbl
[]) {
1964 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
1968 [ALC889_FIXUP_CD
] = {
1969 .type
= HDA_FIXUP_PINS
,
1970 .v
.pins
= (const struct hda_pintbl
[]) {
1971 { 0x1c, 0x993301f0 }, /* CD */
1975 [ALC889_FIXUP_VAIO_TT
] = {
1976 .type
= HDA_FIXUP_PINS
,
1977 .v
.pins
= (const struct hda_pintbl
[]) {
1978 { 0x17, 0x90170111 }, /* hidden surround speaker */
1982 [ALC888_FIXUP_EEE1601
] = {
1983 .type
= HDA_FIXUP_VERBS
,
1984 .v
.verbs
= (const struct hda_verb
[]) {
1985 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x0b },
1986 { 0x20, AC_VERB_SET_PROC_COEF
, 0x0838 },
1990 [ALC882_FIXUP_EAPD
] = {
1991 .type
= HDA_FIXUP_VERBS
,
1992 .v
.verbs
= (const struct hda_verb
[]) {
1993 /* change to EAPD mode */
1994 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x07 },
1995 { 0x20, AC_VERB_SET_PROC_COEF
, 0x3060 },
1999 [ALC883_FIXUP_EAPD
] = {
2000 .type
= HDA_FIXUP_VERBS
,
2001 .v
.verbs
= (const struct hda_verb
[]) {
2002 /* change to EAPD mode */
2003 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x07 },
2004 { 0x20, AC_VERB_SET_PROC_COEF
, 0x3070 },
2008 [ALC883_FIXUP_ACER_EAPD
] = {
2009 .type
= HDA_FIXUP_VERBS
,
2010 .v
.verbs
= (const struct hda_verb
[]) {
2011 /* eanable EAPD on Acer laptops */
2012 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x07 },
2013 { 0x20, AC_VERB_SET_PROC_COEF
, 0x3050 },
2017 [ALC882_FIXUP_GPIO1
] = {
2018 .type
= HDA_FIXUP_VERBS
,
2019 .v
.verbs
= alc_gpio1_init_verbs
,
2021 [ALC882_FIXUP_GPIO2
] = {
2022 .type
= HDA_FIXUP_VERBS
,
2023 .v
.verbs
= alc_gpio2_init_verbs
,
2025 [ALC882_FIXUP_GPIO3
] = {
2026 .type
= HDA_FIXUP_VERBS
,
2027 .v
.verbs
= alc_gpio3_init_verbs
,
2029 [ALC882_FIXUP_ASUS_W2JC
] = {
2030 .type
= HDA_FIXUP_VERBS
,
2031 .v
.verbs
= alc_gpio1_init_verbs
,
2033 .chain_id
= ALC882_FIXUP_EAPD
,
2035 [ALC889_FIXUP_COEF
] = {
2036 .type
= HDA_FIXUP_FUNC
,
2037 .v
.func
= alc889_fixup_coef
,
2039 [ALC882_FIXUP_ACER_ASPIRE_4930G
] = {
2040 .type
= HDA_FIXUP_PINS
,
2041 .v
.pins
= (const struct hda_pintbl
[]) {
2042 { 0x16, 0x99130111 }, /* CLFE speaker */
2043 { 0x17, 0x99130112 }, /* surround speaker */
2047 .chain_id
= ALC882_FIXUP_GPIO1
,
2049 [ALC882_FIXUP_ACER_ASPIRE_8930G
] = {
2050 .type
= HDA_FIXUP_PINS
,
2051 .v
.pins
= (const struct hda_pintbl
[]) {
2052 { 0x16, 0x99130111 }, /* CLFE speaker */
2053 { 0x1b, 0x99130112 }, /* surround speaker */
2057 .chain_id
= ALC882_FIXUP_ASPIRE_8930G_VERBS
,
2059 [ALC882_FIXUP_ASPIRE_8930G_VERBS
] = {
2060 /* additional init verbs for Acer Aspire 8930G */
2061 .type
= HDA_FIXUP_VERBS
,
2062 .v
.verbs
= (const struct hda_verb
[]) {
2063 /* Enable all DACs */
2064 /* DAC DISABLE/MUTE 1? */
2065 /* setting bits 1-5 disables DAC nids 0x02-0x06
2066 * apparently. Init=0x38 */
2067 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x03 },
2068 { 0x20, AC_VERB_SET_PROC_COEF
, 0x0000 },
2069 /* DAC DISABLE/MUTE 2? */
2070 /* some bit here disables the other DACs.
2072 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x08 },
2073 { 0x20, AC_VERB_SET_PROC_COEF
, 0x0000 },
2075 * This laptop has a stereo digital microphone.
2076 * The mics are only 1cm apart which makes the stereo
2077 * useless. However, either the mic or the ALC889
2078 * makes the signal become a difference/sum signal
2079 * instead of standard stereo, which is annoying.
2080 * So instead we flip this bit which makes the
2081 * codec replicate the sum signal to both channels,
2082 * turning it into a normal mono mic.
2084 /* DMIC_CONTROL? Init value = 0x0001 */
2085 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x0b },
2086 { 0x20, AC_VERB_SET_PROC_COEF
, 0x0003 },
2087 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x07 },
2088 { 0x20, AC_VERB_SET_PROC_COEF
, 0x3050 },
2092 .chain_id
= ALC882_FIXUP_GPIO1
,
2094 [ALC885_FIXUP_MACPRO_GPIO
] = {
2095 .type
= HDA_FIXUP_FUNC
,
2096 .v
.func
= alc885_fixup_macpro_gpio
,
2098 [ALC889_FIXUP_DAC_ROUTE
] = {
2099 .type
= HDA_FIXUP_FUNC
,
2100 .v
.func
= alc889_fixup_dac_route
,
2102 [ALC889_FIXUP_MBP_VREF
] = {
2103 .type
= HDA_FIXUP_FUNC
,
2104 .v
.func
= alc889_fixup_mbp_vref
,
2106 .chain_id
= ALC882_FIXUP_GPIO1
,
2108 [ALC889_FIXUP_IMAC91_VREF
] = {
2109 .type
= HDA_FIXUP_FUNC
,
2110 .v
.func
= alc889_fixup_imac91_vref
,
2112 .chain_id
= ALC882_FIXUP_GPIO1
,
2114 [ALC889_FIXUP_MBA11_VREF
] = {
2115 .type
= HDA_FIXUP_FUNC
,
2116 .v
.func
= alc889_fixup_mba11_vref
,
2118 .chain_id
= ALC889_FIXUP_MBP_VREF
,
2120 [ALC889_FIXUP_MBA21_VREF
] = {
2121 .type
= HDA_FIXUP_FUNC
,
2122 .v
.func
= alc889_fixup_mba21_vref
,
2124 .chain_id
= ALC889_FIXUP_MBP_VREF
,
2126 [ALC889_FIXUP_MP11_VREF
] = {
2127 .type
= HDA_FIXUP_FUNC
,
2128 .v
.func
= alc889_fixup_mba11_vref
,
2130 .chain_id
= ALC885_FIXUP_MACPRO_GPIO
,
2132 [ALC889_FIXUP_MP41_VREF
] = {
2133 .type
= HDA_FIXUP_FUNC
,
2134 .v
.func
= alc889_fixup_mbp_vref
,
2136 .chain_id
= ALC885_FIXUP_MACPRO_GPIO
,
2138 [ALC882_FIXUP_INV_DMIC
] = {
2139 .type
= HDA_FIXUP_FUNC
,
2140 .v
.func
= alc_fixup_inv_dmic_0x12
,
2142 [ALC882_FIXUP_NO_PRIMARY_HP
] = {
2143 .type
= HDA_FIXUP_FUNC
,
2144 .v
.func
= alc882_fixup_no_primary_hp
,
2146 [ALC887_FIXUP_ASUS_BASS
] = {
2147 .type
= HDA_FIXUP_PINS
,
2148 .v
.pins
= (const struct hda_pintbl
[]) {
2149 {0x16, 0x99130130}, /* bass speaker */
2155 static const struct snd_pci_quirk alc882_fixup_tbl
[] = {
2156 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD
),
2157 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD
),
2158 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD
),
2159 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD
),
2160 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD
),
2161 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD
),
2162 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD
),
2163 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2164 ALC882_FIXUP_ACER_ASPIRE_4930G
),
2165 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2166 ALC882_FIXUP_ACER_ASPIRE_4930G
),
2167 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2168 ALC882_FIXUP_ACER_ASPIRE_8930G
),
2169 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2170 ALC882_FIXUP_ACER_ASPIRE_8930G
),
2171 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2172 ALC882_FIXUP_ACER_ASPIRE_4930G
),
2173 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2174 ALC882_FIXUP_ACER_ASPIRE_4930G
),
2175 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2176 ALC882_FIXUP_ACER_ASPIRE_4930G
),
2177 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210
),
2178 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2179 ALC882_FIXUP_ACER_ASPIRE_4930G
),
2180 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE
),
2181 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G
),
2182 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736
),
2183 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD
),
2184 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V
),
2185 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC
),
2186 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601
),
2187 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS
),
2188 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3
),
2189 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT
),
2190 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP
),
2191 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP
),
2192 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP
),
2194 /* All Apple entries are in codec SSIDs */
2195 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF
),
2196 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF
),
2197 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF
),
2198 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF
),
2199 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO
),
2200 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO
),
2201 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF
),
2202 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF
),
2203 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD
),
2204 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF
),
2205 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF
),
2206 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF
),
2207 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF
),
2208 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO
),
2209 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF
),
2210 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF
),
2211 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF
),
2212 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF
),
2213 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF
),
2214 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF
),
2215 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF
),
2216 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF
),
2218 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD
),
2219 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD
),
2220 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3
),
2221 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3", ALC889_FIXUP_CD
),
2222 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX
),
2223 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD
),
2224 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD
),
2225 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530
),
2226 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF
),
2230 static const struct hda_model_fixup alc882_fixup_models
[] = {
2231 {.id
= ALC882_FIXUP_ACER_ASPIRE_4930G
, .name
= "acer-aspire-4930g"},
2232 {.id
= ALC882_FIXUP_ACER_ASPIRE_8930G
, .name
= "acer-aspire-8930g"},
2233 {.id
= ALC883_FIXUP_ACER_EAPD
, .name
= "acer-aspire"},
2234 {.id
= ALC882_FIXUP_INV_DMIC
, .name
= "inv-dmic"},
2235 {.id
= ALC882_FIXUP_NO_PRIMARY_HP
, .name
= "no-primary-hp"},
2240 * BIOS auto configuration
2242 /* almost identical with ALC880 parser... */
2243 static int alc882_parse_auto_config(struct hda_codec
*codec
)
2245 static const hda_nid_t alc882_ignore
[] = { 0x1d, 0 };
2246 static const hda_nid_t alc882_ssids
[] = { 0x15, 0x1b, 0x14, 0 };
2247 return alc_parse_auto_config(codec
, alc882_ignore
, alc882_ssids
);
2252 static int patch_alc882(struct hda_codec
*codec
)
2254 struct alc_spec
*spec
;
2257 err
= alc_alloc_spec(codec
, 0x0b);
2263 switch (codec
->vendor_id
) {
2269 /* ALC883 and variants */
2270 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
2274 snd_hda_pick_fixup(codec
, alc882_fixup_models
, alc882_fixup_tbl
,
2276 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
2278 alc_auto_parse_customize_define(codec
);
2280 if (has_cdefine_beep(codec
))
2281 spec
->gen
.beep_nid
= 0x01;
2283 /* automatic parse from the BIOS config */
2284 err
= alc882_parse_auto_config(codec
);
2288 if (!spec
->gen
.no_analog
&& spec
->gen
.beep_nid
)
2289 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
2291 codec
->patch_ops
= alc_patch_ops
;
2293 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
2306 static int alc262_parse_auto_config(struct hda_codec
*codec
)
2308 static const hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
2309 static const hda_nid_t alc262_ssids
[] = { 0x15, 0x1b, 0x14, 0 };
2310 return alc_parse_auto_config(codec
, alc262_ignore
, alc262_ssids
);
2317 ALC262_FIXUP_FSC_H270
,
2318 ALC262_FIXUP_FSC_S7110
,
2319 ALC262_FIXUP_HP_Z200
,
2321 ALC262_FIXUP_LENOVO_3000
,
2323 ALC262_FIXUP_BENQ_T31
,
2324 ALC262_FIXUP_INV_DMIC
,
2327 static const struct hda_fixup alc262_fixups
[] = {
2328 [ALC262_FIXUP_FSC_H270
] = {
2329 .type
= HDA_FIXUP_PINS
,
2330 .v
.pins
= (const struct hda_pintbl
[]) {
2331 { 0x14, 0x99130110 }, /* speaker */
2332 { 0x15, 0x0221142f }, /* front HP */
2333 { 0x1b, 0x0121141f }, /* rear HP */
2337 [ALC262_FIXUP_FSC_S7110
] = {
2338 .type
= HDA_FIXUP_PINS
,
2339 .v
.pins
= (const struct hda_pintbl
[]) {
2340 { 0x15, 0x90170110 }, /* speaker */
2344 .chain_id
= ALC262_FIXUP_BENQ
,
2346 [ALC262_FIXUP_HP_Z200
] = {
2347 .type
= HDA_FIXUP_PINS
,
2348 .v
.pins
= (const struct hda_pintbl
[]) {
2349 { 0x16, 0x99130120 }, /* internal speaker */
2353 [ALC262_FIXUP_TYAN
] = {
2354 .type
= HDA_FIXUP_PINS
,
2355 .v
.pins
= (const struct hda_pintbl
[]) {
2356 { 0x14, 0x1993e1f0 }, /* int AUX */
2360 [ALC262_FIXUP_LENOVO_3000
] = {
2361 .type
= HDA_FIXUP_PINCTLS
,
2362 .v
.pins
= (const struct hda_pintbl
[]) {
2363 { 0x19, PIN_VREF50
},
2367 .chain_id
= ALC262_FIXUP_BENQ
,
2369 [ALC262_FIXUP_BENQ
] = {
2370 .type
= HDA_FIXUP_VERBS
,
2371 .v
.verbs
= (const struct hda_verb
[]) {
2372 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x07 },
2373 { 0x20, AC_VERB_SET_PROC_COEF
, 0x3070 },
2377 [ALC262_FIXUP_BENQ_T31
] = {
2378 .type
= HDA_FIXUP_VERBS
,
2379 .v
.verbs
= (const struct hda_verb
[]) {
2380 { 0x20, AC_VERB_SET_COEF_INDEX
, 0x07 },
2381 { 0x20, AC_VERB_SET_PROC_COEF
, 0x3050 },
2385 [ALC262_FIXUP_INV_DMIC
] = {
2386 .type
= HDA_FIXUP_FUNC
,
2387 .v
.func
= alc_fixup_inv_dmic_0x12
,
2391 static const struct snd_pci_quirk alc262_fixup_tbl
[] = {
2392 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200
),
2393 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110
),
2394 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ
),
2395 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN
),
2396 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270
),
2397 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000
),
2398 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ
),
2399 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31
),
2403 static const struct hda_model_fixup alc262_fixup_models
[] = {
2404 {.id
= ALC262_FIXUP_INV_DMIC
, .name
= "inv-dmic"},
2410 static int patch_alc262(struct hda_codec
*codec
)
2412 struct alc_spec
*spec
;
2415 err
= alc_alloc_spec(codec
, 0x0b);
2420 spec
->gen
.shared_mic_vref_pin
= 0x18;
2423 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2428 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
2429 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
2430 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
2431 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
2434 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
2436 snd_hda_pick_fixup(codec
, alc262_fixup_models
, alc262_fixup_tbl
,
2438 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
2440 alc_auto_parse_customize_define(codec
);
2442 if (has_cdefine_beep(codec
))
2443 spec
->gen
.beep_nid
= 0x01;
2445 /* automatic parse from the BIOS config */
2446 err
= alc262_parse_auto_config(codec
);
2450 if (!spec
->gen
.no_analog
&& spec
->gen
.beep_nid
)
2451 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
2453 codec
->patch_ops
= alc_patch_ops
;
2454 spec
->shutup
= alc_eapd_shutup
;
2456 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
2468 /* bind Beep switches of both NID 0x0f and 0x10 */
2469 static const struct hda_bind_ctls alc268_bind_beep_sw
= {
2470 .ops
= &snd_hda_bind_sw
,
2472 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
2473 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
2478 static const struct snd_kcontrol_new alc268_beep_mixer
[] = {
2479 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
2480 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
2484 /* set PCBEEP vol = 0, mute connections */
2485 static const struct hda_verb alc268_beep_init_verbs
[] = {
2486 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2487 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2488 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2493 ALC268_FIXUP_INV_DMIC
,
2494 ALC268_FIXUP_HP_EAPD
,
2498 static const struct hda_fixup alc268_fixups
[] = {
2499 [ALC268_FIXUP_INV_DMIC
] = {
2500 .type
= HDA_FIXUP_FUNC
,
2501 .v
.func
= alc_fixup_inv_dmic_0x12
,
2503 [ALC268_FIXUP_HP_EAPD
] = {
2504 .type
= HDA_FIXUP_VERBS
,
2505 .v
.verbs
= (const struct hda_verb
[]) {
2506 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 0},
2510 [ALC268_FIXUP_SPDIF
] = {
2511 .type
= HDA_FIXUP_PINS
,
2512 .v
.pins
= (const struct hda_pintbl
[]) {
2513 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2519 static const struct hda_model_fixup alc268_fixup_models
[] = {
2520 {.id
= ALC268_FIXUP_INV_DMIC
, .name
= "inv-dmic"},
2521 {.id
= ALC268_FIXUP_HP_EAPD
, .name
= "hp-eapd"},
2525 static const struct snd_pci_quirk alc268_fixup_tbl
[] = {
2526 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF
),
2527 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC
),
2528 /* below is codec SSID since multiple Toshiba laptops have the
2529 * same PCI SSID 1179:ff00
2531 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD
),
2536 * BIOS auto configuration
2538 static int alc268_parse_auto_config(struct hda_codec
*codec
)
2540 static const hda_nid_t alc268_ssids
[] = { 0x15, 0x1b, 0x14, 0 };
2541 return alc_parse_auto_config(codec
, NULL
, alc268_ssids
);
2546 static int patch_alc268(struct hda_codec
*codec
)
2548 struct alc_spec
*spec
;
2551 /* ALC268 has no aa-loopback mixer */
2552 err
= alc_alloc_spec(codec
, 0);
2557 spec
->gen
.beep_nid
= 0x01;
2559 snd_hda_pick_fixup(codec
, alc268_fixup_models
, alc268_fixup_tbl
, alc268_fixups
);
2560 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
2562 /* automatic parse from the BIOS config */
2563 err
= alc268_parse_auto_config(codec
);
2567 if (err
> 0 && !spec
->gen
.no_analog
&&
2568 spec
->gen
.autocfg
.speaker_pins
[0] != 0x1d) {
2569 add_mixer(spec
, alc268_beep_mixer
);
2570 snd_hda_add_verbs(codec
, alc268_beep_init_verbs
);
2571 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
2572 /* override the amp caps for beep generator */
2573 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
2574 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
2575 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
2576 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
2577 (0 << AC_AMPCAP_MUTE_SHIFT
));
2580 codec
->patch_ops
= alc_patch_ops
;
2581 spec
->shutup
= alc_eapd_shutup
;
2583 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
2596 static int playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2597 struct hda_codec
*codec
,
2598 struct snd_pcm_substream
*substream
)
2600 struct hda_gen_spec
*spec
= codec
->spec
;
2601 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2605 static int playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2606 struct hda_codec
*codec
,
2607 unsigned int stream_tag
,
2608 unsigned int format
,
2609 struct snd_pcm_substream
*substream
)
2611 struct hda_gen_spec
*spec
= codec
->spec
;
2612 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
2613 stream_tag
, format
, substream
);
2616 static int playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2617 struct hda_codec
*codec
,
2618 struct snd_pcm_substream
*substream
)
2620 struct hda_gen_spec
*spec
= codec
->spec
;
2621 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2624 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback
= {
2628 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
2629 /* NID is set in alc_build_pcms */
2631 .open
= playback_pcm_open
,
2632 .prepare
= playback_pcm_prepare
,
2633 .cleanup
= playback_pcm_cleanup
2637 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture
= {
2641 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
2642 /* NID is set in alc_build_pcms */
2645 /* different alc269-variants */
2647 ALC269_TYPE_ALC269VA
,
2648 ALC269_TYPE_ALC269VB
,
2649 ALC269_TYPE_ALC269VC
,
2650 ALC269_TYPE_ALC269VD
,
2659 * BIOS auto configuration
2661 static int alc269_parse_auto_config(struct hda_codec
*codec
)
2663 static const hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
2664 static const hda_nid_t alc269_ssids
[] = { 0, 0x1b, 0x14, 0x21 };
2665 static const hda_nid_t alc269va_ssids
[] = { 0x15, 0x1b, 0x14, 0 };
2666 struct alc_spec
*spec
= codec
->spec
;
2667 const hda_nid_t
*ssids
;
2669 switch (spec
->codec_variant
) {
2670 case ALC269_TYPE_ALC269VA
:
2671 case ALC269_TYPE_ALC269VC
:
2672 case ALC269_TYPE_ALC280
:
2673 case ALC269_TYPE_ALC284
:
2674 ssids
= alc269va_ssids
;
2676 case ALC269_TYPE_ALC269VB
:
2677 case ALC269_TYPE_ALC269VD
:
2678 case ALC269_TYPE_ALC282
:
2679 case ALC269_TYPE_ALC286
:
2680 case ALC269_TYPE_ALC255
:
2681 ssids
= alc269_ssids
;
2684 ssids
= alc269_ssids
;
2688 return alc_parse_auto_config(codec
, alc269_ignore
, ssids
);
2691 static void alc269vb_toggle_power_output(struct hda_codec
*codec
, int power_up
)
2693 int val
= alc_read_coef_idx(codec
, 0x04);
2700 alc_write_coef_idx(codec
, 0x04, val
);
2703 static void alc269_shutup(struct hda_codec
*codec
)
2705 struct alc_spec
*spec
= codec
->spec
;
2707 if (spec
->codec_variant
!= ALC269_TYPE_ALC269VB
)
2710 if (spec
->codec_variant
== ALC269_TYPE_ALC269VB
)
2711 alc269vb_toggle_power_output(codec
, 0);
2712 if (spec
->codec_variant
== ALC269_TYPE_ALC269VB
&&
2713 (alc_get_coef0(codec
) & 0x00ff) == 0x018) {
2719 static int alc269_resume(struct hda_codec
*codec
)
2721 struct alc_spec
*spec
= codec
->spec
;
2723 if (spec
->codec_variant
== ALC269_TYPE_ALC269VB
)
2724 alc269vb_toggle_power_output(codec
, 0);
2725 if (spec
->codec_variant
== ALC269_TYPE_ALC269VB
&&
2726 (alc_get_coef0(codec
) & 0x00ff) == 0x018) {
2730 codec
->patch_ops
.init(codec
);
2732 if (spec
->codec_variant
== ALC269_TYPE_ALC269VB
)
2733 alc269vb_toggle_power_output(codec
, 1);
2734 if (spec
->codec_variant
== ALC269_TYPE_ALC269VB
&&
2735 (alc_get_coef0(codec
) & 0x00ff) == 0x017) {
2739 snd_hda_codec_resume_amp(codec
);
2740 snd_hda_codec_resume_cache(codec
);
2741 hda_call_check_power_status(codec
, 0x01);
2744 #endif /* CONFIG_PM */
2746 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec
*codec
,
2747 const struct hda_fixup
*fix
, int action
)
2749 struct alc_spec
*spec
= codec
->spec
;
2751 if (action
== HDA_FIXUP_ACT_PRE_PROBE
)
2752 spec
->parse_flags
= HDA_PINCFG_NO_HP_FIXUP
;
2755 static void alc269_fixup_hweq(struct hda_codec
*codec
,
2756 const struct hda_fixup
*fix
, int action
)
2760 if (action
!= HDA_FIXUP_ACT_INIT
)
2762 coef
= alc_read_coef_idx(codec
, 0x1e);
2763 alc_write_coef_idx(codec
, 0x1e, coef
| 0x80);
2766 static void alc271_fixup_dmic(struct hda_codec
*codec
,
2767 const struct hda_fixup
*fix
, int action
)
2769 static const struct hda_verb verbs
[] = {
2770 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0d},
2771 {0x20, AC_VERB_SET_PROC_COEF
, 0x4000},
2776 if (strcmp(codec
->chip_name
, "ALC271X") &&
2777 strcmp(codec
->chip_name
, "ALC269VB"))
2779 cfg
= snd_hda_codec_get_pincfg(codec
, 0x12);
2780 if (get_defcfg_connect(cfg
) == AC_JACK_PORT_FIXED
)
2781 snd_hda_sequence_write(codec
, verbs
);
2784 static void alc269_fixup_pcm_44k(struct hda_codec
*codec
,
2785 const struct hda_fixup
*fix
, int action
)
2787 struct alc_spec
*spec
= codec
->spec
;
2789 if (action
!= HDA_FIXUP_ACT_PROBE
)
2792 /* Due to a hardware problem on Lenovo Ideadpad, we need to
2793 * fix the sample rate of analog I/O to 44.1kHz
2795 spec
->gen
.stream_analog_playback
= &alc269_44k_pcm_analog_playback
;
2796 spec
->gen
.stream_analog_capture
= &alc269_44k_pcm_analog_capture
;
2799 static void alc269_fixup_stereo_dmic(struct hda_codec
*codec
,
2800 const struct hda_fixup
*fix
, int action
)
2804 if (action
!= HDA_FIXUP_ACT_INIT
)
2806 /* The digital-mic unit sends PDM (differential signal) instead of
2807 * the standard PCM, thus you can't record a valid mono stream as is.
2808 * Below is a workaround specific to ALC269 to control the dmic
2809 * signal source as mono.
2811 coef
= alc_read_coef_idx(codec
, 0x07);
2812 alc_write_coef_idx(codec
, 0x07, coef
| 0x80);
2815 static void alc269_quanta_automute(struct hda_codec
*codec
)
2817 snd_hda_gen_update_outputs(codec
);
2819 snd_hda_codec_write(codec
, 0x20, 0,
2820 AC_VERB_SET_COEF_INDEX
, 0x0c);
2821 snd_hda_codec_write(codec
, 0x20, 0,
2822 AC_VERB_SET_PROC_COEF
, 0x680);
2824 snd_hda_codec_write(codec
, 0x20, 0,
2825 AC_VERB_SET_COEF_INDEX
, 0x0c);
2826 snd_hda_codec_write(codec
, 0x20, 0,
2827 AC_VERB_SET_PROC_COEF
, 0x480);
2830 static void alc269_fixup_quanta_mute(struct hda_codec
*codec
,
2831 const struct hda_fixup
*fix
, int action
)
2833 struct alc_spec
*spec
= codec
->spec
;
2834 if (action
!= HDA_FIXUP_ACT_PROBE
)
2836 spec
->gen
.automute_hook
= alc269_quanta_automute
;
2839 static void alc269_x101_hp_automute_hook(struct hda_codec
*codec
,
2840 struct hda_jack_tbl
*jack
)
2842 struct alc_spec
*spec
= codec
->spec
;
2845 snd_hda_gen_hp_automute(codec
, jack
);
2847 vref
= spec
->gen
.hp_jack_present
? PIN_VREF80
: 0;
2849 snd_hda_codec_write(codec
, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
2852 snd_hda_codec_write(codec
, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
2856 static void alc269_fixup_x101_headset_mic(struct hda_codec
*codec
,
2857 const struct hda_fixup
*fix
, int action
)
2859 struct alc_spec
*spec
= codec
->spec
;
2860 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
2861 spec
->parse_flags
|= HDA_PINCFG_HEADSET_MIC
;
2862 spec
->gen
.hp_automute_hook
= alc269_x101_hp_automute_hook
;
2867 /* update mute-LED according to the speaker mute state via mic VREF pin */
2868 static void alc269_fixup_mic_mute_hook(void *private_data
, int enabled
)
2870 struct hda_codec
*codec
= private_data
;
2871 struct alc_spec
*spec
= codec
->spec
;
2872 unsigned int pinval
;
2874 if (spec
->mute_led_polarity
)
2876 pinval
= snd_hda_codec_get_pin_target(codec
, spec
->mute_led_nid
);
2877 pinval
&= ~AC_PINCTL_VREFEN
;
2878 pinval
|= enabled
? AC_PINCTL_VREF_HIZ
: AC_PINCTL_VREF_80
;
2879 if (spec
->mute_led_nid
)
2880 snd_hda_set_pin_ctl_cache(codec
, spec
->mute_led_nid
, pinval
);
2883 /* Make sure the led works even in runtime suspend */
2884 static unsigned int led_power_filter(struct hda_codec
*codec
,
2886 unsigned int power_state
)
2888 struct alc_spec
*spec
= codec
->spec
;
2890 if (power_state
!= AC_PWRST_D3
|| nid
!= spec
->mute_led_nid
)
2893 /* Set pin ctl again, it might have just been set to 0 */
2894 snd_hda_set_pin_ctl(codec
, nid
,
2895 snd_hda_codec_get_pin_target(codec
, nid
));
2900 static void alc269_fixup_hp_mute_led(struct hda_codec
*codec
,
2901 const struct hda_fixup
*fix
, int action
)
2903 struct alc_spec
*spec
= codec
->spec
;
2904 const struct dmi_device
*dev
= NULL
;
2906 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
2909 while ((dev
= dmi_find_device(DMI_DEV_TYPE_OEM_STRING
, NULL
, dev
))) {
2911 if (sscanf(dev
->name
, "HP_Mute_LED_%d_%x", &pol
, &pin
) != 2)
2913 if (pin
< 0x0a || pin
>= 0x10)
2915 spec
->mute_led_polarity
= pol
;
2916 spec
->mute_led_nid
= pin
- 0x0a + 0x18;
2917 spec
->gen
.vmaster_mute
.hook
= alc269_fixup_mic_mute_hook
;
2918 spec
->gen
.vmaster_mute_enum
= 1;
2919 codec
->power_filter
= led_power_filter
;
2920 snd_printd("Detected mute LED for %x:%d\n", spec
->mute_led_nid
,
2921 spec
->mute_led_polarity
);
2926 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec
*codec
,
2927 const struct hda_fixup
*fix
, int action
)
2929 struct alc_spec
*spec
= codec
->spec
;
2930 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
2931 spec
->mute_led_polarity
= 0;
2932 spec
->mute_led_nid
= 0x18;
2933 spec
->gen
.vmaster_mute
.hook
= alc269_fixup_mic_mute_hook
;
2934 spec
->gen
.vmaster_mute_enum
= 1;
2935 codec
->power_filter
= led_power_filter
;
2939 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec
*codec
,
2940 const struct hda_fixup
*fix
, int action
)
2942 struct alc_spec
*spec
= codec
->spec
;
2943 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
2944 spec
->mute_led_polarity
= 0;
2945 spec
->mute_led_nid
= 0x19;
2946 spec
->gen
.vmaster_mute
.hook
= alc269_fixup_mic_mute_hook
;
2947 spec
->gen
.vmaster_mute_enum
= 1;
2948 codec
->power_filter
= led_power_filter
;
2952 /* turn on/off mute LED per vmaster hook */
2953 static void alc269_fixup_hp_gpio_mute_hook(void *private_data
, int enabled
)
2955 struct hda_codec
*codec
= private_data
;
2956 struct alc_spec
*spec
= codec
->spec
;
2957 unsigned int oldval
= spec
->gpio_led
;
2960 spec
->gpio_led
&= ~0x08;
2962 spec
->gpio_led
|= 0x08;
2963 if (spec
->gpio_led
!= oldval
)
2964 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
,
2968 /* turn on/off mic-mute LED per capture hook */
2969 static void alc269_fixup_hp_gpio_mic_mute_hook(struct hda_codec
*codec
,
2970 struct snd_ctl_elem_value
*ucontrol
)
2972 struct alc_spec
*spec
= codec
->spec
;
2973 unsigned int oldval
= spec
->gpio_led
;
2978 if (ucontrol
->value
.integer
.value
[0] ||
2979 ucontrol
->value
.integer
.value
[1])
2980 spec
->gpio_led
&= ~0x10;
2982 spec
->gpio_led
|= 0x10;
2983 if (spec
->gpio_led
!= oldval
)
2984 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
,
2988 static void alc269_fixup_hp_gpio_led(struct hda_codec
*codec
,
2989 const struct hda_fixup
*fix
, int action
)
2991 struct alc_spec
*spec
= codec
->spec
;
2992 static const struct hda_verb gpio_init
[] = {
2993 { 0x01, AC_VERB_SET_GPIO_MASK
, 0x18 },
2994 { 0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x18 },
2998 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
2999 spec
->gen
.vmaster_mute
.hook
= alc269_fixup_hp_gpio_mute_hook
;
3000 spec
->gen
.cap_sync_hook
= alc269_fixup_hp_gpio_mic_mute_hook
;
3002 snd_hda_add_verbs(codec
, gpio_init
);
3006 static void alc_headset_mode_unplugged(struct hda_codec
*codec
)
3010 switch (codec
->vendor_id
) {
3012 alc_write_coef_idx(codec
, 0x1b, 0x0c0b);
3013 alc_write_coef_idx(codec
, 0x45, 0xc429);
3014 val
= alc_read_coef_idx(codec
, 0x35);
3015 alc_write_coef_idx(codec
, 0x35, val
& 0xbfff);
3016 alc_write_coef_idx(codec
, 0x06, 0x2104);
3017 alc_write_coef_idx(codec
, 0x1a, 0x0001);
3018 alc_write_coef_idx(codec
, 0x26, 0x0004);
3019 alc_write_coef_idx(codec
, 0x32, 0x42a3);
3022 alc_write_coef_idx(codec
, 0x76, 0x000e);
3023 alc_write_coef_idx(codec
, 0x6c, 0x2400);
3024 alc_write_coef_idx(codec
, 0x18, 0x7308);
3025 alc_write_coef_idx(codec
, 0x6b, 0xc429);
3028 alc_write_coef_idx(codec
, 0x15, 0x0d40);
3029 alc_write_coef_idx(codec
, 0xb7, 0x802b);
3032 snd_printdd("Headset jack set to unplugged mode.\n");
3036 static void alc_headset_mode_mic_in(struct hda_codec
*codec
, hda_nid_t hp_pin
,
3041 switch (codec
->vendor_id
) {
3043 alc_write_coef_idx(codec
, 0x45, 0xc429);
3044 snd_hda_set_pin_ctl_cache(codec
, hp_pin
, 0);
3045 val
= alc_read_coef_idx(codec
, 0x35);
3046 alc_write_coef_idx(codec
, 0x35, val
| 1<<14);
3047 alc_write_coef_idx(codec
, 0x06, 0x2100);
3048 alc_write_coef_idx(codec
, 0x1a, 0x0021);
3049 alc_write_coef_idx(codec
, 0x26, 0x008c);
3050 snd_hda_set_pin_ctl_cache(codec
, mic_pin
, PIN_VREF50
);
3053 snd_hda_set_pin_ctl_cache(codec
, hp_pin
, 0);
3054 alc_write_coef_idx(codec
, 0x19, 0xa208);
3055 alc_write_coef_idx(codec
, 0x2e, 0xacf0);
3058 alc_write_coef_idx(codec
, 0x11, 0x0001);
3059 snd_hda_set_pin_ctl_cache(codec
, hp_pin
, 0);
3060 alc_write_coef_idx(codec
, 0xb7, 0x802b);
3061 alc_write_coef_idx(codec
, 0xb5, 0x1040);
3062 val
= alc_read_coef_idx(codec
, 0xc3);
3063 alc_write_coef_idx(codec
, 0xc3, val
| 1<<12);
3064 snd_hda_set_pin_ctl_cache(codec
, mic_pin
, PIN_VREF50
);
3067 snd_printdd("Headset jack set to mic-in mode.\n");
3070 static void alc_headset_mode_default(struct hda_codec
*codec
)
3072 switch (codec
->vendor_id
) {
3074 alc_write_coef_idx(codec
, 0x06, 0x2100);
3075 alc_write_coef_idx(codec
, 0x32, 0x4ea3);
3078 alc_write_coef_idx(codec
, 0x76, 0x000e);
3079 alc_write_coef_idx(codec
, 0x6c, 0x2400);
3080 alc_write_coef_idx(codec
, 0x6b, 0xc429);
3081 alc_write_coef_idx(codec
, 0x18, 0x7308);
3084 alc_write_coef_idx(codec
, 0x11, 0x0041);
3085 alc_write_coef_idx(codec
, 0x15, 0x0d40);
3086 alc_write_coef_idx(codec
, 0xb7, 0x802b);
3089 snd_printdd("Headset jack set to headphone (default) mode.\n");
3093 static void alc_headset_mode_ctia(struct hda_codec
*codec
)
3095 switch (codec
->vendor_id
) {
3097 alc_write_coef_idx(codec
, 0x45, 0xd429);
3098 alc_write_coef_idx(codec
, 0x1b, 0x0c2b);
3099 alc_write_coef_idx(codec
, 0x32, 0x4ea3);
3102 alc_write_coef_idx(codec
, 0x6b, 0xd429);
3103 alc_write_coef_idx(codec
, 0x76, 0x0008);
3104 alc_write_coef_idx(codec
, 0x18, 0x7388);
3107 alc_write_coef_idx(codec
, 0x11, 0x0001);
3108 alc_write_coef_idx(codec
, 0x15, 0x0d60);
3109 alc_write_coef_idx(codec
, 0xc3, 0x0000);
3112 snd_printdd("Headset jack set to iPhone-style headset mode.\n");
3116 static void alc_headset_mode_omtp(struct hda_codec
*codec
)
3118 switch (codec
->vendor_id
) {
3120 alc_write_coef_idx(codec
, 0x45, 0xe429);
3121 alc_write_coef_idx(codec
, 0x1b, 0x0c2b);
3122 alc_write_coef_idx(codec
, 0x32, 0x4ea3);
3125 alc_write_coef_idx(codec
, 0x6b, 0xe429);
3126 alc_write_coef_idx(codec
, 0x76, 0x0008);
3127 alc_write_coef_idx(codec
, 0x18, 0x7388);
3130 alc_write_coef_idx(codec
, 0x11, 0x0001);
3131 alc_write_coef_idx(codec
, 0x15, 0x0d50);
3132 alc_write_coef_idx(codec
, 0xc3, 0x0000);
3135 snd_printdd("Headset jack set to Nokia-style headset mode.\n");
3138 static void alc_determine_headset_type(struct hda_codec
*codec
)
3141 bool is_ctia
= false;
3142 struct alc_spec
*spec
= codec
->spec
;
3144 switch (codec
->vendor_id
) {
3146 alc_write_coef_idx(codec
, 0x45, 0xd029);
3148 val
= alc_read_coef_idx(codec
, 0x46);
3149 is_ctia
= (val
& 0x0070) == 0x0070;
3152 alc_write_coef_idx(codec
, 0x6b, 0xd429);
3154 val
= alc_read_coef_idx(codec
, 0x6c);
3155 is_ctia
= (val
& 0x001c) == 0x001c;
3158 alc_write_coef_idx(codec
, 0x11, 0x0001);
3159 alc_write_coef_idx(codec
, 0xb7, 0x802b);
3160 alc_write_coef_idx(codec
, 0x15, 0x0d60);
3161 alc_write_coef_idx(codec
, 0xc3, 0x0c00);
3163 val
= alc_read_coef_idx(codec
, 0xbe);
3164 is_ctia
= (val
& 0x1c02) == 0x1c02;
3168 snd_printdd("Headset jack detected iPhone-style headset: %s\n",
3169 is_ctia
? "yes" : "no");
3170 spec
->current_headset_type
= is_ctia
? ALC_HEADSET_TYPE_CTIA
: ALC_HEADSET_TYPE_OMTP
;
3173 static void alc_update_headset_mode(struct hda_codec
*codec
)
3175 struct alc_spec
*spec
= codec
->spec
;
3177 hda_nid_t mux_pin
= spec
->gen
.imux_pins
[spec
->gen
.cur_mux
[0]];
3178 hda_nid_t hp_pin
= spec
->gen
.autocfg
.hp_pins
[0];
3180 int new_headset_mode
;
3182 if (!snd_hda_jack_detect(codec
, hp_pin
))
3183 new_headset_mode
= ALC_HEADSET_MODE_UNPLUGGED
;
3184 else if (mux_pin
== spec
->headset_mic_pin
)
3185 new_headset_mode
= ALC_HEADSET_MODE_HEADSET
;
3186 else if (mux_pin
== spec
->headphone_mic_pin
)
3187 new_headset_mode
= ALC_HEADSET_MODE_MIC
;
3189 new_headset_mode
= ALC_HEADSET_MODE_HEADPHONE
;
3191 if (new_headset_mode
== spec
->current_headset_mode
) {
3192 snd_hda_gen_update_outputs(codec
);
3196 switch (new_headset_mode
) {
3197 case ALC_HEADSET_MODE_UNPLUGGED
:
3198 alc_headset_mode_unplugged(codec
);
3199 spec
->gen
.hp_jack_present
= false;
3201 case ALC_HEADSET_MODE_HEADSET
:
3202 if (spec
->current_headset_type
== ALC_HEADSET_TYPE_UNKNOWN
)
3203 alc_determine_headset_type(codec
);
3204 if (spec
->current_headset_type
== ALC_HEADSET_TYPE_CTIA
)
3205 alc_headset_mode_ctia(codec
);
3206 else if (spec
->current_headset_type
== ALC_HEADSET_TYPE_OMTP
)
3207 alc_headset_mode_omtp(codec
);
3208 spec
->gen
.hp_jack_present
= true;
3210 case ALC_HEADSET_MODE_MIC
:
3211 alc_headset_mode_mic_in(codec
, hp_pin
, spec
->headphone_mic_pin
);
3212 spec
->gen
.hp_jack_present
= false;
3214 case ALC_HEADSET_MODE_HEADPHONE
:
3215 alc_headset_mode_default(codec
);
3216 spec
->gen
.hp_jack_present
= true;
3219 if (new_headset_mode
!= ALC_HEADSET_MODE_MIC
) {
3220 snd_hda_set_pin_ctl_cache(codec
, hp_pin
,
3221 AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
);
3222 if (spec
->headphone_mic_pin
)
3223 snd_hda_set_pin_ctl_cache(codec
, spec
->headphone_mic_pin
,
3226 spec
->current_headset_mode
= new_headset_mode
;
3228 snd_hda_gen_update_outputs(codec
);
3231 static void alc_update_headset_mode_hook(struct hda_codec
*codec
,
3232 struct snd_ctl_elem_value
*ucontrol
)
3234 alc_update_headset_mode(codec
);
3237 static void alc_update_headset_jack_cb(struct hda_codec
*codec
, struct hda_jack_tbl
*jack
)
3239 struct alc_spec
*spec
= codec
->spec
;
3240 spec
->current_headset_type
= ALC_HEADSET_MODE_UNKNOWN
;
3241 snd_hda_gen_hp_automute(codec
, jack
);
3244 static void alc_probe_headset_mode(struct hda_codec
*codec
)
3247 struct alc_spec
*spec
= codec
->spec
;
3248 struct auto_pin_cfg
*cfg
= &spec
->gen
.autocfg
;
3251 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
3252 if (cfg
->inputs
[i
].is_headset_mic
&& !spec
->headset_mic_pin
)
3253 spec
->headset_mic_pin
= cfg
->inputs
[i
].pin
;
3254 if (cfg
->inputs
[i
].is_headphone_mic
&& !spec
->headphone_mic_pin
)
3255 spec
->headphone_mic_pin
= cfg
->inputs
[i
].pin
;
3258 spec
->gen
.cap_sync_hook
= alc_update_headset_mode_hook
;
3259 spec
->gen
.automute_hook
= alc_update_headset_mode
;
3260 spec
->gen
.hp_automute_hook
= alc_update_headset_jack_cb
;
3263 static void alc_fixup_headset_mode(struct hda_codec
*codec
,
3264 const struct hda_fixup
*fix
, int action
)
3266 struct alc_spec
*spec
= codec
->spec
;
3269 case HDA_FIXUP_ACT_PRE_PROBE
:
3270 spec
->parse_flags
|= HDA_PINCFG_HEADSET_MIC
| HDA_PINCFG_HEADPHONE_MIC
;
3272 case HDA_FIXUP_ACT_PROBE
:
3273 alc_probe_headset_mode(codec
);
3275 case HDA_FIXUP_ACT_INIT
:
3276 spec
->current_headset_mode
= 0;
3277 alc_update_headset_mode(codec
);
3282 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec
*codec
,
3283 const struct hda_fixup
*fix
, int action
)
3285 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
3286 struct alc_spec
*spec
= codec
->spec
;
3287 spec
->parse_flags
|= HDA_PINCFG_HEADSET_MIC
;
3290 alc_fixup_headset_mode(codec
, fix
, action
);
3293 static void alc_fixup_headset_mode_alc668(struct hda_codec
*codec
,
3294 const struct hda_fixup
*fix
, int action
)
3296 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
3298 alc_write_coef_idx(codec
, 0xc4, 0x8000);
3299 val
= alc_read_coef_idx(codec
, 0xc2);
3300 alc_write_coef_idx(codec
, 0xc2, val
& 0xfe);
3301 snd_hda_set_pin_ctl_cache(codec
, 0x18, 0);
3303 alc_fixup_headset_mode(codec
, fix
, action
);
3306 static void alc271_hp_gate_mic_jack(struct hda_codec
*codec
,
3307 const struct hda_fixup
*fix
,
3310 struct alc_spec
*spec
= codec
->spec
;
3312 if (action
== HDA_FIXUP_ACT_PROBE
) {
3313 if (snd_BUG_ON(!spec
->gen
.am_entry
[1].pin
||
3314 !spec
->gen
.autocfg
.hp_pins
[0]))
3316 snd_hda_jack_set_gating_jack(codec
, spec
->gen
.am_entry
[1].pin
,
3317 spec
->gen
.autocfg
.hp_pins
[0]);
3321 static void alc269_fixup_limit_int_mic_boost(struct hda_codec
*codec
,
3322 const struct hda_fixup
*fix
,
3325 struct alc_spec
*spec
= codec
->spec
;
3326 struct auto_pin_cfg
*cfg
= &spec
->gen
.autocfg
;
3329 /* The mic boosts on level 2 and 3 are too noisy
3330 on the internal mic input.
3331 Therefore limit the boost to 0 or 1. */
3333 if (action
!= HDA_FIXUP_ACT_PROBE
)
3336 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
3337 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
3338 unsigned int defcfg
;
3339 if (cfg
->inputs
[i
].type
!= AUTO_PIN_MIC
)
3341 defcfg
= snd_hda_codec_get_pincfg(codec
, nid
);
3342 if (snd_hda_get_input_pin_attr(defcfg
) != INPUT_PIN_ATTR_INT
)
3345 snd_hda_override_amp_caps(codec
, nid
, HDA_INPUT
,
3346 (0x00 << AC_AMPCAP_OFFSET_SHIFT
) |
3347 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT
) |
3348 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT
) |
3349 (0 << AC_AMPCAP_MUTE_SHIFT
));
3353 static void alc290_fixup_mono_speakers(struct hda_codec
*codec
,
3354 const struct hda_fixup
*fix
, int action
)
3356 if (action
== HDA_FIXUP_ACT_PRE_PROBE
)
3357 /* Remove DAC node 0x03, as it seems to be
3358 giving mono output */
3359 snd_hda_override_wcaps(codec
, 0x03, 0);
3363 ALC269_FIXUP_SONY_VAIO
,
3364 ALC275_FIXUP_SONY_VAIO_GPIO2
,
3365 ALC269_FIXUP_DELL_M101Z
,
3366 ALC269_FIXUP_SKU_IGNORE
,
3367 ALC269_FIXUP_ASUS_G73JW
,
3368 ALC269_FIXUP_LENOVO_EAPD
,
3369 ALC275_FIXUP_SONY_HWEQ
,
3371 ALC269_FIXUP_PCM_44K
,
3372 ALC269_FIXUP_STEREO_DMIC
,
3373 ALC269_FIXUP_QUANTA_MUTE
,
3374 ALC269_FIXUP_LIFEBOOK
,
3375 ALC269_FIXUP_LIFEBOOK_EXTMIC
,
3376 ALC269_FIXUP_LIFEBOOK_HP_PIN
,
3377 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT
,
3380 ALC269VB_FIXUP_AMIC
,
3381 ALC269VB_FIXUP_DMIC
,
3382 ALC269_FIXUP_HP_MUTE_LED
,
3383 ALC269_FIXUP_HP_MUTE_LED_MIC1
,
3384 ALC269_FIXUP_HP_MUTE_LED_MIC2
,
3385 ALC269_FIXUP_HP_GPIO_LED
,
3386 ALC269_FIXUP_INV_DMIC
,
3387 ALC269_FIXUP_LENOVO_DOCK
,
3388 ALC286_FIXUP_SONY_MIC_NO_PRESENCE
,
3389 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
,
3390 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
,
3391 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
,
3392 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE
,
3393 ALC290_FIXUP_MONO_SPEAKERS
,
3394 ALC269_FIXUP_HEADSET_MODE
,
3395 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
,
3396 ALC269_FIXUP_ASPIRE_HEADSET_MIC
,
3397 ALC269_FIXUP_ASUS_X101_FUNC
,
3398 ALC269_FIXUP_ASUS_X101_VERB
,
3399 ALC269_FIXUP_ASUS_X101
,
3400 ALC271_FIXUP_AMIC_MIC2
,
3401 ALC271_FIXUP_HP_GATE_MIC_JACK
,
3402 ALC269_FIXUP_ACER_AC700
,
3403 ALC269_FIXUP_LIMIT_INT_MIC_BOOST
,
3406 static const struct hda_fixup alc269_fixups
[] = {
3407 [ALC269_FIXUP_SONY_VAIO
] = {
3408 .type
= HDA_FIXUP_PINCTLS
,
3409 .v
.pins
= (const struct hda_pintbl
[]) {
3410 {0x19, PIN_VREFGRD
},
3414 [ALC275_FIXUP_SONY_VAIO_GPIO2
] = {
3415 .type
= HDA_FIXUP_VERBS
,
3416 .v
.verbs
= (const struct hda_verb
[]) {
3417 {0x01, AC_VERB_SET_GPIO_MASK
, 0x04},
3418 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x04},
3419 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
3423 .chain_id
= ALC269_FIXUP_SONY_VAIO
3425 [ALC269_FIXUP_DELL_M101Z
] = {
3426 .type
= HDA_FIXUP_VERBS
,
3427 .v
.verbs
= (const struct hda_verb
[]) {
3428 /* Enables internal speaker */
3429 {0x20, AC_VERB_SET_COEF_INDEX
, 13},
3430 {0x20, AC_VERB_SET_PROC_COEF
, 0x4040},
3434 [ALC269_FIXUP_SKU_IGNORE
] = {
3435 .type
= HDA_FIXUP_FUNC
,
3436 .v
.func
= alc_fixup_sku_ignore
,
3438 [ALC269_FIXUP_ASUS_G73JW
] = {
3439 .type
= HDA_FIXUP_PINS
,
3440 .v
.pins
= (const struct hda_pintbl
[]) {
3441 { 0x17, 0x99130111 }, /* subwoofer */
3445 [ALC269_FIXUP_LENOVO_EAPD
] = {
3446 .type
= HDA_FIXUP_VERBS
,
3447 .v
.verbs
= (const struct hda_verb
[]) {
3448 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
3452 [ALC275_FIXUP_SONY_HWEQ
] = {
3453 .type
= HDA_FIXUP_FUNC
,
3454 .v
.func
= alc269_fixup_hweq
,
3456 .chain_id
= ALC275_FIXUP_SONY_VAIO_GPIO2
3458 [ALC271_FIXUP_DMIC
] = {
3459 .type
= HDA_FIXUP_FUNC
,
3460 .v
.func
= alc271_fixup_dmic
,
3462 [ALC269_FIXUP_PCM_44K
] = {
3463 .type
= HDA_FIXUP_FUNC
,
3464 .v
.func
= alc269_fixup_pcm_44k
,
3466 .chain_id
= ALC269_FIXUP_QUANTA_MUTE
3468 [ALC269_FIXUP_STEREO_DMIC
] = {
3469 .type
= HDA_FIXUP_FUNC
,
3470 .v
.func
= alc269_fixup_stereo_dmic
,
3472 [ALC269_FIXUP_QUANTA_MUTE
] = {
3473 .type
= HDA_FIXUP_FUNC
,
3474 .v
.func
= alc269_fixup_quanta_mute
,
3476 [ALC269_FIXUP_LIFEBOOK
] = {
3477 .type
= HDA_FIXUP_PINS
,
3478 .v
.pins
= (const struct hda_pintbl
[]) {
3479 { 0x1a, 0x2101103f }, /* dock line-out */
3480 { 0x1b, 0x23a11040 }, /* dock mic-in */
3484 .chain_id
= ALC269_FIXUP_QUANTA_MUTE
3486 [ALC269_FIXUP_LIFEBOOK_EXTMIC
] = {
3487 .type
= HDA_FIXUP_PINS
,
3488 .v
.pins
= (const struct hda_pintbl
[]) {
3489 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
3493 [ALC269_FIXUP_LIFEBOOK_HP_PIN
] = {
3494 .type
= HDA_FIXUP_PINS
,
3495 .v
.pins
= (const struct hda_pintbl
[]) {
3496 { 0x21, 0x0221102f }, /* HP out */
3500 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT
] = {
3501 .type
= HDA_FIXUP_FUNC
,
3502 .v
.func
= alc269_fixup_pincfg_no_hp_to_lineout
,
3504 [ALC269_FIXUP_AMIC
] = {
3505 .type
= HDA_FIXUP_PINS
,
3506 .v
.pins
= (const struct hda_pintbl
[]) {
3507 { 0x14, 0x99130110 }, /* speaker */
3508 { 0x15, 0x0121401f }, /* HP out */
3509 { 0x18, 0x01a19c20 }, /* mic */
3510 { 0x19, 0x99a3092f }, /* int-mic */
3514 [ALC269_FIXUP_DMIC
] = {
3515 .type
= HDA_FIXUP_PINS
,
3516 .v
.pins
= (const struct hda_pintbl
[]) {
3517 { 0x12, 0x99a3092f }, /* int-mic */
3518 { 0x14, 0x99130110 }, /* speaker */
3519 { 0x15, 0x0121401f }, /* HP out */
3520 { 0x18, 0x01a19c20 }, /* mic */
3524 [ALC269VB_FIXUP_AMIC
] = {
3525 .type
= HDA_FIXUP_PINS
,
3526 .v
.pins
= (const struct hda_pintbl
[]) {
3527 { 0x14, 0x99130110 }, /* speaker */
3528 { 0x18, 0x01a19c20 }, /* mic */
3529 { 0x19, 0x99a3092f }, /* int-mic */
3530 { 0x21, 0x0121401f }, /* HP out */
3534 [ALC269VB_FIXUP_DMIC
] = {
3535 .type
= HDA_FIXUP_PINS
,
3536 .v
.pins
= (const struct hda_pintbl
[]) {
3537 { 0x12, 0x99a3092f }, /* int-mic */
3538 { 0x14, 0x99130110 }, /* speaker */
3539 { 0x18, 0x01a19c20 }, /* mic */
3540 { 0x21, 0x0121401f }, /* HP out */
3544 [ALC269_FIXUP_HP_MUTE_LED
] = {
3545 .type
= HDA_FIXUP_FUNC
,
3546 .v
.func
= alc269_fixup_hp_mute_led
,
3548 [ALC269_FIXUP_HP_MUTE_LED_MIC1
] = {
3549 .type
= HDA_FIXUP_FUNC
,
3550 .v
.func
= alc269_fixup_hp_mute_led_mic1
,
3552 [ALC269_FIXUP_HP_MUTE_LED_MIC2
] = {
3553 .type
= HDA_FIXUP_FUNC
,
3554 .v
.func
= alc269_fixup_hp_mute_led_mic2
,
3556 [ALC269_FIXUP_HP_GPIO_LED
] = {
3557 .type
= HDA_FIXUP_FUNC
,
3558 .v
.func
= alc269_fixup_hp_gpio_led
,
3560 [ALC269_FIXUP_INV_DMIC
] = {
3561 .type
= HDA_FIXUP_FUNC
,
3562 .v
.func
= alc_fixup_inv_dmic_0x12
,
3564 [ALC269_FIXUP_LENOVO_DOCK
] = {
3565 .type
= HDA_FIXUP_PINS
,
3566 .v
.pins
= (const struct hda_pintbl
[]) {
3567 { 0x19, 0x23a11040 }, /* dock mic */
3568 { 0x1b, 0x2121103f }, /* dock headphone */
3572 .chain_id
= ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
3574 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
] = {
3575 .type
= HDA_FIXUP_FUNC
,
3576 .v
.func
= alc269_fixup_pincfg_no_hp_to_lineout
,
3578 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
] = {
3579 .type
= HDA_FIXUP_PINS
,
3580 .v
.pins
= (const struct hda_pintbl
[]) {
3581 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
3582 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
3586 .chain_id
= ALC269_FIXUP_HEADSET_MODE
3588 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
] = {
3589 .type
= HDA_FIXUP_PINS
,
3590 .v
.pins
= (const struct hda_pintbl
[]) {
3591 { 0x16, 0x21014020 }, /* dock line out */
3592 { 0x19, 0x21a19030 }, /* dock mic */
3593 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
3597 .chain_id
= ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
3599 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE
] = {
3600 .type
= HDA_FIXUP_PINS
,
3601 .v
.pins
= (const struct hda_pintbl
[]) {
3602 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
3606 .chain_id
= ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
3608 [ALC269_FIXUP_HEADSET_MODE
] = {
3609 .type
= HDA_FIXUP_FUNC
,
3610 .v
.func
= alc_fixup_headset_mode
,
3612 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
] = {
3613 .type
= HDA_FIXUP_FUNC
,
3614 .v
.func
= alc_fixup_headset_mode_no_hp_mic
,
3616 [ALC269_FIXUP_ASPIRE_HEADSET_MIC
] = {
3617 .type
= HDA_FIXUP_PINS
,
3618 .v
.pins
= (const struct hda_pintbl
[]) {
3619 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
3623 .chain_id
= ALC269_FIXUP_HEADSET_MODE
,
3625 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE
] = {
3626 .type
= HDA_FIXUP_PINS
,
3627 .v
.pins
= (const struct hda_pintbl
[]) {
3628 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
3632 [ALC269_FIXUP_ASUS_X101_FUNC
] = {
3633 .type
= HDA_FIXUP_FUNC
,
3634 .v
.func
= alc269_fixup_x101_headset_mic
,
3636 [ALC269_FIXUP_ASUS_X101_VERB
] = {
3637 .type
= HDA_FIXUP_VERBS
,
3638 .v
.verbs
= (const struct hda_verb
[]) {
3639 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3640 {0x20, AC_VERB_SET_COEF_INDEX
, 0x08},
3641 {0x20, AC_VERB_SET_PROC_COEF
, 0x0310},
3645 .chain_id
= ALC269_FIXUP_ASUS_X101_FUNC
3647 [ALC269_FIXUP_ASUS_X101
] = {
3648 .type
= HDA_FIXUP_PINS
,
3649 .v
.pins
= (const struct hda_pintbl
[]) {
3650 { 0x18, 0x04a1182c }, /* Headset mic */
3654 .chain_id
= ALC269_FIXUP_ASUS_X101_VERB
3656 [ALC271_FIXUP_AMIC_MIC2
] = {
3657 .type
= HDA_FIXUP_PINS
,
3658 .v
.pins
= (const struct hda_pintbl
[]) {
3659 { 0x14, 0x99130110 }, /* speaker */
3660 { 0x19, 0x01a19c20 }, /* mic */
3661 { 0x1b, 0x99a7012f }, /* int-mic */
3662 { 0x21, 0x0121401f }, /* HP out */
3666 [ALC271_FIXUP_HP_GATE_MIC_JACK
] = {
3667 .type
= HDA_FIXUP_FUNC
,
3668 .v
.func
= alc271_hp_gate_mic_jack
,
3670 .chain_id
= ALC271_FIXUP_AMIC_MIC2
,
3672 [ALC269_FIXUP_ACER_AC700
] = {
3673 .type
= HDA_FIXUP_PINS
,
3674 .v
.pins
= (const struct hda_pintbl
[]) {
3675 { 0x12, 0x99a3092f }, /* int-mic */
3676 { 0x14, 0x99130110 }, /* speaker */
3677 { 0x18, 0x03a11c20 }, /* mic */
3678 { 0x1e, 0x0346101e }, /* SPDIF1 */
3679 { 0x21, 0x0321101f }, /* HP out */
3683 .chain_id
= ALC271_FIXUP_DMIC
,
3685 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST
] = {
3686 .type
= HDA_FIXUP_FUNC
,
3687 .v
.func
= alc269_fixup_limit_int_mic_boost
,
3689 [ALC290_FIXUP_MONO_SPEAKERS
] = {
3690 .type
= HDA_FIXUP_FUNC
,
3691 .v
.func
= alc290_fixup_mono_speakers
,
3693 .chain_id
= ALC269_FIXUP_DELL3_MIC_NO_PRESENCE
,
3697 static const struct snd_pci_quirk alc269_fixup_tbl
[] = {
3698 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC
),
3699 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC
),
3700 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC
),
3701 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
),
3702 SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
),
3703 SND_PCI_QUIRK(0x1028, 0x05c4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3704 SND_PCI_QUIRK(0x1028, 0x05c5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3705 SND_PCI_QUIRK(0x1028, 0x05c6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3706 SND_PCI_QUIRK(0x1028, 0x05c7, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3707 SND_PCI_QUIRK(0x1028, 0x05c8, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3708 SND_PCI_QUIRK(0x1028, 0x05c9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3709 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
),
3710 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
),
3711 SND_PCI_QUIRK(0x1028, 0x05de, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
),
3712 SND_PCI_QUIRK(0x1028, 0x05e0, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
),
3713 SND_PCI_QUIRK(0x1028, 0x05e9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3714 SND_PCI_QUIRK(0x1028, 0x05ea, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3715 SND_PCI_QUIRK(0x1028, 0x05eb, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3716 SND_PCI_QUIRK(0x1028, 0x05ec, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3717 SND_PCI_QUIRK(0x1028, 0x05ed, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3718 SND_PCI_QUIRK(0x1028, 0x05ee, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3719 SND_PCI_QUIRK(0x1028, 0x05f3, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3720 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3721 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3722 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3723 SND_PCI_QUIRK(0x1028, 0x05f8, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3724 SND_PCI_QUIRK(0x1028, 0x05f9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3725 SND_PCI_QUIRK(0x1028, 0x05fb, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3726 SND_PCI_QUIRK(0x1028, 0x0606, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3727 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3728 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3729 SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3730 SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
),
3731 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_MONO_SPEAKERS
),
3732 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS
),
3733 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2
),
3734 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED
),
3735 SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1
),
3736 SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1
),
3737 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED
),
3738 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST
),
3739 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST
),
3740 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC
),
3741 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC
),
3742 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC
),
3743 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW
),
3744 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC
),
3745 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST
),
3746 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC
),
3747 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC
),
3748 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC
),
3749 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC
),
3750 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101
),
3751 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE
),
3752 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE
),
3753 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2
),
3754 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ
),
3755 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ
),
3756 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO
),
3757 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z
),
3758 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700
),
3759 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC
),
3760 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC
),
3761 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK
),
3762 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK
),
3763 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC
),
3764 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK
),
3765 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT
),
3766 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN
),
3767 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN
),
3768 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC
),
3769 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE
),
3770 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE
),
3771 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE
),
3772 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE
),
3773 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE
),
3774 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK
),
3775 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK
),
3776 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK
),
3777 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK
),
3778 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK
),
3779 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK
),
3780 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K
),
3781 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD
),
3784 /* Below is a quirk table taken from the old code.
3785 * Basically the device should work as is without the fixup table.
3786 * If BIOS doesn't give a proper info, enable the corresponding
3789 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
3791 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC
),
3792 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC
),
3793 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC
),
3794 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC
),
3795 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC
),
3796 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC
),
3797 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC
),
3798 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC
),
3799 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC
),
3800 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC
),
3801 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC
),
3802 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC
),
3803 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC
),
3804 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC
),
3805 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC
),
3806 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC
),
3807 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC
),
3808 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC
),
3809 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC
),
3810 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC
),
3811 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC
),
3812 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC
),
3813 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC
),
3814 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC
),
3815 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC
),
3816 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC
),
3817 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC
),
3818 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC
),
3819 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC
),
3820 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC
),
3821 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC
),
3822 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC
),
3823 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC
),
3824 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC
),
3825 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC
),
3826 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC
),
3827 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC
),
3828 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC
),
3829 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC
),
3834 static const struct hda_model_fixup alc269_fixup_models
[] = {
3835 {.id
= ALC269_FIXUP_AMIC
, .name
= "laptop-amic"},
3836 {.id
= ALC269_FIXUP_DMIC
, .name
= "laptop-dmic"},
3837 {.id
= ALC269_FIXUP_STEREO_DMIC
, .name
= "alc269-dmic"},
3838 {.id
= ALC271_FIXUP_DMIC
, .name
= "alc271-dmic"},
3839 {.id
= ALC269_FIXUP_INV_DMIC
, .name
= "inv-dmic"},
3840 {.id
= ALC269_FIXUP_LENOVO_DOCK
, .name
= "lenovo-dock"},
3841 {.id
= ALC269_FIXUP_HP_GPIO_LED
, .name
= "hp-gpio-led"},
3842 {.id
= ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
, .name
= "dell-headset-multi"},
3843 {.id
= ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
, .name
= "dell-headset-dock"},
3848 static void alc269_fill_coef(struct hda_codec
*codec
)
3850 struct alc_spec
*spec
= codec
->spec
;
3853 if (spec
->codec_variant
!= ALC269_TYPE_ALC269VB
)
3856 if ((alc_get_coef0(codec
) & 0x00ff) < 0x015) {
3857 alc_write_coef_idx(codec
, 0xf, 0x960b);
3858 alc_write_coef_idx(codec
, 0xe, 0x8817);
3861 if ((alc_get_coef0(codec
) & 0x00ff) == 0x016) {
3862 alc_write_coef_idx(codec
, 0xf, 0x960b);
3863 alc_write_coef_idx(codec
, 0xe, 0x8814);
3866 if ((alc_get_coef0(codec
) & 0x00ff) == 0x017) {
3867 val
= alc_read_coef_idx(codec
, 0x04);
3868 /* Power up output pin */
3870 alc_write_coef_idx(codec
, 0x04, val
| (1<<11));
3873 if ((alc_get_coef0(codec
) & 0x00ff) == 0x018) {
3874 val
= alc_read_coef_idx(codec
, 0xd);
3875 if (val
!= -1 && (val
& 0x0c00) >> 10 != 0x1) {
3876 /* Capless ramp up clock control */
3877 alc_write_coef_idx(codec
, 0xd, val
| (1<<10));
3879 val
= alc_read_coef_idx(codec
, 0x17);
3880 if (val
!= -1 && (val
& 0x01c0) >> 6 != 0x4) {
3881 /* Class D power on reset */
3882 alc_write_coef_idx(codec
, 0x17, val
| (1<<7));
3886 val
= alc_read_coef_idx(codec
, 0xd); /* Class D */
3888 alc_write_coef_idx(codec
, 0xd, val
| (1<<14));
3890 val
= alc_read_coef_idx(codec
, 0x4); /* HP */
3892 alc_write_coef_idx(codec
, 0x4, val
| (1<<11));
3897 static int patch_alc269(struct hda_codec
*codec
)
3899 struct alc_spec
*spec
;
3902 err
= alc_alloc_spec(codec
, 0x0b);
3907 spec
->gen
.shared_mic_vref_pin
= 0x18;
3909 snd_hda_pick_fixup(codec
, alc269_fixup_models
,
3910 alc269_fixup_tbl
, alc269_fixups
);
3911 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
3913 alc_auto_parse_customize_define(codec
);
3915 if (has_cdefine_beep(codec
))
3916 spec
->gen
.beep_nid
= 0x01;
3918 switch (codec
->vendor_id
) {
3920 spec
->codec_variant
= ALC269_TYPE_ALC269VA
;
3921 switch (alc_get_coef0(codec
) & 0x00f0) {
3923 if (codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
3924 spec
->cdefine
.platform_type
== 1)
3925 err
= alc_codec_rename(codec
, "ALC271X");
3926 spec
->codec_variant
= ALC269_TYPE_ALC269VB
;
3929 if (codec
->bus
->pci
->subsystem_vendor
== 0x17aa &&
3930 codec
->bus
->pci
->subsystem_device
== 0x21f3)
3931 err
= alc_codec_rename(codec
, "ALC3202");
3932 spec
->codec_variant
= ALC269_TYPE_ALC269VC
;
3935 spec
->codec_variant
= ALC269_TYPE_ALC269VD
;
3938 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
3942 spec
->init_hook
= alc269_fill_coef
;
3943 alc269_fill_coef(codec
);
3948 spec
->codec_variant
= ALC269_TYPE_ALC280
;
3953 spec
->codec_variant
= ALC269_TYPE_ALC282
;
3957 spec
->codec_variant
= ALC269_TYPE_ALC284
;
3961 spec
->codec_variant
= ALC269_TYPE_ALC286
;
3964 spec
->codec_variant
= ALC269_TYPE_ALC255
;
3968 /* automatic parse from the BIOS config */
3969 err
= alc269_parse_auto_config(codec
);
3973 if (!spec
->gen
.no_analog
&& spec
->gen
.beep_nid
)
3974 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
3976 codec
->patch_ops
= alc_patch_ops
;
3978 codec
->patch_ops
.resume
= alc269_resume
;
3980 spec
->shutup
= alc269_shutup
;
3982 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
3995 static int alc861_parse_auto_config(struct hda_codec
*codec
)
3997 static const hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
3998 static const hda_nid_t alc861_ssids
[] = { 0x0e, 0x0f, 0x0b, 0 };
3999 return alc_parse_auto_config(codec
, alc861_ignore
, alc861_ssids
);
4002 /* Pin config fixes */
4004 ALC861_FIXUP_FSC_AMILO_PI1505
,
4005 ALC861_FIXUP_AMP_VREF_0F
,
4006 ALC861_FIXUP_NO_JACK_DETECT
,
4007 ALC861_FIXUP_ASUS_A6RP
,
4008 ALC660_FIXUP_ASUS_W7J
,
4011 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
4012 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec
*codec
,
4013 const struct hda_fixup
*fix
, int action
)
4015 struct alc_spec
*spec
= codec
->spec
;
4018 if (action
!= HDA_FIXUP_ACT_INIT
)
4020 val
= snd_hda_codec_get_pin_target(codec
, 0x0f);
4021 if (!(val
& (AC_PINCTL_IN_EN
| AC_PINCTL_OUT_EN
)))
4022 val
|= AC_PINCTL_IN_EN
;
4023 val
|= AC_PINCTL_VREF_50
;
4024 snd_hda_set_pin_ctl(codec
, 0x0f, val
);
4025 spec
->gen
.keep_vref_in_automute
= 1;
4028 /* suppress the jack-detection */
4029 static void alc_fixup_no_jack_detect(struct hda_codec
*codec
,
4030 const struct hda_fixup
*fix
, int action
)
4032 if (action
== HDA_FIXUP_ACT_PRE_PROBE
)
4033 codec
->no_jack_detect
= 1;
4036 static const struct hda_fixup alc861_fixups
[] = {
4037 [ALC861_FIXUP_FSC_AMILO_PI1505
] = {
4038 .type
= HDA_FIXUP_PINS
,
4039 .v
.pins
= (const struct hda_pintbl
[]) {
4040 { 0x0b, 0x0221101f }, /* HP */
4041 { 0x0f, 0x90170310 }, /* speaker */
4045 [ALC861_FIXUP_AMP_VREF_0F
] = {
4046 .type
= HDA_FIXUP_FUNC
,
4047 .v
.func
= alc861_fixup_asus_amp_vref_0f
,
4049 [ALC861_FIXUP_NO_JACK_DETECT
] = {
4050 .type
= HDA_FIXUP_FUNC
,
4051 .v
.func
= alc_fixup_no_jack_detect
,
4053 [ALC861_FIXUP_ASUS_A6RP
] = {
4054 .type
= HDA_FIXUP_FUNC
,
4055 .v
.func
= alc861_fixup_asus_amp_vref_0f
,
4057 .chain_id
= ALC861_FIXUP_NO_JACK_DETECT
,
4059 [ALC660_FIXUP_ASUS_W7J
] = {
4060 .type
= HDA_FIXUP_VERBS
,
4061 .v
.verbs
= (const struct hda_verb
[]) {
4062 /* ASUS W7J needs a magic pin setup on unused NID 0x10
4063 * for enabling outputs
4065 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4071 static const struct snd_pci_quirk alc861_fixup_tbl
[] = {
4072 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J
),
4073 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J
),
4074 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP
),
4075 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F
),
4076 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT
),
4077 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F
),
4078 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F
),
4079 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505
),
4085 static int patch_alc861(struct hda_codec
*codec
)
4087 struct alc_spec
*spec
;
4090 err
= alc_alloc_spec(codec
, 0x15);
4095 spec
->gen
.beep_nid
= 0x23;
4097 snd_hda_pick_fixup(codec
, NULL
, alc861_fixup_tbl
, alc861_fixups
);
4098 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
4100 /* automatic parse from the BIOS config */
4101 err
= alc861_parse_auto_config(codec
);
4105 if (!spec
->gen
.no_analog
)
4106 set_beep_amp(spec
, 0x23, 0, HDA_OUTPUT
);
4108 codec
->patch_ops
= alc_patch_ops
;
4110 spec
->power_hook
= alc_power_eapd
;
4113 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
4127 * In addition, an independent DAC
4129 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
4131 static const hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
4132 static const hda_nid_t alc861vd_ssids
[] = { 0x15, 0x1b, 0x14, 0 };
4133 return alc_parse_auto_config(codec
, alc861vd_ignore
, alc861vd_ssids
);
4137 ALC660VD_FIX_ASUS_GPIO1
,
4138 ALC861VD_FIX_DALLAS
,
4141 /* exclude VREF80 */
4142 static void alc861vd_fixup_dallas(struct hda_codec
*codec
,
4143 const struct hda_fixup
*fix
, int action
)
4145 if (action
== HDA_FIXUP_ACT_PRE_PROBE
) {
4146 snd_hda_override_pin_caps(codec
, 0x18, 0x00000734);
4147 snd_hda_override_pin_caps(codec
, 0x19, 0x0000073c);
4151 static const struct hda_fixup alc861vd_fixups
[] = {
4152 [ALC660VD_FIX_ASUS_GPIO1
] = {
4153 .type
= HDA_FIXUP_VERBS
,
4154 .v
.verbs
= (const struct hda_verb
[]) {
4156 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
4157 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4158 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
4162 [ALC861VD_FIX_DALLAS
] = {
4163 .type
= HDA_FIXUP_FUNC
,
4164 .v
.func
= alc861vd_fixup_dallas
,
4168 static const struct snd_pci_quirk alc861vd_fixup_tbl
[] = {
4169 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS
),
4170 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1
),
4171 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS
),
4177 static int patch_alc861vd(struct hda_codec
*codec
)
4179 struct alc_spec
*spec
;
4182 err
= alc_alloc_spec(codec
, 0x0b);
4187 spec
->gen
.beep_nid
= 0x23;
4189 snd_hda_pick_fixup(codec
, NULL
, alc861vd_fixup_tbl
, alc861vd_fixups
);
4190 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
4192 /* automatic parse from the BIOS config */
4193 err
= alc861vd_parse_auto_config(codec
);
4197 if (!spec
->gen
.no_analog
)
4198 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
4200 codec
->patch_ops
= alc_patch_ops
;
4202 spec
->shutup
= alc_eapd_shutup
;
4204 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
4216 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
4217 * configuration. Each pin widget can choose any input DACs and a mixer.
4218 * Each ADC is connected from a mixer of all inputs. This makes possible
4219 * 6-channel independent captures.
4221 * In addition, an independent DAC for the multi-playback (not used in this
4226 * BIOS auto configuration
4229 static int alc662_parse_auto_config(struct hda_codec
*codec
)
4231 static const hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
4232 static const hda_nid_t alc663_ssids
[] = { 0x15, 0x1b, 0x14, 0x21 };
4233 static const hda_nid_t alc662_ssids
[] = { 0x15, 0x1b, 0x14, 0 };
4234 const hda_nid_t
*ssids
;
4236 if (codec
->vendor_id
== 0x10ec0272 || codec
->vendor_id
== 0x10ec0663 ||
4237 codec
->vendor_id
== 0x10ec0665 || codec
->vendor_id
== 0x10ec0670 ||
4238 codec
->vendor_id
== 0x10ec0671)
4239 ssids
= alc663_ssids
;
4241 ssids
= alc662_ssids
;
4242 return alc_parse_auto_config(codec
, alc662_ignore
, ssids
);
4245 static void alc272_fixup_mario(struct hda_codec
*codec
,
4246 const struct hda_fixup
*fix
, int action
)
4248 if (action
!= HDA_FIXUP_ACT_PRE_PROBE
)
4250 if (snd_hda_override_amp_caps(codec
, 0x2, HDA_OUTPUT
,
4251 (0x3b << AC_AMPCAP_OFFSET_SHIFT
) |
4252 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT
) |
4253 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
4254 (0 << AC_AMPCAP_MUTE_SHIFT
)))
4256 "hda_codec: failed to override amp caps for NID 0x2\n");
4260 ALC662_FIXUP_ASPIRE
,
4261 ALC662_FIXUP_IDEAPAD
,
4263 ALC662_FIXUP_CZC_P10T
,
4264 ALC662_FIXUP_SKU_IGNORE
,
4265 ALC662_FIXUP_HP_RP5800
,
4266 ALC662_FIXUP_ASUS_MODE1
,
4267 ALC662_FIXUP_ASUS_MODE2
,
4268 ALC662_FIXUP_ASUS_MODE3
,
4269 ALC662_FIXUP_ASUS_MODE4
,
4270 ALC662_FIXUP_ASUS_MODE5
,
4271 ALC662_FIXUP_ASUS_MODE6
,
4272 ALC662_FIXUP_ASUS_MODE7
,
4273 ALC662_FIXUP_ASUS_MODE8
,
4274 ALC662_FIXUP_NO_JACK_DETECT
,
4275 ALC662_FIXUP_ZOTAC_Z68
,
4276 ALC662_FIXUP_INV_DMIC
,
4277 ALC668_FIXUP_DELL_MIC_NO_PRESENCE
,
4278 ALC668_FIXUP_HEADSET_MODE
,
4281 static const struct hda_fixup alc662_fixups
[] = {
4282 [ALC662_FIXUP_ASPIRE
] = {
4283 .type
= HDA_FIXUP_PINS
,
4284 .v
.pins
= (const struct hda_pintbl
[]) {
4285 { 0x15, 0x99130112 }, /* subwoofer */
4289 [ALC662_FIXUP_IDEAPAD
] = {
4290 .type
= HDA_FIXUP_PINS
,
4291 .v
.pins
= (const struct hda_pintbl
[]) {
4292 { 0x17, 0x99130112 }, /* subwoofer */
4296 [ALC272_FIXUP_MARIO
] = {
4297 .type
= HDA_FIXUP_FUNC
,
4298 .v
.func
= alc272_fixup_mario
,
4300 [ALC662_FIXUP_CZC_P10T
] = {
4301 .type
= HDA_FIXUP_VERBS
,
4302 .v
.verbs
= (const struct hda_verb
[]) {
4303 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
4307 [ALC662_FIXUP_SKU_IGNORE
] = {
4308 .type
= HDA_FIXUP_FUNC
,
4309 .v
.func
= alc_fixup_sku_ignore
,
4311 [ALC662_FIXUP_HP_RP5800
] = {
4312 .type
= HDA_FIXUP_PINS
,
4313 .v
.pins
= (const struct hda_pintbl
[]) {
4314 { 0x14, 0x0221201f }, /* HP out */
4318 .chain_id
= ALC662_FIXUP_SKU_IGNORE
4320 [ALC662_FIXUP_ASUS_MODE1
] = {
4321 .type
= HDA_FIXUP_PINS
,
4322 .v
.pins
= (const struct hda_pintbl
[]) {
4323 { 0x14, 0x99130110 }, /* speaker */
4324 { 0x18, 0x01a19c20 }, /* mic */
4325 { 0x19, 0x99a3092f }, /* int-mic */
4326 { 0x21, 0x0121401f }, /* HP out */
4330 .chain_id
= ALC662_FIXUP_SKU_IGNORE
4332 [ALC662_FIXUP_ASUS_MODE2
] = {
4333 .type
= HDA_FIXUP_PINS
,
4334 .v
.pins
= (const struct hda_pintbl
[]) {
4335 { 0x14, 0x99130110 }, /* speaker */
4336 { 0x18, 0x01a19820 }, /* mic */
4337 { 0x19, 0x99a3092f }, /* int-mic */
4338 { 0x1b, 0x0121401f }, /* HP out */
4342 .chain_id
= ALC662_FIXUP_SKU_IGNORE
4344 [ALC662_FIXUP_ASUS_MODE3
] = {
4345 .type
= HDA_FIXUP_PINS
,
4346 .v
.pins
= (const struct hda_pintbl
[]) {
4347 { 0x14, 0x99130110 }, /* speaker */
4348 { 0x15, 0x0121441f }, /* HP */
4349 { 0x18, 0x01a19840 }, /* mic */
4350 { 0x19, 0x99a3094f }, /* int-mic */
4351 { 0x21, 0x01211420 }, /* HP2 */
4355 .chain_id
= ALC662_FIXUP_SKU_IGNORE
4357 [ALC662_FIXUP_ASUS_MODE4
] = {
4358 .type
= HDA_FIXUP_PINS
,
4359 .v
.pins
= (const struct hda_pintbl
[]) {
4360 { 0x14, 0x99130110 }, /* speaker */
4361 { 0x16, 0x99130111 }, /* speaker */
4362 { 0x18, 0x01a19840 }, /* mic */
4363 { 0x19, 0x99a3094f }, /* int-mic */
4364 { 0x21, 0x0121441f }, /* HP */
4368 .chain_id
= ALC662_FIXUP_SKU_IGNORE
4370 [ALC662_FIXUP_ASUS_MODE5
] = {
4371 .type
= HDA_FIXUP_PINS
,
4372 .v
.pins
= (const struct hda_pintbl
[]) {
4373 { 0x14, 0x99130110 }, /* speaker */
4374 { 0x15, 0x0121441f }, /* HP */
4375 { 0x16, 0x99130111 }, /* speaker */
4376 { 0x18, 0x01a19840 }, /* mic */
4377 { 0x19, 0x99a3094f }, /* int-mic */
4381 .chain_id
= ALC662_FIXUP_SKU_IGNORE
4383 [ALC662_FIXUP_ASUS_MODE6
] = {
4384 .type
= HDA_FIXUP_PINS
,
4385 .v
.pins
= (const struct hda_pintbl
[]) {
4386 { 0x14, 0x99130110 }, /* speaker */
4387 { 0x15, 0x01211420 }, /* HP2 */
4388 { 0x18, 0x01a19840 }, /* mic */
4389 { 0x19, 0x99a3094f }, /* int-mic */
4390 { 0x1b, 0x0121441f }, /* HP */
4394 .chain_id
= ALC662_FIXUP_SKU_IGNORE
4396 [ALC662_FIXUP_ASUS_MODE7
] = {
4397 .type
= HDA_FIXUP_PINS
,
4398 .v
.pins
= (const struct hda_pintbl
[]) {
4399 { 0x14, 0x99130110 }, /* speaker */
4400 { 0x17, 0x99130111 }, /* speaker */
4401 { 0x18, 0x01a19840 }, /* mic */
4402 { 0x19, 0x99a3094f }, /* int-mic */
4403 { 0x1b, 0x01214020 }, /* HP */
4404 { 0x21, 0x0121401f }, /* HP */
4408 .chain_id
= ALC662_FIXUP_SKU_IGNORE
4410 [ALC662_FIXUP_ASUS_MODE8
] = {
4411 .type
= HDA_FIXUP_PINS
,
4412 .v
.pins
= (const struct hda_pintbl
[]) {
4413 { 0x14, 0x99130110 }, /* speaker */
4414 { 0x12, 0x99a30970 }, /* int-mic */
4415 { 0x15, 0x01214020 }, /* HP */
4416 { 0x17, 0x99130111 }, /* speaker */
4417 { 0x18, 0x01a19840 }, /* mic */
4418 { 0x21, 0x0121401f }, /* HP */
4422 .chain_id
= ALC662_FIXUP_SKU_IGNORE
4424 [ALC662_FIXUP_NO_JACK_DETECT
] = {
4425 .type
= HDA_FIXUP_FUNC
,
4426 .v
.func
= alc_fixup_no_jack_detect
,
4428 [ALC662_FIXUP_ZOTAC_Z68
] = {
4429 .type
= HDA_FIXUP_PINS
,
4430 .v
.pins
= (const struct hda_pintbl
[]) {
4431 { 0x1b, 0x02214020 }, /* Front HP */
4435 [ALC662_FIXUP_INV_DMIC
] = {
4436 .type
= HDA_FIXUP_FUNC
,
4437 .v
.func
= alc_fixup_inv_dmic_0x12
,
4439 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE
] = {
4440 .type
= HDA_FIXUP_PINS
,
4441 .v
.pins
= (const struct hda_pintbl
[]) {
4442 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
4443 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
4447 .chain_id
= ALC668_FIXUP_HEADSET_MODE
4449 [ALC668_FIXUP_HEADSET_MODE
] = {
4450 .type
= HDA_FIXUP_FUNC
,
4451 .v
.func
= alc_fixup_headset_mode_alc668
,
4455 static const struct snd_pci_quirk alc662_fixup_tbl
[] = {
4456 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2
),
4457 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC
),
4458 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC
),
4459 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE
),
4460 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE
),
4461 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC
),
4462 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC
),
4463 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE
),
4464 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE
),
4465 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE
),
4466 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800
),
4467 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_ASUS_MODE4
),
4468 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_ASUS_MODE4
),
4469 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT
),
4470 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2
),
4471 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD
),
4472 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD
),
4473 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD
),
4474 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68
),
4475 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T
),
4478 /* Below is a quirk table taken from the old code.
4479 * Basically the device should work as is without the fixup table.
4480 * If BIOS doesn't give a proper info, enable the corresponding
4483 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1
),
4484 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3
),
4485 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1
),
4486 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3
),
4487 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1
),
4488 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2
),
4489 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1
),
4490 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1
),
4491 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1
),
4492 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2
),
4493 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7
),
4494 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7
),
4495 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8
),
4496 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3
),
4497 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1
),
4498 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2
),
4499 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2
),
4500 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1
),
4501 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2
),
4502 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6
),
4503 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6
),
4504 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2
),
4505 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1
),
4506 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3
),
4507 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2
),
4508 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2
),
4509 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5
),
4510 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6
),
4511 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2
),
4512 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1
),
4513 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2
),
4514 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2
),
4515 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3
),
4516 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3
),
4517 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1
),
4518 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1
),
4519 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1
),
4520 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1
),
4521 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1
),
4522 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2
),
4523 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2
),
4524 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1
),
4525 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1
),
4526 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3
),
4527 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1
),
4528 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1
),
4529 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1
),
4530 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2
),
4531 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1
),
4532 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4
),
4537 static const struct hda_model_fixup alc662_fixup_models
[] = {
4538 {.id
= ALC272_FIXUP_MARIO
, .name
= "mario"},
4539 {.id
= ALC662_FIXUP_ASUS_MODE1
, .name
= "asus-mode1"},
4540 {.id
= ALC662_FIXUP_ASUS_MODE2
, .name
= "asus-mode2"},
4541 {.id
= ALC662_FIXUP_ASUS_MODE3
, .name
= "asus-mode3"},
4542 {.id
= ALC662_FIXUP_ASUS_MODE4
, .name
= "asus-mode4"},
4543 {.id
= ALC662_FIXUP_ASUS_MODE5
, .name
= "asus-mode5"},
4544 {.id
= ALC662_FIXUP_ASUS_MODE6
, .name
= "asus-mode6"},
4545 {.id
= ALC662_FIXUP_ASUS_MODE7
, .name
= "asus-mode7"},
4546 {.id
= ALC662_FIXUP_ASUS_MODE8
, .name
= "asus-mode8"},
4547 {.id
= ALC662_FIXUP_INV_DMIC
, .name
= "inv-dmic"},
4548 {.id
= ALC668_FIXUP_DELL_MIC_NO_PRESENCE
, .name
= "dell-headset-multi"},
4552 static void alc662_fill_coef(struct hda_codec
*codec
)
4556 coef
= alc_get_coef0(codec
);
4558 switch (codec
->vendor_id
) {
4560 if ((coef
& 0x00f0) == 0x0030) {
4561 val
= alc_read_coef_idx(codec
, 0x4); /* EAPD Ctrl */
4562 alc_write_coef_idx(codec
, 0x4, val
& ~(1<<10));
4572 val
= alc_read_coef_idx(codec
, 0xd); /* EAPD Ctrl */
4573 alc_write_coef_idx(codec
, 0xd, val
| (1<<14));
4580 static int patch_alc662(struct hda_codec
*codec
)
4582 struct alc_spec
*spec
;
4585 err
= alc_alloc_spec(codec
, 0x0b);
4591 /* handle multiple HPs as is */
4592 spec
->parse_flags
= HDA_PINCFG_NO_HP_FIXUP
;
4594 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
4596 spec
->init_hook
= alc662_fill_coef
;
4597 alc662_fill_coef(codec
);
4599 snd_hda_pick_fixup(codec
, alc662_fixup_models
,
4600 alc662_fixup_tbl
, alc662_fixups
);
4601 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PRE_PROBE
);
4603 alc_auto_parse_customize_define(codec
);
4605 if (has_cdefine_beep(codec
))
4606 spec
->gen
.beep_nid
= 0x01;
4608 if ((alc_get_coef0(codec
) & (1 << 14)) &&
4609 codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
4610 spec
->cdefine
.platform_type
== 1) {
4611 err
= alc_codec_rename(codec
, "ALC272X");
4616 /* automatic parse from the BIOS config */
4617 err
= alc662_parse_auto_config(codec
);
4621 if (!spec
->gen
.no_analog
&& spec
->gen
.beep_nid
) {
4622 switch (codec
->vendor_id
) {
4624 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
4630 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
4633 set_beep_amp(spec
, 0x0b, 0x03, HDA_INPUT
);
4638 codec
->patch_ops
= alc_patch_ops
;
4639 spec
->shutup
= alc_eapd_shutup
;
4641 snd_hda_apply_fixup(codec
, HDA_FIXUP_ACT_PROBE
);
4654 static int alc680_parse_auto_config(struct hda_codec
*codec
)
4656 return alc_parse_auto_config(codec
, NULL
, NULL
);
4661 static int patch_alc680(struct hda_codec
*codec
)
4665 /* ALC680 has no aa-loopback mixer */
4666 err
= alc_alloc_spec(codec
, 0);
4670 /* automatic parse from the BIOS config */
4671 err
= alc680_parse_auto_config(codec
);
4677 codec
->patch_ops
= alc_patch_ops
;
4685 static const struct hda_codec_preset snd_hda_preset_realtek
[] = {
4686 { .id
= 0x10ec0221, .name
= "ALC221", .patch
= patch_alc269
},
4687 { .id
= 0x10ec0231, .name
= "ALC231", .patch
= patch_alc269
},
4688 { .id
= 0x10ec0233, .name
= "ALC233", .patch
= patch_alc269
},
4689 { .id
= 0x10ec0255, .name
= "ALC255", .patch
= patch_alc269
},
4690 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
4691 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
4692 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
4693 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
4694 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
4695 { .id
= 0x10ec0270, .name
= "ALC270", .patch
= patch_alc269
},
4696 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
4697 { .id
= 0x10ec0275, .name
= "ALC275", .patch
= patch_alc269
},
4698 { .id
= 0x10ec0276, .name
= "ALC276", .patch
= patch_alc269
},
4699 { .id
= 0x10ec0280, .name
= "ALC280", .patch
= patch_alc269
},
4700 { .id
= 0x10ec0282, .name
= "ALC282", .patch
= patch_alc269
},
4701 { .id
= 0x10ec0283, .name
= "ALC283", .patch
= patch_alc269
},
4702 { .id
= 0x10ec0284, .name
= "ALC284", .patch
= patch_alc269
},
4703 { .id
= 0x10ec0286, .name
= "ALC286", .patch
= patch_alc269
},
4704 { .id
= 0x10ec0288, .name
= "ALC288", .patch
= patch_alc269
},
4705 { .id
= 0x10ec0290, .name
= "ALC290", .patch
= patch_alc269
},
4706 { .id
= 0x10ec0292, .name
= "ALC292", .patch
= patch_alc269
},
4707 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
4708 .patch
= patch_alc861
},
4709 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
4710 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
4711 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
4712 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
4713 .patch
= patch_alc882
},
4714 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
4715 .patch
= patch_alc662
},
4716 { .id
= 0x10ec0662, .rev
= 0x100300, .name
= "ALC662 rev3",
4717 .patch
= patch_alc662
},
4718 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
4719 { .id
= 0x10ec0665, .name
= "ALC665", .patch
= patch_alc662
},
4720 { .id
= 0x10ec0668, .name
= "ALC668", .patch
= patch_alc662
},
4721 { .id
= 0x10ec0670, .name
= "ALC670", .patch
= patch_alc662
},
4722 { .id
= 0x10ec0671, .name
= "ALC671", .patch
= patch_alc662
},
4723 { .id
= 0x10ec0680, .name
= "ALC680", .patch
= patch_alc680
},
4724 { .id
= 0x10ec0867, .name
= "ALC891", .patch
= patch_alc882
},
4725 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
4726 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
4727 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc882
},
4728 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
4729 .patch
= patch_alc882
},
4730 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
4731 .patch
= patch_alc882
},
4732 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
4733 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc882
},
4734 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
4735 .patch
= patch_alc882
},
4736 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc882
},
4737 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc882
},
4738 { .id
= 0x10ec0892, .name
= "ALC892", .patch
= patch_alc662
},
4739 { .id
= 0x10ec0899, .name
= "ALC898", .patch
= patch_alc882
},
4740 { .id
= 0x10ec0900, .name
= "ALC1150", .patch
= patch_alc882
},
4744 MODULE_ALIAS("snd-hda-codec-id:10ec*");
4746 MODULE_LICENSE("GPL");
4747 MODULE_DESCRIPTION("Realtek HD-audio codec");
4749 static struct hda_codec_preset_list realtek_list
= {
4750 .preset
= snd_hda_preset_realtek
,
4751 .owner
= THIS_MODULE
,
4754 static int __init
patch_realtek_init(void)
4756 return snd_hda_add_codec_preset(&realtek_list
);
4759 static void __exit
patch_realtek_exit(void)
4761 snd_hda_delete_codec_preset(&realtek_list
);
4764 module_init(patch_realtek_init
)
4765 module_exit(patch_realtek_exit
)