2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 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@physics.adelaide.edu.au>
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 <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
34 #define ALC880_FRONT_EVENT 0x01
35 #define ALC880_DCVOL_EVENT 0x02
36 #define ALC880_HP_EVENT 0x04
37 #define ALC880_MIC_EVENT 0x08
39 /* ALC880 board config type */
63 #ifdef CONFIG_SND_DEBUG
67 ALC880_MODEL_LAST
/* last tag */
80 #ifdef CONFIG_SND_DEBUG
84 ALC260_MODEL_LAST
/* last tag */
94 ALC262_HP_BPC_D7000_WL
,
95 ALC262_HP_BPC_D7000_WF
,
107 ALC262_MODEL_LAST
/* last tag */
117 ALC268_ACER_ASPIRE_ONE
,
120 #ifdef CONFIG_SND_DEBUG
124 ALC268_MODEL_LAST
/* last tag */
131 ALC269_ASUS_EEEPC_P703
,
132 ALC269_ASUS_EEEPC_P901
,
136 ALC269_MODEL_LAST
/* last tag */
153 /* ALC861-VD models */
175 ALC662_ASUS_EEEPC_P701
,
176 ALC662_ASUS_EEEPC_EP20
,
215 ALC883_TARGA_2ch_DIG
,
218 ALC888_ACER_ASPIRE_4930G
,
222 ALC883_LENOVO_101E_2ch
,
223 ALC883_LENOVO_NB0763
,
224 ALC888_LENOVO_MS7195_DIG
,
231 ALC883_FUJITSU_PI2515
,
232 ALC888_FUJITSU_XA3530
,
233 ALC883_3ST_6ch_INTEL
,
242 #define GPIO_MASK 0x03
245 /* codec parameterization */
246 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
247 unsigned int num_mixers
;
248 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
250 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
254 unsigned int num_init_verbs
;
256 char *stream_name_analog
; /* analog PCM stream */
257 struct hda_pcm_stream
*stream_analog_playback
;
258 struct hda_pcm_stream
*stream_analog_capture
;
259 struct hda_pcm_stream
*stream_analog_alt_playback
;
260 struct hda_pcm_stream
*stream_analog_alt_capture
;
262 char *stream_name_digital
; /* digital PCM stream */
263 struct hda_pcm_stream
*stream_digital_playback
;
264 struct hda_pcm_stream
*stream_digital_capture
;
267 struct hda_multi_out multiout
; /* playback set-up
268 * max_channels, dacs must be set
269 * dig_out_nid and hp_nid are optional
271 hda_nid_t alt_dac_nid
;
274 unsigned int num_adc_nids
;
276 hda_nid_t
*capsrc_nids
;
277 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
278 unsigned char is_mix_capture
; /* matrix-style capture (non-mux) */
281 unsigned int num_mux_defs
;
282 const struct hda_input_mux
*input_mux
;
283 unsigned int cur_mux
[3];
286 const struct hda_channel_mode
*channel_mode
;
287 int num_channel_mode
;
290 /* PCM information */
291 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
293 /* dynamic controls, init_verbs and input_mux */
294 struct auto_pin_cfg autocfg
;
295 struct snd_array kctls
;
296 struct hda_input_mux private_imux
;
297 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
300 void (*init_hook
)(struct hda_codec
*codec
);
301 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
303 /* for pin sensing */
304 unsigned int sense_updated
: 1;
305 unsigned int jack_present
: 1;
306 unsigned int master_sw
: 1;
308 /* for virtual master */
309 hda_nid_t vmaster_nid
;
310 #ifdef CONFIG_SND_HDA_POWER_SAVE
311 struct hda_loopback_check loopback
;
316 unsigned int pll_coef_idx
, pll_coef_bit
;
318 #ifdef SND_HDA_NEEDS_RESUME
319 #define ALC_MAX_PINS 16
320 unsigned int num_pins
;
321 hda_nid_t pin_nids
[ALC_MAX_PINS
];
322 unsigned int pin_cfgs
[ALC_MAX_PINS
];
327 * configuration template - to be copied to the spec instance
329 struct alc_config_preset
{
330 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
333 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
334 const struct hda_verb
*init_verbs
[5];
335 unsigned int num_dacs
;
337 hda_nid_t dig_out_nid
; /* optional */
338 hda_nid_t hp_nid
; /* optional */
339 unsigned int num_adc_nids
;
341 hda_nid_t
*capsrc_nids
;
342 hda_nid_t dig_in_nid
;
343 unsigned int num_channel_mode
;
344 const struct hda_channel_mode
*channel_mode
;
346 unsigned int num_mux_defs
;
347 const struct hda_input_mux
*input_mux
;
348 void (*unsol_event
)(struct hda_codec
*, unsigned int);
349 void (*init_hook
)(struct hda_codec
*);
350 #ifdef CONFIG_SND_HDA_POWER_SAVE
351 struct hda_amp_list
*loopbacks
;
359 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
360 struct snd_ctl_elem_info
*uinfo
)
362 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
363 struct alc_spec
*spec
= codec
->spec
;
364 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
365 if (mux_idx
>= spec
->num_mux_defs
)
367 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
370 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
371 struct snd_ctl_elem_value
*ucontrol
)
373 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
374 struct alc_spec
*spec
= codec
->spec
;
375 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
377 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
381 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
382 struct snd_ctl_elem_value
*ucontrol
)
384 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
385 struct alc_spec
*spec
= codec
->spec
;
386 const struct hda_input_mux
*imux
;
387 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
388 unsigned int mux_idx
;
389 hda_nid_t nid
= spec
->capsrc_nids
?
390 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
392 mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
393 imux
= &spec
->input_mux
[mux_idx
];
395 if (spec
->is_mix_capture
) {
396 /* Matrix-mixer style (e.g. ALC882) */
397 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
400 idx
= ucontrol
->value
.enumerated
.item
[0];
401 if (idx
>= imux
->num_items
)
402 idx
= imux
->num_items
- 1;
405 for (i
= 0; i
< imux
->num_items
; i
++) {
406 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
407 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
408 imux
->items
[i
].index
,
414 /* MUX style (e.g. ALC880) */
415 return snd_hda_input_mux_put(codec
, imux
, ucontrol
, nid
,
416 &spec
->cur_mux
[adc_idx
]);
421 * channel mode setting
423 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
424 struct snd_ctl_elem_info
*uinfo
)
426 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
427 struct alc_spec
*spec
= codec
->spec
;
428 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
429 spec
->num_channel_mode
);
432 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
433 struct snd_ctl_elem_value
*ucontrol
)
435 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
436 struct alc_spec
*spec
= codec
->spec
;
437 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
438 spec
->num_channel_mode
,
439 spec
->multiout
.max_channels
);
442 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
443 struct snd_ctl_elem_value
*ucontrol
)
445 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
446 struct alc_spec
*spec
= codec
->spec
;
447 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
448 spec
->num_channel_mode
,
449 &spec
->multiout
.max_channels
);
450 if (err
>= 0 && spec
->need_dac_fix
)
451 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
456 * Control the mode of pin widget settings via the mixer. "pc" is used
457 * instead of "%" to avoid consequences of accidently treating the % as
458 * being part of a format specifier. Maximum allowed length of a value is
459 * 63 characters plus NULL terminator.
461 * Note: some retasking pin complexes seem to ignore requests for input
462 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
463 * are requested. Therefore order this list so that this behaviour will not
464 * cause problems when mixer clients move through the enum sequentially.
465 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
468 static char *alc_pin_mode_names
[] = {
469 "Mic 50pc bias", "Mic 80pc bias",
470 "Line in", "Line out", "Headphone out",
472 static unsigned char alc_pin_mode_values
[] = {
473 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
475 /* The control can present all 5 options, or it can limit the options based
476 * in the pin being assumed to be exclusively an input or an output pin. In
477 * addition, "input" pins may or may not process the mic bias option
478 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
479 * accept requests for bias as of chip versions up to March 2006) and/or
480 * wiring in the computer.
482 #define ALC_PIN_DIR_IN 0x00
483 #define ALC_PIN_DIR_OUT 0x01
484 #define ALC_PIN_DIR_INOUT 0x02
485 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
486 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
488 /* Info about the pin modes supported by the different pin direction modes.
489 * For each direction the minimum and maximum values are given.
491 static signed char alc_pin_mode_dir_info
[5][2] = {
492 { 0, 2 }, /* ALC_PIN_DIR_IN */
493 { 3, 4 }, /* ALC_PIN_DIR_OUT */
494 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
495 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
496 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
498 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
499 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
500 #define alc_pin_mode_n_items(_dir) \
501 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
503 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
504 struct snd_ctl_elem_info
*uinfo
)
506 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
507 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
509 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
511 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
513 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
514 item_num
= alc_pin_mode_min(dir
);
515 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
519 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
520 struct snd_ctl_elem_value
*ucontrol
)
523 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
524 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
525 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
526 long *valp
= ucontrol
->value
.integer
.value
;
527 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
528 AC_VERB_GET_PIN_WIDGET_CONTROL
,
531 /* Find enumerated value for current pinctl setting */
532 i
= alc_pin_mode_min(dir
);
533 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
535 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
539 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
540 struct snd_ctl_elem_value
*ucontrol
)
543 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
544 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
545 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
546 long val
= *ucontrol
->value
.integer
.value
;
547 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
548 AC_VERB_GET_PIN_WIDGET_CONTROL
,
551 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
552 val
= alc_pin_mode_min(dir
);
554 change
= pinctl
!= alc_pin_mode_values
[val
];
556 /* Set pin mode to that requested */
557 snd_hda_codec_write_cache(codec
, nid
, 0,
558 AC_VERB_SET_PIN_WIDGET_CONTROL
,
559 alc_pin_mode_values
[val
]);
561 /* Also enable the retasking pin's input/output as required
562 * for the requested pin mode. Enum values of 2 or less are
565 * Dynamically switching the input/output buffers probably
566 * reduces noise slightly (particularly on input) so we'll
567 * do it. However, having both input and output buffers
568 * enabled simultaneously doesn't seem to be problematic if
569 * this turns out to be necessary in the future.
572 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
573 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
574 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
577 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
578 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
579 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
586 #define ALC_PIN_MODE(xname, nid, dir) \
587 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
588 .info = alc_pin_mode_info, \
589 .get = alc_pin_mode_get, \
590 .put = alc_pin_mode_put, \
591 .private_value = nid | (dir<<16) }
593 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
594 * together using a mask with more than one bit set. This control is
595 * currently used only by the ALC260 test model. At this stage they are not
596 * needed for any "production" models.
598 #ifdef CONFIG_SND_DEBUG
599 #define alc_gpio_data_info snd_ctl_boolean_mono_info
601 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
602 struct snd_ctl_elem_value
*ucontrol
)
604 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
605 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
606 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
607 long *valp
= ucontrol
->value
.integer
.value
;
608 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
609 AC_VERB_GET_GPIO_DATA
, 0x00);
611 *valp
= (val
& mask
) != 0;
614 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
615 struct snd_ctl_elem_value
*ucontrol
)
618 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
619 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
620 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
621 long val
= *ucontrol
->value
.integer
.value
;
622 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
623 AC_VERB_GET_GPIO_DATA
,
626 /* Set/unset the masked GPIO bit(s) as needed */
627 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
632 snd_hda_codec_write_cache(codec
, nid
, 0,
633 AC_VERB_SET_GPIO_DATA
, gpio_data
);
637 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
638 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
639 .info = alc_gpio_data_info, \
640 .get = alc_gpio_data_get, \
641 .put = alc_gpio_data_put, \
642 .private_value = nid | (mask<<16) }
643 #endif /* CONFIG_SND_DEBUG */
645 /* A switch control to allow the enabling of the digital IO pins on the
646 * ALC260. This is incredibly simplistic; the intention of this control is
647 * to provide something in the test model allowing digital outputs to be
648 * identified if present. If models are found which can utilise these
649 * outputs a more complete mixer control can be devised for those models if
652 #ifdef CONFIG_SND_DEBUG
653 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
655 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
656 struct snd_ctl_elem_value
*ucontrol
)
658 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
659 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
660 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
661 long *valp
= ucontrol
->value
.integer
.value
;
662 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
663 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
665 *valp
= (val
& mask
) != 0;
668 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
669 struct snd_ctl_elem_value
*ucontrol
)
672 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
673 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
674 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
675 long val
= *ucontrol
->value
.integer
.value
;
676 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
677 AC_VERB_GET_DIGI_CONVERT_1
,
680 /* Set/unset the masked control bit(s) as needed */
681 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
686 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
691 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
692 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
693 .info = alc_spdif_ctrl_info, \
694 .get = alc_spdif_ctrl_get, \
695 .put = alc_spdif_ctrl_put, \
696 .private_value = nid | (mask<<16) }
697 #endif /* CONFIG_SND_DEBUG */
699 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
700 * Again, this is only used in the ALC26x test models to help identify when
701 * the EAPD line must be asserted for features to work.
703 #ifdef CONFIG_SND_DEBUG
704 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
706 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
707 struct snd_ctl_elem_value
*ucontrol
)
709 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
710 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
711 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
712 long *valp
= ucontrol
->value
.integer
.value
;
713 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
714 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
716 *valp
= (val
& mask
) != 0;
720 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
721 struct snd_ctl_elem_value
*ucontrol
)
724 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
725 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
726 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
727 long val
= *ucontrol
->value
.integer
.value
;
728 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
729 AC_VERB_GET_EAPD_BTLENABLE
,
732 /* Set/unset the masked control bit(s) as needed */
733 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
738 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
744 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
745 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
746 .info = alc_eapd_ctrl_info, \
747 .get = alc_eapd_ctrl_get, \
748 .put = alc_eapd_ctrl_put, \
749 .private_value = nid | (mask<<16) }
750 #endif /* CONFIG_SND_DEBUG */
754 static void add_mixer(struct alc_spec
*spec
, struct snd_kcontrol_new
*mix
)
756 if (snd_BUG_ON(spec
->num_mixers
>= ARRAY_SIZE(spec
->mixers
)))
758 spec
->mixers
[spec
->num_mixers
++] = mix
;
761 static void add_verb(struct alc_spec
*spec
, const struct hda_verb
*verb
)
763 if (snd_BUG_ON(spec
->num_init_verbs
>= ARRAY_SIZE(spec
->init_verbs
)))
765 spec
->init_verbs
[spec
->num_init_verbs
++] = verb
;
769 * set up from the preset table
771 static void setup_preset(struct alc_spec
*spec
,
772 const struct alc_config_preset
*preset
)
776 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
777 add_mixer(spec
, preset
->mixers
[i
]);
778 spec
->cap_mixer
= preset
->cap_mixer
;
779 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
781 add_verb(spec
, preset
->init_verbs
[i
]);
783 spec
->channel_mode
= preset
->channel_mode
;
784 spec
->num_channel_mode
= preset
->num_channel_mode
;
785 spec
->need_dac_fix
= preset
->need_dac_fix
;
787 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
789 spec
->multiout
.num_dacs
= preset
->num_dacs
;
790 spec
->multiout
.dac_nids
= preset
->dac_nids
;
791 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
792 spec
->multiout
.hp_nid
= preset
->hp_nid
;
794 spec
->num_mux_defs
= preset
->num_mux_defs
;
795 if (!spec
->num_mux_defs
)
796 spec
->num_mux_defs
= 1;
797 spec
->input_mux
= preset
->input_mux
;
799 spec
->num_adc_nids
= preset
->num_adc_nids
;
800 spec
->adc_nids
= preset
->adc_nids
;
801 spec
->capsrc_nids
= preset
->capsrc_nids
;
802 spec
->dig_in_nid
= preset
->dig_in_nid
;
804 spec
->unsol_event
= preset
->unsol_event
;
805 spec
->init_hook
= preset
->init_hook
;
806 #ifdef CONFIG_SND_HDA_POWER_SAVE
807 spec
->loopback
.amplist
= preset
->loopbacks
;
811 /* Enable GPIO mask and set output */
812 static struct hda_verb alc_gpio1_init_verbs
[] = {
813 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
814 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
815 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
819 static struct hda_verb alc_gpio2_init_verbs
[] = {
820 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
821 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
822 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
826 static struct hda_verb alc_gpio3_init_verbs
[] = {
827 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
828 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
829 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
834 * Fix hardware PLL issue
835 * On some codecs, the analog PLL gating control must be off while
836 * the default value is 1.
838 static void alc_fix_pll(struct hda_codec
*codec
)
840 struct alc_spec
*spec
= codec
->spec
;
845 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
847 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
848 AC_VERB_GET_PROC_COEF
, 0);
849 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
851 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
852 val
& ~(1 << spec
->pll_coef_bit
));
855 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
856 unsigned int coef_idx
, unsigned int coef_bit
)
858 struct alc_spec
*spec
= codec
->spec
;
860 spec
->pll_coef_idx
= coef_idx
;
861 spec
->pll_coef_bit
= coef_bit
;
865 static void alc_sku_automute(struct hda_codec
*codec
)
867 struct alc_spec
*spec
= codec
->spec
;
868 unsigned int present
;
869 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
870 unsigned int sp_nid
= spec
->autocfg
.speaker_pins
[0];
872 /* need to execute and sync at first */
873 snd_hda_codec_read(codec
, hp_nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
874 present
= snd_hda_codec_read(codec
, hp_nid
, 0,
875 AC_VERB_GET_PIN_SENSE
, 0);
876 spec
->jack_present
= (present
& 0x80000000) != 0;
877 snd_hda_codec_write(codec
, sp_nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
878 spec
->jack_present
? 0 : PIN_OUT
);
881 #if 0 /* it's broken in some acses -- temporarily disabled */
882 static void alc_mic_automute(struct hda_codec
*codec
)
884 struct alc_spec
*spec
= codec
->spec
;
885 unsigned int present
;
886 unsigned int mic_nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
887 unsigned int fmic_nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
888 unsigned int mix_nid
= spec
->capsrc_nids
[0];
889 unsigned int capsrc_idx_mic
, capsrc_idx_fmic
;
891 capsrc_idx_mic
= mic_nid
- 0x18;
892 capsrc_idx_fmic
= fmic_nid
- 0x18;
893 present
= snd_hda_codec_read(codec
, mic_nid
, 0,
894 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
895 snd_hda_codec_write(codec
, mix_nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
896 0x7000 | (capsrc_idx_mic
<< 8) | (present
? 0 : 0x80));
897 snd_hda_codec_write(codec
, mix_nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
898 0x7000 | (capsrc_idx_fmic
<< 8) | (present
? 0x80 : 0));
899 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, capsrc_idx_fmic
,
900 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
903 #define alc_mic_automute(codec) /* NOP */
904 #endif /* disabled */
906 /* unsolicited event for HP jack sensing */
907 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
909 if (codec
->vendor_id
== 0x10ec0880)
913 if (res
== ALC880_HP_EVENT
)
914 alc_sku_automute(codec
);
916 if (res
== ALC880_MIC_EVENT
)
917 alc_mic_automute(codec
);
920 static void alc_inithook(struct hda_codec
*codec
)
922 alc_sku_automute(codec
);
923 alc_mic_automute(codec
);
926 /* additional initialization for ALC888 variants */
927 static void alc888_coef_init(struct hda_codec
*codec
)
931 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
932 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
933 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
934 if ((tmp
& 0xf0) == 2)
936 snd_hda_codec_read(codec
, 0x20, 0,
937 AC_VERB_SET_PROC_COEF
, 0x830);
940 snd_hda_codec_read(codec
, 0x20, 0,
941 AC_VERB_SET_PROC_COEF
, 0x3030);
944 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
945 * 31 ~ 16 : Manufacture ID
947 * 7 ~ 0 : Assembly ID
948 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
950 static void alc_subsystem_id(struct hda_codec
*codec
,
951 unsigned int porta
, unsigned int porte
,
954 unsigned int ass
, tmp
, i
;
956 struct alc_spec
*spec
= codec
->spec
;
958 ass
= codec
->subsystem_id
& 0xffff;
959 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
963 * 31~30 : port conetcivity
966 * 19~16 : Check sum (15:1)
971 if (codec
->vendor_id
== 0x10ec0260)
973 ass
= snd_hda_codec_read(codec
, nid
, 0,
974 AC_VERB_GET_CONFIG_DEFAULT
, 0);
975 if (!(ass
& 1) && !(ass
& 0x100000))
977 if ((ass
>> 30) != 1) /* no physical connection */
982 for (i
= 1; i
< 16; i
++) {
986 if (((ass
>> 16) & 0xf) != tmp
)
992 * 2 : 0 --> Desktop, 1 --> Laptop
993 * 3~5 : External Amplifier control
996 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
999 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
1002 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
1005 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
1007 case 5: /* set EAPD output high */
1008 switch (codec
->vendor_id
) {
1010 snd_hda_codec_write(codec
, 0x0f, 0,
1011 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1012 snd_hda_codec_write(codec
, 0x10, 0,
1013 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1024 snd_hda_codec_write(codec
, 0x14, 0,
1025 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1026 snd_hda_codec_write(codec
, 0x15, 0,
1027 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1030 switch (codec
->vendor_id
) {
1032 snd_hda_codec_write(codec
, 0x1a, 0,
1033 AC_VERB_SET_COEF_INDEX
, 7);
1034 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
1035 AC_VERB_GET_PROC_COEF
, 0);
1036 snd_hda_codec_write(codec
, 0x1a, 0,
1037 AC_VERB_SET_COEF_INDEX
, 7);
1038 snd_hda_codec_write(codec
, 0x1a, 0,
1039 AC_VERB_SET_PROC_COEF
,
1048 snd_hda_codec_write(codec
, 0x20, 0,
1049 AC_VERB_SET_COEF_INDEX
, 7);
1050 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1051 AC_VERB_GET_PROC_COEF
, 0);
1052 snd_hda_codec_write(codec
, 0x20, 0,
1053 AC_VERB_SET_COEF_INDEX
, 7);
1054 snd_hda_codec_write(codec
, 0x20, 0,
1055 AC_VERB_SET_PROC_COEF
,
1059 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1063 snd_hda_codec_write(codec
, 0x20, 0,
1064 AC_VERB_SET_COEF_INDEX
, 7);
1065 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1066 AC_VERB_GET_PROC_COEF
, 0);
1067 snd_hda_codec_write(codec
, 0x20, 0,
1068 AC_VERB_SET_COEF_INDEX
, 7);
1069 snd_hda_codec_write(codec
, 0x20, 0,
1070 AC_VERB_SET_PROC_COEF
,
1078 /* is laptop or Desktop and enable the function "Mute internal speaker
1079 * when the external headphone out jack is plugged"
1081 if (!(ass
& 0x8000))
1084 * 10~8 : Jack location
1085 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1087 * 15 : 1 --> enable the function "Mute internal speaker
1088 * when the external headphone out jack is plugged"
1090 if (!spec
->autocfg
.speaker_pins
[0]) {
1091 if (spec
->autocfg
.line_out_pins
[0])
1092 spec
->autocfg
.speaker_pins
[0] =
1093 spec
->autocfg
.line_out_pins
[0];
1098 if (!spec
->autocfg
.hp_pins
[0]) {
1099 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
1101 spec
->autocfg
.hp_pins
[0] = porta
;
1103 spec
->autocfg
.hp_pins
[0] = porte
;
1105 spec
->autocfg
.hp_pins
[0] = portd
;
1109 if (spec
->autocfg
.hp_pins
[0])
1110 snd_hda_codec_write(codec
, spec
->autocfg
.hp_pins
[0], 0,
1111 AC_VERB_SET_UNSOLICITED_ENABLE
,
1112 AC_USRSP_EN
| ALC880_HP_EVENT
);
1114 #if 0 /* it's broken in some acses -- temporarily disabled */
1115 if (spec
->autocfg
.input_pins
[AUTO_PIN_MIC
] &&
1116 spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
])
1117 snd_hda_codec_write(codec
,
1118 spec
->autocfg
.input_pins
[AUTO_PIN_MIC
], 0,
1119 AC_VERB_SET_UNSOLICITED_ENABLE
,
1120 AC_USRSP_EN
| ALC880_MIC_EVENT
);
1121 #endif /* disabled */
1123 spec
->unsol_event
= alc_sku_unsol_event
;
1127 * Fix-up pin default configurations
1135 static void alc_fix_pincfg(struct hda_codec
*codec
,
1136 const struct snd_pci_quirk
*quirk
,
1137 const struct alc_pincfg
**pinfix
)
1139 const struct alc_pincfg
*cfg
;
1141 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
1145 cfg
= pinfix
[quirk
->value
];
1146 for (; cfg
->nid
; cfg
++) {
1149 for (i
= 0; i
< 4; i
++) {
1150 snd_hda_codec_write(codec
, cfg
->nid
, 0,
1151 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
+ i
,
1165 static struct hda_verb alc888_4ST_ch2_intel_init
[] = {
1166 /* Mic-in jack as mic in */
1167 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1168 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1169 /* Line-in jack as Line in */
1170 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1171 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1172 /* Line-Out as Front */
1173 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1180 static struct hda_verb alc888_4ST_ch4_intel_init
[] = {
1181 /* Mic-in jack as mic in */
1182 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1183 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1184 /* Line-in jack as Surround */
1185 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1186 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1187 /* Line-Out as Front */
1188 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1195 static struct hda_verb alc888_4ST_ch6_intel_init
[] = {
1196 /* Mic-in jack as CLFE */
1197 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1198 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1199 /* Line-in jack as Surround */
1200 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1201 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1202 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1203 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1210 static struct hda_verb alc888_4ST_ch8_intel_init
[] = {
1211 /* Mic-in jack as CLFE */
1212 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1213 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1214 /* Line-in jack as Surround */
1215 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1216 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1217 /* Line-Out as Side */
1218 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1222 static struct hda_channel_mode alc888_4ST_8ch_intel_modes
[4] = {
1223 { 2, alc888_4ST_ch2_intel_init
},
1224 { 4, alc888_4ST_ch4_intel_init
},
1225 { 6, alc888_4ST_ch6_intel_init
},
1226 { 8, alc888_4ST_ch8_intel_init
},
1230 * ALC888 Fujitsu Siemens Amillo xa3530
1233 static struct hda_verb alc888_fujitsu_xa3530_verbs
[] = {
1234 /* Front Mic: set to PIN_IN (empty by default) */
1235 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1236 /* Connect Internal HP to Front */
1237 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1238 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1239 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1240 /* Connect Bass HP to Front */
1241 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1242 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1243 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1244 /* Connect Line-Out side jack (SPDIF) to Side */
1245 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1246 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1247 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1248 /* Connect Mic jack to CLFE */
1249 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1250 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1251 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
1252 /* Connect Line-in jack to Surround */
1253 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1254 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1255 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
1256 /* Connect HP out jack to Front */
1257 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1258 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1259 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1260 /* Enable unsolicited event for HP jack and Line-out jack */
1261 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1262 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1266 static void alc888_fujitsu_xa3530_automute(struct hda_codec
*codec
)
1268 unsigned int present
;
1270 /* Line out presence */
1271 present
= snd_hda_codec_read(codec
, 0x17, 0,
1272 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1273 /* HP out presence */
1274 present
= present
|| snd_hda_codec_read(codec
, 0x1b, 0,
1275 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1276 bits
= present
? HDA_AMP_MUTE
: 0;
1277 /* Toggle internal speakers muting */
1278 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
1279 HDA_AMP_MUTE
, bits
);
1280 /* Toggle internal bass muting */
1281 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
1282 HDA_AMP_MUTE
, bits
);
1285 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec
*codec
,
1288 if (res
>> 26 == ALC880_HP_EVENT
)
1289 alc888_fujitsu_xa3530_automute(codec
);
1294 * ALC888 Acer Aspire 4930G model
1297 static struct hda_verb alc888_acer_aspire_4930g_verbs
[] = {
1298 /* Front Mic: set to PIN_IN (empty by default) */
1299 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1300 /* Unselect Front Mic by default in input mixer 3 */
1301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
1302 /* Enable unsolicited event for HP jack */
1303 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1304 /* Connect Internal HP to front */
1305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1306 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1307 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1308 /* Connect HP out to front */
1309 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1310 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1311 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1315 static struct hda_input_mux alc888_2_capture_sources
[2] = {
1316 /* Front mic only available on one ADC */
1323 { "Front Mic", 0xb },
1336 static struct snd_kcontrol_new alc888_base_mixer
[] = {
1337 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1338 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1339 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1340 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1341 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1343 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1344 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1345 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1346 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1347 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1349 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1353 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
1354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1355 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1356 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1360 static void alc888_acer_aspire_4930g_automute(struct hda_codec
*codec
)
1362 unsigned int present
;
1364 present
= snd_hda_codec_read(codec
, 0x15, 0,
1365 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1366 bits
= present
? HDA_AMP_MUTE
: 0;
1367 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
1368 HDA_AMP_MUTE
, bits
);
1371 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec
*codec
,
1374 if (res
>> 26 == ALC880_HP_EVENT
)
1375 alc888_acer_aspire_4930g_automute(codec
);
1379 * ALC880 3-stack model
1381 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1382 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1383 * F-Mic = 0x1b, HP = 0x19
1386 static hda_nid_t alc880_dac_nids
[4] = {
1387 /* front, rear, clfe, rear_surr */
1388 0x02, 0x05, 0x04, 0x03
1391 static hda_nid_t alc880_adc_nids
[3] = {
1396 /* The datasheet says the node 0x07 is connected from inputs,
1397 * but it shows zero connection in the real implementation on some devices.
1398 * Note: this is a 915GAV bug, fixed on 915GLV
1400 static hda_nid_t alc880_adc_nids_alt
[2] = {
1405 #define ALC880_DIGOUT_NID 0x06
1406 #define ALC880_DIGIN_NID 0x0a
1408 static struct hda_input_mux alc880_capture_source
= {
1412 { "Front Mic", 0x3 },
1418 /* channel source setting (2/6 channel selection for 3-stack) */
1420 static struct hda_verb alc880_threestack_ch2_init
[] = {
1421 /* set line-in to input, mute it */
1422 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1423 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1424 /* set mic-in to input vref 80%, mute it */
1425 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1426 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1431 static struct hda_verb alc880_threestack_ch6_init
[] = {
1432 /* set line-in to output, unmute it */
1433 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1434 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1435 /* set mic-in to output, unmute it */
1436 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1437 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1441 static struct hda_channel_mode alc880_threestack_modes
[2] = {
1442 { 2, alc880_threestack_ch2_init
},
1443 { 6, alc880_threestack_ch6_init
},
1446 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
1447 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1448 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1449 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1450 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
1451 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1452 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1453 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1454 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1455 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1456 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1457 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1458 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1460 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1461 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
1462 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
1463 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1464 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1465 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
1467 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1468 .name
= "Channel Mode",
1469 .info
= alc_ch_mode_info
,
1470 .get
= alc_ch_mode_get
,
1471 .put
= alc_ch_mode_put
,
1476 /* capture mixer elements */
1477 static int alc_cap_vol_info(struct snd_kcontrol
*kcontrol
,
1478 struct snd_ctl_elem_info
*uinfo
)
1480 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1481 struct alc_spec
*spec
= codec
->spec
;
1484 mutex_lock(&codec
->spdif_mutex
); /* reuse spdif_mutex */
1485 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
1487 err
= snd_hda_mixer_amp_volume_info(kcontrol
, uinfo
);
1488 mutex_unlock(&codec
->spdif_mutex
); /* reuse spdif_mutex */
1492 static int alc_cap_vol_tlv(struct snd_kcontrol
*kcontrol
, int op_flag
,
1493 unsigned int size
, unsigned int __user
*tlv
)
1495 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1496 struct alc_spec
*spec
= codec
->spec
;
1499 mutex_lock(&codec
->spdif_mutex
); /* reuse spdif_mutex */
1500 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
1502 err
= snd_hda_mixer_amp_tlv(kcontrol
, op_flag
, size
, tlv
);
1503 mutex_unlock(&codec
->spdif_mutex
); /* reuse spdif_mutex */
1507 typedef int (*getput_call_t
)(struct snd_kcontrol
*kcontrol
,
1508 struct snd_ctl_elem_value
*ucontrol
);
1510 static int alc_cap_getput_caller(struct snd_kcontrol
*kcontrol
,
1511 struct snd_ctl_elem_value
*ucontrol
,
1514 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1515 struct alc_spec
*spec
= codec
->spec
;
1516 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
1519 mutex_lock(&codec
->spdif_mutex
); /* reuse spdif_mutex */
1520 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[adc_idx
],
1522 err
= func(kcontrol
, ucontrol
);
1523 mutex_unlock(&codec
->spdif_mutex
); /* reuse spdif_mutex */
1527 static int alc_cap_vol_get(struct snd_kcontrol
*kcontrol
,
1528 struct snd_ctl_elem_value
*ucontrol
)
1530 return alc_cap_getput_caller(kcontrol
, ucontrol
,
1531 snd_hda_mixer_amp_volume_get
);
1534 static int alc_cap_vol_put(struct snd_kcontrol
*kcontrol
,
1535 struct snd_ctl_elem_value
*ucontrol
)
1537 return alc_cap_getput_caller(kcontrol
, ucontrol
,
1538 snd_hda_mixer_amp_volume_put
);
1541 /* capture mixer elements */
1542 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1544 static int alc_cap_sw_get(struct snd_kcontrol
*kcontrol
,
1545 struct snd_ctl_elem_value
*ucontrol
)
1547 return alc_cap_getput_caller(kcontrol
, ucontrol
,
1548 snd_hda_mixer_amp_switch_get
);
1551 static int alc_cap_sw_put(struct snd_kcontrol
*kcontrol
,
1552 struct snd_ctl_elem_value
*ucontrol
)
1554 return alc_cap_getput_caller(kcontrol
, ucontrol
,
1555 snd_hda_mixer_amp_switch_put
);
1558 #define DEFINE_CAPMIX(num) \
1559 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1562 .name = "Capture Switch", \
1563 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1565 .info = alc_cap_sw_info, \
1566 .get = alc_cap_sw_get, \
1567 .put = alc_cap_sw_put, \
1570 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1571 .name = "Capture Volume", \
1572 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1573 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1574 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1576 .info = alc_cap_vol_info, \
1577 .get = alc_cap_vol_get, \
1578 .put = alc_cap_vol_put, \
1579 .tlv = { .c = alc_cap_vol_tlv }, \
1582 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1583 /* .name = "Capture Source", */ \
1584 .name = "Input Source", \
1586 .info = alc_mux_enum_info, \
1587 .get = alc_mux_enum_get, \
1588 .put = alc_mux_enum_put, \
1593 /* up to three ADCs */
1600 * ALC880 5-stack model
1602 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1604 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1605 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1608 /* additional mixers to alc880_three_stack_mixer */
1609 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
1610 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1611 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
1615 /* channel source setting (6/8 channel selection for 5-stack) */
1617 static struct hda_verb alc880_fivestack_ch6_init
[] = {
1618 /* set line-in to input, mute it */
1619 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1620 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1625 static struct hda_verb alc880_fivestack_ch8_init
[] = {
1626 /* set line-in to output, unmute it */
1627 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1628 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1632 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
1633 { 6, alc880_fivestack_ch6_init
},
1634 { 8, alc880_fivestack_ch8_init
},
1639 * ALC880 6-stack model
1641 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1642 * Side = 0x05 (0x0f)
1643 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1644 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1647 static hda_nid_t alc880_6st_dac_nids
[4] = {
1648 /* front, rear, clfe, rear_surr */
1649 0x02, 0x03, 0x04, 0x05
1652 static struct hda_input_mux alc880_6stack_capture_source
= {
1656 { "Front Mic", 0x1 },
1662 /* fixed 8-channels */
1663 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
1667 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
1668 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1669 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1670 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1671 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1672 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1673 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1674 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1675 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1676 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1677 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1678 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1679 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1680 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1681 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1683 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1684 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1685 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1686 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1687 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1689 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1690 .name
= "Channel Mode",
1691 .info
= alc_ch_mode_info
,
1692 .get
= alc_ch_mode_get
,
1693 .put
= alc_ch_mode_put
,
1702 * W810 has rear IO for:
1705 * Center/LFE (DAC 04)
1708 * The system also has a pair of internal speakers, and a headphone jack.
1709 * These are both connected to Line2 on the codec, hence to DAC 02.
1711 * There is a variable resistor to control the speaker or headphone
1712 * volume. This is a hardware-only device without a software API.
1714 * Plugging headphones in will disable the internal speakers. This is
1715 * implemented in hardware, not via the driver using jack sense. In
1716 * a similar fashion, plugging into the rear socket marked "front" will
1717 * disable both the speakers and headphones.
1719 * For input, there's a microphone jack, and an "audio in" jack.
1720 * These may not do anything useful with this driver yet, because I
1721 * haven't setup any initialization verbs for these yet...
1724 static hda_nid_t alc880_w810_dac_nids
[3] = {
1725 /* front, rear/surround, clfe */
1729 /* fixed 6 channels */
1730 static struct hda_channel_mode alc880_w810_modes
[1] = {
1734 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1735 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
1736 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1737 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1738 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1739 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1740 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1741 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1742 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1743 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1744 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1752 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1753 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1757 static hda_nid_t alc880_z71v_dac_nids
[1] = {
1760 #define ALC880_Z71V_HP_DAC 0x03
1762 /* fixed 2 channels */
1763 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
1767 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
1768 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1769 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1770 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1771 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
1772 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1773 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1774 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1781 * ALC880 F1734 model
1783 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1784 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1787 static hda_nid_t alc880_f1734_dac_nids
[1] = {
1790 #define ALC880_F1734_HP_DAC 0x02
1792 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
1793 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1794 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1795 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1796 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1797 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1798 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1804 static struct hda_input_mux alc880_f1734_capture_source
= {
1816 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1817 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1818 * Mic = 0x18, Line = 0x1a
1821 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1822 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1824 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
1825 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1826 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1827 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1828 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1829 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1830 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1831 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1832 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1833 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1834 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1835 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1836 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1840 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1841 .name
= "Channel Mode",
1842 .info
= alc_ch_mode_info
,
1843 .get
= alc_ch_mode_get
,
1844 .put
= alc_ch_mode_put
,
1850 * ALC880 ASUS W1V model
1852 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1853 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1854 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1857 /* additional mixers to alc880_asus_mixer */
1858 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
1859 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
1860 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
1864 /* additional mixers to alc880_asus_mixer */
1865 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
1866 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1867 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1872 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
1873 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1874 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1875 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
1876 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
1877 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
1878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
1879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
1880 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1881 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1886 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
1887 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1888 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1889 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1890 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1891 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1892 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1893 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1894 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1895 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1896 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1897 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1898 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1899 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1900 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1901 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1902 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1903 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1904 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1906 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1907 .name
= "Channel Mode",
1908 .info
= alc_ch_mode_info
,
1909 .get
= alc_ch_mode_get
,
1910 .put
= alc_ch_mode_put
,
1915 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
1916 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1917 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1918 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1919 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1920 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1921 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1922 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1923 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1924 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1925 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1929 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
1930 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1931 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1932 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1933 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1934 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1935 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1940 * virtual master controls
1944 * slave controls for virtual master
1946 static const char *alc_slave_vols
[] = {
1947 "Front Playback Volume",
1948 "Surround Playback Volume",
1949 "Center Playback Volume",
1950 "LFE Playback Volume",
1951 "Side Playback Volume",
1952 "Headphone Playback Volume",
1953 "Speaker Playback Volume",
1954 "Mono Playback Volume",
1955 "Line-Out Playback Volume",
1956 "PCM Playback Volume",
1960 static const char *alc_slave_sws
[] = {
1961 "Front Playback Switch",
1962 "Surround Playback Switch",
1963 "Center Playback Switch",
1964 "LFE Playback Switch",
1965 "Side Playback Switch",
1966 "Headphone Playback Switch",
1967 "Speaker Playback Switch",
1968 "Mono Playback Switch",
1969 "IEC958 Playback Switch",
1974 * build control elements
1977 static void alc_free_kctls(struct hda_codec
*codec
);
1979 static int alc_build_controls(struct hda_codec
*codec
)
1981 struct alc_spec
*spec
= codec
->spec
;
1985 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1986 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1990 if (spec
->cap_mixer
) {
1991 err
= snd_hda_add_new_ctls(codec
, spec
->cap_mixer
);
1995 if (spec
->multiout
.dig_out_nid
) {
1996 err
= snd_hda_create_spdif_out_ctls(codec
,
1997 spec
->multiout
.dig_out_nid
);
2000 err
= snd_hda_create_spdif_share_sw(codec
,
2004 spec
->multiout
.share_spdif
= 1;
2006 if (spec
->dig_in_nid
) {
2007 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
2012 /* if we have no master control, let's create it */
2013 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
2014 unsigned int vmaster_tlv
[4];
2015 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
2016 HDA_OUTPUT
, vmaster_tlv
);
2017 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
2018 vmaster_tlv
, alc_slave_vols
);
2022 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
2023 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
2024 NULL
, alc_slave_sws
);
2029 alc_free_kctls(codec
); /* no longer needed */
2035 * initialize the codec volumes, etc
2039 * generic initialization of ADC, input mixers and output mixers
2041 static struct hda_verb alc880_volume_init_verbs
[] = {
2043 * Unmute ADC0-2 and set the default input to mic-in
2045 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2046 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2047 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2048 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2049 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2050 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2052 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2054 * Note: PASD motherboards uses the Line In 2 as the input for front
2057 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2058 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
2063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2067 * Set up output mixers (0x0c - 0x0f)
2069 /* set vol=0 to output mixers */
2070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2071 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2072 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2073 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2074 /* set up input amps for analog loopback */
2075 /* Amp Indices: DAC = 0, mixer = 1 */
2076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2077 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2078 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2089 * 3-stack pin configuration:
2090 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2092 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
2094 * preset connection lists of input pins
2095 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2097 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2098 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2099 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2102 * Set pin mode and muting
2104 /* set front pin widgets 0x14 for output */
2105 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2106 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2107 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2108 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2109 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2110 /* Mic2 (as headphone out) for HP output */
2111 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2112 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2113 /* Line In pin widget for input */
2114 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2115 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2116 /* Line2 (as front mic) pin widget for input and vref at 80% */
2117 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2118 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2119 /* CD pin widget for input */
2120 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2126 * 5-stack pin configuration:
2127 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2128 * line-in/side = 0x1a, f-mic = 0x1b
2130 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
2132 * preset connection lists of input pins
2133 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2135 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2136 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
2139 * Set pin mode and muting
2141 /* set pin widgets 0x14-0x17 for output */
2142 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2143 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2144 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2145 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2146 /* unmute pins for output (no gain on this amp) */
2147 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2148 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2149 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2150 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2152 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2153 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2154 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2155 /* Mic2 (as headphone out) for HP output */
2156 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2157 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2158 /* Line In pin widget for input */
2159 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2160 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2161 /* Line2 (as front mic) pin widget for input and vref at 80% */
2162 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2163 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2164 /* CD pin widget for input */
2165 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2171 * W810 pin configuration:
2172 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2174 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
2175 /* hphone/speaker input selector: front DAC */
2176 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
2178 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2179 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2180 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2181 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2182 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2183 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2185 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2186 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2192 * Z71V pin configuration:
2193 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2195 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
2196 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2197 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2198 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2199 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2201 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2202 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2203 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2204 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2210 * 6-stack pin configuration:
2211 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2212 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2214 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
2215 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2221 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2222 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2223 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2224 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2226 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2227 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2228 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2229 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2230 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2231 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2232 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2233 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2234 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2240 * Uniwill pin configuration:
2241 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2244 static struct hda_verb alc880_uniwill_init_verbs
[] = {
2245 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2247 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2248 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2249 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2250 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2251 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2252 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2253 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2254 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2257 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2258 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2262 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2263 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2264 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2265 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2266 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2268 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2269 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2270 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2272 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2273 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
2280 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2282 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
2283 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2285 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2286 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2287 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2288 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2289 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2293 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2296 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2298 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2299 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2300 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2301 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2302 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2303 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2305 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2306 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
2311 static struct hda_verb alc880_beep_init_verbs
[] = {
2312 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
2316 /* toggle speaker-output according to the hp-jack state */
2317 static void alc880_uniwill_hp_automute(struct hda_codec
*codec
)
2319 unsigned int present
;
2322 present
= snd_hda_codec_read(codec
, 0x14, 0,
2323 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2324 bits
= present
? HDA_AMP_MUTE
: 0;
2325 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
2326 HDA_AMP_MUTE
, bits
);
2327 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
2328 HDA_AMP_MUTE
, bits
);
2331 /* auto-toggle front mic */
2332 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
2334 unsigned int present
;
2337 present
= snd_hda_codec_read(codec
, 0x18, 0,
2338 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2339 bits
= present
? HDA_AMP_MUTE
: 0;
2340 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
2343 static void alc880_uniwill_automute(struct hda_codec
*codec
)
2345 alc880_uniwill_hp_automute(codec
);
2346 alc880_uniwill_mic_automute(codec
);
2349 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
2352 /* Looks like the unsol event is incompatible with the standard
2353 * definition. 4bit tag is placed at 28 bit!
2355 switch (res
>> 28) {
2356 case ALC880_HP_EVENT
:
2357 alc880_uniwill_hp_automute(codec
);
2359 case ALC880_MIC_EVENT
:
2360 alc880_uniwill_mic_automute(codec
);
2365 static void alc880_uniwill_p53_hp_automute(struct hda_codec
*codec
)
2367 unsigned int present
;
2370 present
= snd_hda_codec_read(codec
, 0x14, 0,
2371 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2372 bits
= present
? HDA_AMP_MUTE
: 0;
2373 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0, HDA_AMP_MUTE
, bits
);
2376 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
2378 unsigned int present
;
2380 present
= snd_hda_codec_read(codec
, 0x21, 0,
2381 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
2382 present
&= HDA_AMP_VOLMASK
;
2383 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
2384 HDA_AMP_VOLMASK
, present
);
2385 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
2386 HDA_AMP_VOLMASK
, present
);
2389 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
2392 /* Looks like the unsol event is incompatible with the standard
2393 * definition. 4bit tag is placed at 28 bit!
2395 if ((res
>> 28) == ALC880_HP_EVENT
)
2396 alc880_uniwill_p53_hp_automute(codec
);
2397 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
2398 alc880_uniwill_p53_dcvol_automute(codec
);
2402 * F1734 pin configuration:
2403 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2405 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
2406 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
2407 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2408 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2409 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2410 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2413 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2414 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2415 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2417 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2418 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2419 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
2420 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2421 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2422 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2423 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2424 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2425 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2427 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
2428 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
2434 * ASUS pin configuration:
2435 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2437 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
2438 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2439 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2440 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2441 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2446 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2447 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2448 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2449 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2450 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2452 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2453 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2454 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2455 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2456 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2457 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2458 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2459 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2460 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2465 /* Enable GPIO mask and set output */
2466 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2467 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2469 /* Clevo m520g init */
2470 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
2471 /* headphone output */
2472 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2475 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2477 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2478 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2480 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2481 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2482 /* Mic1 (rear panel) */
2483 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2484 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2485 /* Mic2 (front panel) */
2486 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2487 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2489 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2490 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2491 /* change to EAPD mode */
2492 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2493 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2498 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
2499 /* change to EAPD mode */
2500 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2501 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2503 /* Headphone output */
2504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2506 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2507 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2509 /* Line In pin widget for input */
2510 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2511 /* CD pin widget for input */
2512 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2513 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2514 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2516 /* change to EAPD mode */
2517 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2518 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
2524 * LG m1 express dual
2527 * Rear Line-In/Out (blue): 0x14
2528 * Build-in Mic-In: 0x15
2530 * HP-Out (green): 0x1b
2531 * Mic-In/Out (red): 0x19
2535 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2536 static hda_nid_t alc880_lg_dac_nids
[3] = {
2540 /* seems analog CD is not working */
2541 static struct hda_input_mux alc880_lg_capture_source
= {
2546 { "Internal Mic", 0x6 },
2550 /* 2,4,6 channel modes */
2551 static struct hda_verb alc880_lg_ch2_init
[] = {
2552 /* set line-in and mic-in to input */
2553 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2554 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2558 static struct hda_verb alc880_lg_ch4_init
[] = {
2559 /* set line-in to out and mic-in to input */
2560 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2561 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2565 static struct hda_verb alc880_lg_ch6_init
[] = {
2566 /* set line-in and mic-in to output */
2567 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2568 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2572 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
2573 { 2, alc880_lg_ch2_init
},
2574 { 4, alc880_lg_ch4_init
},
2575 { 6, alc880_lg_ch6_init
},
2578 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
2579 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2580 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
2581 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2582 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
2583 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
2584 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
2585 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
2586 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
2587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2589 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
2590 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
2591 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
2592 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
2594 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2595 .name
= "Channel Mode",
2596 .info
= alc_ch_mode_info
,
2597 .get
= alc_ch_mode_get
,
2598 .put
= alc_ch_mode_put
,
2603 static struct hda_verb alc880_lg_init_verbs
[] = {
2604 /* set capture source to mic-in */
2605 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2606 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2607 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2608 /* mute all amp mixer inputs */
2609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
2610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2612 /* line-in to input */
2613 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2614 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2616 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2619 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2620 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2621 /* mic-in to input */
2622 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2623 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2624 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2626 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
2627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2630 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2634 /* toggle speaker-output according to the hp-jack state */
2635 static void alc880_lg_automute(struct hda_codec
*codec
)
2637 unsigned int present
;
2640 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2641 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2642 bits
= present
? HDA_AMP_MUTE
: 0;
2643 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
2644 HDA_AMP_MUTE
, bits
);
2647 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2649 /* Looks like the unsol event is incompatible with the standard
2650 * definition. 4bit tag is placed at 28 bit!
2652 if ((res
>> 28) == 0x01)
2653 alc880_lg_automute(codec
);
2662 * Built-in Mic-In: 0x19
2668 static struct hda_input_mux alc880_lg_lw_capture_source
= {
2672 { "Internal Mic", 0x1 },
2677 #define alc880_lg_lw_modes alc880_threestack_modes
2679 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
2680 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2681 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2682 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2683 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2684 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2685 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2686 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2687 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2688 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2689 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2690 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2691 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2692 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
2693 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
2695 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2696 .name
= "Channel Mode",
2697 .info
= alc_ch_mode_info
,
2698 .get
= alc_ch_mode_get
,
2699 .put
= alc_ch_mode_put
,
2704 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
2705 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2706 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2707 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2709 /* set capture source to mic-in */
2710 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2711 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2712 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2715 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2716 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2718 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2719 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2720 /* mic-in to input */
2721 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2722 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2724 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2725 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2727 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2731 /* toggle speaker-output according to the hp-jack state */
2732 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
2734 unsigned int present
;
2737 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2738 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2739 bits
= present
? HDA_AMP_MUTE
: 0;
2740 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
2741 HDA_AMP_MUTE
, bits
);
2744 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2746 /* Looks like the unsol event is incompatible with the standard
2747 * definition. 4bit tag is placed at 28 bit!
2749 if ((res
>> 28) == 0x01)
2750 alc880_lg_lw_automute(codec
);
2753 static struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
2754 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2755 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
2756 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2758 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2759 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2763 static struct hda_input_mux alc880_medion_rim_capture_source
= {
2767 { "Internal Mic", 0x1 },
2771 static struct hda_verb alc880_medion_rim_init_verbs
[] = {
2772 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2774 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2775 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2777 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2778 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2779 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2780 /* Mic2 (as headphone out) for HP output */
2781 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2782 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2783 /* Internal Speaker */
2784 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2785 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2787 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2788 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2790 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2794 /* toggle speaker-output according to the hp-jack state */
2795 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
2797 unsigned int present
;
2800 present
= snd_hda_codec_read(codec
, 0x14, 0,
2801 AC_VERB_GET_PIN_SENSE
, 0)
2802 & AC_PINSENSE_PRESENCE
;
2803 bits
= present
? HDA_AMP_MUTE
: 0;
2804 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
2805 HDA_AMP_MUTE
, bits
);
2807 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
2809 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
2812 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
2815 /* Looks like the unsol event is incompatible with the standard
2816 * definition. 4bit tag is placed at 28 bit!
2818 if ((res
>> 28) == ALC880_HP_EVENT
)
2819 alc880_medion_rim_automute(codec
);
2822 #ifdef CONFIG_SND_HDA_POWER_SAVE
2823 static struct hda_amp_list alc880_loopbacks
[] = {
2824 { 0x0b, HDA_INPUT
, 0 },
2825 { 0x0b, HDA_INPUT
, 1 },
2826 { 0x0b, HDA_INPUT
, 2 },
2827 { 0x0b, HDA_INPUT
, 3 },
2828 { 0x0b, HDA_INPUT
, 4 },
2832 static struct hda_amp_list alc880_lg_loopbacks
[] = {
2833 { 0x0b, HDA_INPUT
, 1 },
2834 { 0x0b, HDA_INPUT
, 6 },
2835 { 0x0b, HDA_INPUT
, 7 },
2844 static int alc_init(struct hda_codec
*codec
)
2846 struct alc_spec
*spec
= codec
->spec
;
2850 if (codec
->vendor_id
== 0x10ec0888)
2851 alc888_coef_init(codec
);
2853 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
2854 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
2856 if (spec
->init_hook
)
2857 spec
->init_hook(codec
);
2862 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2864 struct alc_spec
*spec
= codec
->spec
;
2866 if (spec
->unsol_event
)
2867 spec
->unsol_event(codec
, res
);
2870 #ifdef CONFIG_SND_HDA_POWER_SAVE
2871 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
2873 struct alc_spec
*spec
= codec
->spec
;
2874 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
2879 * Analog playback callbacks
2881 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2882 struct hda_codec
*codec
,
2883 struct snd_pcm_substream
*substream
)
2885 struct alc_spec
*spec
= codec
->spec
;
2886 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2890 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2891 struct hda_codec
*codec
,
2892 unsigned int stream_tag
,
2893 unsigned int format
,
2894 struct snd_pcm_substream
*substream
)
2896 struct alc_spec
*spec
= codec
->spec
;
2897 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
2898 stream_tag
, format
, substream
);
2901 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2902 struct hda_codec
*codec
,
2903 struct snd_pcm_substream
*substream
)
2905 struct alc_spec
*spec
= codec
->spec
;
2906 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2912 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2913 struct hda_codec
*codec
,
2914 struct snd_pcm_substream
*substream
)
2916 struct alc_spec
*spec
= codec
->spec
;
2917 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2920 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2921 struct hda_codec
*codec
,
2922 unsigned int stream_tag
,
2923 unsigned int format
,
2924 struct snd_pcm_substream
*substream
)
2926 struct alc_spec
*spec
= codec
->spec
;
2927 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2928 stream_tag
, format
, substream
);
2931 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2932 struct hda_codec
*codec
,
2933 struct snd_pcm_substream
*substream
)
2935 struct alc_spec
*spec
= codec
->spec
;
2936 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2942 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2943 struct hda_codec
*codec
,
2944 unsigned int stream_tag
,
2945 unsigned int format
,
2946 struct snd_pcm_substream
*substream
)
2948 struct alc_spec
*spec
= codec
->spec
;
2950 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
2951 stream_tag
, 0, format
);
2955 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2956 struct hda_codec
*codec
,
2957 struct snd_pcm_substream
*substream
)
2959 struct alc_spec
*spec
= codec
->spec
;
2961 snd_hda_codec_cleanup_stream(codec
,
2962 spec
->adc_nids
[substream
->number
+ 1]);
2969 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
2973 /* NID is set in alc_build_pcms */
2975 .open
= alc880_playback_pcm_open
,
2976 .prepare
= alc880_playback_pcm_prepare
,
2977 .cleanup
= alc880_playback_pcm_cleanup
2981 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
2985 /* NID is set in alc_build_pcms */
2988 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
2992 /* NID is set in alc_build_pcms */
2995 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
2996 .substreams
= 2, /* can be overridden */
2999 /* NID is set in alc_build_pcms */
3001 .prepare
= alc880_alt_capture_pcm_prepare
,
3002 .cleanup
= alc880_alt_capture_pcm_cleanup
3006 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
3010 /* NID is set in alc_build_pcms */
3012 .open
= alc880_dig_playback_pcm_open
,
3013 .close
= alc880_dig_playback_pcm_close
,
3014 .prepare
= alc880_dig_playback_pcm_prepare
3018 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
3022 /* NID is set in alc_build_pcms */
3025 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3026 static struct hda_pcm_stream alc_pcm_null_stream
= {
3032 static int alc_build_pcms(struct hda_codec
*codec
)
3034 struct alc_spec
*spec
= codec
->spec
;
3035 struct hda_pcm
*info
= spec
->pcm_rec
;
3038 codec
->num_pcms
= 1;
3039 codec
->pcm_info
= info
;
3041 info
->name
= spec
->stream_name_analog
;
3042 if (spec
->stream_analog_playback
) {
3043 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
3045 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
3046 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
3048 if (spec
->stream_analog_capture
) {
3049 if (snd_BUG_ON(!spec
->adc_nids
))
3051 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
3052 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
3055 if (spec
->channel_mode
) {
3056 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
3057 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
3058 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
3059 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
3064 /* SPDIF for stream index #1 */
3065 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
3066 codec
->num_pcms
= 2;
3067 info
= spec
->pcm_rec
+ 1;
3068 info
->name
= spec
->stream_name_digital
;
3069 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
3070 if (spec
->multiout
.dig_out_nid
&&
3071 spec
->stream_digital_playback
) {
3072 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
3073 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
3075 if (spec
->dig_in_nid
&&
3076 spec
->stream_digital_capture
) {
3077 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
3078 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
3080 /* FIXME: do we need this for all Realtek codec models? */
3081 codec
->spdif_status_reset
= 1;
3084 /* If the use of more than one ADC is requested for the current
3085 * model, configure a second analog capture-only PCM.
3087 /* Additional Analaog capture for index #2 */
3088 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
3089 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
3090 codec
->num_pcms
= 3;
3091 info
= spec
->pcm_rec
+ 2;
3092 info
->name
= spec
->stream_name_analog
;
3093 if (spec
->alt_dac_nid
) {
3094 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
3095 *spec
->stream_analog_alt_playback
;
3096 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
3099 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
3100 alc_pcm_null_stream
;
3101 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
3103 if (spec
->num_adc_nids
> 1) {
3104 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
3105 *spec
->stream_analog_alt_capture
;
3106 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
3108 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
3109 spec
->num_adc_nids
- 1;
3111 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
3112 alc_pcm_null_stream
;
3113 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
3120 static void alc_free_kctls(struct hda_codec
*codec
)
3122 struct alc_spec
*spec
= codec
->spec
;
3124 if (spec
->kctls
.list
) {
3125 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
3127 for (i
= 0; i
< spec
->kctls
.used
; i
++)
3128 kfree(kctl
[i
].name
);
3130 snd_array_free(&spec
->kctls
);
3133 static void alc_free(struct hda_codec
*codec
)
3135 struct alc_spec
*spec
= codec
->spec
;
3140 alc_free_kctls(codec
);
3142 codec
->spec
= NULL
; /* to be sure */
3145 #ifdef SND_HDA_NEEDS_RESUME
3146 static void store_pin_configs(struct hda_codec
*codec
)
3148 struct alc_spec
*spec
= codec
->spec
;
3149 hda_nid_t nid
, end_nid
;
3151 end_nid
= codec
->start_nid
+ codec
->num_nodes
;
3152 for (nid
= codec
->start_nid
; nid
< end_nid
; nid
++) {
3153 unsigned int wid_caps
= get_wcaps(codec
, nid
);
3154 unsigned int wid_type
=
3155 (wid_caps
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
3156 if (wid_type
!= AC_WID_PIN
)
3158 if (spec
->num_pins
>= ARRAY_SIZE(spec
->pin_nids
))
3160 spec
->pin_nids
[spec
->num_pins
] = nid
;
3161 spec
->pin_cfgs
[spec
->num_pins
] =
3162 snd_hda_codec_read(codec
, nid
, 0,
3163 AC_VERB_GET_CONFIG_DEFAULT
, 0);
3168 static void resume_pin_configs(struct hda_codec
*codec
)
3170 struct alc_spec
*spec
= codec
->spec
;
3173 for (i
= 0; i
< spec
->num_pins
; i
++) {
3174 hda_nid_t pin_nid
= spec
->pin_nids
[i
];
3175 unsigned int pin_config
= spec
->pin_cfgs
[i
];
3176 snd_hda_codec_write(codec
, pin_nid
, 0,
3177 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
,
3178 pin_config
& 0x000000ff);
3179 snd_hda_codec_write(codec
, pin_nid
, 0,
3180 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
,
3181 (pin_config
& 0x0000ff00) >> 8);
3182 snd_hda_codec_write(codec
, pin_nid
, 0,
3183 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
,
3184 (pin_config
& 0x00ff0000) >> 16);
3185 snd_hda_codec_write(codec
, pin_nid
, 0,
3186 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
,
3191 static int alc_resume(struct hda_codec
*codec
)
3193 resume_pin_configs(codec
);
3194 codec
->patch_ops
.init(codec
);
3195 snd_hda_codec_resume_amp(codec
);
3196 snd_hda_codec_resume_cache(codec
);
3200 #define store_pin_configs(codec)
3205 static struct hda_codec_ops alc_patch_ops
= {
3206 .build_controls
= alc_build_controls
,
3207 .build_pcms
= alc_build_pcms
,
3210 .unsol_event
= alc_unsol_event
,
3211 #ifdef SND_HDA_NEEDS_RESUME
3212 .resume
= alc_resume
,
3214 #ifdef CONFIG_SND_HDA_POWER_SAVE
3215 .check_power_status
= alc_check_power_status
,
3221 * Test configuration for debugging
3223 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3226 #ifdef CONFIG_SND_DEBUG
3227 static hda_nid_t alc880_test_dac_nids
[4] = {
3228 0x02, 0x03, 0x04, 0x05
3231 static struct hda_input_mux alc880_test_capture_source
= {
3240 { "Surround", 0x6 },
3244 static struct hda_channel_mode alc880_test_modes
[4] = {
3251 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
3252 struct snd_ctl_elem_info
*uinfo
)
3254 static char *texts
[] = {
3255 "N/A", "Line Out", "HP Out",
3256 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3258 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
3260 uinfo
->value
.enumerated
.items
= 8;
3261 if (uinfo
->value
.enumerated
.item
>= 8)
3262 uinfo
->value
.enumerated
.item
= 7;
3263 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
3267 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
3268 struct snd_ctl_elem_value
*ucontrol
)
3270 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3271 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3272 unsigned int pin_ctl
, item
= 0;
3274 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
3275 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3276 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
3277 if (pin_ctl
& AC_PINCTL_HP_EN
)
3281 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
3282 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
3283 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
3284 case AC_PINCTL_VREF_50
: item
= 4; break;
3285 case AC_PINCTL_VREF_GRD
: item
= 5; break;
3286 case AC_PINCTL_VREF_80
: item
= 6; break;
3287 case AC_PINCTL_VREF_100
: item
= 7; break;
3290 ucontrol
->value
.enumerated
.item
[0] = item
;
3294 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
3295 struct snd_ctl_elem_value
*ucontrol
)
3297 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3298 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3299 static unsigned int ctls
[] = {
3300 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
3301 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
3302 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
3303 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
3304 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
3305 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
3307 unsigned int old_ctl
, new_ctl
;
3309 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
3310 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3311 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
3312 if (old_ctl
!= new_ctl
) {
3314 snd_hda_codec_write_cache(codec
, nid
, 0,
3315 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3317 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
3319 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
3326 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
3327 struct snd_ctl_elem_info
*uinfo
)
3329 static char *texts
[] = {
3330 "Front", "Surround", "CLFE", "Side"
3332 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
3334 uinfo
->value
.enumerated
.items
= 4;
3335 if (uinfo
->value
.enumerated
.item
>= 4)
3336 uinfo
->value
.enumerated
.item
= 3;
3337 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
3341 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
3342 struct snd_ctl_elem_value
*ucontrol
)
3344 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3345 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3348 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
3349 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
3353 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
3354 struct snd_ctl_elem_value
*ucontrol
)
3356 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3357 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3360 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
3361 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
3362 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
3363 snd_hda_codec_write_cache(codec
, nid
, 0,
3364 AC_VERB_SET_CONNECT_SEL
, sel
);
3370 #define PIN_CTL_TEST(xname,nid) { \
3371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3373 .info = alc_test_pin_ctl_info, \
3374 .get = alc_test_pin_ctl_get, \
3375 .put = alc_test_pin_ctl_put, \
3376 .private_value = nid \
3379 #define PIN_SRC_TEST(xname,nid) { \
3380 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3382 .info = alc_test_pin_src_info, \
3383 .get = alc_test_pin_src_get, \
3384 .put = alc_test_pin_src_put, \
3385 .private_value = nid \
3388 static struct snd_kcontrol_new alc880_test_mixer
[] = {
3389 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3390 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3391 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
3392 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3393 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3394 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
3395 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
3396 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
3397 PIN_CTL_TEST("Front Pin Mode", 0x14),
3398 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3399 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3400 PIN_CTL_TEST("Side Pin Mode", 0x17),
3401 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3402 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3403 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3404 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3405 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3406 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3407 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3408 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3409 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3410 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3411 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3412 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3413 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
3414 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
3415 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
3416 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
3417 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
3418 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
3420 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3421 .name
= "Channel Mode",
3422 .info
= alc_ch_mode_info
,
3423 .get
= alc_ch_mode_get
,
3424 .put
= alc_ch_mode_put
,
3429 static struct hda_verb alc880_test_init_verbs
[] = {
3430 /* Unmute inputs of 0x0c - 0x0f */
3431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3432 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3433 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3434 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3437 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3438 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3439 /* Vol output for 0x0c-0x0f */
3440 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3441 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3442 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3443 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3444 /* Set output pins 0x14-0x17 */
3445 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3446 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3447 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3448 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3449 /* Unmute output pins 0x14-0x17 */
3450 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3451 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3452 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3453 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3454 /* Set input pins 0x18-0x1c */
3455 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3456 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3457 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3458 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3459 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3460 /* Mute input pins 0x18-0x1b */
3461 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3462 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3463 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3464 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3466 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3467 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
3468 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3469 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
3470 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3471 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
3472 /* Analog input/passthru */
3473 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3474 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3475 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3476 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3477 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3485 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
3486 [ALC880_3ST
] = "3stack",
3487 [ALC880_TCL_S700
] = "tcl",
3488 [ALC880_3ST_DIG
] = "3stack-digout",
3489 [ALC880_CLEVO
] = "clevo",
3490 [ALC880_5ST
] = "5stack",
3491 [ALC880_5ST_DIG
] = "5stack-digout",
3492 [ALC880_W810
] = "w810",
3493 [ALC880_Z71V
] = "z71v",
3494 [ALC880_6ST
] = "6stack",
3495 [ALC880_6ST_DIG
] = "6stack-digout",
3496 [ALC880_ASUS
] = "asus",
3497 [ALC880_ASUS_W1V
] = "asus-w1v",
3498 [ALC880_ASUS_DIG
] = "asus-dig",
3499 [ALC880_ASUS_DIG2
] = "asus-dig2",
3500 [ALC880_UNIWILL_DIG
] = "uniwill",
3501 [ALC880_UNIWILL_P53
] = "uniwill-p53",
3502 [ALC880_FUJITSU
] = "fujitsu",
3503 [ALC880_F1734
] = "F1734",
3505 [ALC880_LG_LW
] = "lg-lw",
3506 [ALC880_MEDION_RIM
] = "medion",
3507 #ifdef CONFIG_SND_DEBUG
3508 [ALC880_TEST
] = "test",
3510 [ALC880_AUTO
] = "auto",
3513 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
3514 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
3515 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
3516 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
3517 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
3518 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
3519 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
3520 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
3521 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
3522 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
3523 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
3524 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
3525 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
3526 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
3527 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
3528 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
3529 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
3530 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
3531 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
3532 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3533 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
3534 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
3535 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
3536 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
3537 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
3538 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
3539 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS
), /* default ASUS */
3540 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
3541 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
3542 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
3543 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
3544 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
3545 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
3546 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
3547 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
3548 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
3549 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
3550 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
3551 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
3552 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
3553 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
3554 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
3555 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
3556 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
3557 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
3558 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
3559 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
3560 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
3561 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
3562 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
3563 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
3564 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
3565 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
3566 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
3567 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
3568 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
3569 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
3570 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
3571 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
3572 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
3573 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
3574 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
3575 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
3576 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
3577 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
3578 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
3579 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
3580 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
3581 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
3582 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST
), /* default Intel */
3583 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
3584 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
3589 * ALC880 codec presets
3591 static struct alc_config_preset alc880_presets
[] = {
3593 .mixers
= { alc880_three_stack_mixer
},
3594 .init_verbs
= { alc880_volume_init_verbs
,
3595 alc880_pin_3stack_init_verbs
},
3596 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3597 .dac_nids
= alc880_dac_nids
,
3598 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3599 .channel_mode
= alc880_threestack_modes
,
3601 .input_mux
= &alc880_capture_source
,
3603 [ALC880_3ST_DIG
] = {
3604 .mixers
= { alc880_three_stack_mixer
},
3605 .init_verbs
= { alc880_volume_init_verbs
,
3606 alc880_pin_3stack_init_verbs
},
3607 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3608 .dac_nids
= alc880_dac_nids
,
3609 .dig_out_nid
= ALC880_DIGOUT_NID
,
3610 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3611 .channel_mode
= alc880_threestack_modes
,
3613 .input_mux
= &alc880_capture_source
,
3615 [ALC880_TCL_S700
] = {
3616 .mixers
= { alc880_tcl_s700_mixer
},
3617 .init_verbs
= { alc880_volume_init_verbs
,
3618 alc880_pin_tcl_S700_init_verbs
,
3619 alc880_gpio2_init_verbs
},
3620 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3621 .dac_nids
= alc880_dac_nids
,
3622 .adc_nids
= alc880_adc_nids_alt
, /* FIXME: correct? */
3623 .num_adc_nids
= 1, /* single ADC */
3625 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3626 .channel_mode
= alc880_2_jack_modes
,
3627 .input_mux
= &alc880_capture_source
,
3630 .mixers
= { alc880_three_stack_mixer
,
3631 alc880_five_stack_mixer
},
3632 .init_verbs
= { alc880_volume_init_verbs
,
3633 alc880_pin_5stack_init_verbs
},
3634 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3635 .dac_nids
= alc880_dac_nids
,
3636 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3637 .channel_mode
= alc880_fivestack_modes
,
3638 .input_mux
= &alc880_capture_source
,
3640 [ALC880_5ST_DIG
] = {
3641 .mixers
= { alc880_three_stack_mixer
,
3642 alc880_five_stack_mixer
},
3643 .init_verbs
= { alc880_volume_init_verbs
,
3644 alc880_pin_5stack_init_verbs
},
3645 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3646 .dac_nids
= alc880_dac_nids
,
3647 .dig_out_nid
= ALC880_DIGOUT_NID
,
3648 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3649 .channel_mode
= alc880_fivestack_modes
,
3650 .input_mux
= &alc880_capture_source
,
3653 .mixers
= { alc880_six_stack_mixer
},
3654 .init_verbs
= { alc880_volume_init_verbs
,
3655 alc880_pin_6stack_init_verbs
},
3656 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3657 .dac_nids
= alc880_6st_dac_nids
,
3658 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3659 .channel_mode
= alc880_sixstack_modes
,
3660 .input_mux
= &alc880_6stack_capture_source
,
3662 [ALC880_6ST_DIG
] = {
3663 .mixers
= { alc880_six_stack_mixer
},
3664 .init_verbs
= { alc880_volume_init_verbs
,
3665 alc880_pin_6stack_init_verbs
},
3666 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3667 .dac_nids
= alc880_6st_dac_nids
,
3668 .dig_out_nid
= ALC880_DIGOUT_NID
,
3669 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3670 .channel_mode
= alc880_sixstack_modes
,
3671 .input_mux
= &alc880_6stack_capture_source
,
3674 .mixers
= { alc880_w810_base_mixer
},
3675 .init_verbs
= { alc880_volume_init_verbs
,
3676 alc880_pin_w810_init_verbs
,
3677 alc880_gpio2_init_verbs
},
3678 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
3679 .dac_nids
= alc880_w810_dac_nids
,
3680 .dig_out_nid
= ALC880_DIGOUT_NID
,
3681 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3682 .channel_mode
= alc880_w810_modes
,
3683 .input_mux
= &alc880_capture_source
,
3686 .mixers
= { alc880_z71v_mixer
},
3687 .init_verbs
= { alc880_volume_init_verbs
,
3688 alc880_pin_z71v_init_verbs
},
3689 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
3690 .dac_nids
= alc880_z71v_dac_nids
,
3691 .dig_out_nid
= ALC880_DIGOUT_NID
,
3693 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3694 .channel_mode
= alc880_2_jack_modes
,
3695 .input_mux
= &alc880_capture_source
,
3698 .mixers
= { alc880_f1734_mixer
},
3699 .init_verbs
= { alc880_volume_init_verbs
,
3700 alc880_pin_f1734_init_verbs
},
3701 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
3702 .dac_nids
= alc880_f1734_dac_nids
,
3704 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3705 .channel_mode
= alc880_2_jack_modes
,
3706 .input_mux
= &alc880_f1734_capture_source
,
3707 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3708 .init_hook
= alc880_uniwill_p53_hp_automute
,
3711 .mixers
= { alc880_asus_mixer
},
3712 .init_verbs
= { alc880_volume_init_verbs
,
3713 alc880_pin_asus_init_verbs
,
3714 alc880_gpio1_init_verbs
},
3715 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3716 .dac_nids
= alc880_asus_dac_nids
,
3717 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3718 .channel_mode
= alc880_asus_modes
,
3720 .input_mux
= &alc880_capture_source
,
3722 [ALC880_ASUS_DIG
] = {
3723 .mixers
= { alc880_asus_mixer
},
3724 .init_verbs
= { alc880_volume_init_verbs
,
3725 alc880_pin_asus_init_verbs
,
3726 alc880_gpio1_init_verbs
},
3727 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3728 .dac_nids
= alc880_asus_dac_nids
,
3729 .dig_out_nid
= ALC880_DIGOUT_NID
,
3730 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3731 .channel_mode
= alc880_asus_modes
,
3733 .input_mux
= &alc880_capture_source
,
3735 [ALC880_ASUS_DIG2
] = {
3736 .mixers
= { alc880_asus_mixer
},
3737 .init_verbs
= { alc880_volume_init_verbs
,
3738 alc880_pin_asus_init_verbs
,
3739 alc880_gpio2_init_verbs
}, /* use GPIO2 */
3740 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3741 .dac_nids
= alc880_asus_dac_nids
,
3742 .dig_out_nid
= ALC880_DIGOUT_NID
,
3743 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3744 .channel_mode
= alc880_asus_modes
,
3746 .input_mux
= &alc880_capture_source
,
3748 [ALC880_ASUS_W1V
] = {
3749 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
3750 .init_verbs
= { alc880_volume_init_verbs
,
3751 alc880_pin_asus_init_verbs
,
3752 alc880_gpio1_init_verbs
},
3753 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3754 .dac_nids
= alc880_asus_dac_nids
,
3755 .dig_out_nid
= ALC880_DIGOUT_NID
,
3756 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3757 .channel_mode
= alc880_asus_modes
,
3759 .input_mux
= &alc880_capture_source
,
3761 [ALC880_UNIWILL_DIG
] = {
3762 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
3763 .init_verbs
= { alc880_volume_init_verbs
,
3764 alc880_pin_asus_init_verbs
},
3765 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3766 .dac_nids
= alc880_asus_dac_nids
,
3767 .dig_out_nid
= ALC880_DIGOUT_NID
,
3768 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3769 .channel_mode
= alc880_asus_modes
,
3771 .input_mux
= &alc880_capture_source
,
3773 [ALC880_UNIWILL
] = {
3774 .mixers
= { alc880_uniwill_mixer
},
3775 .init_verbs
= { alc880_volume_init_verbs
,
3776 alc880_uniwill_init_verbs
},
3777 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3778 .dac_nids
= alc880_asus_dac_nids
,
3779 .dig_out_nid
= ALC880_DIGOUT_NID
,
3780 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3781 .channel_mode
= alc880_threestack_modes
,
3783 .input_mux
= &alc880_capture_source
,
3784 .unsol_event
= alc880_uniwill_unsol_event
,
3785 .init_hook
= alc880_uniwill_automute
,
3787 [ALC880_UNIWILL_P53
] = {
3788 .mixers
= { alc880_uniwill_p53_mixer
},
3789 .init_verbs
= { alc880_volume_init_verbs
,
3790 alc880_uniwill_p53_init_verbs
},
3791 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3792 .dac_nids
= alc880_asus_dac_nids
,
3793 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3794 .channel_mode
= alc880_threestack_modes
,
3795 .input_mux
= &alc880_capture_source
,
3796 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3797 .init_hook
= alc880_uniwill_p53_hp_automute
,
3799 [ALC880_FUJITSU
] = {
3800 .mixers
= { alc880_fujitsu_mixer
,
3801 alc880_pcbeep_mixer
, },
3802 .init_verbs
= { alc880_volume_init_verbs
,
3803 alc880_uniwill_p53_init_verbs
,
3804 alc880_beep_init_verbs
},
3805 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3806 .dac_nids
= alc880_dac_nids
,
3807 .dig_out_nid
= ALC880_DIGOUT_NID
,
3808 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3809 .channel_mode
= alc880_2_jack_modes
,
3810 .input_mux
= &alc880_capture_source
,
3811 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3812 .init_hook
= alc880_uniwill_p53_hp_automute
,
3815 .mixers
= { alc880_three_stack_mixer
},
3816 .init_verbs
= { alc880_volume_init_verbs
,
3817 alc880_pin_clevo_init_verbs
},
3818 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3819 .dac_nids
= alc880_dac_nids
,
3821 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3822 .channel_mode
= alc880_threestack_modes
,
3824 .input_mux
= &alc880_capture_source
,
3827 .mixers
= { alc880_lg_mixer
},
3828 .init_verbs
= { alc880_volume_init_verbs
,
3829 alc880_lg_init_verbs
},
3830 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
3831 .dac_nids
= alc880_lg_dac_nids
,
3832 .dig_out_nid
= ALC880_DIGOUT_NID
,
3833 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
3834 .channel_mode
= alc880_lg_ch_modes
,
3836 .input_mux
= &alc880_lg_capture_source
,
3837 .unsol_event
= alc880_lg_unsol_event
,
3838 .init_hook
= alc880_lg_automute
,
3839 #ifdef CONFIG_SND_HDA_POWER_SAVE
3840 .loopbacks
= alc880_lg_loopbacks
,
3844 .mixers
= { alc880_lg_lw_mixer
},
3845 .init_verbs
= { alc880_volume_init_verbs
,
3846 alc880_lg_lw_init_verbs
},
3847 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3848 .dac_nids
= alc880_dac_nids
,
3849 .dig_out_nid
= ALC880_DIGOUT_NID
,
3850 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
3851 .channel_mode
= alc880_lg_lw_modes
,
3852 .input_mux
= &alc880_lg_lw_capture_source
,
3853 .unsol_event
= alc880_lg_lw_unsol_event
,
3854 .init_hook
= alc880_lg_lw_automute
,
3856 [ALC880_MEDION_RIM
] = {
3857 .mixers
= { alc880_medion_rim_mixer
},
3858 .init_verbs
= { alc880_volume_init_verbs
,
3859 alc880_medion_rim_init_verbs
,
3860 alc_gpio2_init_verbs
},
3861 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3862 .dac_nids
= alc880_dac_nids
,
3863 .dig_out_nid
= ALC880_DIGOUT_NID
,
3864 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3865 .channel_mode
= alc880_2_jack_modes
,
3866 .input_mux
= &alc880_medion_rim_capture_source
,
3867 .unsol_event
= alc880_medion_rim_unsol_event
,
3868 .init_hook
= alc880_medion_rim_automute
,
3870 #ifdef CONFIG_SND_DEBUG
3872 .mixers
= { alc880_test_mixer
},
3873 .init_verbs
= { alc880_test_init_verbs
},
3874 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
3875 .dac_nids
= alc880_test_dac_nids
,
3876 .dig_out_nid
= ALC880_DIGOUT_NID
,
3877 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
3878 .channel_mode
= alc880_test_modes
,
3879 .input_mux
= &alc880_test_capture_source
,
3885 * Automatic parse of I/O pins from the BIOS configuration
3890 ALC_CTL_WIDGET_MUTE
,
3893 static struct snd_kcontrol_new alc880_control_templates
[] = {
3894 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
3895 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
3896 HDA_BIND_MUTE(NULL
, 0, 0, 0),
3899 /* add dynamic controls */
3900 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
3903 struct snd_kcontrol_new
*knew
;
3905 snd_array_init(&spec
->kctls
, sizeof(*knew
), 32);
3906 knew
= snd_array_new(&spec
->kctls
);
3909 *knew
= alc880_control_templates
[type
];
3910 knew
->name
= kstrdup(name
, GFP_KERNEL
);
3913 knew
->private_value
= val
;
3917 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3918 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3919 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3920 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3921 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3922 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3923 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3924 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3925 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3926 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3927 #define ALC880_PIN_CD_NID 0x1c
3929 /* fill in the dac_nids table from the parsed pin configuration */
3930 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
3931 const struct auto_pin_cfg
*cfg
)
3937 memset(assigned
, 0, sizeof(assigned
));
3938 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3940 /* check the pins hardwired to audio widget */
3941 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3942 nid
= cfg
->line_out_pins
[i
];
3943 if (alc880_is_fixed_pin(nid
)) {
3944 int idx
= alc880_fixed_pin_idx(nid
);
3945 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
3949 /* left pins can be connect to any audio widget */
3950 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3951 nid
= cfg
->line_out_pins
[i
];
3952 if (alc880_is_fixed_pin(nid
))
3954 /* search for an empty channel */
3955 for (j
= 0; j
< cfg
->line_outs
; j
++) {
3957 spec
->multiout
.dac_nids
[i
] =
3958 alc880_idx_to_dac(j
);
3964 spec
->multiout
.num_dacs
= cfg
->line_outs
;
3968 /* add playback controls from the parsed DAC table */
3969 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3970 const struct auto_pin_cfg
*cfg
)
3973 static const char *chname
[4] = {
3974 "Front", "Surround", NULL
/*CLFE*/, "Side"
3979 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3980 if (!spec
->multiout
.dac_nids
[i
])
3982 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
3985 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3986 "Center Playback Volume",
3987 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
3991 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3992 "LFE Playback Volume",
3993 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
3997 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3998 "Center Playback Switch",
3999 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
4003 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
4004 "LFE Playback Switch",
4005 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
4010 sprintf(name
, "%s Playback Volume", chname
[i
]);
4011 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
4012 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
4016 sprintf(name
, "%s Playback Switch", chname
[i
]);
4017 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
4018 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
4027 /* add playback controls for speaker and HP outputs */
4028 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
4038 if (alc880_is_fixed_pin(pin
)) {
4039 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
4040 /* specify the DAC as the extra output */
4041 if (!spec
->multiout
.hp_nid
)
4042 spec
->multiout
.hp_nid
= nid
;
4044 spec
->multiout
.extra_out_nid
[0] = nid
;
4045 /* control HP volume/switch on the output mixer amp */
4046 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
4047 sprintf(name
, "%s Playback Volume", pfx
);
4048 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
4049 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
4052 sprintf(name
, "%s Playback Switch", pfx
);
4053 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
4054 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
4057 } else if (alc880_is_multi_pin(pin
)) {
4058 /* set manual connection */
4059 /* we have only a switch on HP-out PIN */
4060 sprintf(name
, "%s Playback Switch", pfx
);
4061 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
4062 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
4069 /* create input playback/capture controls for the given pin */
4070 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
4071 const char *ctlname
,
4072 int idx
, hda_nid_t mix_nid
)
4077 sprintf(name
, "%s Playback Volume", ctlname
);
4078 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
4079 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
4082 sprintf(name
, "%s Playback Switch", ctlname
);
4083 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
4084 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
4090 /* create playback/capture controls for input pins */
4091 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
4092 const struct auto_pin_cfg
*cfg
)
4094 struct hda_input_mux
*imux
= &spec
->private_imux
;
4097 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4098 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
4099 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
4100 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4101 auto_pin_cfg_labels
[i
],
4105 imux
->items
[imux
->num_items
].label
=
4106 auto_pin_cfg_labels
[i
];
4107 imux
->items
[imux
->num_items
].index
=
4108 alc880_input_pin_idx(cfg
->input_pins
[i
]);
4115 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
4116 unsigned int pin_type
)
4118 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4121 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4125 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
4126 hda_nid_t nid
, int pin_type
,
4129 alc_set_pin_output(codec
, nid
, pin_type
);
4130 /* need the manual connection? */
4131 if (alc880_is_multi_pin(nid
)) {
4132 struct alc_spec
*spec
= codec
->spec
;
4133 int idx
= alc880_multi_pin_idx(nid
);
4134 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
4135 AC_VERB_SET_CONNECT_SEL
,
4136 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
4140 static int get_pin_type(int line_out_type
)
4142 if (line_out_type
== AUTO_PIN_HP_OUT
)
4148 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
4150 struct alc_spec
*spec
= codec
->spec
;
4153 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
4154 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
4155 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
4156 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
4157 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
4161 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
4163 struct alc_spec
*spec
= codec
->spec
;
4166 pin
= spec
->autocfg
.speaker_pins
[0];
4167 if (pin
) /* connect to front */
4168 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
4169 pin
= spec
->autocfg
.hp_pins
[0];
4170 if (pin
) /* connect to front */
4171 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
4174 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
4176 struct alc_spec
*spec
= codec
->spec
;
4179 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4180 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4181 if (alc880_is_input_pin(nid
)) {
4182 snd_hda_codec_write(codec
, nid
, 0,
4183 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4184 i
<= AUTO_PIN_FRONT_MIC
?
4185 PIN_VREF80
: PIN_IN
);
4186 if (nid
!= ALC880_PIN_CD_NID
)
4187 snd_hda_codec_write(codec
, nid
, 0,
4188 AC_VERB_SET_AMP_GAIN_MUTE
,
4194 /* parse the BIOS configuration and set up the alc_spec */
4195 /* return 1 if successful, 0 if the proper config is not found,
4196 * or a negative error code
4198 static int alc880_parse_auto_config(struct hda_codec
*codec
)
4200 struct alc_spec
*spec
= codec
->spec
;
4202 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
4204 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
4208 if (!spec
->autocfg
.line_outs
)
4209 return 0; /* can't find valid BIOS pin config */
4211 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
4214 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
4217 err
= alc880_auto_create_extra_out(spec
,
4218 spec
->autocfg
.speaker_pins
[0],
4222 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
4226 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
4230 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
4232 if (spec
->autocfg
.dig_out_pin
)
4233 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
4234 if (spec
->autocfg
.dig_in_pin
)
4235 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
4237 if (spec
->kctls
.list
)
4238 add_mixer(spec
, spec
->kctls
.list
);
4240 add_verb(spec
, alc880_volume_init_verbs
);
4242 spec
->num_mux_defs
= 1;
4243 spec
->input_mux
= &spec
->private_imux
;
4245 store_pin_configs(codec
);
4249 /* additional initialization for auto-configuration model */
4250 static void alc880_auto_init(struct hda_codec
*codec
)
4252 struct alc_spec
*spec
= codec
->spec
;
4253 alc880_auto_init_multi_out(codec
);
4254 alc880_auto_init_extra_out(codec
);
4255 alc880_auto_init_analog_input(codec
);
4256 if (spec
->unsol_event
)
4257 alc_inithook(codec
);
4261 * OK, here we have finally the patch for ALC880
4264 static void set_capture_mixer(struct alc_spec
*spec
)
4266 static struct snd_kcontrol_new
*caps
[3] = {
4271 if (spec
->num_adc_nids
> 0 && spec
->num_adc_nids
<= 3)
4272 spec
->cap_mixer
= caps
[spec
->num_adc_nids
- 1];
4275 static int patch_alc880(struct hda_codec
*codec
)
4277 struct alc_spec
*spec
;
4281 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4287 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
4290 if (board_config
< 0) {
4291 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
4292 "trying auto-probe from BIOS...\n");
4293 board_config
= ALC880_AUTO
;
4296 if (board_config
== ALC880_AUTO
) {
4297 /* automatic parse from the BIOS config */
4298 err
= alc880_parse_auto_config(codec
);
4304 "hda_codec: Cannot set up configuration "
4305 "from BIOS. Using 3-stack mode...\n");
4306 board_config
= ALC880_3ST
;
4310 if (board_config
!= ALC880_AUTO
)
4311 setup_preset(spec
, &alc880_presets
[board_config
]);
4313 spec
->stream_name_analog
= "ALC880 Analog";
4314 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
4315 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
4316 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
4318 spec
->stream_name_digital
= "ALC880 Digital";
4319 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
4320 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
4322 if (!spec
->adc_nids
&& spec
->input_mux
) {
4323 /* check whether NID 0x07 is valid */
4324 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
4326 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
4327 if (wcap
!= AC_WID_AUD_IN
) {
4328 spec
->adc_nids
= alc880_adc_nids_alt
;
4329 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
4331 spec
->adc_nids
= alc880_adc_nids
;
4332 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
4335 set_capture_mixer(spec
);
4337 spec
->vmaster_nid
= 0x0c;
4339 codec
->patch_ops
= alc_patch_ops
;
4340 if (board_config
== ALC880_AUTO
)
4341 spec
->init_hook
= alc880_auto_init
;
4342 #ifdef CONFIG_SND_HDA_POWER_SAVE
4343 if (!spec
->loopback
.amplist
)
4344 spec
->loopback
.amplist
= alc880_loopbacks
;
4355 static hda_nid_t alc260_dac_nids
[1] = {
4360 static hda_nid_t alc260_adc_nids
[1] = {
4365 static hda_nid_t alc260_adc_nids_alt
[1] = {
4370 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4371 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4373 static hda_nid_t alc260_dual_adc_nids
[2] = {
4378 #define ALC260_DIGOUT_NID 0x03
4379 #define ALC260_DIGIN_NID 0x06
4381 static struct hda_input_mux alc260_capture_source
= {
4385 { "Front Mic", 0x1 },
4391 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4392 * headphone jack and the internal CD lines since these are the only pins at
4393 * which audio can appear. For flexibility, also allow the option of
4394 * recording the mixer output on the second ADC (ADC0 doesn't have a
4395 * connection to the mixer output).
4397 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
4401 { "Mic/Line", 0x0 },
4403 { "Headphone", 0x2 },
4409 { "Mic/Line", 0x0 },
4411 { "Headphone", 0x2 },
4418 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4419 * the Fujitsu S702x, but jacks are marked differently.
4421 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
4428 { "Headphone", 0x5 },
4437 { "Headphone", 0x6 },
4443 * This is just place-holder, so there's something for alc_build_pcms to look
4444 * at when it calculates the maximum number of channels. ALC260 has no mixer
4445 * element which allows changing the channel mode, so the verb list is
4448 static struct hda_channel_mode alc260_modes
[1] = {
4453 /* Mixer combinations
4455 * basic: base_output + input + pc_beep + capture
4456 * HP: base_output + input + capture_alt
4457 * HP_3013: hp_3013 + input + capture
4458 * fujitsu: fujitsu + capture
4459 * acer: acer + capture
4462 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
4463 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4464 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4465 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4466 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4467 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4468 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4472 static struct snd_kcontrol_new alc260_input_mixer
[] = {
4473 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4474 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4475 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4476 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4477 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4478 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4479 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
4480 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
4484 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
4485 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
4486 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
4490 /* update HP, line and mono out pins according to the master switch */
4491 static void alc260_hp_master_update(struct hda_codec
*codec
,
4492 hda_nid_t hp
, hda_nid_t line
,
4495 struct alc_spec
*spec
= codec
->spec
;
4496 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
4497 /* change HP and line-out pins */
4498 snd_hda_codec_write(codec
, hp
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4500 snd_hda_codec_write(codec
, line
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4502 /* mono (speaker) depending on the HP jack sense */
4503 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
4504 snd_hda_codec_write(codec
, mono
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4508 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
4509 struct snd_ctl_elem_value
*ucontrol
)
4511 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4512 struct alc_spec
*spec
= codec
->spec
;
4513 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
4517 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
4518 struct snd_ctl_elem_value
*ucontrol
)
4520 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4521 struct alc_spec
*spec
= codec
->spec
;
4522 int val
= !!*ucontrol
->value
.integer
.value
;
4523 hda_nid_t hp
, line
, mono
;
4525 if (val
== spec
->master_sw
)
4527 spec
->master_sw
= val
;
4528 hp
= (kcontrol
->private_value
>> 16) & 0xff;
4529 line
= (kcontrol
->private_value
>> 8) & 0xff;
4530 mono
= kcontrol
->private_value
& 0xff;
4531 alc260_hp_master_update(codec
, hp
, line
, mono
);
4535 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
4537 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4538 .name
= "Master Playback Switch",
4539 .info
= snd_ctl_boolean_mono_info
,
4540 .get
= alc260_hp_master_sw_get
,
4541 .put
= alc260_hp_master_sw_put
,
4542 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
4544 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4545 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4546 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4547 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4548 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4550 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4554 static struct hda_verb alc260_hp_unsol_verbs
[] = {
4555 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4559 static void alc260_hp_automute(struct hda_codec
*codec
)
4561 struct alc_spec
*spec
= codec
->spec
;
4562 unsigned int present
;
4564 present
= snd_hda_codec_read(codec
, 0x10, 0,
4565 AC_VERB_GET_PIN_SENSE
, 0);
4566 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4567 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
4570 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4572 if ((res
>> 26) == ALC880_HP_EVENT
)
4573 alc260_hp_automute(codec
);
4576 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
4578 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4579 .name
= "Master Playback Switch",
4580 .info
= snd_ctl_boolean_mono_info
,
4581 .get
= alc260_hp_master_sw_get
,
4582 .put
= alc260_hp_master_sw_put
,
4583 .private_value
= (0x15 << 16) | (0x10 << 8) | 0x11
4585 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4586 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4587 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
4588 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
4589 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
4591 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4592 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
4596 static struct hda_bind_ctls alc260_dc7600_bind_master_vol
= {
4597 .ops
= &snd_hda_bind_vol
,
4599 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT
),
4600 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
4601 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT
),
4606 static struct hda_bind_ctls alc260_dc7600_bind_switch
= {
4607 .ops
= &snd_hda_bind_sw
,
4609 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT
),
4610 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
4615 static struct snd_kcontrol_new alc260_hp_dc7600_mixer
[] = {
4616 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol
),
4617 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch
),
4618 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT
),
4619 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4623 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
4624 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4628 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
4630 struct alc_spec
*spec
= codec
->spec
;
4631 unsigned int present
;
4633 present
= snd_hda_codec_read(codec
, 0x15, 0,
4634 AC_VERB_GET_PIN_SENSE
, 0);
4635 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4636 alc260_hp_master_update(codec
, 0x15, 0x10, 0x11);
4639 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
4642 if ((res
>> 26) == ALC880_HP_EVENT
)
4643 alc260_hp_3013_automute(codec
);
4646 static void alc260_hp_3012_automute(struct hda_codec
*codec
)
4648 unsigned int present
, bits
;
4650 present
= snd_hda_codec_read(codec
, 0x10, 0,
4651 AC_VERB_GET_PIN_SENSE
, 0) & AC_PINSENSE_PRESENCE
;
4653 bits
= present
? 0 : PIN_OUT
;
4654 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4656 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4658 snd_hda_codec_write(codec
, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4662 static void alc260_hp_3012_unsol_event(struct hda_codec
*codec
,
4665 if ((res
>> 26) == ALC880_HP_EVENT
)
4666 alc260_hp_3012_automute(codec
);
4669 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4670 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4672 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
4673 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4674 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
4675 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4676 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4677 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4678 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
4679 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
4680 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4681 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4682 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4683 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4684 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
4688 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4689 * versions of the ALC260 don't act on requests to enable mic bias from NID
4690 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4691 * datasheet doesn't mention this restriction. At this stage it's not clear
4692 * whether this behaviour is intentional or is a hardware bug in chip
4693 * revisions available in early 2006. Therefore for now allow the
4694 * "Headphone Jack Mode" control to span all choices, but if it turns out
4695 * that the lack of mic bias for this NID is intentional we could change the
4696 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4698 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4699 * don't appear to make the mic bias available from the "line" jack, even
4700 * though the NID used for this jack (0x14) can supply it. The theory is
4701 * that perhaps Acer have included blocking capacitors between the ALC260
4702 * and the output jack. If this turns out to be the case for all such
4703 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4704 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4706 * The C20x Tablet series have a mono internal speaker which is controlled
4707 * via the chip's Mono sum widget and pin complex, so include the necessary
4708 * controls for such models. On models without a "mono speaker" the control
4709 * won't do anything.
4711 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
4712 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4713 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
4714 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
4715 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4717 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4719 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4720 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4722 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4723 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4724 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4725 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4726 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4727 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4728 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4732 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4733 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4735 static struct snd_kcontrol_new alc260_will_mixer
[] = {
4736 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4737 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4739 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4740 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4741 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4742 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4743 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4744 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4745 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4746 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4747 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4751 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4752 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4754 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
4755 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4756 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4757 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4758 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4759 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4760 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
4761 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
4762 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4763 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4764 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4769 * initialization verbs
4771 static struct hda_verb alc260_init_verbs
[] = {
4772 /* Line In pin widget for input */
4773 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4774 /* CD pin widget for input */
4775 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4776 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4777 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4778 /* Mic2 (front panel) pin widget for input and vref at 80% */
4779 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4780 /* LINE-2 is used for line-out in rear */
4781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4782 /* select line-out */
4783 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
4785 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4787 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4789 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4790 /* mute capture amp left and right */
4791 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4792 /* set connection select to line in (default select for this ADC) */
4793 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4794 /* mute capture amp left and right */
4795 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4796 /* set connection select to line in (default select for this ADC) */
4797 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
4798 /* set vol=0 Line-Out mixer amp left and right */
4799 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4800 /* unmute pin widget amp left and right (no gain on this amp) */
4801 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4802 /* set vol=0 HP mixer amp left and right */
4803 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4804 /* unmute pin widget amp left and right (no gain on this amp) */
4805 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4806 /* set vol=0 Mono mixer amp left and right */
4807 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4808 /* unmute pin widget amp left and right (no gain on this amp) */
4809 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4810 /* unmute LINE-2 out pin */
4811 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4812 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4815 /* mute analog inputs */
4816 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4817 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4820 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4821 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4822 /* mute Front out path */
4823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4824 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4825 /* mute Headphone out path */
4826 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4828 /* mute Mono out path */
4829 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4830 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4834 #if 0 /* should be identical with alc260_init_verbs? */
4835 static struct hda_verb alc260_hp_init_verbs
[] = {
4836 /* Headphone and output */
4837 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4839 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4840 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4841 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4842 /* Mic2 (front panel) pin widget for input and vref at 80% */
4843 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4844 /* Line In pin widget for input */
4845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4846 /* Line-2 pin widget for output */
4847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4848 /* CD pin widget for input */
4849 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4850 /* unmute amp left and right */
4851 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4852 /* set connection select to line in (default select for this ADC) */
4853 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4854 /* unmute Line-Out mixer amp left and right (volume = 0) */
4855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4856 /* mute pin widget amp left and right (no gain on this amp) */
4857 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4858 /* unmute HP mixer amp left and right (volume = 0) */
4859 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4860 /* mute pin widget amp left and right (no gain on this amp) */
4861 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4862 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4865 /* mute analog inputs */
4866 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4867 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4868 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4869 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4870 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4871 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4872 /* Unmute Front out path */
4873 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4874 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4875 /* Unmute Headphone out path */
4876 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4877 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4878 /* Unmute Mono out path */
4879 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4880 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4885 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
4886 /* Line out and output */
4887 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4889 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4890 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4891 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4892 /* Mic2 (front panel) pin widget for input and vref at 80% */
4893 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4894 /* Line In pin widget for input */
4895 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4896 /* Headphone pin widget for output */
4897 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4898 /* CD pin widget for input */
4899 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4900 /* unmute amp left and right */
4901 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4902 /* set connection select to line in (default select for this ADC) */
4903 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4904 /* unmute Line-Out mixer amp left and right (volume = 0) */
4905 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4906 /* mute pin widget amp left and right (no gain on this amp) */
4907 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4908 /* unmute HP mixer amp left and right (volume = 0) */
4909 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4910 /* mute pin widget amp left and right (no gain on this amp) */
4911 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4912 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4915 /* mute analog inputs */
4916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4921 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4922 /* Unmute Front out path */
4923 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4924 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4925 /* Unmute Headphone out path */
4926 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4927 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4928 /* Unmute Mono out path */
4929 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4930 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4934 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4935 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4936 * audio = 0x16, internal speaker = 0x10.
4938 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
4939 /* Disable all GPIOs */
4940 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
4941 /* Internal speaker is connected to headphone pin */
4942 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4943 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4944 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4945 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4946 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4947 /* Ensure all other unused pins are disabled and muted. */
4948 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4949 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4950 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4951 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4952 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4953 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4954 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4957 /* Disable digital (SPDIF) pins */
4958 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4959 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4961 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4962 * when acting as an output.
4964 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4966 /* Start with output sum widgets muted and their output gains at min */
4967 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4968 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4969 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4970 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4971 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4972 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4973 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4974 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4975 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4977 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4978 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4979 /* Unmute Line1 pin widget output buffer since it starts as an output.
4980 * If the pin mode is changed by the user the pin mode control will
4981 * take care of enabling the pin's input/output buffers as needed.
4982 * Therefore there's no need to enable the input buffer at this
4985 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4986 /* Unmute input buffer of pin widget used for Line-in (no equiv
4989 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4991 /* Mute capture amp left and right */
4992 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4993 /* Set ADC connection select to match default mixer setting - line
4996 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4998 /* Do the same for the second ADC: mute capture input amp and
4999 * set ADC connection to line in (on mic1 pin)
5001 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5002 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5004 /* Mute all inputs to mixer widget (even unconnected ones) */
5005 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5006 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5008 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5009 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5010 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5011 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5012 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5017 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5018 * similar laptops (adapted from Fujitsu init verbs).
5020 static struct hda_verb alc260_acer_init_verbs
[] = {
5021 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5022 * the headphone jack. Turn this on and rely on the standard mute
5023 * methods whenever the user wants to turn these outputs off.
5025 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
5026 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
5027 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
5028 /* Internal speaker/Headphone jack is connected to Line-out pin */
5029 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5030 /* Internal microphone/Mic jack is connected to Mic1 pin */
5031 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
5032 /* Line In jack is connected to Line1 pin */
5033 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5034 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5035 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5036 /* Ensure all other unused pins are disabled and muted. */
5037 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5038 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5039 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5040 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5041 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5042 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5043 /* Disable digital (SPDIF) pins */
5044 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5045 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5047 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5048 * bus when acting as outputs.
5050 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
5051 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5053 /* Start with output sum widgets muted and their output gains at min */
5054 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5055 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5056 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5057 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5058 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5059 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5060 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5061 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5062 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5064 /* Unmute Line-out pin widget amp left and right
5065 * (no equiv mixer ctrl)
5067 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5068 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5069 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5070 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5071 * inputs. If the pin mode is changed by the user the pin mode control
5072 * will take care of enabling the pin's input/output buffers as needed.
5073 * Therefore there's no need to enable the input buffer at this
5076 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5077 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5079 /* Mute capture amp left and right */
5080 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5081 /* Set ADC connection select to match default mixer setting - mic
5084 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5086 /* Do similar with the second ADC: mute capture input amp and
5087 * set ADC connection to mic to match ALSA's default state.
5089 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5090 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5092 /* Mute all inputs to mixer widget (even unconnected ones) */
5093 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5094 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5095 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5099 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5100 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5105 static struct hda_verb alc260_will_verbs
[] = {
5106 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5107 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5108 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
5109 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
5110 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
5111 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
5115 static struct hda_verb alc260_replacer_672v_verbs
[] = {
5116 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
5117 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
5118 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
5120 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
5121 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
5122 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
5124 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5128 /* toggle speaker-output according to the hp-jack state */
5129 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
5131 unsigned int present
;
5133 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5134 present
= snd_hda_codec_read(codec
, 0x0f, 0,
5135 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5137 snd_hda_codec_write_cache(codec
, 0x01, 0,
5138 AC_VERB_SET_GPIO_DATA
, 1);
5139 snd_hda_codec_write_cache(codec
, 0x0f, 0,
5140 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5143 snd_hda_codec_write_cache(codec
, 0x01, 0,
5144 AC_VERB_SET_GPIO_DATA
, 0);
5145 snd_hda_codec_write_cache(codec
, 0x0f, 0,
5146 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5151 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
5154 if ((res
>> 26) == ALC880_HP_EVENT
)
5155 alc260_replacer_672v_automute(codec
);
5158 static struct hda_verb alc260_hp_dc7600_verbs
[] = {
5159 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x01},
5160 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5161 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5162 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5163 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5165 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5166 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5167 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5168 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5172 /* Test configuration for debugging, modelled after the ALC880 test
5175 #ifdef CONFIG_SND_DEBUG
5176 static hda_nid_t alc260_test_dac_nids
[1] = {
5179 static hda_nid_t alc260_test_adc_nids
[2] = {
5182 /* For testing the ALC260, each input MUX needs its own definition since
5183 * the signal assignments are different. This assumes that the first ADC
5186 static struct hda_input_mux alc260_test_capture_sources
[2] = {
5190 { "MIC1 pin", 0x0 },
5191 { "MIC2 pin", 0x1 },
5192 { "LINE1 pin", 0x2 },
5193 { "LINE2 pin", 0x3 },
5195 { "LINE-OUT pin", 0x5 },
5196 { "HP-OUT pin", 0x6 },
5202 { "MIC1 pin", 0x0 },
5203 { "MIC2 pin", 0x1 },
5204 { "LINE1 pin", 0x2 },
5205 { "LINE2 pin", 0x3 },
5208 { "LINE-OUT pin", 0x6 },
5209 { "HP-OUT pin", 0x7 },
5213 static struct snd_kcontrol_new alc260_test_mixer
[] = {
5214 /* Output driver widgets */
5215 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
5216 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
5217 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5218 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
5219 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5220 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
5222 /* Modes for retasking pin widgets
5223 * Note: the ALC260 doesn't seem to act on requests to enable mic
5224 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5225 * mention this restriction. At this stage it's not clear whether
5226 * this behaviour is intentional or is a hardware bug in chip
5227 * revisions available at least up until early 2006. Therefore for
5228 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5229 * choices, but if it turns out that the lack of mic bias for these
5230 * NIDs is intentional we could change their modes from
5231 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5233 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
5234 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
5235 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
5236 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
5237 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
5238 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
5240 /* Loopback mixer controls */
5241 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
5242 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
5243 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
5244 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
5245 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
5246 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
5247 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
5248 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
5249 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5250 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5251 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
5252 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
5253 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
5254 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
5255 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
5256 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
5258 /* Controls for GPIO pins, assuming they are configured as outputs */
5259 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5260 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5261 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5262 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5264 /* Switches to allow the digital IO pins to be enabled. The datasheet
5265 * is ambigious as to which NID is which; testing on laptops which
5266 * make this output available should provide clarification.
5268 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5269 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5271 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5272 * this output to turn on an external amplifier.
5274 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5275 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5279 static struct hda_verb alc260_test_init_verbs
[] = {
5280 /* Enable all GPIOs as outputs with an initial value of 0 */
5281 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
5282 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
5283 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
5285 /* Enable retasking pins as output, initially without power amp */
5286 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5287 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5288 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5290 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5291 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5293 /* Disable digital (SPDIF) pins initially, but users can enable
5294 * them via a mixer switch. In the case of SPDIF-out, this initverb
5295 * payload also sets the generation to 0, output to be in "consumer"
5296 * PCM format, copyright asserted, no pre-emphasis and no validity
5299 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5300 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5302 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5303 * OUT1 sum bus when acting as an output.
5305 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
5306 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
5307 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5308 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
5310 /* Start with output sum widgets muted and their output gains at min */
5311 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5312 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5313 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5314 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5315 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5316 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5317 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5318 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5319 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5321 /* Unmute retasking pin widget output buffers since the default
5322 * state appears to be output. As the pin mode is changed by the
5323 * user the pin mode control will take care of enabling the pin's
5324 * input/output buffers as needed.
5326 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5327 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5328 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5329 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5330 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5331 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5332 /* Also unmute the mono-out pin widget */
5333 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5335 /* Mute capture amp left and right */
5336 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5337 /* Set ADC connection select to match default mixer setting (mic1
5340 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5342 /* Do the same for the second ADC: mute capture input amp and
5343 * set ADC connection to mic1 pin
5345 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5346 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5348 /* Mute all inputs to mixer widget (even unconnected ones) */
5349 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5351 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5352 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5353 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5354 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5355 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5362 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5363 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5365 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5366 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5369 * for BIOS auto-configuration
5372 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
5373 const char *pfx
, int *vol_bits
)
5376 unsigned long vol_val
, sw_val
;
5380 if (nid
>= 0x0f && nid
< 0x11) {
5381 nid_vol
= nid
- 0x7;
5382 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
5383 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
5384 } else if (nid
== 0x11) {
5385 nid_vol
= nid
- 0x7;
5386 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
5387 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
5388 } else if (nid
>= 0x12 && nid
<= 0x15) {
5390 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
5391 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
5395 if (!(*vol_bits
& (1 << nid_vol
))) {
5396 /* first control for the volume widget */
5397 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
5398 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
);
5401 *vol_bits
|= (1 << nid_vol
);
5403 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
5404 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
);
5410 /* add playback controls from the parsed DAC table */
5411 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
5412 const struct auto_pin_cfg
*cfg
)
5418 spec
->multiout
.num_dacs
= 1;
5419 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
5420 spec
->multiout
.dac_nids
[0] = 0x02;
5422 nid
= cfg
->line_out_pins
[0];
5424 err
= alc260_add_playback_controls(spec
, nid
, "Front", &vols
);
5429 nid
= cfg
->speaker_pins
[0];
5431 err
= alc260_add_playback_controls(spec
, nid
, "Speaker", &vols
);
5436 nid
= cfg
->hp_pins
[0];
5438 err
= alc260_add_playback_controls(spec
, nid
, "Headphone",
5446 /* create playback/capture controls for input pins */
5447 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
5448 const struct auto_pin_cfg
*cfg
)
5450 struct hda_input_mux
*imux
= &spec
->private_imux
;
5453 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5454 if (cfg
->input_pins
[i
] >= 0x12) {
5455 idx
= cfg
->input_pins
[i
] - 0x12;
5456 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
5457 auto_pin_cfg_labels
[i
], idx
,
5461 imux
->items
[imux
->num_items
].label
=
5462 auto_pin_cfg_labels
[i
];
5463 imux
->items
[imux
->num_items
].index
= idx
;
5466 if (cfg
->input_pins
[i
] >= 0x0f && cfg
->input_pins
[i
] <= 0x10){
5467 idx
= cfg
->input_pins
[i
] - 0x09;
5468 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
5469 auto_pin_cfg_labels
[i
], idx
,
5473 imux
->items
[imux
->num_items
].label
=
5474 auto_pin_cfg_labels
[i
];
5475 imux
->items
[imux
->num_items
].index
= idx
;
5482 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
5483 hda_nid_t nid
, int pin_type
,
5486 alc_set_pin_output(codec
, nid
, pin_type
);
5487 /* need the manual connection? */
5489 int idx
= nid
- 0x12;
5490 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
5491 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
5495 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
5497 struct alc_spec
*spec
= codec
->spec
;
5500 alc_subsystem_id(codec
, 0x10, 0x15, 0x0f);
5501 nid
= spec
->autocfg
.line_out_pins
[0];
5503 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5504 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
5507 nid
= spec
->autocfg
.speaker_pins
[0];
5509 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
5511 nid
= spec
->autocfg
.hp_pins
[0];
5513 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
5516 #define ALC260_PIN_CD_NID 0x16
5517 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
5519 struct alc_spec
*spec
= codec
->spec
;
5522 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5523 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5525 snd_hda_codec_write(codec
, nid
, 0,
5526 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5527 i
<= AUTO_PIN_FRONT_MIC
?
5528 PIN_VREF80
: PIN_IN
);
5529 if (nid
!= ALC260_PIN_CD_NID
)
5530 snd_hda_codec_write(codec
, nid
, 0,
5531 AC_VERB_SET_AMP_GAIN_MUTE
,
5538 * generic initialization of ADC, input mixers and output mixers
5540 static struct hda_verb alc260_volume_init_verbs
[] = {
5542 * Unmute ADC0-1 and set the default input to mic-in
5544 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5545 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5546 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5547 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5549 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5551 * Note: PASD motherboards uses the Line In 2 as the input for
5552 * front panel mic (mic 2)
5554 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5555 /* mute analog inputs */
5556 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5557 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5559 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5560 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5563 * Set up output mixers (0x08 - 0x0a)
5565 /* set vol=0 to output mixers */
5566 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5567 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5568 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5569 /* set up input amps for analog loopback */
5570 /* Amp Indices: DAC = 0, mixer = 1 */
5571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5572 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5573 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5575 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5576 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5581 static int alc260_parse_auto_config(struct hda_codec
*codec
)
5583 struct alc_spec
*spec
= codec
->spec
;
5585 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
5587 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5591 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5594 if (!spec
->kctls
.list
)
5595 return 0; /* can't find valid BIOS pin config */
5596 err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
5600 spec
->multiout
.max_channels
= 2;
5602 if (spec
->autocfg
.dig_out_pin
)
5603 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
5604 if (spec
->kctls
.list
)
5605 add_mixer(spec
, spec
->kctls
.list
);
5607 add_verb(spec
, alc260_volume_init_verbs
);
5609 spec
->num_mux_defs
= 1;
5610 spec
->input_mux
= &spec
->private_imux
;
5612 store_pin_configs(codec
);
5616 /* additional initialization for auto-configuration model */
5617 static void alc260_auto_init(struct hda_codec
*codec
)
5619 struct alc_spec
*spec
= codec
->spec
;
5620 alc260_auto_init_multi_out(codec
);
5621 alc260_auto_init_analog_input(codec
);
5622 if (spec
->unsol_event
)
5623 alc_inithook(codec
);
5626 #ifdef CONFIG_SND_HDA_POWER_SAVE
5627 static struct hda_amp_list alc260_loopbacks
[] = {
5628 { 0x07, HDA_INPUT
, 0 },
5629 { 0x07, HDA_INPUT
, 1 },
5630 { 0x07, HDA_INPUT
, 2 },
5631 { 0x07, HDA_INPUT
, 3 },
5632 { 0x07, HDA_INPUT
, 4 },
5638 * ALC260 configurations
5640 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
5641 [ALC260_BASIC
] = "basic",
5643 [ALC260_HP_3013
] = "hp-3013",
5644 [ALC260_HP_DC7600
] = "hp-dc7600",
5645 [ALC260_FUJITSU_S702X
] = "fujitsu",
5646 [ALC260_ACER
] = "acer",
5647 [ALC260_WILL
] = "will",
5648 [ALC260_REPLACER_672V
] = "replacer",
5649 #ifdef CONFIG_SND_DEBUG
5650 [ALC260_TEST
] = "test",
5652 [ALC260_AUTO
] = "auto",
5655 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
5656 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
5657 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
5658 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
5659 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013
),
5660 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
5661 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
5662 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600
),
5663 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
5664 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
5665 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
5666 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
5667 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
5668 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
5669 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
5670 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
5671 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
5672 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
5673 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
5677 static struct alc_config_preset alc260_presets
[] = {
5679 .mixers
= { alc260_base_output_mixer
,
5681 alc260_pc_beep_mixer
},
5682 .init_verbs
= { alc260_init_verbs
},
5683 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5684 .dac_nids
= alc260_dac_nids
,
5685 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5686 .adc_nids
= alc260_adc_nids
,
5687 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5688 .channel_mode
= alc260_modes
,
5689 .input_mux
= &alc260_capture_source
,
5692 .mixers
= { alc260_hp_output_mixer
,
5693 alc260_input_mixer
},
5694 .init_verbs
= { alc260_init_verbs
,
5695 alc260_hp_unsol_verbs
},
5696 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5697 .dac_nids
= alc260_dac_nids
,
5698 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
5699 .adc_nids
= alc260_adc_nids_alt
,
5700 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5701 .channel_mode
= alc260_modes
,
5702 .input_mux
= &alc260_capture_source
,
5703 .unsol_event
= alc260_hp_unsol_event
,
5704 .init_hook
= alc260_hp_automute
,
5706 [ALC260_HP_DC7600
] = {
5707 .mixers
= { alc260_hp_dc7600_mixer
,
5708 alc260_input_mixer
},
5709 .init_verbs
= { alc260_init_verbs
,
5710 alc260_hp_dc7600_verbs
},
5711 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5712 .dac_nids
= alc260_dac_nids
,
5713 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
5714 .adc_nids
= alc260_adc_nids_alt
,
5715 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5716 .channel_mode
= alc260_modes
,
5717 .input_mux
= &alc260_capture_source
,
5718 .unsol_event
= alc260_hp_3012_unsol_event
,
5719 .init_hook
= alc260_hp_3012_automute
,
5721 [ALC260_HP_3013
] = {
5722 .mixers
= { alc260_hp_3013_mixer
,
5723 alc260_input_mixer
},
5724 .init_verbs
= { alc260_hp_3013_init_verbs
,
5725 alc260_hp_3013_unsol_verbs
},
5726 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5727 .dac_nids
= alc260_dac_nids
,
5728 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
5729 .adc_nids
= alc260_adc_nids_alt
,
5730 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5731 .channel_mode
= alc260_modes
,
5732 .input_mux
= &alc260_capture_source
,
5733 .unsol_event
= alc260_hp_3013_unsol_event
,
5734 .init_hook
= alc260_hp_3013_automute
,
5736 [ALC260_FUJITSU_S702X
] = {
5737 .mixers
= { alc260_fujitsu_mixer
},
5738 .init_verbs
= { alc260_fujitsu_init_verbs
},
5739 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5740 .dac_nids
= alc260_dac_nids
,
5741 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5742 .adc_nids
= alc260_dual_adc_nids
,
5743 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5744 .channel_mode
= alc260_modes
,
5745 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
5746 .input_mux
= alc260_fujitsu_capture_sources
,
5749 .mixers
= { alc260_acer_mixer
},
5750 .init_verbs
= { alc260_acer_init_verbs
},
5751 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5752 .dac_nids
= alc260_dac_nids
,
5753 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5754 .adc_nids
= alc260_dual_adc_nids
,
5755 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5756 .channel_mode
= alc260_modes
,
5757 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
5758 .input_mux
= alc260_acer_capture_sources
,
5761 .mixers
= { alc260_will_mixer
},
5762 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
5763 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5764 .dac_nids
= alc260_dac_nids
,
5765 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5766 .adc_nids
= alc260_adc_nids
,
5767 .dig_out_nid
= ALC260_DIGOUT_NID
,
5768 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5769 .channel_mode
= alc260_modes
,
5770 .input_mux
= &alc260_capture_source
,
5772 [ALC260_REPLACER_672V
] = {
5773 .mixers
= { alc260_replacer_672v_mixer
},
5774 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
5775 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5776 .dac_nids
= alc260_dac_nids
,
5777 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5778 .adc_nids
= alc260_adc_nids
,
5779 .dig_out_nid
= ALC260_DIGOUT_NID
,
5780 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5781 .channel_mode
= alc260_modes
,
5782 .input_mux
= &alc260_capture_source
,
5783 .unsol_event
= alc260_replacer_672v_unsol_event
,
5784 .init_hook
= alc260_replacer_672v_automute
,
5786 #ifdef CONFIG_SND_DEBUG
5788 .mixers
= { alc260_test_mixer
},
5789 .init_verbs
= { alc260_test_init_verbs
},
5790 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
5791 .dac_nids
= alc260_test_dac_nids
,
5792 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
5793 .adc_nids
= alc260_test_adc_nids
,
5794 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5795 .channel_mode
= alc260_modes
,
5796 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
5797 .input_mux
= alc260_test_capture_sources
,
5802 static int patch_alc260(struct hda_codec
*codec
)
5804 struct alc_spec
*spec
;
5805 int err
, board_config
;
5807 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5813 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
5816 if (board_config
< 0) {
5817 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
5818 "trying auto-probe from BIOS...\n");
5819 board_config
= ALC260_AUTO
;
5822 if (board_config
== ALC260_AUTO
) {
5823 /* automatic parse from the BIOS config */
5824 err
= alc260_parse_auto_config(codec
);
5830 "hda_codec: Cannot set up configuration "
5831 "from BIOS. Using base mode...\n");
5832 board_config
= ALC260_BASIC
;
5836 if (board_config
!= ALC260_AUTO
)
5837 setup_preset(spec
, &alc260_presets
[board_config
]);
5839 spec
->stream_name_analog
= "ALC260 Analog";
5840 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
5841 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
5843 spec
->stream_name_digital
= "ALC260 Digital";
5844 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
5845 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
5847 if (!spec
->adc_nids
&& spec
->input_mux
) {
5848 /* check whether NID 0x04 is valid */
5849 unsigned int wcap
= get_wcaps(codec
, 0x04);
5850 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
5852 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
5853 spec
->adc_nids
= alc260_adc_nids_alt
;
5854 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
5856 spec
->adc_nids
= alc260_adc_nids
;
5857 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
5860 set_capture_mixer(spec
);
5862 spec
->vmaster_nid
= 0x08;
5864 codec
->patch_ops
= alc_patch_ops
;
5865 if (board_config
== ALC260_AUTO
)
5866 spec
->init_hook
= alc260_auto_init
;
5867 #ifdef CONFIG_SND_HDA_POWER_SAVE
5868 if (!spec
->loopback
.amplist
)
5869 spec
->loopback
.amplist
= alc260_loopbacks
;
5879 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5880 * configuration. Each pin widget can choose any input DACs and a mixer.
5881 * Each ADC is connected from a mixer of all inputs. This makes possible
5882 * 6-channel independent captures.
5884 * In addition, an independent DAC for the multi-playback (not used in this
5887 #define ALC882_DIGOUT_NID 0x06
5888 #define ALC882_DIGIN_NID 0x0a
5890 static struct hda_channel_mode alc882_ch_modes
[1] = {
5894 static hda_nid_t alc882_dac_nids
[4] = {
5895 /* front, rear, clfe, rear_surr */
5896 0x02, 0x03, 0x04, 0x05
5899 /* identical with ALC880 */
5900 #define alc882_adc_nids alc880_adc_nids
5901 #define alc882_adc_nids_alt alc880_adc_nids_alt
5903 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
5904 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
5907 /* FIXME: should be a matrix-type input source selection */
5909 static struct hda_input_mux alc882_capture_source
= {
5913 { "Front Mic", 0x1 },
5921 static struct hda_verb alc882_3ST_ch2_init
[] = {
5922 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5923 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5924 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5925 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5932 static struct hda_verb alc882_3ST_ch6_init
[] = {
5933 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5934 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5935 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
5936 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5937 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5938 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5942 static struct hda_channel_mode alc882_3ST_6ch_modes
[2] = {
5943 { 2, alc882_3ST_ch2_init
},
5944 { 6, alc882_3ST_ch6_init
},
5950 static struct hda_verb alc882_sixstack_ch6_init
[] = {
5951 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
5952 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5953 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5954 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5961 static struct hda_verb alc882_sixstack_ch8_init
[] = {
5962 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5963 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5964 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5965 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5969 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
5970 { 6, alc882_sixstack_ch6_init
},
5971 { 8, alc882_sixstack_ch8_init
},
5975 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5981 static struct hda_verb alc885_mbp_ch2_init
[] = {
5982 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5983 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5984 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5991 static struct hda_verb alc885_mbp_ch6_init
[] = {
5992 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5993 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5994 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5995 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5996 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6000 static struct hda_channel_mode alc885_mbp_6ch_modes
[2] = {
6001 { 2, alc885_mbp_ch2_init
},
6002 { 6, alc885_mbp_ch6_init
},
6006 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6007 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6009 static struct snd_kcontrol_new alc882_base_mixer
[] = {
6010 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6011 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6012 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6013 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6014 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6015 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6016 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6017 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6018 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6019 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6020 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6021 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6022 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6023 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6024 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6026 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6027 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6028 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6029 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6030 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6031 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6032 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6036 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
6037 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
6038 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
6039 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT
),
6040 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
6041 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6042 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
6044 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
6045 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
6046 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
6049 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
6050 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6051 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6052 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6053 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6054 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6055 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6056 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6057 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6058 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6059 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6060 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6064 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
6065 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6066 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6067 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6068 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6069 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6070 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6071 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6073 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6074 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6075 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6076 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6077 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6081 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6082 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6084 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
6085 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6086 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6088 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
6089 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6090 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6091 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6092 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6093 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
6094 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
6095 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6096 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6097 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6101 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
6102 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6103 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6104 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6105 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6106 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6107 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6108 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6109 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6110 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6112 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6113 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6117 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
6119 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6120 .name
= "Channel Mode",
6121 .info
= alc_ch_mode_info
,
6122 .get
= alc_ch_mode_get
,
6123 .put
= alc_ch_mode_put
,
6128 static struct hda_verb alc882_init_verbs
[] = {
6129 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6130 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6131 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6132 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6134 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6135 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6138 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6139 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6140 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6142 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6143 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6144 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6146 /* Front Pin: output 0 (0x0c) */
6147 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6148 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6149 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6150 /* Rear Pin: output 1 (0x0d) */
6151 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6152 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6153 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6154 /* CLFE Pin: output 2 (0x0e) */
6155 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6156 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6157 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
6158 /* Side Pin: output 3 (0x0f) */
6159 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6160 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6161 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
6162 /* Mic (rear) pin: input vref at 80% */
6163 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6164 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6165 /* Front Mic pin: input vref at 80% */
6166 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6167 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6168 /* Line In pin: input */
6169 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6170 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6171 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6172 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6173 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6174 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6175 /* CD pin widget for input */
6176 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6178 /* FIXME: use matrix-type input source selection */
6179 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6180 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6181 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6186 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6187 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6188 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6189 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6191 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6195 /* ADC1: mute amp left and right */
6196 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6197 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6198 /* ADC2: mute amp left and right */
6199 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6200 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6201 /* ADC3: mute amp left and right */
6202 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6203 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6208 static struct hda_verb alc882_eapd_verbs
[] = {
6209 /* change to EAPD mode */
6210 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6211 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
6216 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
6217 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6218 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6219 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
6220 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
6221 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
6222 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6223 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6227 static struct hda_verb alc882_macpro_init_verbs
[] = {
6228 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6229 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6230 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6231 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6232 /* Front Pin: output 0 (0x0c) */
6233 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6234 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6235 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6236 /* Front Mic pin: input vref at 80% */
6237 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6238 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6239 /* Speaker: output */
6240 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6241 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6242 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
6243 /* Headphone output (output 0 - 0x0c) */
6244 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6245 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6246 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
6248 /* FIXME: use matrix-type input source selection */
6249 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6250 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6251 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6252 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6253 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6254 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6256 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6257 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6258 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6261 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6265 /* ADC1: mute amp left and right */
6266 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6267 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6268 /* ADC2: mute amp left and right */
6269 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6270 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6271 /* ADC3: mute amp left and right */
6272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6273 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6278 /* Macbook Pro rev3 */
6279 static struct hda_verb alc885_mbp3_init_verbs
[] = {
6280 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6285 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6286 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6287 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6288 /* Front Pin: output 0 (0x0c) */
6289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6290 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6291 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6292 /* HP Pin: output 0 (0x0d) */
6293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
6294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6295 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6296 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6297 /* Mic (rear) pin: input vref at 80% */
6298 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6299 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6300 /* Front Mic pin: input vref at 80% */
6301 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6302 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6303 /* Line In pin: use output 1 when in LineOut mode */
6304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6305 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6306 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
6308 /* FIXME: use matrix-type input source selection */
6309 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6310 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6311 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6325 /* ADC1: mute amp left and right */
6326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6327 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6328 /* ADC2: mute amp left and right */
6329 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6330 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6331 /* ADC3: mute amp left and right */
6332 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6333 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6338 /* iMac 24 mixer. */
6339 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
6340 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
6341 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
6345 /* iMac 24 init verbs. */
6346 static struct hda_verb alc885_imac24_init_verbs
[] = {
6347 /* Internal speakers: output 0 (0x0c) */
6348 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6349 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6350 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
6351 /* Internal speakers: output 0 (0x0c) */
6352 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6353 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6354 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
6355 /* Headphone: output 0 (0x0c) */
6356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6357 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6358 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6359 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6360 /* Front Mic: input vref at 80% */
6361 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6362 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6366 /* Toggle speaker-output according to the hp-jack state */
6367 static void alc885_imac24_automute(struct hda_codec
*codec
)
6369 unsigned int present
;
6371 present
= snd_hda_codec_read(codec
, 0x14, 0,
6372 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6373 snd_hda_codec_amp_stereo(codec
, 0x18, HDA_OUTPUT
, 0,
6374 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6375 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
6376 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6379 /* Processes unsolicited events. */
6380 static void alc885_imac24_unsol_event(struct hda_codec
*codec
,
6383 /* Headphone insertion or removal. */
6384 if ((res
>> 26) == ALC880_HP_EVENT
)
6385 alc885_imac24_automute(codec
);
6388 static void alc885_mbp3_automute(struct hda_codec
*codec
)
6390 unsigned int present
;
6392 present
= snd_hda_codec_read(codec
, 0x15, 0,
6393 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6394 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
6395 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6396 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6397 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
6400 static void alc885_mbp3_unsol_event(struct hda_codec
*codec
,
6403 /* Headphone insertion or removal. */
6404 if ((res
>> 26) == ALC880_HP_EVENT
)
6405 alc885_mbp3_automute(codec
);
6409 static struct hda_verb alc882_targa_verbs
[] = {
6410 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6411 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6413 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6414 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6416 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6417 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6418 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6420 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6421 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
6422 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
6423 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
6427 /* toggle speaker-output according to the hp-jack state */
6428 static void alc882_targa_automute(struct hda_codec
*codec
)
6430 unsigned int present
;
6432 present
= snd_hda_codec_read(codec
, 0x14, 0,
6433 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6434 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
6435 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6436 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
6440 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
6442 /* Looks like the unsol event is incompatible with the standard
6443 * definition. 4bit tag is placed at 26 bit!
6445 if (((res
>> 26) == ALC880_HP_EVENT
)) {
6446 alc882_targa_automute(codec
);
6450 static struct hda_verb alc882_asus_a7j_verbs
[] = {
6451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6455 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6456 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6458 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6459 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6460 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6462 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6463 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6464 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6468 static struct hda_verb alc882_asus_a7m_verbs
[] = {
6469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6472 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6474 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6476 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6477 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6478 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6480 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6481 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6482 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6486 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
6488 unsigned int gpiostate
, gpiomask
, gpiodir
;
6490 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6491 AC_VERB_GET_GPIO_DATA
, 0);
6494 gpiostate
|= (1 << pin
);
6496 gpiostate
&= ~(1 << pin
);
6498 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6499 AC_VERB_GET_GPIO_MASK
, 0);
6500 gpiomask
|= (1 << pin
);
6502 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6503 AC_VERB_GET_GPIO_DIRECTION
, 0);
6504 gpiodir
|= (1 << pin
);
6507 snd_hda_codec_write(codec
, codec
->afg
, 0,
6508 AC_VERB_SET_GPIO_MASK
, gpiomask
);
6509 snd_hda_codec_write(codec
, codec
->afg
, 0,
6510 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
6514 snd_hda_codec_write(codec
, codec
->afg
, 0,
6515 AC_VERB_SET_GPIO_DATA
, gpiostate
);
6518 /* set up GPIO at initialization */
6519 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
6521 alc882_gpio_mute(codec
, 0, 0);
6522 alc882_gpio_mute(codec
, 1, 0);
6525 /* set up GPIO and update auto-muting at initialization */
6526 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
6528 alc885_macpro_init_hook(codec
);
6529 alc885_imac24_automute(codec
);
6533 * generic initialization of ADC, input mixers and output mixers
6535 static struct hda_verb alc882_auto_init_verbs
[] = {
6537 * Unmute ADC0-2 and set the default input to mic-in
6539 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6540 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6541 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6542 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6543 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6544 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6546 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6548 * Note: PASD motherboards uses the Line In 2 as the input for
6549 * front panel mic (mic 2)
6551 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6554 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6555 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6556 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6559 * Set up output mixers (0x0c - 0x0f)
6561 /* set vol=0 to output mixers */
6562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6564 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6565 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6566 /* set up input amps for analog loopback */
6567 /* Amp Indices: DAC = 0, mixer = 1 */
6568 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6569 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6570 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6571 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6572 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6573 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6574 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6575 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6576 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6577 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6579 /* FIXME: use matrix-type input source selection */
6580 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6581 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6582 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6583 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6584 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6585 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6587 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6588 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6589 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6590 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6592 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6595 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6600 #ifdef CONFIG_SND_HDA_POWER_SAVE
6601 #define alc882_loopbacks alc880_loopbacks
6604 /* pcm configuration: identiacal with ALC880 */
6605 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6606 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6607 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6608 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6611 * configuration and preset
6613 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
6614 [ALC882_3ST_DIG
] = "3stack-dig",
6615 [ALC882_6ST_DIG
] = "6stack-dig",
6616 [ALC882_ARIMA
] = "arima",
6617 [ALC882_W2JC
] = "w2jc",
6618 [ALC882_TARGA
] = "targa",
6619 [ALC882_ASUS_A7J
] = "asus-a7j",
6620 [ALC882_ASUS_A7M
] = "asus-a7m",
6621 [ALC885_MACPRO
] = "macpro",
6622 [ALC885_MBP3
] = "mbp3",
6623 [ALC885_IMAC24
] = "imac24",
6624 [ALC882_AUTO
] = "auto",
6627 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
6628 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
6629 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
6630 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
6631 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
6632 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
6633 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
6634 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
6635 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
6636 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
6637 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
6638 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
6639 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
6643 static struct alc_config_preset alc882_presets
[] = {
6644 [ALC882_3ST_DIG
] = {
6645 .mixers
= { alc882_base_mixer
},
6646 .init_verbs
= { alc882_init_verbs
},
6647 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6648 .dac_nids
= alc882_dac_nids
,
6649 .dig_out_nid
= ALC882_DIGOUT_NID
,
6650 .dig_in_nid
= ALC882_DIGIN_NID
,
6651 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6652 .channel_mode
= alc882_ch_modes
,
6654 .input_mux
= &alc882_capture_source
,
6656 [ALC882_6ST_DIG
] = {
6657 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6658 .init_verbs
= { alc882_init_verbs
},
6659 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6660 .dac_nids
= alc882_dac_nids
,
6661 .dig_out_nid
= ALC882_DIGOUT_NID
,
6662 .dig_in_nid
= ALC882_DIGIN_NID
,
6663 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6664 .channel_mode
= alc882_sixstack_modes
,
6665 .input_mux
= &alc882_capture_source
,
6668 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6669 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
6670 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6671 .dac_nids
= alc882_dac_nids
,
6672 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6673 .channel_mode
= alc882_sixstack_modes
,
6674 .input_mux
= &alc882_capture_source
,
6677 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
6678 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6679 alc880_gpio1_init_verbs
},
6680 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6681 .dac_nids
= alc882_dac_nids
,
6682 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6683 .channel_mode
= alc880_threestack_modes
,
6685 .input_mux
= &alc882_capture_source
,
6686 .dig_out_nid
= ALC882_DIGOUT_NID
,
6689 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
6690 .init_verbs
= { alc885_mbp3_init_verbs
,
6691 alc880_gpio1_init_verbs
},
6692 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6693 .dac_nids
= alc882_dac_nids
,
6694 .channel_mode
= alc885_mbp_6ch_modes
,
6695 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_6ch_modes
),
6696 .input_mux
= &alc882_capture_source
,
6697 .dig_out_nid
= ALC882_DIGOUT_NID
,
6698 .dig_in_nid
= ALC882_DIGIN_NID
,
6699 .unsol_event
= alc885_mbp3_unsol_event
,
6700 .init_hook
= alc885_mbp3_automute
,
6703 .mixers
= { alc882_macpro_mixer
},
6704 .init_verbs
= { alc882_macpro_init_verbs
},
6705 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6706 .dac_nids
= alc882_dac_nids
,
6707 .dig_out_nid
= ALC882_DIGOUT_NID
,
6708 .dig_in_nid
= ALC882_DIGIN_NID
,
6709 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6710 .channel_mode
= alc882_ch_modes
,
6711 .input_mux
= &alc882_capture_source
,
6712 .init_hook
= alc885_macpro_init_hook
,
6715 .mixers
= { alc885_imac24_mixer
},
6716 .init_verbs
= { alc885_imac24_init_verbs
},
6717 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6718 .dac_nids
= alc882_dac_nids
,
6719 .dig_out_nid
= ALC882_DIGOUT_NID
,
6720 .dig_in_nid
= ALC882_DIGIN_NID
,
6721 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6722 .channel_mode
= alc882_ch_modes
,
6723 .input_mux
= &alc882_capture_source
,
6724 .unsol_event
= alc885_imac24_unsol_event
,
6725 .init_hook
= alc885_imac24_init_hook
,
6728 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
},
6729 .init_verbs
= { alc882_init_verbs
, alc882_targa_verbs
},
6730 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6731 .dac_nids
= alc882_dac_nids
,
6732 .dig_out_nid
= ALC882_DIGOUT_NID
,
6733 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6734 .adc_nids
= alc882_adc_nids
,
6735 .capsrc_nids
= alc882_capsrc_nids
,
6736 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6737 .channel_mode
= alc882_3ST_6ch_modes
,
6739 .input_mux
= &alc882_capture_source
,
6740 .unsol_event
= alc882_targa_unsol_event
,
6741 .init_hook
= alc882_targa_automute
,
6743 [ALC882_ASUS_A7J
] = {
6744 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
},
6745 .init_verbs
= { alc882_init_verbs
, alc882_asus_a7j_verbs
},
6746 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6747 .dac_nids
= alc882_dac_nids
,
6748 .dig_out_nid
= ALC882_DIGOUT_NID
,
6749 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6750 .adc_nids
= alc882_adc_nids
,
6751 .capsrc_nids
= alc882_capsrc_nids
,
6752 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6753 .channel_mode
= alc882_3ST_6ch_modes
,
6755 .input_mux
= &alc882_capture_source
,
6757 [ALC882_ASUS_A7M
] = {
6758 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
6759 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6760 alc880_gpio1_init_verbs
,
6761 alc882_asus_a7m_verbs
},
6762 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6763 .dac_nids
= alc882_dac_nids
,
6764 .dig_out_nid
= ALC882_DIGOUT_NID
,
6765 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6766 .channel_mode
= alc880_threestack_modes
,
6768 .input_mux
= &alc882_capture_source
,
6777 PINFIX_ABIT_AW9D_MAX
6780 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
6781 { 0x15, 0x01080104 }, /* side */
6782 { 0x16, 0x01011012 }, /* rear */
6783 { 0x17, 0x01016011 }, /* clfe */
6787 static const struct alc_pincfg
*alc882_pin_fixes
[] = {
6788 [PINFIX_ABIT_AW9D_MAX
] = alc882_abit_aw9d_pinfix
,
6791 static struct snd_pci_quirk alc882_pinfix_tbl
[] = {
6792 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
6797 * BIOS auto configuration
6799 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
6800 hda_nid_t nid
, int pin_type
,
6804 struct alc_spec
*spec
= codec
->spec
;
6807 alc_set_pin_output(codec
, nid
, pin_type
);
6808 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
6811 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
6812 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
6816 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
6818 struct alc_spec
*spec
= codec
->spec
;
6821 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
6822 for (i
= 0; i
<= HDA_SIDE
; i
++) {
6823 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
6824 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
6826 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
6831 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
6833 struct alc_spec
*spec
= codec
->spec
;
6836 pin
= spec
->autocfg
.hp_pins
[0];
6837 if (pin
) /* connect to front */
6839 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
6840 pin
= spec
->autocfg
.speaker_pins
[0];
6842 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
6845 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6846 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6848 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
6850 struct alc_spec
*spec
= codec
->spec
;
6853 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
6854 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
6859 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6860 unsigned int pincap
;
6861 pincap
= snd_hda_param_read(codec
, nid
, AC_PAR_PIN_CAP
);
6862 if ((pincap
>> AC_PINCAP_VREF_SHIFT
) &
6866 snd_hda_codec_write(codec
, nid
, 0,
6867 AC_VERB_SET_PIN_WIDGET_CONTROL
, vref
);
6868 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
6869 snd_hda_codec_write(codec
, nid
, 0,
6870 AC_VERB_SET_AMP_GAIN_MUTE
,
6875 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
6877 struct alc_spec
*spec
= codec
->spec
;
6878 const struct hda_input_mux
*imux
= spec
->input_mux
;
6881 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
6882 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
6883 hda_nid_t nid
= spec
->capsrc_nids
[c
];
6884 int conns
, mute
, idx
, item
;
6886 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
6887 ARRAY_SIZE(conn_list
));
6890 for (idx
= 0; idx
< conns
; idx
++) {
6891 /* if the current connection is the selected one,
6892 * unmute it as default - otherwise mute it
6894 mute
= AMP_IN_MUTE(idx
);
6895 for (item
= 0; item
< imux
->num_items
; item
++) {
6896 if (imux
->items
[item
].index
== idx
) {
6897 if (spec
->cur_mux
[c
] == item
)
6898 mute
= AMP_IN_UNMUTE(idx
);
6902 snd_hda_codec_write(codec
, nid
, 0,
6903 AC_VERB_SET_AMP_GAIN_MUTE
, mute
);
6908 /* add mic boosts if needed */
6909 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
6911 struct alc_spec
*spec
= codec
->spec
;
6915 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
6916 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6917 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6919 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6923 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
6924 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6925 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6927 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6934 /* almost identical with ALC880 parser... */
6935 static int alc882_parse_auto_config(struct hda_codec
*codec
)
6937 struct alc_spec
*spec
= codec
->spec
;
6938 int err
= alc880_parse_auto_config(codec
);
6943 return 0; /* no config found */
6945 err
= alc_auto_add_mic_boost(codec
);
6949 /* hack - override the init verbs */
6950 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
6952 return 1; /* config found */
6955 /* additional initialization for auto-configuration model */
6956 static void alc882_auto_init(struct hda_codec
*codec
)
6958 struct alc_spec
*spec
= codec
->spec
;
6959 alc882_auto_init_multi_out(codec
);
6960 alc882_auto_init_hp_out(codec
);
6961 alc882_auto_init_analog_input(codec
);
6962 alc882_auto_init_input_src(codec
);
6963 if (spec
->unsol_event
)
6964 alc_inithook(codec
);
6967 static int patch_alc883(struct hda_codec
*codec
); /* called in patch_alc882() */
6969 static int patch_alc882(struct hda_codec
*codec
)
6971 struct alc_spec
*spec
;
6972 int err
, board_config
;
6974 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6980 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
6984 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
6985 /* Pick up systems that don't supply PCI SSID */
6986 switch (codec
->subsystem_id
) {
6987 case 0x106b0c00: /* Mac Pro */
6988 board_config
= ALC885_MACPRO
;
6990 case 0x106b1000: /* iMac 24 */
6991 case 0x106b2800: /* AppleTV */
6992 board_config
= ALC885_IMAC24
;
6994 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6995 case 0x106b00a4: /* MacbookPro4,1 */
6996 case 0x106b2c00: /* Macbook Pro rev3 */
6997 case 0x106b3600: /* Macbook 3.1 */
6998 board_config
= ALC885_MBP3
;
7001 /* ALC889A is handled better as ALC888-compatible */
7002 if (codec
->revision_id
== 0x100101 ||
7003 codec
->revision_id
== 0x100103) {
7005 return patch_alc883(codec
);
7007 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
7008 "trying auto-probe from BIOS...\n");
7009 board_config
= ALC882_AUTO
;
7013 alc_fix_pincfg(codec
, alc882_pinfix_tbl
, alc882_pin_fixes
);
7015 if (board_config
== ALC882_AUTO
) {
7016 /* automatic parse from the BIOS config */
7017 err
= alc882_parse_auto_config(codec
);
7023 "hda_codec: Cannot set up configuration "
7024 "from BIOS. Using base mode...\n");
7025 board_config
= ALC882_3ST_DIG
;
7029 if (board_config
!= ALC882_AUTO
)
7030 setup_preset(spec
, &alc882_presets
[board_config
]);
7032 if (codec
->vendor_id
== 0x10ec0885) {
7033 spec
->stream_name_analog
= "ALC885 Analog";
7034 spec
->stream_name_digital
= "ALC885 Digital";
7036 spec
->stream_name_analog
= "ALC882 Analog";
7037 spec
->stream_name_digital
= "ALC882 Digital";
7040 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
7041 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
7042 /* FIXME: setup DAC5 */
7043 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7044 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
7046 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
7047 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
7049 spec
->is_mix_capture
= 1; /* matrix-style capture */
7050 if (!spec
->adc_nids
&& spec
->input_mux
) {
7051 /* check whether NID 0x07 is valid */
7052 unsigned int wcap
= get_wcaps(codec
, 0x07);
7054 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
7055 if (wcap
!= AC_WID_AUD_IN
) {
7056 spec
->adc_nids
= alc882_adc_nids_alt
;
7057 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
7058 spec
->capsrc_nids
= alc882_capsrc_nids_alt
;
7060 spec
->adc_nids
= alc882_adc_nids
;
7061 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
7062 spec
->capsrc_nids
= alc882_capsrc_nids
;
7065 set_capture_mixer(spec
);
7067 spec
->vmaster_nid
= 0x0c;
7069 codec
->patch_ops
= alc_patch_ops
;
7070 if (board_config
== ALC882_AUTO
)
7071 spec
->init_hook
= alc882_auto_init
;
7072 #ifdef CONFIG_SND_HDA_POWER_SAVE
7073 if (!spec
->loopback
.amplist
)
7074 spec
->loopback
.amplist
= alc882_loopbacks
;
7083 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7084 * configuration. Each pin widget can choose any input DACs and a mixer.
7085 * Each ADC is connected from a mixer of all inputs. This makes possible
7086 * 6-channel independent captures.
7088 * In addition, an independent DAC for the multi-playback (not used in this
7091 #define ALC883_DIGOUT_NID 0x06
7092 #define ALC883_DIGIN_NID 0x0a
7094 #define ALC1200_DIGOUT_NID 0x10
7096 static hda_nid_t alc883_dac_nids
[4] = {
7097 /* front, rear, clfe, rear_surr */
7098 0x02, 0x03, 0x04, 0x05
7101 static hda_nid_t alc883_adc_nids
[2] = {
7106 static hda_nid_t alc883_adc_nids_alt
[1] = {
7111 static hda_nid_t alc883_adc_nids_rev
[2] = {
7116 static hda_nid_t alc883_capsrc_nids
[2] = { 0x23, 0x22 };
7118 static hda_nid_t alc883_capsrc_nids_rev
[2] = { 0x22, 0x23 };
7121 /* FIXME: should be a matrix-type input source selection */
7123 static struct hda_input_mux alc883_capture_source
= {
7127 { "Front Mic", 0x1 },
7133 static struct hda_input_mux alc883_3stack_6ch_intel
= {
7137 { "Front Mic", 0x0 },
7143 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
7151 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
7161 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
7169 static struct hda_input_mux alc883_lenovo_sky_capture_source
= {
7173 { "Front Mic", 0x1 },
7178 static struct hda_input_mux alc883_asus_eee1601_capture_source
= {
7189 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
7196 static struct hda_verb alc883_3ST_ch2_init
[] = {
7197 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7198 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7199 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7200 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7207 static struct hda_verb alc883_3ST_ch4_init
[] = {
7208 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7209 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7210 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7211 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7212 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7219 static struct hda_verb alc883_3ST_ch6_init
[] = {
7220 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7221 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7222 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7223 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7224 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7225 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7229 static struct hda_channel_mode alc883_3ST_6ch_modes
[3] = {
7230 { 2, alc883_3ST_ch2_init
},
7231 { 4, alc883_3ST_ch4_init
},
7232 { 6, alc883_3ST_ch6_init
},
7238 static struct hda_verb alc883_3ST_ch2_intel_init
[] = {
7239 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7240 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7241 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7242 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7249 static struct hda_verb alc883_3ST_ch4_intel_init
[] = {
7250 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7251 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7252 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7253 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7254 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7261 static struct hda_verb alc883_3ST_ch6_intel_init
[] = {
7262 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7263 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7264 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7265 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7266 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7267 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7271 static struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
7272 { 2, alc883_3ST_ch2_intel_init
},
7273 { 4, alc883_3ST_ch4_intel_init
},
7274 { 6, alc883_3ST_ch6_intel_init
},
7280 static struct hda_verb alc883_sixstack_ch6_init
[] = {
7281 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7282 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7283 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7284 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7291 static struct hda_verb alc883_sixstack_ch8_init
[] = {
7292 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7293 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7294 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7295 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7299 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
7300 { 6, alc883_sixstack_ch6_init
},
7301 { 8, alc883_sixstack_ch8_init
},
7304 static struct hda_verb alc883_medion_eapd_verbs
[] = {
7305 /* eanable EAPD on medion laptop */
7306 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7307 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
7311 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7312 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7315 static struct snd_kcontrol_new alc883_base_mixer
[] = {
7316 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7317 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7318 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7319 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7320 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7321 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7322 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7323 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7324 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
7325 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
7326 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7327 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7328 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7329 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7330 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7332 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7333 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7334 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7335 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7336 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7337 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7338 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7342 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
7343 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7344 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7345 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7346 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7347 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7348 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7351 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7353 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7354 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7355 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7359 static struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
7360 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7361 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
7362 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7363 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
7364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7365 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7367 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7368 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
7369 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7373 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
7374 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7375 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
7376 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7377 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
7378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7379 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7380 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7381 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7382 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
7383 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7387 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
7388 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7389 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7390 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7391 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7392 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7393 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7394 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7396 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7397 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7398 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7399 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7400 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7401 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7402 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7406 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
7407 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7408 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7409 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7410 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7411 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7412 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7413 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7414 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7415 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7416 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7417 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7418 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7419 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7421 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7422 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7423 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7424 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7425 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7426 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7427 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7431 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
7432 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7433 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7434 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7435 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7436 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7438 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7439 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7440 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7441 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7442 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7443 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7444 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7445 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7446 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7447 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
7448 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7449 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7450 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT
),
7451 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7452 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7453 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7457 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
7458 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7459 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7460 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7461 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7462 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7463 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7464 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7465 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7466 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7467 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7468 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7471 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7472 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7473 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7474 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7475 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7476 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7477 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7478 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7482 static struct snd_kcontrol_new alc883_tagra_mixer
[] = {
7483 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7484 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7485 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7486 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7487 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7488 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7489 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7490 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7491 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7492 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7493 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7494 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7495 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7496 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7497 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7498 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7502 static struct snd_kcontrol_new alc883_tagra_2ch_mixer
[] = {
7503 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7504 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7505 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7506 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7507 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7508 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7509 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7510 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7511 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7512 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
7513 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7517 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
7518 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7519 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7520 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7521 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
7522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7523 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7524 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7529 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
7530 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7531 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
7532 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7533 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7534 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7535 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7536 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7537 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7538 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7542 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
7543 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7545 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7546 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7547 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7548 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7549 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7550 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7551 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7555 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
7556 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7557 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7558 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7559 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7560 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7562 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7563 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7567 static struct snd_kcontrol_new alc888_lenovo_sky_mixer
[] = {
7568 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7569 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7570 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
7571 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
7572 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7573 0x0d, 1, 0x0, HDA_OUTPUT
),
7574 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
7575 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
7576 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
7577 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
7578 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
7579 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7580 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT
),
7581 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7582 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7583 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7584 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7585 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7586 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7587 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7588 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7589 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7590 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7594 static struct hda_bind_ctls alc883_bind_cap_vol
= {
7595 .ops
= &snd_hda_bind_vol
,
7597 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
7598 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
7603 static struct hda_bind_ctls alc883_bind_cap_switch
= {
7604 .ops
= &snd_hda_bind_sw
,
7606 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
7607 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
7612 static struct snd_kcontrol_new alc883_asus_eee1601_mixer
[] = {
7613 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7614 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7615 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7616 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7617 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7618 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7619 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7620 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7624 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer
[] = {
7625 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol
),
7626 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch
),
7628 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7629 /* .name = "Capture Source", */
7630 .name
= "Input Source",
7632 .info
= alc_mux_enum_info
,
7633 .get
= alc_mux_enum_get
,
7634 .put
= alc_mux_enum_put
,
7639 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
7641 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7642 .name
= "Channel Mode",
7643 .info
= alc_ch_mode_info
,
7644 .get
= alc_ch_mode_get
,
7645 .put
= alc_ch_mode_put
,
7650 static struct hda_verb alc883_init_verbs
[] = {
7651 /* ADC1: mute amp left and right */
7652 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7653 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7654 /* ADC2: mute amp left and right */
7655 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7656 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7657 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7663 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7666 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7667 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7668 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7670 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7671 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7672 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7674 /* mute analog input loopbacks */
7675 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7676 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7677 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7678 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7679 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7681 /* Front Pin: output 0 (0x0c) */
7682 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7683 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7684 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7685 /* Rear Pin: output 1 (0x0d) */
7686 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7687 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7688 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7689 /* CLFE Pin: output 2 (0x0e) */
7690 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7691 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7692 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
7693 /* Side Pin: output 3 (0x0f) */
7694 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7695 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7696 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
7697 /* Mic (rear) pin: input vref at 80% */
7698 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7699 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7700 /* Front Mic pin: input vref at 80% */
7701 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7702 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7703 /* Line In pin: input */
7704 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7705 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7706 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7707 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7708 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7709 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7710 /* CD pin widget for input */
7711 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7713 /* FIXME: use matrix-type input source selection */
7714 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7716 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7717 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7718 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7719 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7721 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7722 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7723 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7724 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7728 /* toggle speaker-output according to the hp-jack state */
7729 static void alc883_mitac_hp_automute(struct hda_codec
*codec
)
7731 unsigned int present
;
7733 present
= snd_hda_codec_read(codec
, 0x15, 0,
7734 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7735 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7736 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7737 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
7738 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7741 /* auto-toggle front mic */
7743 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7745 unsigned int present;
7748 present = snd_hda_codec_read(codec, 0x18, 0,
7749 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7750 bits = present ? HDA_AMP_MUTE : 0;
7751 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7755 static void alc883_mitac_automute(struct hda_codec
*codec
)
7757 alc883_mitac_hp_automute(codec
);
7758 /* alc883_mitac_mic_automute(codec); */
7761 static void alc883_mitac_unsol_event(struct hda_codec
*codec
,
7764 switch (res
>> 26) {
7765 case ALC880_HP_EVENT
:
7766 alc883_mitac_hp_automute(codec
);
7768 case ALC880_MIC_EVENT
:
7769 /* alc883_mitac_mic_automute(codec); */
7774 static struct hda_verb alc883_mitac_verbs
[] = {
7776 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7777 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7779 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
7780 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7782 /* enable unsolicited event */
7783 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7784 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7789 static struct hda_verb alc883_clevo_m720_verbs
[] = {
7791 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7792 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7794 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
7795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7797 /* enable unsolicited event */
7798 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7799 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
7804 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
7806 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7809 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7810 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7812 /* enable unsolicited event */
7813 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7818 static struct hda_verb alc883_tagra_verbs
[] = {
7819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7823 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7825 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
7826 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
7827 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
7829 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7830 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
7831 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
7832 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
7837 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
7838 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7839 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
7840 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
7844 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
7845 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7846 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7847 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7848 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7852 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
7853 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7855 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7856 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
7857 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7861 static struct hda_verb alc883_haier_w66_verbs
[] = {
7862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7865 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7867 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7868 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7869 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7870 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7874 static struct hda_verb alc888_lenovo_sky_verbs
[] = {
7875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7878 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7879 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7880 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7881 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
7882 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7886 static struct hda_verb alc888_3st_hp_verbs
[] = {
7887 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
7888 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
7889 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
7893 static struct hda_verb alc888_6st_dell_verbs
[] = {
7894 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7898 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
7899 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7900 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7901 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7902 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7906 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
7907 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7908 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7909 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7910 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7914 static struct hda_channel_mode alc888_3st_hp_modes
[2] = {
7915 { 2, alc888_3st_hp_2ch_init
},
7916 { 6, alc888_3st_hp_6ch_init
},
7919 /* toggle front-jack and RCA according to the hp-jack state */
7920 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
7922 unsigned int present
;
7924 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7925 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7926 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7927 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7928 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7929 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7932 /* toggle RCA according to the front-jack state */
7933 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
7935 unsigned int present
;
7937 present
= snd_hda_codec_read(codec
, 0x14, 0,
7938 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7939 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7940 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7943 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
7946 if ((res
>> 26) == ALC880_HP_EVENT
)
7947 alc888_lenovo_ms7195_front_automute(codec
);
7948 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7949 alc888_lenovo_ms7195_rca_automute(codec
);
7952 static struct hda_verb alc883_medion_md2_verbs
[] = {
7953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7956 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7958 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7962 /* toggle speaker-output according to the hp-jack state */
7963 static void alc883_medion_md2_automute(struct hda_codec
*codec
)
7965 unsigned int present
;
7967 present
= snd_hda_codec_read(codec
, 0x14, 0,
7968 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7969 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7970 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7973 static void alc883_medion_md2_unsol_event(struct hda_codec
*codec
,
7976 if ((res
>> 26) == ALC880_HP_EVENT
)
7977 alc883_medion_md2_automute(codec
);
7980 /* toggle speaker-output according to the hp-jack state */
7981 static void alc883_tagra_automute(struct hda_codec
*codec
)
7983 unsigned int present
;
7986 present
= snd_hda_codec_read(codec
, 0x14, 0,
7987 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7988 bits
= present
? HDA_AMP_MUTE
: 0;
7989 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
7990 HDA_AMP_MUTE
, bits
);
7991 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
7995 static void alc883_tagra_unsol_event(struct hda_codec
*codec
, unsigned int res
)
7997 if ((res
>> 26) == ALC880_HP_EVENT
)
7998 alc883_tagra_automute(codec
);
8001 /* toggle speaker-output according to the hp-jack state */
8002 static void alc883_clevo_m720_hp_automute(struct hda_codec
*codec
)
8004 unsigned int present
;
8007 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
8008 & AC_PINSENSE_PRESENCE
;
8009 bits
= present
? HDA_AMP_MUTE
: 0;
8010 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8011 HDA_AMP_MUTE
, bits
);
8014 static void alc883_clevo_m720_mic_automute(struct hda_codec
*codec
)
8016 unsigned int present
;
8018 present
= snd_hda_codec_read(codec
, 0x18, 0,
8019 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8020 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
8021 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8024 static void alc883_clevo_m720_automute(struct hda_codec
*codec
)
8026 alc883_clevo_m720_hp_automute(codec
);
8027 alc883_clevo_m720_mic_automute(codec
);
8030 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
8033 switch (res
>> 26) {
8034 case ALC880_HP_EVENT
:
8035 alc883_clevo_m720_hp_automute(codec
);
8037 case ALC880_MIC_EVENT
:
8038 alc883_clevo_m720_mic_automute(codec
);
8043 /* toggle speaker-output according to the hp-jack state */
8044 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec
*codec
)
8046 unsigned int present
;
8049 present
= snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_GET_PIN_SENSE
, 0)
8050 & AC_PINSENSE_PRESENCE
;
8051 bits
= present
? HDA_AMP_MUTE
: 0;
8052 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8053 HDA_AMP_MUTE
, bits
);
8056 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec
*codec
,
8059 if ((res
>> 26) == ALC880_HP_EVENT
)
8060 alc883_2ch_fujitsu_pi2515_automute(codec
);
8063 static void alc883_haier_w66_automute(struct hda_codec
*codec
)
8065 unsigned int present
;
8068 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8069 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8070 bits
= present
? 0x80 : 0;
8071 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8075 static void alc883_haier_w66_unsol_event(struct hda_codec
*codec
,
8078 if ((res
>> 26) == ALC880_HP_EVENT
)
8079 alc883_haier_w66_automute(codec
);
8082 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
8084 unsigned int present
;
8087 present
= snd_hda_codec_read(codec
, 0x14, 0,
8088 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8089 bits
= present
? HDA_AMP_MUTE
: 0;
8090 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8091 HDA_AMP_MUTE
, bits
);
8094 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
8096 unsigned int present
;
8099 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8100 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8101 bits
= present
? HDA_AMP_MUTE
: 0;
8102 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8103 HDA_AMP_MUTE
, bits
);
8104 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8105 HDA_AMP_MUTE
, bits
);
8108 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
8111 if ((res
>> 26) == ALC880_HP_EVENT
)
8112 alc883_lenovo_101e_all_automute(codec
);
8113 if ((res
>> 26) == ALC880_FRONT_EVENT
)
8114 alc883_lenovo_101e_ispeaker_automute(codec
);
8117 /* toggle speaker-output according to the hp-jack state */
8118 static void alc883_acer_aspire_automute(struct hda_codec
*codec
)
8120 unsigned int present
;
8122 present
= snd_hda_codec_read(codec
, 0x14, 0,
8123 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8124 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8125 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8126 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
8127 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8130 static void alc883_acer_aspire_unsol_event(struct hda_codec
*codec
,
8133 if ((res
>> 26) == ALC880_HP_EVENT
)
8134 alc883_acer_aspire_automute(codec
);
8137 static struct hda_verb alc883_acer_eapd_verbs
[] = {
8138 /* HP Pin: output 0 (0x0c) */
8139 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8140 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8141 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8142 /* Front Pin: output 0 (0x0c) */
8143 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8144 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8145 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8146 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
8147 /* eanable EAPD on medion laptop */
8148 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8149 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
8150 /* enable unsolicited event */
8151 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8155 static void alc888_6st_dell_front_automute(struct hda_codec
*codec
)
8157 unsigned int present
;
8159 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8160 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8161 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8162 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8163 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8164 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8165 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
8166 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8167 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
8168 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8171 static void alc888_6st_dell_unsol_event(struct hda_codec
*codec
,
8174 switch (res
>> 26) {
8175 case ALC880_HP_EVENT
:
8176 printk("hp_event\n");
8177 alc888_6st_dell_front_automute(codec
);
8182 static void alc888_lenovo_sky_front_automute(struct hda_codec
*codec
)
8185 unsigned int present
;
8187 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
8188 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8189 AC_VERB_GET_PIN_SENSE
, 0);
8190 present
= (present
& 0x80000000) != 0;
8192 /* mute internal speaker */
8193 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8194 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8195 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8196 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8197 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
8198 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8199 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
8200 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8201 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
8202 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8204 /* unmute internal speaker if necessary */
8205 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
8206 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8207 HDA_AMP_MUTE
, mute
);
8208 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8209 HDA_AMP_MUTE
, mute
);
8210 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
8211 HDA_AMP_MUTE
, mute
);
8212 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
8213 HDA_AMP_MUTE
, mute
);
8214 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
8215 HDA_AMP_MUTE
, mute
);
8219 static void alc883_lenovo_sky_unsol_event(struct hda_codec
*codec
,
8222 if ((res
>> 26) == ALC880_HP_EVENT
)
8223 alc888_lenovo_sky_front_automute(codec
);
8227 * generic initialization of ADC, input mixers and output mixers
8229 static struct hda_verb alc883_auto_init_verbs
[] = {
8231 * Unmute ADC0-2 and set the default input to mic-in
8233 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8235 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8236 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8238 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8240 * Note: PASD motherboards uses the Line In 2 as the input for
8241 * front panel mic (mic 2)
8243 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8244 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8251 * Set up output mixers (0x0c - 0x0f)
8253 /* set vol=0 to output mixers */
8254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8255 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8256 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8257 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8258 /* set up input amps for analog loopback */
8259 /* Amp Indices: DAC = 0, mixer = 1 */
8260 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8262 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8263 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8264 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8266 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8267 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8268 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8269 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8271 /* FIXME: use matrix-type input source selection */
8272 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8274 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8275 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8276 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8277 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8278 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
8280 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8281 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8282 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8283 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8284 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
8289 static struct hda_verb alc888_asus_m90v_verbs
[] = {
8290 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8291 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8293 /* enable unsolicited event */
8294 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8295 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
8299 static void alc883_nb_mic_automute(struct hda_codec
*codec
)
8301 unsigned int present
;
8303 present
= snd_hda_codec_read(codec
, 0x18, 0,
8304 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8305 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
8306 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
8307 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
8308 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
8311 static void alc883_M90V_speaker_automute(struct hda_codec
*codec
)
8313 unsigned int present
;
8316 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8317 AC_VERB_GET_PIN_SENSE
, 0)
8318 & AC_PINSENSE_PRESENCE
;
8319 bits
= present
? 0 : PIN_OUT
;
8320 snd_hda_codec_write(codec
, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
8322 snd_hda_codec_write(codec
, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
8324 snd_hda_codec_write(codec
, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
8328 static void alc883_mode2_unsol_event(struct hda_codec
*codec
,
8331 switch (res
>> 26) {
8332 case ALC880_HP_EVENT
:
8333 alc883_M90V_speaker_automute(codec
);
8335 case ALC880_MIC_EVENT
:
8336 alc883_nb_mic_automute(codec
);
8341 static void alc883_mode2_inithook(struct hda_codec
*codec
)
8343 alc883_M90V_speaker_automute(codec
);
8344 alc883_nb_mic_automute(codec
);
8347 static struct hda_verb alc888_asus_eee1601_verbs
[] = {
8348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8349 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8351 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8352 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8353 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
8354 {0x20, AC_VERB_SET_PROC_COEF
, 0x0838},
8355 /* enable unsolicited event */
8356 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8360 static void alc883_eee1601_speaker_automute(struct hda_codec
*codec
)
8362 unsigned int present
;
8365 present
= snd_hda_codec_read(codec
, 0x14, 0,
8366 AC_VERB_GET_PIN_SENSE
, 0)
8367 & AC_PINSENSE_PRESENCE
;
8368 bits
= present
? 0 : PIN_OUT
;
8369 snd_hda_codec_write(codec
, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
8373 static void alc883_eee1601_unsol_event(struct hda_codec
*codec
,
8376 switch (res
>> 26) {
8377 case ALC880_HP_EVENT
:
8378 alc883_eee1601_speaker_automute(codec
);
8383 static void alc883_eee1601_inithook(struct hda_codec
*codec
)
8385 alc883_eee1601_speaker_automute(codec
);
8388 #ifdef CONFIG_SND_HDA_POWER_SAVE
8389 #define alc883_loopbacks alc880_loopbacks
8392 /* pcm configuration: identiacal with ALC880 */
8393 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8394 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8395 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8396 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8397 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8400 * configuration and preset
8402 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
8403 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
8404 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
8405 [ALC883_3ST_6ch
] = "3stack-6ch",
8406 [ALC883_6ST_DIG
] = "6stack-dig",
8407 [ALC883_TARGA_DIG
] = "targa-dig",
8408 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
8409 [ALC883_ACER
] = "acer",
8410 [ALC883_ACER_ASPIRE
] = "acer-aspire",
8411 [ALC888_ACER_ASPIRE_4930G
] = "acer-aspire-4930g",
8412 [ALC883_MEDION
] = "medion",
8413 [ALC883_MEDION_MD2
] = "medion-md2",
8414 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
8415 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
8416 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
8417 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
8418 [ALC888_LENOVO_SKY
] = "lenovo-sky",
8419 [ALC883_HAIER_W66
] = "haier-w66",
8420 [ALC888_3ST_HP
] = "3stack-hp",
8421 [ALC888_6ST_DELL
] = "6stack-dell",
8422 [ALC883_MITAC
] = "mitac",
8423 [ALC883_CLEVO_M720
] = "clevo-m720",
8424 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
8425 [ALC888_FUJITSU_XA3530
] = "fujitsu-xa3530",
8426 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
8427 [ALC1200_ASUS_P5Q
] = "asus-p5q",
8428 [ALC883_AUTO
] = "auto",
8431 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
8432 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
8433 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
8434 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE
),
8435 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
8436 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
8437 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
8438 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8439 ALC888_ACER_ASPIRE_4930G
),
8440 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER
), /* default Acer */
8441 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
8442 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
8443 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
8444 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
8445 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
8446 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V
),
8447 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
8448 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q
),
8449 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601
),
8450 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
8451 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
8452 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
8453 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
8454 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL
),
8455 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
8456 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG
),
8457 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
8458 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
8459 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
8460 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG
),
8461 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
8462 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
8463 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
8464 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
8465 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
8466 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
8467 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
8468 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
8469 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
8470 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
8471 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
8472 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
8473 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
8474 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
8475 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG
),
8476 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
8477 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
8478 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
8479 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
8480 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
8481 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
8482 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
8483 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD
),
8484 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
8485 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
8486 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515
),
8487 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8488 ALC888_FUJITSU_XA3530
),
8489 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
8490 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
8491 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
8492 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
8493 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY
),
8494 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
8495 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG
),
8496 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
8497 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
8498 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
8499 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
8500 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
8504 static struct alc_config_preset alc883_presets
[] = {
8505 [ALC883_3ST_2ch_DIG
] = {
8506 .mixers
= { alc883_3ST_2ch_mixer
},
8507 .init_verbs
= { alc883_init_verbs
},
8508 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8509 .dac_nids
= alc883_dac_nids
,
8510 .dig_out_nid
= ALC883_DIGOUT_NID
,
8511 .dig_in_nid
= ALC883_DIGIN_NID
,
8512 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8513 .channel_mode
= alc883_3ST_2ch_modes
,
8514 .input_mux
= &alc883_capture_source
,
8516 [ALC883_3ST_6ch_DIG
] = {
8517 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8518 .init_verbs
= { alc883_init_verbs
},
8519 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8520 .dac_nids
= alc883_dac_nids
,
8521 .dig_out_nid
= ALC883_DIGOUT_NID
,
8522 .dig_in_nid
= ALC883_DIGIN_NID
,
8523 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8524 .channel_mode
= alc883_3ST_6ch_modes
,
8526 .input_mux
= &alc883_capture_source
,
8528 [ALC883_3ST_6ch
] = {
8529 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8530 .init_verbs
= { alc883_init_verbs
},
8531 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8532 .dac_nids
= alc883_dac_nids
,
8533 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8534 .channel_mode
= alc883_3ST_6ch_modes
,
8536 .input_mux
= &alc883_capture_source
,
8538 [ALC883_3ST_6ch_INTEL
] = {
8539 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
8540 .init_verbs
= { alc883_init_verbs
},
8541 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8542 .dac_nids
= alc883_dac_nids
,
8543 .dig_out_nid
= ALC883_DIGOUT_NID
,
8544 .dig_in_nid
= ALC883_DIGIN_NID
,
8545 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
8546 .channel_mode
= alc883_3ST_6ch_intel_modes
,
8548 .input_mux
= &alc883_3stack_6ch_intel
,
8550 [ALC883_6ST_DIG
] = {
8551 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8552 .init_verbs
= { alc883_init_verbs
},
8553 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8554 .dac_nids
= alc883_dac_nids
,
8555 .dig_out_nid
= ALC883_DIGOUT_NID
,
8556 .dig_in_nid
= ALC883_DIGIN_NID
,
8557 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8558 .channel_mode
= alc883_sixstack_modes
,
8559 .input_mux
= &alc883_capture_source
,
8561 [ALC883_TARGA_DIG
] = {
8562 .mixers
= { alc883_tagra_mixer
, alc883_chmode_mixer
},
8563 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
8564 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8565 .dac_nids
= alc883_dac_nids
,
8566 .dig_out_nid
= ALC883_DIGOUT_NID
,
8567 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8568 .channel_mode
= alc883_3ST_6ch_modes
,
8570 .input_mux
= &alc883_capture_source
,
8571 .unsol_event
= alc883_tagra_unsol_event
,
8572 .init_hook
= alc883_tagra_automute
,
8574 [ALC883_TARGA_2ch_DIG
] = {
8575 .mixers
= { alc883_tagra_2ch_mixer
},
8576 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
8577 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8578 .dac_nids
= alc883_dac_nids
,
8579 .adc_nids
= alc883_adc_nids_alt
,
8580 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
8581 .dig_out_nid
= ALC883_DIGOUT_NID
,
8582 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8583 .channel_mode
= alc883_3ST_2ch_modes
,
8584 .input_mux
= &alc883_capture_source
,
8585 .unsol_event
= alc883_tagra_unsol_event
,
8586 .init_hook
= alc883_tagra_automute
,
8589 .mixers
= { alc883_base_mixer
},
8590 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8591 * and the headphone jack. Turn this on and rely on the
8592 * standard mute methods whenever the user wants to turn
8593 * these outputs off.
8595 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
8596 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8597 .dac_nids
= alc883_dac_nids
,
8598 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8599 .channel_mode
= alc883_3ST_2ch_modes
,
8600 .input_mux
= &alc883_capture_source
,
8602 [ALC883_ACER_ASPIRE
] = {
8603 .mixers
= { alc883_acer_aspire_mixer
},
8604 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
8605 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8606 .dac_nids
= alc883_dac_nids
,
8607 .dig_out_nid
= ALC883_DIGOUT_NID
,
8608 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8609 .channel_mode
= alc883_3ST_2ch_modes
,
8610 .input_mux
= &alc883_capture_source
,
8611 .unsol_event
= alc883_acer_aspire_unsol_event
,
8612 .init_hook
= alc883_acer_aspire_automute
,
8614 [ALC888_ACER_ASPIRE_4930G
] = {
8615 .mixers
= { alc888_base_mixer
,
8616 alc883_chmode_mixer
},
8617 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
8618 alc888_acer_aspire_4930g_verbs
},
8619 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8620 .dac_nids
= alc883_dac_nids
,
8621 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
8622 .adc_nids
= alc883_adc_nids_rev
,
8623 .capsrc_nids
= alc883_capsrc_nids_rev
,
8624 .dig_out_nid
= ALC883_DIGOUT_NID
,
8625 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8626 .channel_mode
= alc883_3ST_6ch_modes
,
8629 ARRAY_SIZE(alc888_2_capture_sources
),
8630 .input_mux
= alc888_2_capture_sources
,
8631 .unsol_event
= alc888_acer_aspire_4930g_unsol_event
,
8632 .init_hook
= alc888_acer_aspire_4930g_automute
,
8635 .mixers
= { alc883_fivestack_mixer
,
8636 alc883_chmode_mixer
},
8637 .init_verbs
= { alc883_init_verbs
,
8638 alc883_medion_eapd_verbs
},
8639 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8640 .dac_nids
= alc883_dac_nids
,
8641 .adc_nids
= alc883_adc_nids_alt
,
8642 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
8643 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8644 .channel_mode
= alc883_sixstack_modes
,
8645 .input_mux
= &alc883_capture_source
,
8647 [ALC883_MEDION_MD2
] = {
8648 .mixers
= { alc883_medion_md2_mixer
},
8649 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
8650 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8651 .dac_nids
= alc883_dac_nids
,
8652 .dig_out_nid
= ALC883_DIGOUT_NID
,
8653 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8654 .channel_mode
= alc883_3ST_2ch_modes
,
8655 .input_mux
= &alc883_capture_source
,
8656 .unsol_event
= alc883_medion_md2_unsol_event
,
8657 .init_hook
= alc883_medion_md2_automute
,
8659 [ALC883_LAPTOP_EAPD
] = {
8660 .mixers
= { alc883_base_mixer
},
8661 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
8662 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8663 .dac_nids
= alc883_dac_nids
,
8664 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8665 .channel_mode
= alc883_3ST_2ch_modes
,
8666 .input_mux
= &alc883_capture_source
,
8668 [ALC883_CLEVO_M720
] = {
8669 .mixers
= { alc883_clevo_m720_mixer
},
8670 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
8671 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8672 .dac_nids
= alc883_dac_nids
,
8673 .dig_out_nid
= ALC883_DIGOUT_NID
,
8674 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8675 .channel_mode
= alc883_3ST_2ch_modes
,
8676 .input_mux
= &alc883_capture_source
,
8677 .unsol_event
= alc883_clevo_m720_unsol_event
,
8678 .init_hook
= alc883_clevo_m720_automute
,
8680 [ALC883_LENOVO_101E_2ch
] = {
8681 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
8682 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
8683 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8684 .dac_nids
= alc883_dac_nids
,
8685 .adc_nids
= alc883_adc_nids_alt
,
8686 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
8687 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8688 .channel_mode
= alc883_3ST_2ch_modes
,
8689 .input_mux
= &alc883_lenovo_101e_capture_source
,
8690 .unsol_event
= alc883_lenovo_101e_unsol_event
,
8691 .init_hook
= alc883_lenovo_101e_all_automute
,
8693 [ALC883_LENOVO_NB0763
] = {
8694 .mixers
= { alc883_lenovo_nb0763_mixer
},
8695 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
8696 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8697 .dac_nids
= alc883_dac_nids
,
8698 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8699 .channel_mode
= alc883_3ST_2ch_modes
,
8701 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
8702 .unsol_event
= alc883_medion_md2_unsol_event
,
8703 .init_hook
= alc883_medion_md2_automute
,
8705 [ALC888_LENOVO_MS7195_DIG
] = {
8706 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8707 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
8708 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8709 .dac_nids
= alc883_dac_nids
,
8710 .dig_out_nid
= ALC883_DIGOUT_NID
,
8711 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8712 .channel_mode
= alc883_3ST_6ch_modes
,
8714 .input_mux
= &alc883_capture_source
,
8715 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
8716 .init_hook
= alc888_lenovo_ms7195_front_automute
,
8718 [ALC883_HAIER_W66
] = {
8719 .mixers
= { alc883_tagra_2ch_mixer
},
8720 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
8721 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8722 .dac_nids
= alc883_dac_nids
,
8723 .dig_out_nid
= ALC883_DIGOUT_NID
,
8724 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8725 .channel_mode
= alc883_3ST_2ch_modes
,
8726 .input_mux
= &alc883_capture_source
,
8727 .unsol_event
= alc883_haier_w66_unsol_event
,
8728 .init_hook
= alc883_haier_w66_automute
,
8731 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8732 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
8733 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8734 .dac_nids
= alc883_dac_nids
,
8735 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
8736 .channel_mode
= alc888_3st_hp_modes
,
8738 .input_mux
= &alc883_capture_source
,
8740 [ALC888_6ST_DELL
] = {
8741 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8742 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
8743 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8744 .dac_nids
= alc883_dac_nids
,
8745 .dig_out_nid
= ALC883_DIGOUT_NID
,
8746 .dig_in_nid
= ALC883_DIGIN_NID
,
8747 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8748 .channel_mode
= alc883_sixstack_modes
,
8749 .input_mux
= &alc883_capture_source
,
8750 .unsol_event
= alc888_6st_dell_unsol_event
,
8751 .init_hook
= alc888_6st_dell_front_automute
,
8754 .mixers
= { alc883_mitac_mixer
},
8755 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
8756 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8757 .dac_nids
= alc883_dac_nids
,
8758 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8759 .channel_mode
= alc883_3ST_2ch_modes
,
8760 .input_mux
= &alc883_capture_source
,
8761 .unsol_event
= alc883_mitac_unsol_event
,
8762 .init_hook
= alc883_mitac_automute
,
8764 [ALC883_FUJITSU_PI2515
] = {
8765 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
8766 .init_verbs
= { alc883_init_verbs
,
8767 alc883_2ch_fujitsu_pi2515_verbs
},
8768 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8769 .dac_nids
= alc883_dac_nids
,
8770 .dig_out_nid
= ALC883_DIGOUT_NID
,
8771 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8772 .channel_mode
= alc883_3ST_2ch_modes
,
8773 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
8774 .unsol_event
= alc883_2ch_fujitsu_pi2515_unsol_event
,
8775 .init_hook
= alc883_2ch_fujitsu_pi2515_automute
,
8777 [ALC888_FUJITSU_XA3530
] = {
8778 .mixers
= { alc888_base_mixer
, alc883_chmode_mixer
},
8779 .init_verbs
= { alc883_init_verbs
,
8780 alc888_fujitsu_xa3530_verbs
},
8781 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8782 .dac_nids
= alc883_dac_nids
,
8783 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
8784 .adc_nids
= alc883_adc_nids_rev
,
8785 .capsrc_nids
= alc883_capsrc_nids_rev
,
8786 .dig_out_nid
= ALC883_DIGOUT_NID
,
8787 .num_channel_mode
= ARRAY_SIZE(alc888_4ST_8ch_intel_modes
),
8788 .channel_mode
= alc888_4ST_8ch_intel_modes
,
8790 ARRAY_SIZE(alc888_2_capture_sources
),
8791 .input_mux
= alc888_2_capture_sources
,
8792 .unsol_event
= alc888_fujitsu_xa3530_unsol_event
,
8793 .init_hook
= alc888_fujitsu_xa3530_automute
,
8795 [ALC888_LENOVO_SKY
] = {
8796 .mixers
= { alc888_lenovo_sky_mixer
, alc883_chmode_mixer
},
8797 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_sky_verbs
},
8798 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8799 .dac_nids
= alc883_dac_nids
,
8800 .dig_out_nid
= ALC883_DIGOUT_NID
,
8801 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8802 .channel_mode
= alc883_sixstack_modes
,
8804 .input_mux
= &alc883_lenovo_sky_capture_source
,
8805 .unsol_event
= alc883_lenovo_sky_unsol_event
,
8806 .init_hook
= alc888_lenovo_sky_front_automute
,
8808 [ALC888_ASUS_M90V
] = {
8809 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8810 .init_verbs
= { alc883_init_verbs
, alc888_asus_m90v_verbs
},
8811 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8812 .dac_nids
= alc883_dac_nids
,
8813 .dig_out_nid
= ALC883_DIGOUT_NID
,
8814 .dig_in_nid
= ALC883_DIGIN_NID
,
8815 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8816 .channel_mode
= alc883_3ST_6ch_modes
,
8818 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
8819 .unsol_event
= alc883_mode2_unsol_event
,
8820 .init_hook
= alc883_mode2_inithook
,
8822 [ALC888_ASUS_EEE1601
] = {
8823 .mixers
= { alc883_asus_eee1601_mixer
},
8824 .cap_mixer
= alc883_asus_eee1601_cap_mixer
,
8825 .init_verbs
= { alc883_init_verbs
, alc888_asus_eee1601_verbs
},
8826 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8827 .dac_nids
= alc883_dac_nids
,
8828 .dig_out_nid
= ALC883_DIGOUT_NID
,
8829 .dig_in_nid
= ALC883_DIGIN_NID
,
8830 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8831 .channel_mode
= alc883_3ST_2ch_modes
,
8833 .input_mux
= &alc883_asus_eee1601_capture_source
,
8834 .unsol_event
= alc883_eee1601_unsol_event
,
8835 .init_hook
= alc883_eee1601_inithook
,
8837 [ALC1200_ASUS_P5Q
] = {
8838 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8839 .init_verbs
= { alc883_init_verbs
},
8840 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8841 .dac_nids
= alc883_dac_nids
,
8842 .dig_out_nid
= ALC1200_DIGOUT_NID
,
8843 .dig_in_nid
= ALC883_DIGIN_NID
,
8844 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8845 .channel_mode
= alc883_sixstack_modes
,
8846 .input_mux
= &alc883_capture_source
,
8852 * BIOS auto configuration
8854 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
8855 hda_nid_t nid
, int pin_type
,
8859 struct alc_spec
*spec
= codec
->spec
;
8862 alc_set_pin_output(codec
, nid
, pin_type
);
8863 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
8866 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
8867 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
8871 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
8873 struct alc_spec
*spec
= codec
->spec
;
8876 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
8877 for (i
= 0; i
<= HDA_SIDE
; i
++) {
8878 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
8879 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
8881 alc883_auto_set_output_and_unmute(codec
, nid
, pin_type
,
8886 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
8888 struct alc_spec
*spec
= codec
->spec
;
8891 pin
= spec
->autocfg
.hp_pins
[0];
8892 if (pin
) /* connect to front */
8894 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
8895 pin
= spec
->autocfg
.speaker_pins
[0];
8897 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
8900 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8901 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8903 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
8905 struct alc_spec
*spec
= codec
->spec
;
8908 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
8909 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
8910 if (alc883_is_input_pin(nid
)) {
8911 snd_hda_codec_write(codec
, nid
, 0,
8912 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8913 (i
<= AUTO_PIN_FRONT_MIC
?
8914 PIN_VREF80
: PIN_IN
));
8915 if (nid
!= ALC883_PIN_CD_NID
)
8916 snd_hda_codec_write(codec
, nid
, 0,
8917 AC_VERB_SET_AMP_GAIN_MUTE
,
8923 #define alc883_auto_init_input_src alc882_auto_init_input_src
8925 /* almost identical with ALC880 parser... */
8926 static int alc883_parse_auto_config(struct hda_codec
*codec
)
8928 struct alc_spec
*spec
= codec
->spec
;
8929 int err
= alc880_parse_auto_config(codec
);
8934 return 0; /* no config found */
8936 err
= alc_auto_add_mic_boost(codec
);
8940 /* hack - override the init verbs */
8941 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
8943 return 1; /* config found */
8946 /* additional initialization for auto-configuration model */
8947 static void alc883_auto_init(struct hda_codec
*codec
)
8949 struct alc_spec
*spec
= codec
->spec
;
8950 alc883_auto_init_multi_out(codec
);
8951 alc883_auto_init_hp_out(codec
);
8952 alc883_auto_init_analog_input(codec
);
8953 alc883_auto_init_input_src(codec
);
8954 if (spec
->unsol_event
)
8955 alc_inithook(codec
);
8958 static int patch_alc883(struct hda_codec
*codec
)
8960 struct alc_spec
*spec
;
8961 int err
, board_config
;
8963 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
8969 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
8971 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
8974 if (board_config
< 0) {
8975 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
8976 "trying auto-probe from BIOS...\n");
8977 board_config
= ALC883_AUTO
;
8980 if (board_config
== ALC883_AUTO
) {
8981 /* automatic parse from the BIOS config */
8982 err
= alc883_parse_auto_config(codec
);
8988 "hda_codec: Cannot set up configuration "
8989 "from BIOS. Using base mode...\n");
8990 board_config
= ALC883_3ST_2ch_DIG
;
8994 if (board_config
!= ALC883_AUTO
)
8995 setup_preset(spec
, &alc883_presets
[board_config
]);
8997 switch (codec
->vendor_id
) {
8999 if (codec
->revision_id
== 0x100101) {
9000 spec
->stream_name_analog
= "ALC1200 Analog";
9001 spec
->stream_name_digital
= "ALC1200 Digital";
9003 spec
->stream_name_analog
= "ALC888 Analog";
9004 spec
->stream_name_digital
= "ALC888 Digital";
9008 spec
->stream_name_analog
= "ALC889 Analog";
9009 spec
->stream_name_digital
= "ALC889 Digital";
9012 spec
->stream_name_analog
= "ALC883 Analog";
9013 spec
->stream_name_digital
= "ALC883 Digital";
9017 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
9018 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
9019 spec
->stream_analog_alt_capture
= &alc883_pcm_analog_alt_capture
;
9021 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
9022 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
9024 if (!spec
->num_adc_nids
) {
9025 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
9026 spec
->adc_nids
= alc883_adc_nids
;
9028 if (!spec
->capsrc_nids
)
9029 spec
->capsrc_nids
= alc883_capsrc_nids
;
9030 spec
->is_mix_capture
= 1; /* matrix-style capture */
9031 if (!spec
->cap_mixer
)
9032 set_capture_mixer(spec
);
9034 spec
->vmaster_nid
= 0x0c;
9036 codec
->patch_ops
= alc_patch_ops
;
9037 if (board_config
== ALC883_AUTO
)
9038 spec
->init_hook
= alc883_auto_init
;
9040 #ifdef CONFIG_SND_HDA_POWER_SAVE
9041 if (!spec
->loopback
.amplist
)
9042 spec
->loopback
.amplist
= alc883_loopbacks
;
9052 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9053 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9055 #define alc262_dac_nids alc260_dac_nids
9056 #define alc262_adc_nids alc882_adc_nids
9057 #define alc262_adc_nids_alt alc882_adc_nids_alt
9058 #define alc262_capsrc_nids alc882_capsrc_nids
9059 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9061 #define alc262_modes alc260_modes
9062 #define alc262_capture_source alc882_capture_source
9064 static hda_nid_t alc262_dmic_adc_nids
[1] = {
9069 static hda_nid_t alc262_dmic_capsrc_nids
[1] = { 0x22 };
9071 static struct snd_kcontrol_new alc262_base_mixer
[] = {
9072 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9073 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9074 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9075 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9076 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9077 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9079 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9080 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9081 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9082 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9083 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9084 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9085 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9086 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
9087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9088 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9089 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
9093 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
9094 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9095 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9096 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9097 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9098 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9099 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9100 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9101 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9102 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9103 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9104 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9105 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9106 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9107 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9108 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9109 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9113 /* update HP, line and mono-out pins according to the master switch */
9114 static void alc262_hp_master_update(struct hda_codec
*codec
)
9116 struct alc_spec
*spec
= codec
->spec
;
9117 int val
= spec
->master_sw
;
9120 snd_hda_codec_write_cache(codec
, 0x1b, 0,
9121 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9123 snd_hda_codec_write_cache(codec
, 0x15, 0,
9124 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9126 /* mono (speaker) depending on the HP jack sense */
9127 val
= val
&& !spec
->jack_present
;
9128 snd_hda_codec_write_cache(codec
, 0x16, 0,
9129 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9133 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
9135 struct alc_spec
*spec
= codec
->spec
;
9136 unsigned int presence
;
9137 presence
= snd_hda_codec_read(codec
, 0x1b, 0,
9138 AC_VERB_GET_PIN_SENSE
, 0);
9139 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
9140 alc262_hp_master_update(codec
);
9143 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
9145 if ((res
>> 26) != ALC880_HP_EVENT
)
9147 alc262_hp_bpc_automute(codec
);
9150 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
9152 struct alc_spec
*spec
= codec
->spec
;
9153 unsigned int presence
;
9154 presence
= snd_hda_codec_read(codec
, 0x15, 0,
9155 AC_VERB_GET_PIN_SENSE
, 0);
9156 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
9157 alc262_hp_master_update(codec
);
9160 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
9163 if ((res
>> 26) != ALC880_HP_EVENT
)
9165 alc262_hp_wildwest_automute(codec
);
9168 static int alc262_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
9169 struct snd_ctl_elem_value
*ucontrol
)
9171 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9172 struct alc_spec
*spec
= codec
->spec
;
9173 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
9177 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
9178 struct snd_ctl_elem_value
*ucontrol
)
9180 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9181 struct alc_spec
*spec
= codec
->spec
;
9182 int val
= !!*ucontrol
->value
.integer
.value
;
9184 if (val
== spec
->master_sw
)
9186 spec
->master_sw
= val
;
9187 alc262_hp_master_update(codec
);
9191 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
9193 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9194 .name
= "Master Playback Switch",
9195 .info
= snd_ctl_boolean_mono_info
,
9196 .get
= alc262_hp_master_sw_get
,
9197 .put
= alc262_hp_master_sw_put
,
9199 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9200 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9201 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9202 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9204 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9206 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9207 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9208 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9209 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9210 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9211 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9212 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9213 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9214 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9215 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9216 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
9217 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
9218 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
9219 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
9223 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
9225 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9226 .name
= "Master Playback Switch",
9227 .info
= snd_ctl_boolean_mono_info
,
9228 .get
= alc262_hp_master_sw_get
,
9229 .put
= alc262_hp_master_sw_put
,
9231 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9232 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9233 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9234 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9235 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9237 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9239 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9240 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9241 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
9242 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9243 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9246 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
9247 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
9251 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
9252 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9253 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9254 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
9258 /* mute/unmute internal speaker according to the hp jack and mute state */
9259 static void alc262_hp_t5735_automute(struct hda_codec
*codec
, int force
)
9261 struct alc_spec
*spec
= codec
->spec
;
9263 if (force
|| !spec
->sense_updated
) {
9264 unsigned int present
;
9265 present
= snd_hda_codec_read(codec
, 0x15, 0,
9266 AC_VERB_GET_PIN_SENSE
, 0);
9267 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
9268 spec
->sense_updated
= 1;
9270 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0, HDA_AMP_MUTE
,
9271 spec
->jack_present
? HDA_AMP_MUTE
: 0);
9274 static void alc262_hp_t5735_unsol_event(struct hda_codec
*codec
,
9277 if ((res
>> 26) != ALC880_HP_EVENT
)
9279 alc262_hp_t5735_automute(codec
, 1);
9282 static void alc262_hp_t5735_init_hook(struct hda_codec
*codec
)
9284 alc262_hp_t5735_automute(codec
, 1);
9287 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
9288 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9289 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9290 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9291 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9292 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9293 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9294 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9298 static struct hda_verb alc262_hp_t5735_verbs
[] = {
9299 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9300 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9302 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9306 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
9307 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9308 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9309 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
9310 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
9311 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9312 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9316 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
9317 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9318 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9319 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9320 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9321 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
9322 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9323 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9325 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
9326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
9330 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
9337 /* bind hp and internal speaker mute (with plug check) */
9338 static int alc262_sony_master_sw_put(struct snd_kcontrol
*kcontrol
,
9339 struct snd_ctl_elem_value
*ucontrol
)
9341 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9342 long *valp
= ucontrol
->value
.integer
.value
;
9345 /* change hp mute */
9346 change
= snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
9348 valp
[0] ? 0 : HDA_AMP_MUTE
);
9349 change
|= snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
9351 valp
[1] ? 0 : HDA_AMP_MUTE
);
9353 /* change speaker according to HP jack state */
9354 struct alc_spec
*spec
= codec
->spec
;
9356 if (spec
->jack_present
)
9357 mute
= HDA_AMP_MUTE
;
9359 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0,
9361 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9362 HDA_AMP_MUTE
, mute
);
9367 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
9368 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9370 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9371 .name
= "Master Playback Switch",
9372 .info
= snd_hda_mixer_amp_switch_info
,
9373 .get
= snd_hda_mixer_amp_switch_get
,
9374 .put
= alc262_sony_master_sw_put
,
9375 .private_value
= HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
9377 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9378 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9379 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9380 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9384 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
9385 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9386 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9387 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9388 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9389 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9390 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9391 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9395 #define alc262_capture_mixer alc882_capture_mixer
9396 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9399 * generic initialization of ADC, input mixers and output mixers
9401 static struct hda_verb alc262_init_verbs
[] = {
9403 * Unmute ADC0-2 and set the default input to mic-in
9405 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9406 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9407 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9408 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9409 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9410 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9412 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9414 * Note: PASD motherboards uses the Line In 2 as the input for
9415 * front panel mic (mic 2)
9417 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9421 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9422 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9425 * Set up output mixers (0x0c - 0x0e)
9427 /* set vol=0 to output mixers */
9428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9429 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9431 /* set up input amps for analog loopback */
9432 /* Amp Indices: DAC = 0, mixer = 1 */
9433 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9434 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9435 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9436 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9437 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9438 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9440 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
9441 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
9442 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
9443 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9444 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9445 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9447 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9449 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9450 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9451 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9453 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9454 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9456 /* FIXME: use matrix-type input source selection */
9457 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9458 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9462 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9477 static struct hda_verb alc262_eapd_verbs
[] = {
9478 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
9479 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
9483 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
9484 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9489 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
9490 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
9491 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9492 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9494 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9499 static struct hda_verb alc262_sony_unsol_verbs
[] = {
9500 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
9501 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9502 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
9504 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9505 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9509 static struct hda_input_mux alc262_dmic_capture_source
= {
9512 { "Int DMic", 0x9 },
9517 static struct snd_kcontrol_new alc262_toshiba_s06_mixer
[] = {
9518 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9519 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9520 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9521 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9522 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9526 static struct hda_verb alc262_toshiba_s06_verbs
[] = {
9527 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
9528 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9530 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9531 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x09},
9532 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9533 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
9534 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9538 static void alc262_dmic_automute(struct hda_codec
*codec
)
9540 unsigned int present
;
9542 present
= snd_hda_codec_read(codec
, 0x18, 0,
9543 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
9544 snd_hda_codec_write(codec
, 0x22, 0,
9545 AC_VERB_SET_CONNECT_SEL
, present
? 0x0 : 0x09);
9548 /* toggle speaker-output according to the hp-jack state */
9549 static void alc262_toshiba_s06_speaker_automute(struct hda_codec
*codec
)
9551 unsigned int present
;
9554 present
= snd_hda_codec_read(codec
, 0x15, 0,
9555 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
9556 bits
= present
? 0 : PIN_OUT
;
9557 snd_hda_codec_write(codec
, 0x14, 0,
9558 AC_VERB_SET_PIN_WIDGET_CONTROL
, bits
);
9563 /* unsolicited event for HP jack sensing */
9564 static void alc262_toshiba_s06_unsol_event(struct hda_codec
*codec
,
9567 if ((res
>> 26) == ALC880_HP_EVENT
)
9568 alc262_toshiba_s06_speaker_automute(codec
);
9569 if ((res
>> 26) == ALC880_MIC_EVENT
)
9570 alc262_dmic_automute(codec
);
9574 static void alc262_toshiba_s06_init_hook(struct hda_codec
*codec
)
9576 alc262_toshiba_s06_speaker_automute(codec
);
9577 alc262_dmic_automute(codec
);
9580 /* mute/unmute internal speaker according to the hp jack and mute state */
9581 static void alc262_hippo_automute(struct hda_codec
*codec
)
9583 struct alc_spec
*spec
= codec
->spec
;
9585 unsigned int present
;
9587 /* need to execute and sync at first */
9588 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
9589 present
= snd_hda_codec_read(codec
, 0x15, 0,
9590 AC_VERB_GET_PIN_SENSE
, 0);
9591 spec
->jack_present
= (present
& 0x80000000) != 0;
9592 if (spec
->jack_present
) {
9593 /* mute internal speaker */
9594 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9595 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9597 /* unmute internal speaker if necessary */
9598 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
9599 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9600 HDA_AMP_MUTE
, mute
);
9604 /* unsolicited event for HP jack sensing */
9605 static void alc262_hippo_unsol_event(struct hda_codec
*codec
,
9608 if ((res
>> 26) != ALC880_HP_EVENT
)
9610 alc262_hippo_automute(codec
);
9613 static void alc262_hippo1_automute(struct hda_codec
*codec
)
9616 unsigned int present
;
9618 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9619 present
= snd_hda_codec_read(codec
, 0x1b, 0,
9620 AC_VERB_GET_PIN_SENSE
, 0);
9621 present
= (present
& 0x80000000) != 0;
9623 /* mute internal speaker */
9624 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9625 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9627 /* unmute internal speaker if necessary */
9628 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
9629 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9630 HDA_AMP_MUTE
, mute
);
9634 /* unsolicited event for HP jack sensing */
9635 static void alc262_hippo1_unsol_event(struct hda_codec
*codec
,
9638 if ((res
>> 26) != ALC880_HP_EVENT
)
9640 alc262_hippo1_automute(codec
);
9646 * 0x16 = internal speaker
9647 * 0x18 = external mic
9650 static struct snd_kcontrol_new alc262_nec_mixer
[] = {
9651 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9652 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
9654 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9655 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9656 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9658 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9659 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9663 static struct hda_verb alc262_nec_verbs
[] = {
9664 /* Unmute Speaker */
9665 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9668 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9671 /* External mic to headphone */
9672 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9673 /* External mic to speaker */
9674 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9680 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9681 * 0x1b = port replicator headphone out
9684 #define ALC_HP_EVENT 0x37
9686 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
9687 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
9688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9689 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
9690 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9694 static struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
9695 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
9696 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9700 static struct hda_input_mux alc262_fujitsu_capture_source
= {
9709 static struct hda_input_mux alc262_HP_capture_source
= {
9713 { "Front Mic", 0x1 },
9720 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
9724 { "Front Mic", 0x2 },
9730 /* mute/unmute internal speaker according to the hp jacks and mute state */
9731 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
9733 struct alc_spec
*spec
= codec
->spec
;
9736 if (force
|| !spec
->sense_updated
) {
9737 unsigned int present
;
9738 /* need to execute and sync at first */
9739 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
9740 /* check laptop HP jack */
9741 present
= snd_hda_codec_read(codec
, 0x14, 0,
9742 AC_VERB_GET_PIN_SENSE
, 0);
9743 /* need to execute and sync at first */
9744 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9745 /* check docking HP jack */
9746 present
|= snd_hda_codec_read(codec
, 0x1b, 0,
9747 AC_VERB_GET_PIN_SENSE
, 0);
9748 if (present
& AC_PINSENSE_PRESENCE
)
9749 spec
->jack_present
= 1;
9751 spec
->jack_present
= 0;
9752 spec
->sense_updated
= 1;
9754 /* unmute internal speaker only if both HPs are unplugged and
9755 * master switch is on
9757 if (spec
->jack_present
)
9758 mute
= HDA_AMP_MUTE
;
9760 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
9761 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9762 HDA_AMP_MUTE
, mute
);
9765 /* unsolicited event for HP jack sensing */
9766 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
9769 if ((res
>> 26) != ALC_HP_EVENT
)
9771 alc262_fujitsu_automute(codec
, 1);
9774 static void alc262_fujitsu_init_hook(struct hda_codec
*codec
)
9776 alc262_fujitsu_automute(codec
, 1);
9779 /* bind volumes of both NID 0x0c and 0x0d */
9780 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
9781 .ops
= &snd_hda_bind_vol
,
9783 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
9784 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
9789 /* mute/unmute internal speaker according to the hp jack and mute state */
9790 static void alc262_lenovo_3000_automute(struct hda_codec
*codec
, int force
)
9792 struct alc_spec
*spec
= codec
->spec
;
9795 if (force
|| !spec
->sense_updated
) {
9796 unsigned int present_int_hp
;
9797 /* need to execute and sync at first */
9798 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9799 present_int_hp
= snd_hda_codec_read(codec
, 0x1b, 0,
9800 AC_VERB_GET_PIN_SENSE
, 0);
9801 spec
->jack_present
= (present_int_hp
& 0x80000000) != 0;
9802 spec
->sense_updated
= 1;
9804 if (spec
->jack_present
) {
9805 /* mute internal speaker */
9806 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9807 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9808 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9809 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9811 /* unmute internal speaker if necessary */
9812 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
9813 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9814 HDA_AMP_MUTE
, mute
);
9815 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9816 HDA_AMP_MUTE
, mute
);
9820 /* unsolicited event for HP jack sensing */
9821 static void alc262_lenovo_3000_unsol_event(struct hda_codec
*codec
,
9824 if ((res
>> 26) != ALC_HP_EVENT
)
9826 alc262_lenovo_3000_automute(codec
, 1);
9829 /* bind hp and internal speaker mute (with plug check) */
9830 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
9831 struct snd_ctl_elem_value
*ucontrol
)
9833 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9834 long *valp
= ucontrol
->value
.integer
.value
;
9837 change
= snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9839 valp
? 0 : HDA_AMP_MUTE
);
9840 change
|= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
9842 valp
? 0 : HDA_AMP_MUTE
);
9845 alc262_fujitsu_automute(codec
, 0);
9849 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
9850 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9852 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9853 .name
= "Master Playback Switch",
9854 .info
= snd_hda_mixer_amp_switch_info
,
9855 .get
= snd_hda_mixer_amp_switch_get
,
9856 .put
= alc262_fujitsu_master_sw_put
,
9857 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
9859 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9860 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9861 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT
),
9862 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT
),
9863 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9864 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9865 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9866 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
9867 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9868 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9872 /* bind hp and internal speaker mute (with plug check) */
9873 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol
*kcontrol
,
9874 struct snd_ctl_elem_value
*ucontrol
)
9876 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9877 long *valp
= ucontrol
->value
.integer
.value
;
9880 change
= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
9882 valp
? 0 : HDA_AMP_MUTE
);
9885 alc262_lenovo_3000_automute(codec
, 0);
9889 static struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
9890 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9892 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9893 .name
= "Master Playback Switch",
9894 .info
= snd_hda_mixer_amp_switch_info
,
9895 .get
= snd_hda_mixer_amp_switch_get
,
9896 .put
= alc262_lenovo_3000_master_sw_put
,
9897 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
9899 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9900 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9901 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9904 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
9905 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9906 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9910 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer
[] = {
9911 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9913 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9914 .name
= "Master Playback Switch",
9915 .info
= snd_hda_mixer_amp_switch_info
,
9916 .get
= snd_hda_mixer_amp_switch_get
,
9917 .put
= alc262_sony_master_sw_put
,
9918 .private_value
= HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
9920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9922 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9923 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9924 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9925 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9929 /* additional init verbs for Benq laptops */
9930 static struct hda_verb alc262_EAPD_verbs
[] = {
9931 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9932 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
9936 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
9937 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9938 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9940 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9941 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9945 /* Samsung Q1 Ultra Vista model setup */
9946 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
9947 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9948 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
9949 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9950 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9951 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
9952 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT
),
9956 static struct hda_verb alc262_ultra_verbs
[] = {
9958 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9959 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9960 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9963 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9964 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9965 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9967 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9968 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9970 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9971 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9973 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9974 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9975 /* ADC, choose mic */
9976 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9977 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9978 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9979 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9980 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9981 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9982 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
9985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
9989 /* mute/unmute internal speaker according to the hp jack and mute state */
9990 static void alc262_ultra_automute(struct hda_codec
*codec
)
9992 struct alc_spec
*spec
= codec
->spec
;
9996 /* auto-mute only when HP is used as HP */
9997 if (!spec
->cur_mux
[0]) {
9998 unsigned int present
;
9999 /* need to execute and sync at first */
10000 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
10001 present
= snd_hda_codec_read(codec
, 0x15, 0,
10002 AC_VERB_GET_PIN_SENSE
, 0);
10003 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
10004 if (spec
->jack_present
)
10005 mute
= HDA_AMP_MUTE
;
10007 /* mute/unmute internal speaker */
10008 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10009 HDA_AMP_MUTE
, mute
);
10010 /* mute/unmute HP */
10011 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
10012 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
10015 /* unsolicited event for HP jack sensing */
10016 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
10019 if ((res
>> 26) != ALC880_HP_EVENT
)
10021 alc262_ultra_automute(codec
);
10024 static struct hda_input_mux alc262_ultra_capture_source
= {
10028 { "Headphone", 0x7 },
10032 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
10033 struct snd_ctl_elem_value
*ucontrol
)
10035 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10036 struct alc_spec
*spec
= codec
->spec
;
10039 ret
= alc_mux_enum_put(kcontrol
, ucontrol
);
10042 /* reprogram the HP pin as mic or HP according to the input source */
10043 snd_hda_codec_write_cache(codec
, 0x15, 0,
10044 AC_VERB_SET_PIN_WIDGET_CONTROL
,
10045 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
10046 alc262_ultra_automute(codec
); /* mute/unmute HP */
10050 static struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
10051 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
10052 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
10054 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10055 .name
= "Capture Source",
10056 .info
= alc_mux_enum_info
,
10057 .get
= alc_mux_enum_get
,
10058 .put
= alc262_ultra_mux_enum_put
,
10063 /* add playback controls from the parsed DAC table */
10064 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
10065 const struct auto_pin_cfg
*cfg
)
10070 spec
->multiout
.num_dacs
= 1; /* only use one dac */
10071 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
10072 spec
->multiout
.dac_nids
[0] = 2;
10074 nid
= cfg
->line_out_pins
[0];
10076 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10077 "Front Playback Volume",
10078 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
));
10081 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10082 "Front Playback Switch",
10083 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
10088 nid
= cfg
->speaker_pins
[0];
10091 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10092 "Speaker Playback Volume",
10093 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10097 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10098 "Speaker Playback Switch",
10099 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
10104 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10105 "Speaker Playback Switch",
10106 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
10112 nid
= cfg
->hp_pins
[0];
10114 /* spec->multiout.hp_nid = 2; */
10116 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10117 "Headphone Playback Volume",
10118 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10122 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10123 "Headphone Playback Switch",
10124 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
10129 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10130 "Headphone Playback Switch",
10131 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
10140 /* identical with ALC880 */
10141 #define alc262_auto_create_analog_input_ctls \
10142 alc880_auto_create_analog_input_ctls
10145 * generic initialization of ADC, input mixers and output mixers
10147 static struct hda_verb alc262_volume_init_verbs
[] = {
10149 * Unmute ADC0-2 and set the default input to mic-in
10151 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10152 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10153 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10154 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10155 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10156 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10158 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10160 * Note: PASD motherboards uses the Line In 2 as the input for
10161 * front panel mic (mic 2)
10163 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10164 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10165 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10166 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10167 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10168 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10171 * Set up output mixers (0x0c - 0x0f)
10173 /* set vol=0 to output mixers */
10174 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10175 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10176 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10178 /* set up input amps for analog loopback */
10179 /* Amp Indices: DAC = 0, mixer = 1 */
10180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10182 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10183 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10184 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10185 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10187 /* FIXME: use matrix-type input source selection */
10188 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10189 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10190 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10191 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10195 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10196 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10197 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10198 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10202 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10208 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
10210 * Unmute ADC0-2 and set the default input to mic-in
10212 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10213 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10214 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10216 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10217 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10219 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10221 * Note: PASD motherboards uses the Line In 2 as the input for
10222 * front panel mic (mic 2)
10224 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10225 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10226 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10227 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
10231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
10234 * Set up output mixers (0x0c - 0x0e)
10236 /* set vol=0 to output mixers */
10237 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10238 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10239 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10241 /* set up input amps for analog loopback */
10242 /* Amp Indices: DAC = 0, mixer = 1 */
10243 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10244 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10245 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10246 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10247 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10248 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10250 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10252 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10254 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10257 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10258 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10260 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10261 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10262 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10263 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10264 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10266 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
10267 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10269 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
10270 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10271 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10274 /* FIXME: use matrix-type input source selection */
10275 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10276 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
10279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
10280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
10282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
10284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
10285 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
10287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
10289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
10290 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
10292 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10297 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
10299 * Unmute ADC0-2 and set the default input to mic-in
10301 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10302 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10303 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10305 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10306 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10308 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10310 * Note: PASD motherboards uses the Line In 2 as the input for front
10311 * panel mic (mic 2)
10313 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
10320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
10321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
10323 * Set up output mixers (0x0c - 0x0e)
10325 /* set vol=0 to output mixers */
10326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10327 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10330 /* set up input amps for analog loopback */
10331 /* Amp Indices: DAC = 0, mixer = 1 */
10332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10334 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10336 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
10341 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
10342 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
10343 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
10344 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
10345 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
10346 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
10348 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10349 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10351 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10352 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
10354 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10356 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10357 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
10358 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10359 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10361 /* FIXME: use matrix-type input source selection */
10362 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10363 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
10366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
10367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
10368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
10369 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
10372 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
10374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
10375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
10376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
10377 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
10380 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
10382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
10383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
10384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
10385 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
10388 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10393 static struct hda_verb alc262_toshiba_rx1_unsol_verbs
[] = {
10395 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Front Speaker */
10396 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10397 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
10399 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* MIC jack */
10400 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
10401 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
10402 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
10404 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP jack */
10405 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10406 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10411 #ifdef CONFIG_SND_HDA_POWER_SAVE
10412 #define alc262_loopbacks alc880_loopbacks
10415 /* pcm configuration: identiacal with ALC880 */
10416 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10417 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10418 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10419 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10422 * BIOS auto configuration
10424 static int alc262_parse_auto_config(struct hda_codec
*codec
)
10426 struct alc_spec
*spec
= codec
->spec
;
10428 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
10430 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10434 if (!spec
->autocfg
.line_outs
)
10435 return 0; /* can't find valid BIOS pin config */
10436 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10439 err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
10443 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
10445 if (spec
->autocfg
.dig_out_pin
)
10446 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
10447 if (spec
->autocfg
.dig_in_pin
)
10448 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
10450 if (spec
->kctls
.list
)
10451 add_mixer(spec
, spec
->kctls
.list
);
10453 add_verb(spec
, alc262_volume_init_verbs
);
10454 spec
->num_mux_defs
= 1;
10455 spec
->input_mux
= &spec
->private_imux
;
10457 err
= alc_auto_add_mic_boost(codec
);
10461 store_pin_configs(codec
);
10465 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10466 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10467 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10468 #define alc262_auto_init_input_src alc882_auto_init_input_src
10471 /* init callback for auto-configuration model -- overriding the default init */
10472 static void alc262_auto_init(struct hda_codec
*codec
)
10474 struct alc_spec
*spec
= codec
->spec
;
10475 alc262_auto_init_multi_out(codec
);
10476 alc262_auto_init_hp_out(codec
);
10477 alc262_auto_init_analog_input(codec
);
10478 alc262_auto_init_input_src(codec
);
10479 if (spec
->unsol_event
)
10480 alc_inithook(codec
);
10484 * configuration and preset
10486 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
10487 [ALC262_BASIC
] = "basic",
10488 [ALC262_HIPPO
] = "hippo",
10489 [ALC262_HIPPO_1
] = "hippo_1",
10490 [ALC262_FUJITSU
] = "fujitsu",
10491 [ALC262_HP_BPC
] = "hp-bpc",
10492 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
10493 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
10494 [ALC262_HP_RP5700
] = "hp-rp5700",
10495 [ALC262_BENQ_ED8
] = "benq",
10496 [ALC262_BENQ_T31
] = "benq-t31",
10497 [ALC262_SONY_ASSAMD
] = "sony-assamd",
10498 [ALC262_TOSHIBA_S06
] = "toshiba-s06",
10499 [ALC262_TOSHIBA_RX1
] = "toshiba-rx1",
10500 [ALC262_ULTRA
] = "ultra",
10501 [ALC262_LENOVO_3000
] = "lenovo-3000",
10502 [ALC262_NEC
] = "nec",
10503 [ALC262_AUTO
] = "auto",
10506 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
10507 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
10508 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
10509 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC
),
10510 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC
),
10511 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC
),
10512 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC
),
10513 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC
),
10514 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC
),
10515 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC
),
10516 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC
),
10517 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
10518 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
10519 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
10520 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
10521 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
10522 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
10523 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
10524 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
10525 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
10526 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
10527 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
10528 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10529 ALC262_HP_TC_T5735
),
10530 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
10531 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
10532 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
10533 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
10534 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
10535 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD
),
10536 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10537 ALC262_TOSHIBA_RX1
),
10538 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06
),
10539 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
10540 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
10541 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA
),
10542 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA
),
10543 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
10544 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
10545 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
10546 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
10550 static struct alc_config_preset alc262_presets
[] = {
10552 .mixers
= { alc262_base_mixer
},
10553 .init_verbs
= { alc262_init_verbs
},
10554 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10555 .dac_nids
= alc262_dac_nids
,
10557 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10558 .channel_mode
= alc262_modes
,
10559 .input_mux
= &alc262_capture_source
,
10562 .mixers
= { alc262_base_mixer
},
10563 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
10564 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10565 .dac_nids
= alc262_dac_nids
,
10567 .dig_out_nid
= ALC262_DIGOUT_NID
,
10568 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10569 .channel_mode
= alc262_modes
,
10570 .input_mux
= &alc262_capture_source
,
10571 .unsol_event
= alc262_hippo_unsol_event
,
10572 .init_hook
= alc262_hippo_automute
,
10574 [ALC262_HIPPO_1
] = {
10575 .mixers
= { alc262_hippo1_mixer
},
10576 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
10577 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10578 .dac_nids
= alc262_dac_nids
,
10580 .dig_out_nid
= ALC262_DIGOUT_NID
,
10581 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10582 .channel_mode
= alc262_modes
,
10583 .input_mux
= &alc262_capture_source
,
10584 .unsol_event
= alc262_hippo1_unsol_event
,
10585 .init_hook
= alc262_hippo1_automute
,
10587 [ALC262_FUJITSU
] = {
10588 .mixers
= { alc262_fujitsu_mixer
},
10589 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
10590 alc262_fujitsu_unsol_verbs
},
10591 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10592 .dac_nids
= alc262_dac_nids
,
10594 .dig_out_nid
= ALC262_DIGOUT_NID
,
10595 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10596 .channel_mode
= alc262_modes
,
10597 .input_mux
= &alc262_fujitsu_capture_source
,
10598 .unsol_event
= alc262_fujitsu_unsol_event
,
10599 .init_hook
= alc262_fujitsu_init_hook
,
10601 [ALC262_HP_BPC
] = {
10602 .mixers
= { alc262_HP_BPC_mixer
},
10603 .init_verbs
= { alc262_HP_BPC_init_verbs
},
10604 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10605 .dac_nids
= alc262_dac_nids
,
10607 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10608 .channel_mode
= alc262_modes
,
10609 .input_mux
= &alc262_HP_capture_source
,
10610 .unsol_event
= alc262_hp_bpc_unsol_event
,
10611 .init_hook
= alc262_hp_bpc_automute
,
10613 [ALC262_HP_BPC_D7000_WF
] = {
10614 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
10615 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
10616 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10617 .dac_nids
= alc262_dac_nids
,
10619 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10620 .channel_mode
= alc262_modes
,
10621 .input_mux
= &alc262_HP_D7000_capture_source
,
10622 .unsol_event
= alc262_hp_wildwest_unsol_event
,
10623 .init_hook
= alc262_hp_wildwest_automute
,
10625 [ALC262_HP_BPC_D7000_WL
] = {
10626 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
10627 alc262_HP_BPC_WildWest_option_mixer
},
10628 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
10629 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10630 .dac_nids
= alc262_dac_nids
,
10632 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10633 .channel_mode
= alc262_modes
,
10634 .input_mux
= &alc262_HP_D7000_capture_source
,
10635 .unsol_event
= alc262_hp_wildwest_unsol_event
,
10636 .init_hook
= alc262_hp_wildwest_automute
,
10638 [ALC262_HP_TC_T5735
] = {
10639 .mixers
= { alc262_hp_t5735_mixer
},
10640 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
10641 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10642 .dac_nids
= alc262_dac_nids
,
10644 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10645 .channel_mode
= alc262_modes
,
10646 .input_mux
= &alc262_capture_source
,
10647 .unsol_event
= alc262_hp_t5735_unsol_event
,
10648 .init_hook
= alc262_hp_t5735_init_hook
,
10650 [ALC262_HP_RP5700
] = {
10651 .mixers
= { alc262_hp_rp5700_mixer
},
10652 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
10653 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10654 .dac_nids
= alc262_dac_nids
,
10655 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10656 .channel_mode
= alc262_modes
,
10657 .input_mux
= &alc262_hp_rp5700_capture_source
,
10659 [ALC262_BENQ_ED8
] = {
10660 .mixers
= { alc262_base_mixer
},
10661 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
10662 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10663 .dac_nids
= alc262_dac_nids
,
10665 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10666 .channel_mode
= alc262_modes
,
10667 .input_mux
= &alc262_capture_source
,
10669 [ALC262_SONY_ASSAMD
] = {
10670 .mixers
= { alc262_sony_mixer
},
10671 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
10672 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10673 .dac_nids
= alc262_dac_nids
,
10675 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10676 .channel_mode
= alc262_modes
,
10677 .input_mux
= &alc262_capture_source
,
10678 .unsol_event
= alc262_hippo_unsol_event
,
10679 .init_hook
= alc262_hippo_automute
,
10681 [ALC262_BENQ_T31
] = {
10682 .mixers
= { alc262_benq_t31_mixer
},
10683 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
, alc262_hippo_unsol_verbs
},
10684 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10685 .dac_nids
= alc262_dac_nids
,
10687 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10688 .channel_mode
= alc262_modes
,
10689 .input_mux
= &alc262_capture_source
,
10690 .unsol_event
= alc262_hippo_unsol_event
,
10691 .init_hook
= alc262_hippo_automute
,
10694 .mixers
= { alc262_ultra_mixer
},
10695 .cap_mixer
= alc262_ultra_capture_mixer
,
10696 .init_verbs
= { alc262_ultra_verbs
},
10697 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10698 .dac_nids
= alc262_dac_nids
,
10699 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10700 .channel_mode
= alc262_modes
,
10701 .input_mux
= &alc262_ultra_capture_source
,
10702 .adc_nids
= alc262_adc_nids
, /* ADC0 */
10703 .capsrc_nids
= alc262_capsrc_nids
,
10704 .num_adc_nids
= 1, /* single ADC */
10705 .unsol_event
= alc262_ultra_unsol_event
,
10706 .init_hook
= alc262_ultra_automute
,
10708 [ALC262_LENOVO_3000
] = {
10709 .mixers
= { alc262_lenovo_3000_mixer
},
10710 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
10711 alc262_lenovo_3000_unsol_verbs
},
10712 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10713 .dac_nids
= alc262_dac_nids
,
10715 .dig_out_nid
= ALC262_DIGOUT_NID
,
10716 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10717 .channel_mode
= alc262_modes
,
10718 .input_mux
= &alc262_fujitsu_capture_source
,
10719 .unsol_event
= alc262_lenovo_3000_unsol_event
,
10722 .mixers
= { alc262_nec_mixer
},
10723 .init_verbs
= { alc262_nec_verbs
},
10724 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10725 .dac_nids
= alc262_dac_nids
,
10727 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10728 .channel_mode
= alc262_modes
,
10729 .input_mux
= &alc262_capture_source
,
10731 [ALC262_TOSHIBA_S06
] = {
10732 .mixers
= { alc262_toshiba_s06_mixer
},
10733 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_s06_verbs
,
10734 alc262_eapd_verbs
},
10735 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10736 .capsrc_nids
= alc262_dmic_capsrc_nids
,
10737 .dac_nids
= alc262_dac_nids
,
10738 .adc_nids
= alc262_dmic_adc_nids
, /* ADC0 */
10739 .dig_out_nid
= ALC262_DIGOUT_NID
,
10740 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10741 .channel_mode
= alc262_modes
,
10742 .input_mux
= &alc262_dmic_capture_source
,
10743 .unsol_event
= alc262_toshiba_s06_unsol_event
,
10744 .init_hook
= alc262_toshiba_s06_init_hook
,
10746 [ALC262_TOSHIBA_RX1
] = {
10747 .mixers
= { alc262_toshiba_rx1_mixer
},
10748 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_rx1_unsol_verbs
},
10749 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10750 .dac_nids
= alc262_dac_nids
,
10752 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10753 .channel_mode
= alc262_modes
,
10754 .input_mux
= &alc262_capture_source
,
10755 .unsol_event
= alc262_hippo_unsol_event
,
10756 .init_hook
= alc262_hippo_automute
,
10760 static int patch_alc262(struct hda_codec
*codec
)
10762 struct alc_spec
*spec
;
10766 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10770 codec
->spec
= spec
;
10772 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10777 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
10778 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
10779 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
10780 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
10784 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
10786 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
10790 if (board_config
< 0) {
10791 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
10792 "trying auto-probe from BIOS...\n");
10793 board_config
= ALC262_AUTO
;
10796 if (board_config
== ALC262_AUTO
) {
10797 /* automatic parse from the BIOS config */
10798 err
= alc262_parse_auto_config(codec
);
10804 "hda_codec: Cannot set up configuration "
10805 "from BIOS. Using base mode...\n");
10806 board_config
= ALC262_BASIC
;
10810 if (board_config
!= ALC262_AUTO
)
10811 setup_preset(spec
, &alc262_presets
[board_config
]);
10813 spec
->stream_name_analog
= "ALC262 Analog";
10814 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
10815 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
10817 spec
->stream_name_digital
= "ALC262 Digital";
10818 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
10819 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
10821 spec
->is_mix_capture
= 1;
10822 if (!spec
->adc_nids
&& spec
->input_mux
) {
10823 /* check whether NID 0x07 is valid */
10824 unsigned int wcap
= get_wcaps(codec
, 0x07);
10827 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
10828 if (wcap
!= AC_WID_AUD_IN
) {
10829 spec
->adc_nids
= alc262_adc_nids_alt
;
10830 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
10831 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
10833 spec
->adc_nids
= alc262_adc_nids
;
10834 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
10835 spec
->capsrc_nids
= alc262_capsrc_nids
;
10838 if (!spec
->cap_mixer
)
10839 set_capture_mixer(spec
);
10841 spec
->vmaster_nid
= 0x0c;
10843 codec
->patch_ops
= alc_patch_ops
;
10844 if (board_config
== ALC262_AUTO
)
10845 spec
->init_hook
= alc262_auto_init
;
10846 #ifdef CONFIG_SND_HDA_POWER_SAVE
10847 if (!spec
->loopback
.amplist
)
10848 spec
->loopback
.amplist
= alc262_loopbacks
;
10855 * ALC268 channel source setting (2 channel)
10857 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10858 #define alc268_modes alc260_modes
10860 static hda_nid_t alc268_dac_nids
[2] = {
10865 static hda_nid_t alc268_adc_nids
[2] = {
10870 static hda_nid_t alc268_adc_nids_alt
[1] = {
10875 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
10877 static struct snd_kcontrol_new alc268_base_mixer
[] = {
10878 /* output mixer control */
10879 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
10880 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10881 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
10882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10883 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10884 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10885 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
10889 /* bind Beep switches of both NID 0x0f and 0x10 */
10890 static struct hda_bind_ctls alc268_bind_beep_sw
= {
10891 .ops
= &snd_hda_bind_sw
,
10893 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
10894 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
10899 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
10900 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
10901 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
10905 static struct hda_verb alc268_eapd_verbs
[] = {
10906 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10907 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10911 /* Toshiba specific */
10912 #define alc268_toshiba_automute alc262_hippo_automute
10914 static struct hda_verb alc268_toshiba_verbs
[] = {
10915 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10919 static struct hda_input_mux alc268_acer_lc_capture_source
= {
10927 /* Acer specific */
10928 /* bind volumes of both NID 0x02 and 0x03 */
10929 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
10930 .ops
= &snd_hda_bind_vol
,
10932 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
10933 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
10938 /* mute/unmute internal speaker according to the hp jack and mute state */
10939 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
10941 struct alc_spec
*spec
= codec
->spec
;
10944 if (force
|| !spec
->sense_updated
) {
10945 unsigned int present
;
10946 present
= snd_hda_codec_read(codec
, 0x14, 0,
10947 AC_VERB_GET_PIN_SENSE
, 0);
10948 spec
->jack_present
= (present
& 0x80000000) != 0;
10949 spec
->sense_updated
= 1;
10951 if (spec
->jack_present
)
10952 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
10953 else /* unmute internal speaker if necessary */
10954 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
10955 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
10956 HDA_AMP_MUTE
, mute
);
10960 /* bind hp and internal speaker mute (with plug check) */
10961 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
10962 struct snd_ctl_elem_value
*ucontrol
)
10964 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10965 long *valp
= ucontrol
->value
.integer
.value
;
10968 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
10970 valp
[0] ? 0 : HDA_AMP_MUTE
);
10971 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
10973 valp
[1] ? 0 : HDA_AMP_MUTE
);
10975 alc268_acer_automute(codec
, 0);
10979 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer
[] = {
10980 /* output mixer control */
10981 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
10983 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10984 .name
= "Master Playback Switch",
10985 .info
= snd_hda_mixer_amp_switch_info
,
10986 .get
= snd_hda_mixer_amp_switch_get
,
10987 .put
= alc268_acer_master_sw_put
,
10988 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
10990 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT
),
10994 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
10995 /* output mixer control */
10996 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
10998 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10999 .name
= "Master Playback Switch",
11000 .info
= snd_hda_mixer_amp_switch_info
,
11001 .get
= snd_hda_mixer_amp_switch_get
,
11002 .put
= alc268_acer_master_sw_put
,
11003 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11005 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11006 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
11007 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
11011 static struct snd_kcontrol_new alc268_acer_dmic_mixer
[] = {
11012 /* output mixer control */
11013 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
11015 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11016 .name
= "Master Playback Switch",
11017 .info
= snd_hda_mixer_amp_switch_info
,
11018 .get
= snd_hda_mixer_amp_switch_get
,
11019 .put
= alc268_acer_master_sw_put
,
11020 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11022 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11023 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
11027 static struct hda_verb alc268_acer_aspire_one_verbs
[] = {
11028 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11029 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11030 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11031 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11032 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x06},
11033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, 0xa017},
11037 static struct hda_verb alc268_acer_verbs
[] = {
11038 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
11039 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11040 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11041 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11042 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11043 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11044 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11048 /* unsolicited event for HP jack sensing */
11049 static void alc268_toshiba_unsol_event(struct hda_codec
*codec
,
11052 if ((res
>> 26) != ALC880_HP_EVENT
)
11054 alc268_toshiba_automute(codec
);
11057 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
11060 if ((res
>> 26) != ALC880_HP_EVENT
)
11062 alc268_acer_automute(codec
, 1);
11065 static void alc268_acer_init_hook(struct hda_codec
*codec
)
11067 alc268_acer_automute(codec
, 1);
11070 /* toggle speaker-output according to the hp-jack state */
11071 static void alc268_aspire_one_speaker_automute(struct hda_codec
*codec
)
11073 unsigned int present
;
11074 unsigned char bits
;
11076 present
= snd_hda_codec_read(codec
, 0x15, 0,
11077 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11078 bits
= present
? AMP_IN_MUTE(0) : 0;
11079 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 0,
11080 AMP_IN_MUTE(0), bits
);
11081 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 1,
11082 AMP_IN_MUTE(0), bits
);
11086 static void alc268_acer_mic_automute(struct hda_codec
*codec
)
11088 unsigned int present
;
11090 present
= snd_hda_codec_read(codec
, 0x18, 0,
11091 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11092 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_CONNECT_SEL
,
11093 present
? 0x0 : 0x6);
11096 static void alc268_acer_lc_unsol_event(struct hda_codec
*codec
,
11099 if ((res
>> 26) == ALC880_HP_EVENT
)
11100 alc268_aspire_one_speaker_automute(codec
);
11101 if ((res
>> 26) == ALC880_MIC_EVENT
)
11102 alc268_acer_mic_automute(codec
);
11105 static void alc268_acer_lc_init_hook(struct hda_codec
*codec
)
11107 alc268_aspire_one_speaker_automute(codec
);
11108 alc268_acer_mic_automute(codec
);
11111 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
11112 /* output mixer control */
11113 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11114 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11115 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
11116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11117 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11118 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
11122 static struct hda_verb alc268_dell_verbs
[] = {
11123 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11124 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11125 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11129 /* mute/unmute internal speaker according to the hp jack and mute state */
11130 static void alc268_dell_automute(struct hda_codec
*codec
)
11132 unsigned int present
;
11135 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0);
11136 if (present
& 0x80000000)
11137 mute
= HDA_AMP_MUTE
;
11139 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
11140 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11141 HDA_AMP_MUTE
, mute
);
11144 static void alc268_dell_unsol_event(struct hda_codec
*codec
,
11147 if ((res
>> 26) != ALC880_HP_EVENT
)
11149 alc268_dell_automute(codec
);
11152 #define alc268_dell_init_hook alc268_dell_automute
11154 static struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
11155 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
11156 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11157 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
11158 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11159 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
11160 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
11161 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
11162 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
11166 static struct hda_verb alc267_quanta_il1_verbs
[] = {
11167 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11168 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
11172 static void alc267_quanta_il1_hp_automute(struct hda_codec
*codec
)
11174 unsigned int present
;
11176 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
11177 & AC_PINSENSE_PRESENCE
;
11178 snd_hda_codec_write(codec
, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
11179 present
? 0 : PIN_OUT
);
11182 static void alc267_quanta_il1_mic_automute(struct hda_codec
*codec
)
11184 unsigned int present
;
11186 present
= snd_hda_codec_read(codec
, 0x18, 0,
11187 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11188 snd_hda_codec_write(codec
, 0x23, 0,
11189 AC_VERB_SET_CONNECT_SEL
,
11190 present
? 0x00 : 0x01);
11193 static void alc267_quanta_il1_automute(struct hda_codec
*codec
)
11195 alc267_quanta_il1_hp_automute(codec
);
11196 alc267_quanta_il1_mic_automute(codec
);
11199 static void alc267_quanta_il1_unsol_event(struct hda_codec
*codec
,
11202 switch (res
>> 26) {
11203 case ALC880_HP_EVENT
:
11204 alc267_quanta_il1_hp_automute(codec
);
11206 case ALC880_MIC_EVENT
:
11207 alc267_quanta_il1_mic_automute(codec
);
11213 * generic initialization of ADC, input mixers and output mixers
11215 static struct hda_verb alc268_base_init_verbs
[] = {
11216 /* Unmute DAC0-1 and set vol = 0 */
11217 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11218 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11219 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11220 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11221 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11222 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11225 * Set up output mixers (0x0c - 0x0e)
11227 /* set vol=0 to output mixers */
11228 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11229 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11230 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11231 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
11233 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11234 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11236 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11237 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11238 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11239 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11240 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11241 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11242 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11243 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11245 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11246 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11247 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11248 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11249 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11250 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11251 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11253 /* set PCBEEP vol = 0, mute connections */
11254 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11255 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11256 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11258 /* Unmute Selector 23h,24h and set the default input to mic-in */
11260 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
11261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11262 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
11263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11269 * generic initialization of ADC, input mixers and output mixers
11271 static struct hda_verb alc268_volume_init_verbs
[] = {
11272 /* set output DAC */
11273 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11274 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11275 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11276 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11278 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11279 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11280 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11281 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11282 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11284 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11285 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11287 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11288 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11290 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11291 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11292 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11293 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11295 /* set PCBEEP vol = 0, mute connections */
11296 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11297 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11298 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11303 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
11304 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
11305 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
11307 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11308 /* The multiple "Capture Source" controls confuse alsamixer
11309 * So call somewhat different..
11311 /* .name = "Capture Source", */
11312 .name
= "Input Source",
11314 .info
= alc_mux_enum_info
,
11315 .get
= alc_mux_enum_get
,
11316 .put
= alc_mux_enum_put
,
11321 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
11322 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
11323 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
11324 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
11325 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
11327 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11328 /* The multiple "Capture Source" controls confuse alsamixer
11329 * So call somewhat different..
11331 /* .name = "Capture Source", */
11332 .name
= "Input Source",
11334 .info
= alc_mux_enum_info
,
11335 .get
= alc_mux_enum_get
,
11336 .put
= alc_mux_enum_put
,
11341 static struct hda_input_mux alc268_capture_source
= {
11345 { "Front Mic", 0x1 },
11351 static struct hda_input_mux alc268_acer_capture_source
= {
11355 { "Internal Mic", 0x1 },
11360 static struct hda_input_mux alc268_acer_dmic_capture_source
= {
11364 { "Internal Mic", 0x6 },
11369 #ifdef CONFIG_SND_DEBUG
11370 static struct snd_kcontrol_new alc268_test_mixer
[] = {
11371 /* Volume widgets */
11372 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11373 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
11374 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
11375 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
11376 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
11377 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
11378 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
11379 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
11380 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
11381 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
11382 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
11383 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
11384 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
11385 /* The below appears problematic on some hardwares */
11386 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11387 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
11388 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
11389 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
11390 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
11392 /* Modes for retasking pin widgets */
11393 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
11394 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
11395 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
11396 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
11398 /* Controls for GPIO pins, assuming they are configured as outputs */
11399 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11400 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11401 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11402 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11404 /* Switches to allow the digital SPDIF output pin to be enabled.
11405 * The ALC268 does not have an SPDIF input.
11407 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11409 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11410 * this output to turn on an external amplifier.
11412 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11413 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11419 /* create input playback/capture controls for the given pin */
11420 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
11421 const char *ctlname
, int idx
)
11426 sprintf(name
, "%s Playback Volume", ctlname
);
11428 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
11429 HDA_COMPOSE_AMP_VAL(0x02, 3, idx
,
11433 } else if (nid
== 0x15) {
11434 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
11435 HDA_COMPOSE_AMP_VAL(0x03, 3, idx
,
11441 sprintf(name
, "%s Playback Switch", ctlname
);
11442 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
11443 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
11449 /* add playback controls from the parsed DAC table */
11450 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11451 const struct auto_pin_cfg
*cfg
)
11456 spec
->multiout
.num_dacs
= 2; /* only use one dac */
11457 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
11458 spec
->multiout
.dac_nids
[0] = 2;
11459 spec
->multiout
.dac_nids
[1] = 3;
11461 nid
= cfg
->line_out_pins
[0];
11463 alc268_new_analog_output(spec
, nid
, "Front", 0);
11465 nid
= cfg
->speaker_pins
[0];
11467 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11468 "Speaker Playback Volume",
11469 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
11473 nid
= cfg
->hp_pins
[0];
11475 alc268_new_analog_output(spec
, nid
, "Headphone", 0);
11477 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
11479 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11480 "Mono Playback Switch",
11481 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_INPUT
));
11488 /* create playback/capture controls for input pins */
11489 static int alc268_auto_create_analog_input_ctls(struct alc_spec
*spec
,
11490 const struct auto_pin_cfg
*cfg
)
11492 struct hda_input_mux
*imux
= &spec
->private_imux
;
11495 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
11496 switch(cfg
->input_pins
[i
]) {
11498 idx1
= 0; /* Mic 1 */
11501 idx1
= 1; /* Mic 2 */
11504 idx1
= 2; /* Line In */
11511 idx1
= 6; /* digital mics */
11516 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
11517 imux
->items
[imux
->num_items
].index
= idx1
;
11523 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
11525 struct alc_spec
*spec
= codec
->spec
;
11526 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
11527 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
11528 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
11529 unsigned int dac_vol1
, dac_vol2
;
11532 snd_hda_codec_write(codec
, speaker_nid
, 0,
11533 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
11534 snd_hda_codec_write(codec
, 0x0f, 0,
11535 AC_VERB_SET_AMP_GAIN_MUTE
,
11537 snd_hda_codec_write(codec
, 0x10, 0,
11538 AC_VERB_SET_AMP_GAIN_MUTE
,
11541 snd_hda_codec_write(codec
, 0x0f, 0,
11542 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
11543 snd_hda_codec_write(codec
, 0x10, 0,
11544 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
11547 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
11548 if (line_nid
== 0x14)
11549 dac_vol2
= AMP_OUT_ZERO
;
11550 else if (line_nid
== 0x15)
11551 dac_vol1
= AMP_OUT_ZERO
;
11552 if (hp_nid
== 0x14)
11553 dac_vol2
= AMP_OUT_ZERO
;
11554 else if (hp_nid
== 0x15)
11555 dac_vol1
= AMP_OUT_ZERO
;
11556 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
11557 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
11558 spec
->autocfg
.line_out_pins
[2] != 0x16)
11559 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
11561 snd_hda_codec_write(codec
, 0x02, 0,
11562 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
11563 snd_hda_codec_write(codec
, 0x03, 0,
11564 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
11567 /* pcm configuration: identiacal with ALC880 */
11568 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11569 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11570 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11571 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11574 * BIOS auto configuration
11576 static int alc268_parse_auto_config(struct hda_codec
*codec
)
11578 struct alc_spec
*spec
= codec
->spec
;
11580 static hda_nid_t alc268_ignore
[] = { 0 };
11582 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11586 if (!spec
->autocfg
.line_outs
)
11587 return 0; /* can't find valid BIOS pin config */
11589 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11592 err
= alc268_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
11596 spec
->multiout
.max_channels
= 2;
11598 /* digital only support output */
11599 if (spec
->autocfg
.dig_out_pin
)
11600 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
11602 if (spec
->kctls
.list
)
11603 add_mixer(spec
, spec
->kctls
.list
);
11605 if (spec
->autocfg
.speaker_pins
[0] != 0x1d)
11606 add_mixer(spec
, alc268_beep_mixer
);
11608 add_verb(spec
, alc268_volume_init_verbs
);
11609 spec
->num_mux_defs
= 1;
11610 spec
->input_mux
= &spec
->private_imux
;
11612 err
= alc_auto_add_mic_boost(codec
);
11616 store_pin_configs(codec
);
11620 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11621 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11622 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11624 /* init callback for auto-configuration model -- overriding the default init */
11625 static void alc268_auto_init(struct hda_codec
*codec
)
11627 struct alc_spec
*spec
= codec
->spec
;
11628 alc268_auto_init_multi_out(codec
);
11629 alc268_auto_init_hp_out(codec
);
11630 alc268_auto_init_mono_speaker_out(codec
);
11631 alc268_auto_init_analog_input(codec
);
11632 if (spec
->unsol_event
)
11633 alc_inithook(codec
);
11637 * configuration and preset
11639 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
11640 [ALC267_QUANTA_IL1
] = "quanta-il1",
11641 [ALC268_3ST
] = "3stack",
11642 [ALC268_TOSHIBA
] = "toshiba",
11643 [ALC268_ACER
] = "acer",
11644 [ALC268_ACER_DMIC
] = "acer-dmic",
11645 [ALC268_ACER_ASPIRE_ONE
] = "acer-aspire",
11646 [ALC268_DELL
] = "dell",
11647 [ALC268_ZEPTO
] = "zepto",
11648 #ifdef CONFIG_SND_DEBUG
11649 [ALC268_TEST
] = "test",
11651 [ALC268_AUTO
] = "auto",
11654 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
11655 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
11656 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
11657 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
11658 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
11659 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
11660 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11661 ALC268_ACER_ASPIRE_ONE
),
11662 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
11663 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA
),
11664 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
11665 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA
),
11666 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA
),
11667 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA
),
11668 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
11669 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
11670 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
11671 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
11675 static struct alc_config_preset alc268_presets
[] = {
11676 [ALC267_QUANTA_IL1
] = {
11677 .mixers
= { alc267_quanta_il1_mixer
},
11678 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11679 alc267_quanta_il1_verbs
},
11680 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11681 .dac_nids
= alc268_dac_nids
,
11682 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11683 .adc_nids
= alc268_adc_nids_alt
,
11685 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11686 .channel_mode
= alc268_modes
,
11687 .input_mux
= &alc268_capture_source
,
11688 .unsol_event
= alc267_quanta_il1_unsol_event
,
11689 .init_hook
= alc267_quanta_il1_automute
,
11692 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
11693 alc268_beep_mixer
},
11694 .init_verbs
= { alc268_base_init_verbs
},
11695 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11696 .dac_nids
= alc268_dac_nids
,
11697 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11698 .adc_nids
= alc268_adc_nids_alt
,
11699 .capsrc_nids
= alc268_capsrc_nids
,
11701 .dig_out_nid
= ALC268_DIGOUT_NID
,
11702 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11703 .channel_mode
= alc268_modes
,
11704 .input_mux
= &alc268_capture_source
,
11706 [ALC268_TOSHIBA
] = {
11707 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
11708 alc268_beep_mixer
},
11709 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11710 alc268_toshiba_verbs
},
11711 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11712 .dac_nids
= alc268_dac_nids
,
11713 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11714 .adc_nids
= alc268_adc_nids_alt
,
11715 .capsrc_nids
= alc268_capsrc_nids
,
11717 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11718 .channel_mode
= alc268_modes
,
11719 .input_mux
= &alc268_capture_source
,
11720 .unsol_event
= alc268_toshiba_unsol_event
,
11721 .init_hook
= alc268_toshiba_automute
,
11724 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
11725 alc268_beep_mixer
},
11726 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11727 alc268_acer_verbs
},
11728 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11729 .dac_nids
= alc268_dac_nids
,
11730 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11731 .adc_nids
= alc268_adc_nids_alt
,
11732 .capsrc_nids
= alc268_capsrc_nids
,
11734 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11735 .channel_mode
= alc268_modes
,
11736 .input_mux
= &alc268_acer_capture_source
,
11737 .unsol_event
= alc268_acer_unsol_event
,
11738 .init_hook
= alc268_acer_init_hook
,
11740 [ALC268_ACER_DMIC
] = {
11741 .mixers
= { alc268_acer_dmic_mixer
, alc268_capture_alt_mixer
,
11742 alc268_beep_mixer
},
11743 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11744 alc268_acer_verbs
},
11745 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11746 .dac_nids
= alc268_dac_nids
,
11747 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11748 .adc_nids
= alc268_adc_nids_alt
,
11749 .capsrc_nids
= alc268_capsrc_nids
,
11751 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11752 .channel_mode
= alc268_modes
,
11753 .input_mux
= &alc268_acer_dmic_capture_source
,
11754 .unsol_event
= alc268_acer_unsol_event
,
11755 .init_hook
= alc268_acer_init_hook
,
11757 [ALC268_ACER_ASPIRE_ONE
] = {
11758 .mixers
= { alc268_acer_aspire_one_mixer
,
11759 alc268_capture_alt_mixer
},
11760 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11761 alc268_acer_aspire_one_verbs
},
11762 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11763 .dac_nids
= alc268_dac_nids
,
11764 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11765 .adc_nids
= alc268_adc_nids_alt
,
11766 .capsrc_nids
= alc268_capsrc_nids
,
11768 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11769 .channel_mode
= alc268_modes
,
11770 .input_mux
= &alc268_acer_lc_capture_source
,
11771 .unsol_event
= alc268_acer_lc_unsol_event
,
11772 .init_hook
= alc268_acer_lc_init_hook
,
11775 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
},
11776 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11777 alc268_dell_verbs
},
11778 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11779 .dac_nids
= alc268_dac_nids
,
11781 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11782 .channel_mode
= alc268_modes
,
11783 .unsol_event
= alc268_dell_unsol_event
,
11784 .init_hook
= alc268_dell_init_hook
,
11785 .input_mux
= &alc268_capture_source
,
11788 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
11789 alc268_beep_mixer
},
11790 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11791 alc268_toshiba_verbs
},
11792 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11793 .dac_nids
= alc268_dac_nids
,
11794 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11795 .adc_nids
= alc268_adc_nids_alt
,
11796 .capsrc_nids
= alc268_capsrc_nids
,
11798 .dig_out_nid
= ALC268_DIGOUT_NID
,
11799 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11800 .channel_mode
= alc268_modes
,
11801 .input_mux
= &alc268_capture_source
,
11802 .unsol_event
= alc268_toshiba_unsol_event
,
11803 .init_hook
= alc268_toshiba_automute
11805 #ifdef CONFIG_SND_DEBUG
11807 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
11808 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11809 alc268_volume_init_verbs
},
11810 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11811 .dac_nids
= alc268_dac_nids
,
11812 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11813 .adc_nids
= alc268_adc_nids_alt
,
11814 .capsrc_nids
= alc268_capsrc_nids
,
11816 .dig_out_nid
= ALC268_DIGOUT_NID
,
11817 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11818 .channel_mode
= alc268_modes
,
11819 .input_mux
= &alc268_capture_source
,
11824 static int patch_alc268(struct hda_codec
*codec
)
11826 struct alc_spec
*spec
;
11830 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
11834 codec
->spec
= spec
;
11836 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
11840 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
11841 printk(KERN_INFO
"hda_codec: Unknown model for ALC268, "
11842 "trying auto-probe from BIOS...\n");
11843 board_config
= ALC268_AUTO
;
11846 if (board_config
== ALC268_AUTO
) {
11847 /* automatic parse from the BIOS config */
11848 err
= alc268_parse_auto_config(codec
);
11854 "hda_codec: Cannot set up configuration "
11855 "from BIOS. Using base mode...\n");
11856 board_config
= ALC268_3ST
;
11860 if (board_config
!= ALC268_AUTO
)
11861 setup_preset(spec
, &alc268_presets
[board_config
]);
11863 if (codec
->vendor_id
== 0x10ec0267) {
11864 spec
->stream_name_analog
= "ALC267 Analog";
11865 spec
->stream_name_digital
= "ALC267 Digital";
11867 spec
->stream_name_analog
= "ALC268 Analog";
11868 spec
->stream_name_digital
= "ALC268 Digital";
11871 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
11872 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
11873 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
11875 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
11877 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
11878 /* override the amp caps for beep generator */
11879 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
11880 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
11881 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
11882 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
11883 (0 << AC_AMPCAP_MUTE_SHIFT
));
11885 if (!spec
->adc_nids
&& spec
->input_mux
) {
11886 /* check whether NID 0x07 is valid */
11887 unsigned int wcap
= get_wcaps(codec
, 0x07);
11891 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
11892 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
11893 spec
->adc_nids
= alc268_adc_nids_alt
;
11894 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
11895 add_mixer(spec
, alc268_capture_alt_mixer
);
11897 spec
->adc_nids
= alc268_adc_nids
;
11898 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
11899 add_mixer(spec
, alc268_capture_mixer
);
11901 spec
->capsrc_nids
= alc268_capsrc_nids
;
11902 /* set default input source */
11903 for (i
= 0; i
< spec
->num_adc_nids
; i
++)
11904 snd_hda_codec_write_cache(codec
, alc268_capsrc_nids
[i
],
11905 0, AC_VERB_SET_CONNECT_SEL
,
11906 spec
->input_mux
->items
[0].index
);
11909 spec
->vmaster_nid
= 0x02;
11911 codec
->patch_ops
= alc_patch_ops
;
11912 if (board_config
== ALC268_AUTO
)
11913 spec
->init_hook
= alc268_auto_init
;
11919 * ALC269 channel source setting (2 channel)
11921 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11923 #define alc269_dac_nids alc260_dac_nids
11925 static hda_nid_t alc269_adc_nids
[1] = {
11930 static hda_nid_t alc269_capsrc_nids
[1] = {
11934 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11938 static struct hda_input_mux alc269_eeepc_dmic_capture_source
= {
11946 static struct hda_input_mux alc269_eeepc_amic_capture_source
= {
11954 #define alc269_modes alc260_modes
11955 #define alc269_capture_source alc880_lg_lw_capture_source
11957 static struct snd_kcontrol_new alc269_base_mixer
[] = {
11958 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11959 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11960 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11961 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11962 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11963 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11964 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT
),
11965 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT
),
11966 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11967 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11968 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11969 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
11970 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11971 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
11975 static struct snd_kcontrol_new alc269_quanta_fl1_mixer
[] = {
11976 /* output mixer control */
11977 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
11979 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11980 .name
= "Master Playback Switch",
11981 .info
= snd_hda_mixer_amp_switch_info
,
11982 .get
= snd_hda_mixer_amp_switch_get
,
11983 .put
= alc268_acer_master_sw_put
,
11984 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11986 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11987 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11988 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11989 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11990 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11991 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
11992 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11993 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11997 static struct snd_kcontrol_new alc269_lifebook_mixer
[] = {
11998 /* output mixer control */
11999 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12001 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12002 .name
= "Master Playback Switch",
12003 .info
= snd_hda_mixer_amp_switch_info
,
12004 .get
= snd_hda_mixer_amp_switch_get
,
12005 .put
= alc268_acer_master_sw_put
,
12006 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
12008 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12009 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12010 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12011 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12012 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12013 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
12014 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT
),
12015 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT
),
12016 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT
),
12017 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12018 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12022 /* bind volumes of both NID 0x0c and 0x0d */
12023 static struct hda_bind_ctls alc269_epc_bind_vol
= {
12024 .ops
= &snd_hda_bind_vol
,
12026 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
12027 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
12032 static struct snd_kcontrol_new alc269_eeepc_mixer
[] = {
12033 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12034 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol
),
12035 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12039 /* capture mixer elements */
12040 static struct snd_kcontrol_new alc269_epc_capture_mixer
[] = {
12041 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12042 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12043 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12048 static struct snd_kcontrol_new alc269_fujitsu_mixer
[] = {
12049 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12050 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12051 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol
),
12056 static struct snd_kcontrol_new alc269_beep_mixer
[] = {
12057 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT
),
12058 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT
),
12062 static struct hda_verb alc269_quanta_fl1_verbs
[] = {
12063 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12064 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12065 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12066 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12067 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12068 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12072 static struct hda_verb alc269_lifebook_verbs
[] = {
12073 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12074 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
12075 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12076 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12077 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12078 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12079 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12080 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12081 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12082 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12086 /* toggle speaker-output according to the hp-jack state */
12087 static void alc269_quanta_fl1_speaker_automute(struct hda_codec
*codec
)
12089 unsigned int present
;
12090 unsigned char bits
;
12092 present
= snd_hda_codec_read(codec
, 0x15, 0,
12093 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12094 bits
= present
? AMP_IN_MUTE(0) : 0;
12095 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
12096 AMP_IN_MUTE(0), bits
);
12097 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
12098 AMP_IN_MUTE(0), bits
);
12100 snd_hda_codec_write(codec
, 0x20, 0,
12101 AC_VERB_SET_COEF_INDEX
, 0x0c);
12102 snd_hda_codec_write(codec
, 0x20, 0,
12103 AC_VERB_SET_PROC_COEF
, 0x680);
12105 snd_hda_codec_write(codec
, 0x20, 0,
12106 AC_VERB_SET_COEF_INDEX
, 0x0c);
12107 snd_hda_codec_write(codec
, 0x20, 0,
12108 AC_VERB_SET_PROC_COEF
, 0x480);
12111 /* toggle speaker-output according to the hp-jacks state */
12112 static void alc269_lifebook_speaker_automute(struct hda_codec
*codec
)
12114 unsigned int present
;
12115 unsigned char bits
;
12117 /* Check laptop headphone socket */
12118 present
= snd_hda_codec_read(codec
, 0x15, 0,
12119 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12121 /* Check port replicator headphone socket */
12122 present
|= snd_hda_codec_read(codec
, 0x1a, 0,
12123 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12125 bits
= present
? AMP_IN_MUTE(0) : 0;
12126 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
12127 AMP_IN_MUTE(0), bits
);
12128 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
12129 AMP_IN_MUTE(0), bits
);
12131 snd_hda_codec_write(codec
, 0x20, 0,
12132 AC_VERB_SET_COEF_INDEX
, 0x0c);
12133 snd_hda_codec_write(codec
, 0x20, 0,
12134 AC_VERB_SET_PROC_COEF
, 0x680);
12136 snd_hda_codec_write(codec
, 0x20, 0,
12137 AC_VERB_SET_COEF_INDEX
, 0x0c);
12138 snd_hda_codec_write(codec
, 0x20, 0,
12139 AC_VERB_SET_PROC_COEF
, 0x480);
12142 static void alc269_quanta_fl1_mic_automute(struct hda_codec
*codec
)
12144 unsigned int present
;
12146 present
= snd_hda_codec_read(codec
, 0x18, 0,
12147 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12148 snd_hda_codec_write(codec
, 0x23, 0,
12149 AC_VERB_SET_CONNECT_SEL
, present
? 0x0 : 0x1);
12152 static void alc269_lifebook_mic_autoswitch(struct hda_codec
*codec
)
12154 unsigned int present_laptop
;
12155 unsigned int present_dock
;
12157 present_laptop
= snd_hda_codec_read(codec
, 0x18, 0,
12158 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12160 present_dock
= snd_hda_codec_read(codec
, 0x1b, 0,
12161 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12163 /* Laptop mic port overrides dock mic port, design decision */
12165 snd_hda_codec_write(codec
, 0x23, 0,
12166 AC_VERB_SET_CONNECT_SEL
, 0x3);
12167 if (present_laptop
)
12168 snd_hda_codec_write(codec
, 0x23, 0,
12169 AC_VERB_SET_CONNECT_SEL
, 0x0);
12170 if (!present_dock
&& !present_laptop
)
12171 snd_hda_codec_write(codec
, 0x23, 0,
12172 AC_VERB_SET_CONNECT_SEL
, 0x1);
12175 static void alc269_quanta_fl1_unsol_event(struct hda_codec
*codec
,
12178 if ((res
>> 26) == ALC880_HP_EVENT
)
12179 alc269_quanta_fl1_speaker_automute(codec
);
12180 if ((res
>> 26) == ALC880_MIC_EVENT
)
12181 alc269_quanta_fl1_mic_automute(codec
);
12184 static void alc269_lifebook_unsol_event(struct hda_codec
*codec
,
12187 if ((res
>> 26) == ALC880_HP_EVENT
)
12188 alc269_lifebook_speaker_automute(codec
);
12189 if ((res
>> 26) == ALC880_MIC_EVENT
)
12190 alc269_lifebook_mic_autoswitch(codec
);
12193 static void alc269_quanta_fl1_init_hook(struct hda_codec
*codec
)
12195 alc269_quanta_fl1_speaker_automute(codec
);
12196 alc269_quanta_fl1_mic_automute(codec
);
12199 static void alc269_lifebook_init_hook(struct hda_codec
*codec
)
12201 alc269_lifebook_speaker_automute(codec
);
12202 alc269_lifebook_mic_autoswitch(codec
);
12205 static struct hda_verb alc269_eeepc_dmic_init_verbs
[] = {
12206 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12207 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
12208 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
12209 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
12210 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12211 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12212 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12216 static struct hda_verb alc269_eeepc_amic_init_verbs
[] = {
12217 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12218 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
12219 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
12220 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
12221 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12222 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12226 /* toggle speaker-output according to the hp-jack state */
12227 static void alc269_speaker_automute(struct hda_codec
*codec
)
12229 unsigned int present
;
12230 unsigned char bits
;
12232 present
= snd_hda_codec_read(codec
, 0x15, 0,
12233 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12234 bits
= present
? AMP_IN_MUTE(0) : 0;
12235 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
12236 AMP_IN_MUTE(0), bits
);
12237 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
12238 AMP_IN_MUTE(0), bits
);
12241 static void alc269_eeepc_dmic_automute(struct hda_codec
*codec
)
12243 unsigned int present
;
12245 present
= snd_hda_codec_read(codec
, 0x18, 0,
12246 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12247 snd_hda_codec_write(codec
, 0x23, 0,
12248 AC_VERB_SET_CONNECT_SEL
, (present
? 0 : 5));
12251 static void alc269_eeepc_amic_automute(struct hda_codec
*codec
)
12253 unsigned int present
;
12255 present
= snd_hda_codec_read(codec
, 0x18, 0,
12256 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12257 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12258 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
12259 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12260 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
12263 /* unsolicited event for HP jack sensing */
12264 static void alc269_eeepc_dmic_unsol_event(struct hda_codec
*codec
,
12267 if ((res
>> 26) == ALC880_HP_EVENT
)
12268 alc269_speaker_automute(codec
);
12270 if ((res
>> 26) == ALC880_MIC_EVENT
)
12271 alc269_eeepc_dmic_automute(codec
);
12274 static void alc269_eeepc_dmic_inithook(struct hda_codec
*codec
)
12276 alc269_speaker_automute(codec
);
12277 alc269_eeepc_dmic_automute(codec
);
12280 /* unsolicited event for HP jack sensing */
12281 static void alc269_eeepc_amic_unsol_event(struct hda_codec
*codec
,
12284 if ((res
>> 26) == ALC880_HP_EVENT
)
12285 alc269_speaker_automute(codec
);
12287 if ((res
>> 26) == ALC880_MIC_EVENT
)
12288 alc269_eeepc_amic_automute(codec
);
12291 static void alc269_eeepc_amic_inithook(struct hda_codec
*codec
)
12293 alc269_speaker_automute(codec
);
12294 alc269_eeepc_amic_automute(codec
);
12298 * generic initialization of ADC, input mixers and output mixers
12300 static struct hda_verb alc269_init_verbs
[] = {
12302 * Unmute ADC0 and set the default input to mic-in
12304 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12306 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12307 * analog-loopback mixer widget
12308 * Note: PASD motherboards uses the Line In 2 as the input for
12309 * front panel mic (mic 2)
12311 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12312 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12313 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12319 * Set up output mixers (0x0c - 0x0e)
12321 /* set vol=0 to output mixers */
12322 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12323 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12325 /* set up input amps for analog loopback */
12326 /* Amp Indices: DAC = 0, mixer = 1 */
12327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12330 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12331 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12332 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12334 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12335 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12336 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12337 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12338 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12339 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12340 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12342 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12344 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12345 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12346 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12347 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12348 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12350 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
12351 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12353 /* FIXME: use matrix-type input source selection */
12354 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12355 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12356 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12357 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12358 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12362 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12363 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12367 /* add playback controls from the parsed DAC table */
12368 static int alc269_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12369 const struct auto_pin_cfg
*cfg
)
12374 spec
->multiout
.num_dacs
= 1; /* only use one dac */
12375 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
12376 spec
->multiout
.dac_nids
[0] = 2;
12378 nid
= cfg
->line_out_pins
[0];
12380 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12381 "Front Playback Volume",
12382 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
));
12385 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12386 "Front Playback Switch",
12387 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
12392 nid
= cfg
->speaker_pins
[0];
12394 if (!cfg
->line_out_pins
[0]) {
12395 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12396 "Speaker Playback Volume",
12397 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12403 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12404 "Speaker Playback Switch",
12405 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
12410 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12411 "Speaker Playback Switch",
12412 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
12418 nid
= cfg
->hp_pins
[0];
12420 /* spec->multiout.hp_nid = 2; */
12421 if (!cfg
->line_out_pins
[0] && !cfg
->speaker_pins
[0]) {
12422 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12423 "Headphone Playback Volume",
12424 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12430 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12431 "Headphone Playback Switch",
12432 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
12437 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12438 "Headphone Playback Switch",
12439 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
12448 static int alc269_auto_create_analog_input_ctls(struct alc_spec
*spec
,
12449 const struct auto_pin_cfg
*cfg
)
12453 err
= alc880_auto_create_analog_input_ctls(spec
, cfg
);
12456 /* digital-mic input pin is excluded in alc880_auto_create..()
12457 * because it's under 0x18
12459 if (cfg
->input_pins
[AUTO_PIN_MIC
] == 0x12 ||
12460 cfg
->input_pins
[AUTO_PIN_FRONT_MIC
] == 0x12) {
12461 struct hda_input_mux
*imux
= &spec
->private_imux
;
12462 imux
->items
[imux
->num_items
].label
= "Int Mic";
12463 imux
->items
[imux
->num_items
].index
= 0x05;
12469 #ifdef CONFIG_SND_HDA_POWER_SAVE
12470 #define alc269_loopbacks alc880_loopbacks
12473 /* pcm configuration: identiacal with ALC880 */
12474 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12475 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12476 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12477 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12480 * BIOS auto configuration
12482 static int alc269_parse_auto_config(struct hda_codec
*codec
)
12484 struct alc_spec
*spec
= codec
->spec
;
12486 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
12488 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12493 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12496 err
= alc269_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
12500 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12502 if (spec
->autocfg
.dig_out_pin
)
12503 spec
->multiout
.dig_out_nid
= ALC269_DIGOUT_NID
;
12505 if (spec
->kctls
.list
)
12506 add_mixer(spec
, spec
->kctls
.list
);
12508 /* create a beep mixer control if the pin 0x1d isn't assigned */
12509 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.input_pins
); i
++)
12510 if (spec
->autocfg
.input_pins
[i
] == 0x1d)
12512 if (i
>= ARRAY_SIZE(spec
->autocfg
.input_pins
))
12513 add_mixer(spec
, alc269_beep_mixer
);
12515 add_verb(spec
, alc269_init_verbs
);
12516 spec
->num_mux_defs
= 1;
12517 spec
->input_mux
= &spec
->private_imux
;
12518 /* set default input source */
12519 snd_hda_codec_write_cache(codec
, alc269_capsrc_nids
[0],
12520 0, AC_VERB_SET_CONNECT_SEL
,
12521 spec
->input_mux
->items
[0].index
);
12523 err
= alc_auto_add_mic_boost(codec
);
12527 if (!spec
->cap_mixer
)
12528 set_capture_mixer(spec
);
12530 store_pin_configs(codec
);
12534 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12535 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12536 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12539 /* init callback for auto-configuration model -- overriding the default init */
12540 static void alc269_auto_init(struct hda_codec
*codec
)
12542 struct alc_spec
*spec
= codec
->spec
;
12543 alc269_auto_init_multi_out(codec
);
12544 alc269_auto_init_hp_out(codec
);
12545 alc269_auto_init_analog_input(codec
);
12546 if (spec
->unsol_event
)
12547 alc_inithook(codec
);
12551 * configuration and preset
12553 static const char *alc269_models
[ALC269_MODEL_LAST
] = {
12554 [ALC269_BASIC
] = "basic",
12555 [ALC269_QUANTA_FL1
] = "quanta",
12556 [ALC269_ASUS_EEEPC_P703
] = "eeepc-p703",
12557 [ALC269_ASUS_EEEPC_P901
] = "eeepc-p901",
12558 [ALC269_FUJITSU
] = "fujitsu",
12559 [ALC269_LIFEBOOK
] = "lifebook"
12562 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
12563 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1
),
12564 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12565 ALC269_ASUS_EEEPC_P703
),
12566 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12567 ALC269_ASUS_EEEPC_P901
),
12568 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12569 ALC269_ASUS_EEEPC_P901
),
12570 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU
),
12571 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK
),
12575 static struct alc_config_preset alc269_presets
[] = {
12577 .mixers
= { alc269_base_mixer
},
12578 .init_verbs
= { alc269_init_verbs
},
12579 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
12580 .dac_nids
= alc269_dac_nids
,
12582 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
12583 .channel_mode
= alc269_modes
,
12584 .input_mux
= &alc269_capture_source
,
12586 [ALC269_QUANTA_FL1
] = {
12587 .mixers
= { alc269_quanta_fl1_mixer
},
12588 .init_verbs
= { alc269_init_verbs
, alc269_quanta_fl1_verbs
},
12589 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
12590 .dac_nids
= alc269_dac_nids
,
12592 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
12593 .channel_mode
= alc269_modes
,
12594 .input_mux
= &alc269_capture_source
,
12595 .unsol_event
= alc269_quanta_fl1_unsol_event
,
12596 .init_hook
= alc269_quanta_fl1_init_hook
,
12598 [ALC269_ASUS_EEEPC_P703
] = {
12599 .mixers
= { alc269_eeepc_mixer
},
12600 .cap_mixer
= alc269_epc_capture_mixer
,
12601 .init_verbs
= { alc269_init_verbs
,
12602 alc269_eeepc_amic_init_verbs
},
12603 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
12604 .dac_nids
= alc269_dac_nids
,
12606 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
12607 .channel_mode
= alc269_modes
,
12608 .input_mux
= &alc269_eeepc_amic_capture_source
,
12609 .unsol_event
= alc269_eeepc_amic_unsol_event
,
12610 .init_hook
= alc269_eeepc_amic_inithook
,
12612 [ALC269_ASUS_EEEPC_P901
] = {
12613 .mixers
= { alc269_eeepc_mixer
},
12614 .cap_mixer
= alc269_epc_capture_mixer
,
12615 .init_verbs
= { alc269_init_verbs
,
12616 alc269_eeepc_dmic_init_verbs
},
12617 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
12618 .dac_nids
= alc269_dac_nids
,
12620 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
12621 .channel_mode
= alc269_modes
,
12622 .input_mux
= &alc269_eeepc_dmic_capture_source
,
12623 .unsol_event
= alc269_eeepc_dmic_unsol_event
,
12624 .init_hook
= alc269_eeepc_dmic_inithook
,
12626 [ALC269_FUJITSU
] = {
12627 .mixers
= { alc269_fujitsu_mixer
, alc269_beep_mixer
},
12628 .cap_mixer
= alc269_epc_capture_mixer
,
12629 .init_verbs
= { alc269_init_verbs
,
12630 alc269_eeepc_dmic_init_verbs
},
12631 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
12632 .dac_nids
= alc269_dac_nids
,
12634 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
12635 .channel_mode
= alc269_modes
,
12636 .input_mux
= &alc269_eeepc_dmic_capture_source
,
12637 .unsol_event
= alc269_eeepc_dmic_unsol_event
,
12638 .init_hook
= alc269_eeepc_dmic_inithook
,
12640 [ALC269_LIFEBOOK
] = {
12641 .mixers
= { alc269_lifebook_mixer
},
12642 .init_verbs
= { alc269_init_verbs
, alc269_lifebook_verbs
},
12643 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
12644 .dac_nids
= alc269_dac_nids
,
12646 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
12647 .channel_mode
= alc269_modes
,
12648 .input_mux
= &alc269_capture_source
,
12649 .unsol_event
= alc269_lifebook_unsol_event
,
12650 .init_hook
= alc269_lifebook_init_hook
,
12654 static int patch_alc269(struct hda_codec
*codec
)
12656 struct alc_spec
*spec
;
12660 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12664 codec
->spec
= spec
;
12666 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
12668 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
12672 if (board_config
< 0) {
12673 printk(KERN_INFO
"hda_codec: Unknown model for ALC269, "
12674 "trying auto-probe from BIOS...\n");
12675 board_config
= ALC269_AUTO
;
12678 if (board_config
== ALC269_AUTO
) {
12679 /* automatic parse from the BIOS config */
12680 err
= alc269_parse_auto_config(codec
);
12686 "hda_codec: Cannot set up configuration "
12687 "from BIOS. Using base mode...\n");
12688 board_config
= ALC269_BASIC
;
12692 if (board_config
!= ALC269_AUTO
)
12693 setup_preset(spec
, &alc269_presets
[board_config
]);
12695 spec
->stream_name_analog
= "ALC269 Analog";
12696 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
12697 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
12699 spec
->stream_name_digital
= "ALC269 Digital";
12700 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
12701 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
12703 spec
->adc_nids
= alc269_adc_nids
;
12704 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
12705 spec
->capsrc_nids
= alc269_capsrc_nids
;
12706 if (!spec
->cap_mixer
)
12707 set_capture_mixer(spec
);
12709 codec
->patch_ops
= alc_patch_ops
;
12710 if (board_config
== ALC269_AUTO
)
12711 spec
->init_hook
= alc269_auto_init
;
12712 #ifdef CONFIG_SND_HDA_POWER_SAVE
12713 if (!spec
->loopback
.amplist
)
12714 spec
->loopback
.amplist
= alc269_loopbacks
;
12721 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12725 * set the path ways for 2 channel output
12726 * need to set the codec line out and mic 1 pin widgets to inputs
12728 static struct hda_verb alc861_threestack_ch2_init
[] = {
12729 /* set pin widget 1Ah (line in) for input */
12730 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12731 /* set pin widget 18h (mic1/2) for input, for mic also enable
12734 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12736 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
12738 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
12739 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
12745 * need to set the codec line out and mic 1 pin widgets to outputs
12747 static struct hda_verb alc861_threestack_ch6_init
[] = {
12748 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12749 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12750 /* set pin widget 18h (mic1) for output (CLFE)*/
12751 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12753 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12754 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12756 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
12758 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
12759 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
12764 static struct hda_channel_mode alc861_threestack_modes
[2] = {
12765 { 2, alc861_threestack_ch2_init
},
12766 { 6, alc861_threestack_ch6_init
},
12768 /* Set mic1 as input and unmute the mixer */
12769 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
12770 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12771 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
12774 /* Set mic1 as output and mute mixer */
12775 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
12776 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12777 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
12781 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
12782 { 2, alc861_uniwill_m31_ch2_init
},
12783 { 4, alc861_uniwill_m31_ch4_init
},
12786 /* Set mic1 and line-in as input and unmute the mixer */
12787 static struct hda_verb alc861_asus_ch2_init
[] = {
12788 /* set pin widget 1Ah (line in) for input */
12789 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12790 /* set pin widget 18h (mic1/2) for input, for mic also enable
12793 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12795 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
12797 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
12798 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
12802 /* Set mic1 nad line-in as output and mute mixer */
12803 static struct hda_verb alc861_asus_ch6_init
[] = {
12804 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12805 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12806 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12807 /* set pin widget 18h (mic1) for output (CLFE)*/
12808 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12809 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12810 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12811 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12813 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
12815 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
12816 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
12821 static struct hda_channel_mode alc861_asus_modes
[2] = {
12822 { 2, alc861_asus_ch2_init
},
12823 { 6, alc861_asus_ch6_init
},
12828 static struct snd_kcontrol_new alc861_base_mixer
[] = {
12829 /* output mixer control */
12830 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
12831 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
12832 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
12833 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
12834 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
12836 /*Input mixer control */
12837 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12838 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12839 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
12840 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
12841 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
12842 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
12843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
12844 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
12845 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
12846 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
12851 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
12852 /* output mixer control */
12853 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
12854 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
12855 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
12856 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
12857 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12859 /* Input mixer control */
12860 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12861 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12862 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
12863 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
12864 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
12865 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
12866 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
12867 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
12868 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
12869 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
12872 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12873 .name
= "Channel Mode",
12874 .info
= alc_ch_mode_info
,
12875 .get
= alc_ch_mode_get
,
12876 .put
= alc_ch_mode_put
,
12877 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
12882 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
12883 /* output mixer control */
12884 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
12885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
12886 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
12891 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
12892 /* output mixer control */
12893 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
12894 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
12895 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
12896 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
12897 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12899 /* Input mixer control */
12900 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12901 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12902 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
12903 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
12904 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
12905 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
12906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
12907 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
12908 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
12909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
12912 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12913 .name
= "Channel Mode",
12914 .info
= alc_ch_mode_info
,
12915 .get
= alc_ch_mode_get
,
12916 .put
= alc_ch_mode_put
,
12917 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
12922 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
12923 /* output mixer control */
12924 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
12925 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
12926 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
12927 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
12928 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
12930 /* Input mixer control */
12931 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
12932 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12933 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
12934 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
12935 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
12936 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
12937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
12938 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
12939 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
12940 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
12943 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12944 .name
= "Channel Mode",
12945 .info
= alc_ch_mode_info
,
12946 .get
= alc_ch_mode_get
,
12947 .put
= alc_ch_mode_put
,
12948 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
12953 /* additional mixer */
12954 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
12955 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
12956 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
12957 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT
),
12958 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT
),
12963 * generic initialization of ADC, input mixers and output mixers
12965 static struct hda_verb alc861_base_init_verbs
[] = {
12967 * Unmute ADC0 and set the default input to mic-in
12969 /* port-A for surround (rear panel) */
12970 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12971 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12972 /* port-B for mic-in (rear panel) with vref */
12973 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12974 /* port-C for line-in (rear panel) */
12975 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12976 /* port-D for Front */
12977 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12978 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12979 /* port-E for HP out (front panel) */
12980 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
12981 /* route front PCM to HP */
12982 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12983 /* port-F for mic-in (front panel) with vref */
12984 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12985 /* port-G for CLFE (rear panel) */
12986 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12987 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12988 /* port-H for side (rear panel) */
12989 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12990 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12992 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12993 /* route front mic to ADC1*/
12994 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12995 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12997 /* Unmute DAC0~3 & spdif out*/
12998 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12999 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13000 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13001 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13004 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13005 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13006 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13007 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13008 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13010 /* Unmute Stereo Mixer 15 */
13011 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13012 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13014 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
13016 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13017 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13018 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13019 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13020 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13021 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13022 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13023 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13024 /* hp used DAC 3 (Front) */
13025 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13026 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13031 static struct hda_verb alc861_threestack_init_verbs
[] = {
13033 * Unmute ADC0 and set the default input to mic-in
13035 /* port-A for surround (rear panel) */
13036 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13037 /* port-B for mic-in (rear panel) with vref */
13038 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13039 /* port-C for line-in (rear panel) */
13040 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13041 /* port-D for Front */
13042 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13043 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13044 /* port-E for HP out (front panel) */
13045 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
13046 /* route front PCM to HP */
13047 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13048 /* port-F for mic-in (front panel) with vref */
13049 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13050 /* port-G for CLFE (rear panel) */
13051 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13052 /* port-H for side (rear panel) */
13053 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13055 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13056 /* route front mic to ADC1*/
13057 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
13058 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13059 /* Unmute DAC0~3 & spdif out*/
13060 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13061 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13062 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13063 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13064 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13066 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13067 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13068 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13069 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13070 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13072 /* Unmute Stereo Mixer 15 */
13073 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13074 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13075 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13076 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
13078 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13079 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13080 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13081 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13082 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13083 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13084 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13085 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13086 /* hp used DAC 3 (Front) */
13087 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13088 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13092 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
13094 * Unmute ADC0 and set the default input to mic-in
13096 /* port-A for surround (rear panel) */
13097 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13098 /* port-B for mic-in (rear panel) with vref */
13099 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13100 /* port-C for line-in (rear panel) */
13101 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13102 /* port-D for Front */
13103 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13104 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13105 /* port-E for HP out (front panel) */
13106 /* this has to be set to VREF80 */
13107 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13108 /* route front PCM to HP */
13109 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13110 /* port-F for mic-in (front panel) with vref */
13111 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13112 /* port-G for CLFE (rear panel) */
13113 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13114 /* port-H for side (rear panel) */
13115 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13117 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13118 /* route front mic to ADC1*/
13119 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
13120 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13121 /* Unmute DAC0~3 & spdif out*/
13122 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13123 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13124 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13125 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13126 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13128 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13129 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13130 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13131 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13132 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13134 /* Unmute Stereo Mixer 15 */
13135 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13136 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13137 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13138 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
13140 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13141 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13142 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13143 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13144 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13145 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13146 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13147 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13148 /* hp used DAC 3 (Front) */
13149 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13150 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13154 static struct hda_verb alc861_asus_init_verbs
[] = {
13156 * Unmute ADC0 and set the default input to mic-in
13158 /* port-A for surround (rear panel)
13159 * according to codec#0 this is the HP jack
13161 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
13162 /* route front PCM to HP */
13163 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
13164 /* port-B for mic-in (rear panel) with vref */
13165 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13166 /* port-C for line-in (rear panel) */
13167 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13168 /* port-D for Front */
13169 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13170 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13171 /* port-E for HP out (front panel) */
13172 /* this has to be set to VREF80 */
13173 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13174 /* route front PCM to HP */
13175 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13176 /* port-F for mic-in (front panel) with vref */
13177 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13178 /* port-G for CLFE (rear panel) */
13179 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13180 /* port-H for side (rear panel) */
13181 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13183 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13184 /* route front mic to ADC1*/
13185 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
13186 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13187 /* Unmute DAC0~3 & spdif out*/
13188 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13189 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13190 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13191 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13192 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13193 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13194 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13195 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13196 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13197 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13199 /* Unmute Stereo Mixer 15 */
13200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13202 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
13205 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13206 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13207 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13208 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13209 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13210 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13211 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13212 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13213 /* hp used DAC 3 (Front) */
13214 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13215 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13219 /* additional init verbs for ASUS laptops */
13220 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
13221 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
13222 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
13227 * generic initialization of ADC, input mixers and output mixers
13229 static struct hda_verb alc861_auto_init_verbs
[] = {
13231 * Unmute ADC0 and set the default input to mic-in
13233 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13236 /* Unmute DAC0~3 & spdif out*/
13237 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13238 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13239 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13240 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13243 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13244 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13245 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13246 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13247 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13249 /* Unmute Stereo Mixer 15 */
13250 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13251 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13252 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13253 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
13255 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13256 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13257 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13258 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13259 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13260 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13261 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13262 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13264 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13265 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13266 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13268 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13269 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13270 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13271 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13273 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
13278 static struct hda_verb alc861_toshiba_init_verbs
[] = {
13279 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13284 /* toggle speaker-output according to the hp-jack state */
13285 static void alc861_toshiba_automute(struct hda_codec
*codec
)
13287 unsigned int present
;
13289 present
= snd_hda_codec_read(codec
, 0x0f, 0,
13290 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13291 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
13292 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
13293 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
13294 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
13297 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
13300 if ((res
>> 26) == ALC880_HP_EVENT
)
13301 alc861_toshiba_automute(codec
);
13304 /* pcm configuration: identiacal with ALC880 */
13305 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13306 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13307 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13308 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13311 #define ALC861_DIGOUT_NID 0x07
13313 static struct hda_channel_mode alc861_8ch_modes
[1] = {
13317 static hda_nid_t alc861_dac_nids
[4] = {
13318 /* front, surround, clfe, side */
13319 0x03, 0x06, 0x05, 0x04
13322 static hda_nid_t alc660_dac_nids
[3] = {
13323 /* front, clfe, surround */
13327 static hda_nid_t alc861_adc_nids
[1] = {
13332 static struct hda_input_mux alc861_capture_source
= {
13336 { "Front Mic", 0x3 },
13343 /* fill in the dac_nids table from the parsed pin configuration */
13344 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
,
13345 const struct auto_pin_cfg
*cfg
)
13350 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
13351 for (i
= 0; i
< cfg
->line_outs
; i
++) {
13352 nid
= cfg
->line_out_pins
[i
];
13354 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
13356 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
13359 spec
->multiout
.num_dacs
= cfg
->line_outs
;
13363 /* add playback controls from the parsed DAC table */
13364 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13365 const struct auto_pin_cfg
*cfg
)
13368 static const char *chname
[4] = {
13369 "Front", "Surround", NULL
/*CLFE*/, "Side"
13374 for (i
= 0; i
< cfg
->line_outs
; i
++) {
13375 nid
= spec
->multiout
.dac_nids
[i
];
13380 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13381 "Center Playback Switch",
13382 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
13386 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13387 "LFE Playback Switch",
13388 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
13393 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1;
13395 if (nid
== alc861_dac_nids
[idx
])
13397 sprintf(name
, "%s Playback Switch", chname
[idx
]);
13398 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
13399 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
13408 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
13416 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
13418 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13419 "Headphone Playback Switch",
13420 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
13423 spec
->multiout
.hp_nid
= nid
;
13428 /* create playback/capture controls for input pins */
13429 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
,
13430 const struct auto_pin_cfg
*cfg
)
13432 struct hda_input_mux
*imux
= &spec
->private_imux
;
13433 int i
, err
, idx
, idx1
;
13435 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
13436 switch (cfg
->input_pins
[i
]) {
13439 idx
= 2; /* Line In */
13443 idx
= 2; /* Line In */
13447 idx
= 1; /* Mic In */
13451 idx
= 1; /* Mic In */
13461 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
13462 auto_pin_cfg_labels
[i
], idx
, 0x15);
13466 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
13467 imux
->items
[imux
->num_items
].index
= idx1
;
13473 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
13475 int pin_type
, int dac_idx
)
13477 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
13479 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13483 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
13485 struct alc_spec
*spec
= codec
->spec
;
13488 alc_subsystem_id(codec
, 0x0e, 0x0f, 0x0b);
13489 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
13490 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13491 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13493 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
13494 spec
->multiout
.dac_nids
[i
]);
13498 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
13500 struct alc_spec
*spec
= codec
->spec
;
13503 pin
= spec
->autocfg
.hp_pins
[0];
13504 if (pin
) /* connect to front */
13505 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
13506 spec
->multiout
.dac_nids
[0]);
13507 pin
= spec
->autocfg
.speaker_pins
[0];
13509 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
13512 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
13514 struct alc_spec
*spec
= codec
->spec
;
13517 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
13518 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
13519 if (nid
>= 0x0c && nid
<= 0x11) {
13520 snd_hda_codec_write(codec
, nid
, 0,
13521 AC_VERB_SET_PIN_WIDGET_CONTROL
,
13522 i
<= AUTO_PIN_FRONT_MIC
?
13523 PIN_VREF80
: PIN_IN
);
13528 /* parse the BIOS configuration and set up the alc_spec */
13529 /* return 1 if successful, 0 if the proper config is not found,
13530 * or a negative error code
13532 static int alc861_parse_auto_config(struct hda_codec
*codec
)
13534 struct alc_spec
*spec
= codec
->spec
;
13536 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
13538 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13542 if (!spec
->autocfg
.line_outs
)
13543 return 0; /* can't find valid BIOS pin config */
13545 err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
);
13548 err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13551 err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0]);
13554 err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
13558 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
13560 if (spec
->autocfg
.dig_out_pin
)
13561 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
13563 if (spec
->kctls
.list
)
13564 add_mixer(spec
, spec
->kctls
.list
);
13566 add_verb(spec
, alc861_auto_init_verbs
);
13568 spec
->num_mux_defs
= 1;
13569 spec
->input_mux
= &spec
->private_imux
;
13571 spec
->adc_nids
= alc861_adc_nids
;
13572 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
13573 set_capture_mixer(spec
);
13575 store_pin_configs(codec
);
13579 /* additional initialization for auto-configuration model */
13580 static void alc861_auto_init(struct hda_codec
*codec
)
13582 struct alc_spec
*spec
= codec
->spec
;
13583 alc861_auto_init_multi_out(codec
);
13584 alc861_auto_init_hp_out(codec
);
13585 alc861_auto_init_analog_input(codec
);
13586 if (spec
->unsol_event
)
13587 alc_inithook(codec
);
13590 #ifdef CONFIG_SND_HDA_POWER_SAVE
13591 static struct hda_amp_list alc861_loopbacks
[] = {
13592 { 0x15, HDA_INPUT
, 0 },
13593 { 0x15, HDA_INPUT
, 1 },
13594 { 0x15, HDA_INPUT
, 2 },
13595 { 0x15, HDA_INPUT
, 3 },
13602 * configuration and preset
13604 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
13605 [ALC861_3ST
] = "3stack",
13606 [ALC660_3ST
] = "3stack-660",
13607 [ALC861_3ST_DIG
] = "3stack-dig",
13608 [ALC861_6ST_DIG
] = "6stack-dig",
13609 [ALC861_UNIWILL_M31
] = "uniwill-m31",
13610 [ALC861_TOSHIBA
] = "toshiba",
13611 [ALC861_ASUS
] = "asus",
13612 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
13613 [ALC861_AUTO
] = "auto",
13616 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
13617 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
13618 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
13619 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
13620 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
13621 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
13622 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
13623 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
13624 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13625 * Any other models that need this preset?
13627 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13628 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
13629 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
13630 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
13631 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
13632 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
13633 /* FIXME: the below seems conflict */
13634 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13635 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
13636 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
13640 static struct alc_config_preset alc861_presets
[] = {
13642 .mixers
= { alc861_3ST_mixer
},
13643 .init_verbs
= { alc861_threestack_init_verbs
},
13644 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13645 .dac_nids
= alc861_dac_nids
,
13646 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
13647 .channel_mode
= alc861_threestack_modes
,
13649 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13650 .adc_nids
= alc861_adc_nids
,
13651 .input_mux
= &alc861_capture_source
,
13653 [ALC861_3ST_DIG
] = {
13654 .mixers
= { alc861_base_mixer
},
13655 .init_verbs
= { alc861_threestack_init_verbs
},
13656 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13657 .dac_nids
= alc861_dac_nids
,
13658 .dig_out_nid
= ALC861_DIGOUT_NID
,
13659 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
13660 .channel_mode
= alc861_threestack_modes
,
13662 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13663 .adc_nids
= alc861_adc_nids
,
13664 .input_mux
= &alc861_capture_source
,
13666 [ALC861_6ST_DIG
] = {
13667 .mixers
= { alc861_base_mixer
},
13668 .init_verbs
= { alc861_base_init_verbs
},
13669 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13670 .dac_nids
= alc861_dac_nids
,
13671 .dig_out_nid
= ALC861_DIGOUT_NID
,
13672 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
13673 .channel_mode
= alc861_8ch_modes
,
13674 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13675 .adc_nids
= alc861_adc_nids
,
13676 .input_mux
= &alc861_capture_source
,
13679 .mixers
= { alc861_3ST_mixer
},
13680 .init_verbs
= { alc861_threestack_init_verbs
},
13681 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
13682 .dac_nids
= alc660_dac_nids
,
13683 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
13684 .channel_mode
= alc861_threestack_modes
,
13686 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13687 .adc_nids
= alc861_adc_nids
,
13688 .input_mux
= &alc861_capture_source
,
13690 [ALC861_UNIWILL_M31
] = {
13691 .mixers
= { alc861_uniwill_m31_mixer
},
13692 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
13693 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13694 .dac_nids
= alc861_dac_nids
,
13695 .dig_out_nid
= ALC861_DIGOUT_NID
,
13696 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
13697 .channel_mode
= alc861_uniwill_m31_modes
,
13699 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13700 .adc_nids
= alc861_adc_nids
,
13701 .input_mux
= &alc861_capture_source
,
13703 [ALC861_TOSHIBA
] = {
13704 .mixers
= { alc861_toshiba_mixer
},
13705 .init_verbs
= { alc861_base_init_verbs
,
13706 alc861_toshiba_init_verbs
},
13707 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13708 .dac_nids
= alc861_dac_nids
,
13709 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
13710 .channel_mode
= alc883_3ST_2ch_modes
,
13711 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13712 .adc_nids
= alc861_adc_nids
,
13713 .input_mux
= &alc861_capture_source
,
13714 .unsol_event
= alc861_toshiba_unsol_event
,
13715 .init_hook
= alc861_toshiba_automute
,
13718 .mixers
= { alc861_asus_mixer
},
13719 .init_verbs
= { alc861_asus_init_verbs
},
13720 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13721 .dac_nids
= alc861_dac_nids
,
13722 .dig_out_nid
= ALC861_DIGOUT_NID
,
13723 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
13724 .channel_mode
= alc861_asus_modes
,
13727 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13728 .adc_nids
= alc861_adc_nids
,
13729 .input_mux
= &alc861_capture_source
,
13731 [ALC861_ASUS_LAPTOP
] = {
13732 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
13733 .init_verbs
= { alc861_asus_init_verbs
,
13734 alc861_asus_laptop_init_verbs
},
13735 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13736 .dac_nids
= alc861_dac_nids
,
13737 .dig_out_nid
= ALC861_DIGOUT_NID
,
13738 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
13739 .channel_mode
= alc883_3ST_2ch_modes
,
13741 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13742 .adc_nids
= alc861_adc_nids
,
13743 .input_mux
= &alc861_capture_source
,
13748 static int patch_alc861(struct hda_codec
*codec
)
13750 struct alc_spec
*spec
;
13754 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13758 codec
->spec
= spec
;
13760 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
13764 if (board_config
< 0) {
13765 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
13766 "trying auto-probe from BIOS...\n");
13767 board_config
= ALC861_AUTO
;
13770 if (board_config
== ALC861_AUTO
) {
13771 /* automatic parse from the BIOS config */
13772 err
= alc861_parse_auto_config(codec
);
13778 "hda_codec: Cannot set up configuration "
13779 "from BIOS. Using base mode...\n");
13780 board_config
= ALC861_3ST_DIG
;
13784 if (board_config
!= ALC861_AUTO
)
13785 setup_preset(spec
, &alc861_presets
[board_config
]);
13787 spec
->stream_name_analog
= "ALC861 Analog";
13788 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
13789 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
13791 spec
->stream_name_digital
= "ALC861 Digital";
13792 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
13793 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
13795 spec
->vmaster_nid
= 0x03;
13797 codec
->patch_ops
= alc_patch_ops
;
13798 if (board_config
== ALC861_AUTO
)
13799 spec
->init_hook
= alc861_auto_init
;
13800 #ifdef CONFIG_SND_HDA_POWER_SAVE
13801 if (!spec
->loopback
.amplist
)
13802 spec
->loopback
.amplist
= alc861_loopbacks
;
13809 * ALC861-VD support
13813 * In addition, an independent DAC
13815 #define ALC861VD_DIGOUT_NID 0x06
13817 static hda_nid_t alc861vd_dac_nids
[4] = {
13818 /* front, surr, clfe, side surr */
13819 0x02, 0x03, 0x04, 0x05
13822 /* dac_nids for ALC660vd are in a different order - according to
13823 * Realtek's driver.
13824 * This should probably tesult in a different mixer for 6stack models
13825 * of ALC660vd codecs, but for now there is only 3stack mixer
13826 * - and it is the same as in 861vd.
13827 * adc_nids in ALC660vd are (is) the same as in 861vd
13829 static hda_nid_t alc660vd_dac_nids
[3] = {
13830 /* front, rear, clfe, rear_surr */
13834 static hda_nid_t alc861vd_adc_nids
[1] = {
13839 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
13842 /* FIXME: should be a matrix-type input source selection */
13843 static struct hda_input_mux alc861vd_capture_source
= {
13847 { "Front Mic", 0x1 },
13853 static struct hda_input_mux alc861vd_dallas_capture_source
= {
13856 { "Ext Mic", 0x0 },
13857 { "Int Mic", 0x1 },
13861 static struct hda_input_mux alc861vd_hp_capture_source
= {
13864 { "Front Mic", 0x0 },
13865 { "ATAPI Mic", 0x1 },
13872 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
13879 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
13880 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13881 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13882 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13883 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13890 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
13891 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13892 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13893 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13894 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13898 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
13899 { 6, alc861vd_6stack_ch6_init
},
13900 { 8, alc861vd_6stack_ch8_init
},
13903 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
13905 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13906 .name
= "Channel Mode",
13907 .info
= alc_ch_mode_info
,
13908 .get
= alc_ch_mode_get
,
13909 .put
= alc_ch_mode_put
,
13914 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13915 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13917 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
13918 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13919 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
13921 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13922 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
13924 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13926 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13928 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
13929 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
13931 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
13932 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
13934 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13936 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13940 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
13941 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13942 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13944 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13945 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13947 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13948 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13950 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13951 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13956 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
13957 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13958 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
13960 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13962 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13963 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13964 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13966 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
13967 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13968 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13970 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13971 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13973 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13974 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13976 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13977 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13982 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
13983 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13984 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
13985 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13989 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13991 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13993 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
13994 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13997 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13998 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14003 /* Pin assignment: Speaker=0x14, HP = 0x15,
14004 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14006 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
14007 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14008 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
14009 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14010 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
14011 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
14012 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14013 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14014 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
14015 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14016 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14017 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT
),
14018 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT
),
14022 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14023 * Front Mic=0x18, ATAPI Mic = 0x19,
14025 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
14026 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14027 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
14028 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14029 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
14030 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14031 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14032 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14033 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14039 * generic initialization of ADC, input mixers and output mixers
14041 static struct hda_verb alc861vd_volume_init_verbs
[] = {
14043 * Unmute ADC0 and set the default input to mic-in
14045 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
14046 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14048 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14049 * the analog-loopback mixer widget
14051 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14052 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14053 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14054 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
14055 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
14056 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
14058 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14059 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14060 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14061 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
14065 * Set up output mixers (0x02 - 0x05)
14067 /* set vol=0 to output mixers */
14068 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14069 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14070 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14071 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14073 /* set up input amps for analog loopback */
14074 /* Amp Indices: DAC = 0, mixer = 1 */
14075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14077 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14078 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14079 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14088 * 3-stack pin configuration:
14089 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14091 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
14093 * Set pin mode and muting
14095 /* set front pin widgets 0x14 for output */
14096 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14097 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14098 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
14100 /* Mic (rear) pin: input vref at 80% */
14101 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14102 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14103 /* Front Mic pin: input vref at 80% */
14104 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14105 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14106 /* Line In pin: input */
14107 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14108 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14109 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14110 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14111 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14112 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
14113 /* CD pin widget for input */
14114 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14120 * 6-stack pin configuration:
14122 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
14124 * Set pin mode and muting
14126 /* set front pin widgets 0x14 for output */
14127 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14128 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14129 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
14131 /* Rear Pin: output 1 (0x0d) */
14132 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14133 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14134 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14135 /* CLFE Pin: output 2 (0x0e) */
14136 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14137 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14138 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
14139 /* Side Pin: output 3 (0x0f) */
14140 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14141 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14142 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
14144 /* Mic (rear) pin: input vref at 80% */
14145 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14146 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14147 /* Front Mic pin: input vref at 80% */
14148 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14149 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14150 /* Line In pin: input */
14151 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14152 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14153 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14154 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14155 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14156 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
14157 /* CD pin widget for input */
14158 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14163 static struct hda_verb alc861vd_eapd_verbs
[] = {
14164 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14168 static struct hda_verb alc660vd_eapd_verbs
[] = {
14169 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14170 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14174 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
14175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14177 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
14178 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14183 /* toggle speaker-output according to the hp-jack state */
14184 static void alc861vd_lenovo_hp_automute(struct hda_codec
*codec
)
14186 unsigned int present
;
14187 unsigned char bits
;
14189 present
= snd_hda_codec_read(codec
, 0x1b, 0,
14190 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14191 bits
= present
? HDA_AMP_MUTE
: 0;
14192 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14193 HDA_AMP_MUTE
, bits
);
14196 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
14198 unsigned int present
;
14199 unsigned char bits
;
14201 present
= snd_hda_codec_read(codec
, 0x18, 0,
14202 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14203 bits
= present
? HDA_AMP_MUTE
: 0;
14204 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
14205 HDA_AMP_MUTE
, bits
);
14208 static void alc861vd_lenovo_automute(struct hda_codec
*codec
)
14210 alc861vd_lenovo_hp_automute(codec
);
14211 alc861vd_lenovo_mic_automute(codec
);
14214 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
14217 switch (res
>> 26) {
14218 case ALC880_HP_EVENT
:
14219 alc861vd_lenovo_hp_automute(codec
);
14221 case ALC880_MIC_EVENT
:
14222 alc861vd_lenovo_mic_automute(codec
);
14227 static struct hda_verb alc861vd_dallas_verbs
[] = {
14228 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14229 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14230 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14231 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14233 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14235 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14236 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14237 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14238 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14239 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14240 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14242 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14243 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14244 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14245 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14246 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14247 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14248 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14249 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14251 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
14252 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14253 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
14254 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14255 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14256 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14257 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14258 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14261 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
14262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
14263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
14265 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14266 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
14267 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14272 /* toggle speaker-output according to the hp-jack state */
14273 static void alc861vd_dallas_automute(struct hda_codec
*codec
)
14275 unsigned int present
;
14277 present
= snd_hda_codec_read(codec
, 0x15, 0,
14278 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14279 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14280 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
14283 static void alc861vd_dallas_unsol_event(struct hda_codec
*codec
, unsigned int res
)
14285 if ((res
>> 26) == ALC880_HP_EVENT
)
14286 alc861vd_dallas_automute(codec
);
14289 #ifdef CONFIG_SND_HDA_POWER_SAVE
14290 #define alc861vd_loopbacks alc880_loopbacks
14293 /* pcm configuration: identiacal with ALC880 */
14294 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14295 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14296 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14297 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14300 * configuration and preset
14302 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
14303 [ALC660VD_3ST
] = "3stack-660",
14304 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
14305 [ALC660VD_ASUS_V1S
] = "asus-v1s",
14306 [ALC861VD_3ST
] = "3stack",
14307 [ALC861VD_3ST_DIG
] = "3stack-digout",
14308 [ALC861VD_6ST_DIG
] = "6stack-digout",
14309 [ALC861VD_LENOVO
] = "lenovo",
14310 [ALC861VD_DALLAS
] = "dallas",
14311 [ALC861VD_HP
] = "hp",
14312 [ALC861VD_AUTO
] = "auto",
14315 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
14316 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
14317 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
14318 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
14319 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST
),
14320 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S
),
14321 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
14322 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
14323 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
14324 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14325 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS
),
14326 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
14327 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
14328 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
14329 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO
),
14330 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO
),
14331 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO
),
14332 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
14336 static struct alc_config_preset alc861vd_presets
[] = {
14338 .mixers
= { alc861vd_3st_mixer
},
14339 .init_verbs
= { alc861vd_volume_init_verbs
,
14340 alc861vd_3stack_init_verbs
},
14341 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
14342 .dac_nids
= alc660vd_dac_nids
,
14343 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14344 .channel_mode
= alc861vd_3stack_2ch_modes
,
14345 .input_mux
= &alc861vd_capture_source
,
14347 [ALC660VD_3ST_DIG
] = {
14348 .mixers
= { alc861vd_3st_mixer
},
14349 .init_verbs
= { alc861vd_volume_init_verbs
,
14350 alc861vd_3stack_init_verbs
},
14351 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
14352 .dac_nids
= alc660vd_dac_nids
,
14353 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
14354 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14355 .channel_mode
= alc861vd_3stack_2ch_modes
,
14356 .input_mux
= &alc861vd_capture_source
,
14359 .mixers
= { alc861vd_3st_mixer
},
14360 .init_verbs
= { alc861vd_volume_init_verbs
,
14361 alc861vd_3stack_init_verbs
},
14362 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
14363 .dac_nids
= alc861vd_dac_nids
,
14364 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14365 .channel_mode
= alc861vd_3stack_2ch_modes
,
14366 .input_mux
= &alc861vd_capture_source
,
14368 [ALC861VD_3ST_DIG
] = {
14369 .mixers
= { alc861vd_3st_mixer
},
14370 .init_verbs
= { alc861vd_volume_init_verbs
,
14371 alc861vd_3stack_init_verbs
},
14372 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
14373 .dac_nids
= alc861vd_dac_nids
,
14374 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
14375 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14376 .channel_mode
= alc861vd_3stack_2ch_modes
,
14377 .input_mux
= &alc861vd_capture_source
,
14379 [ALC861VD_6ST_DIG
] = {
14380 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
14381 .init_verbs
= { alc861vd_volume_init_verbs
,
14382 alc861vd_6stack_init_verbs
},
14383 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
14384 .dac_nids
= alc861vd_dac_nids
,
14385 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
14386 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
14387 .channel_mode
= alc861vd_6stack_modes
,
14388 .input_mux
= &alc861vd_capture_source
,
14390 [ALC861VD_LENOVO
] = {
14391 .mixers
= { alc861vd_lenovo_mixer
},
14392 .init_verbs
= { alc861vd_volume_init_verbs
,
14393 alc861vd_3stack_init_verbs
,
14394 alc861vd_eapd_verbs
,
14395 alc861vd_lenovo_unsol_verbs
},
14396 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
14397 .dac_nids
= alc660vd_dac_nids
,
14398 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14399 .channel_mode
= alc861vd_3stack_2ch_modes
,
14400 .input_mux
= &alc861vd_capture_source
,
14401 .unsol_event
= alc861vd_lenovo_unsol_event
,
14402 .init_hook
= alc861vd_lenovo_automute
,
14404 [ALC861VD_DALLAS
] = {
14405 .mixers
= { alc861vd_dallas_mixer
},
14406 .init_verbs
= { alc861vd_dallas_verbs
},
14407 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
14408 .dac_nids
= alc861vd_dac_nids
,
14409 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14410 .channel_mode
= alc861vd_3stack_2ch_modes
,
14411 .input_mux
= &alc861vd_dallas_capture_source
,
14412 .unsol_event
= alc861vd_dallas_unsol_event
,
14413 .init_hook
= alc861vd_dallas_automute
,
14416 .mixers
= { alc861vd_hp_mixer
},
14417 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
14418 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
14419 .dac_nids
= alc861vd_dac_nids
,
14420 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
14421 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14422 .channel_mode
= alc861vd_3stack_2ch_modes
,
14423 .input_mux
= &alc861vd_hp_capture_source
,
14424 .unsol_event
= alc861vd_dallas_unsol_event
,
14425 .init_hook
= alc861vd_dallas_automute
,
14427 [ALC660VD_ASUS_V1S
] = {
14428 .mixers
= { alc861vd_lenovo_mixer
},
14429 .init_verbs
= { alc861vd_volume_init_verbs
,
14430 alc861vd_3stack_init_verbs
,
14431 alc861vd_eapd_verbs
,
14432 alc861vd_lenovo_unsol_verbs
},
14433 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
14434 .dac_nids
= alc660vd_dac_nids
,
14435 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
14436 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14437 .channel_mode
= alc861vd_3stack_2ch_modes
,
14438 .input_mux
= &alc861vd_capture_source
,
14439 .unsol_event
= alc861vd_lenovo_unsol_event
,
14440 .init_hook
= alc861vd_lenovo_automute
,
14445 * BIOS auto configuration
14447 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
14448 hda_nid_t nid
, int pin_type
, int dac_idx
)
14450 alc_set_pin_output(codec
, nid
, pin_type
);
14453 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
14455 struct alc_spec
*spec
= codec
->spec
;
14458 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
14459 for (i
= 0; i
<= HDA_SIDE
; i
++) {
14460 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
14461 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
14463 alc861vd_auto_set_output_and_unmute(codec
, nid
,
14469 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
14471 struct alc_spec
*spec
= codec
->spec
;
14474 pin
= spec
->autocfg
.hp_pins
[0];
14475 if (pin
) /* connect to front and use dac 0 */
14476 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
14477 pin
= spec
->autocfg
.speaker_pins
[0];
14479 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
14482 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14483 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14485 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
14487 struct alc_spec
*spec
= codec
->spec
;
14490 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14491 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
14492 if (alc861vd_is_input_pin(nid
)) {
14493 snd_hda_codec_write(codec
, nid
, 0,
14494 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14495 i
<= AUTO_PIN_FRONT_MIC
?
14496 PIN_VREF80
: PIN_IN
);
14497 if (nid
!= ALC861VD_PIN_CD_NID
)
14498 snd_hda_codec_write(codec
, nid
, 0,
14499 AC_VERB_SET_AMP_GAIN_MUTE
,
14505 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14507 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14508 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14510 /* add playback controls from the parsed DAC table */
14511 /* Based on ALC880 version. But ALC861VD has separate,
14512 * different NIDs for mute/unmute switch and volume control */
14513 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
14514 const struct auto_pin_cfg
*cfg
)
14517 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
14518 hda_nid_t nid_v
, nid_s
;
14521 for (i
= 0; i
< cfg
->line_outs
; i
++) {
14522 if (!spec
->multiout
.dac_nids
[i
])
14524 nid_v
= alc861vd_idx_to_mixer_vol(
14526 spec
->multiout
.dac_nids
[i
]));
14527 nid_s
= alc861vd_idx_to_mixer_switch(
14529 spec
->multiout
.dac_nids
[i
]));
14533 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
14534 "Center Playback Volume",
14535 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
14539 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
14540 "LFE Playback Volume",
14541 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
14545 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14546 "Center Playback Switch",
14547 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
14551 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14552 "LFE Playback Switch",
14553 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
14558 sprintf(name
, "%s Playback Volume", chname
[i
]);
14559 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
14560 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
14564 sprintf(name
, "%s Playback Switch", chname
[i
]);
14565 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14566 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
14575 /* add playback controls for speaker and HP outputs */
14576 /* Based on ALC880 version. But ALC861VD has separate,
14577 * different NIDs for mute/unmute switch and volume control */
14578 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
14579 hda_nid_t pin
, const char *pfx
)
14581 hda_nid_t nid_v
, nid_s
;
14588 if (alc880_is_fixed_pin(pin
)) {
14589 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
14590 /* specify the DAC as the extra output */
14591 if (!spec
->multiout
.hp_nid
)
14592 spec
->multiout
.hp_nid
= nid_v
;
14594 spec
->multiout
.extra_out_nid
[0] = nid_v
;
14595 /* control HP volume/switch on the output mixer amp */
14596 nid_v
= alc861vd_idx_to_mixer_vol(
14597 alc880_fixed_pin_idx(pin
));
14598 nid_s
= alc861vd_idx_to_mixer_switch(
14599 alc880_fixed_pin_idx(pin
));
14601 sprintf(name
, "%s Playback Volume", pfx
);
14602 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
14603 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
14606 sprintf(name
, "%s Playback Switch", pfx
);
14607 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14608 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
14611 } else if (alc880_is_multi_pin(pin
)) {
14612 /* set manual connection */
14613 /* we have only a switch on HP-out PIN */
14614 sprintf(name
, "%s Playback Switch", pfx
);
14615 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
14616 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
14623 /* parse the BIOS configuration and set up the alc_spec
14624 * return 1 if successful, 0 if the proper config is not found,
14625 * or a negative error code
14626 * Based on ALC880 version - had to change it to override
14627 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14628 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
14630 struct alc_spec
*spec
= codec
->spec
;
14632 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
14634 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14638 if (!spec
->autocfg
.line_outs
)
14639 return 0; /* can't find valid BIOS pin config */
14641 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
14644 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14647 err
= alc861vd_auto_create_extra_out(spec
,
14648 spec
->autocfg
.speaker_pins
[0],
14652 err
= alc861vd_auto_create_extra_out(spec
,
14653 spec
->autocfg
.hp_pins
[0],
14657 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
14661 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14663 if (spec
->autocfg
.dig_out_pin
)
14664 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
14666 if (spec
->kctls
.list
)
14667 add_mixer(spec
, spec
->kctls
.list
);
14669 add_verb(spec
, alc861vd_volume_init_verbs
);
14671 spec
->num_mux_defs
= 1;
14672 spec
->input_mux
= &spec
->private_imux
;
14674 err
= alc_auto_add_mic_boost(codec
);
14678 store_pin_configs(codec
);
14682 /* additional initialization for auto-configuration model */
14683 static void alc861vd_auto_init(struct hda_codec
*codec
)
14685 struct alc_spec
*spec
= codec
->spec
;
14686 alc861vd_auto_init_multi_out(codec
);
14687 alc861vd_auto_init_hp_out(codec
);
14688 alc861vd_auto_init_analog_input(codec
);
14689 alc861vd_auto_init_input_src(codec
);
14690 if (spec
->unsol_event
)
14691 alc_inithook(codec
);
14694 static int patch_alc861vd(struct hda_codec
*codec
)
14696 struct alc_spec
*spec
;
14697 int err
, board_config
;
14699 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14703 codec
->spec
= spec
;
14705 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
14709 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
14710 printk(KERN_INFO
"hda_codec: Unknown model for ALC660VD/"
14711 "ALC861VD, trying auto-probe from BIOS...\n");
14712 board_config
= ALC861VD_AUTO
;
14715 if (board_config
== ALC861VD_AUTO
) {
14716 /* automatic parse from the BIOS config */
14717 err
= alc861vd_parse_auto_config(codec
);
14723 "hda_codec: Cannot set up configuration "
14724 "from BIOS. Using base mode...\n");
14725 board_config
= ALC861VD_3ST
;
14729 if (board_config
!= ALC861VD_AUTO
)
14730 setup_preset(spec
, &alc861vd_presets
[board_config
]);
14732 if (codec
->vendor_id
== 0x10ec0660) {
14733 spec
->stream_name_analog
= "ALC660-VD Analog";
14734 spec
->stream_name_digital
= "ALC660-VD Digital";
14735 /* always turn on EAPD */
14736 add_verb(spec
, alc660vd_eapd_verbs
);
14738 spec
->stream_name_analog
= "ALC861VD Analog";
14739 spec
->stream_name_digital
= "ALC861VD Digital";
14742 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
14743 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
14745 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
14746 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
14748 spec
->adc_nids
= alc861vd_adc_nids
;
14749 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
14750 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
14751 spec
->is_mix_capture
= 1;
14753 set_capture_mixer(spec
);
14755 spec
->vmaster_nid
= 0x02;
14757 codec
->patch_ops
= alc_patch_ops
;
14759 if (board_config
== ALC861VD_AUTO
)
14760 spec
->init_hook
= alc861vd_auto_init
;
14761 #ifdef CONFIG_SND_HDA_POWER_SAVE
14762 if (!spec
->loopback
.amplist
)
14763 spec
->loopback
.amplist
= alc861vd_loopbacks
;
14772 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14773 * configuration. Each pin widget can choose any input DACs and a mixer.
14774 * Each ADC is connected from a mixer of all inputs. This makes possible
14775 * 6-channel independent captures.
14777 * In addition, an independent DAC for the multi-playback (not used in this
14780 #define ALC662_DIGOUT_NID 0x06
14781 #define ALC662_DIGIN_NID 0x0a
14783 static hda_nid_t alc662_dac_nids
[4] = {
14784 /* front, rear, clfe, rear_surr */
14788 static hda_nid_t alc662_adc_nids
[1] = {
14793 static hda_nid_t alc662_capsrc_nids
[1] = { 0x22 };
14796 /* FIXME: should be a matrix-type input source selection */
14797 static struct hda_input_mux alc662_capture_source
= {
14801 { "Front Mic", 0x1 },
14807 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
14815 static struct hda_input_mux alc662_eeepc_capture_source
= {
14823 static struct hda_input_mux alc663_capture_source
= {
14827 { "Front Mic", 0x1 },
14832 static struct hda_input_mux alc663_m51va_capture_source
= {
14835 { "Ext-Mic", 0x0 },
14843 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
14850 static struct hda_verb alc662_3ST_ch2_init
[] = {
14851 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14852 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14853 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14854 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14861 static struct hda_verb alc662_3ST_ch6_init
[] = {
14862 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14863 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14864 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
14865 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14866 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14867 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
14871 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
14872 { 2, alc662_3ST_ch2_init
},
14873 { 6, alc662_3ST_ch6_init
},
14879 static struct hda_verb alc662_sixstack_ch6_init
[] = {
14880 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14881 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14882 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14889 static struct hda_verb alc662_sixstack_ch8_init
[] = {
14890 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14891 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14892 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14896 static struct hda_channel_mode alc662_5stack_modes
[2] = {
14897 { 2, alc662_sixstack_ch6_init
},
14898 { 6, alc662_sixstack_ch8_init
},
14901 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14902 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14905 static struct snd_kcontrol_new alc662_base_mixer
[] = {
14906 /* output mixer control */
14907 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
14908 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
14909 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
14910 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
14911 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
14912 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
14913 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
14914 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
14915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14917 /*Input mixer control */
14918 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
14919 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
14920 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
14921 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
14922 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
14923 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
14924 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
14925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
14929 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
14930 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14931 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
14932 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14933 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
14934 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14935 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14936 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14939 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14940 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14941 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
14942 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
14946 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
14947 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14948 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
14949 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14950 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
14951 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
14952 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
14953 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
14954 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
14955 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14956 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
14957 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14958 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14959 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14960 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14961 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14962 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14963 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14964 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
14965 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
14969 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
14970 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14971 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
14972 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14973 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
14974 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14975 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14976 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14977 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14978 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14982 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
14983 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14985 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14986 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14988 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
14989 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14990 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14992 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
14993 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14994 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14998 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
14999 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15000 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
15001 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15002 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT
),
15003 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
15004 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
15005 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
15006 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
15007 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15008 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
15009 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15010 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15016 static struct hda_bind_ctls alc663_asus_bind_master_vol
= {
15017 .ops
= &snd_hda_bind_vol
,
15019 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
15020 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
15025 static struct hda_bind_ctls alc663_asus_one_bind_switch
= {
15026 .ops
= &snd_hda_bind_sw
,
15028 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15029 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
15034 static struct snd_kcontrol_new alc663_m51va_mixer
[] = {
15035 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15036 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch
),
15037 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15038 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15042 static struct hda_bind_ctls alc663_asus_tree_bind_switch
= {
15043 .ops
= &snd_hda_bind_sw
,
15045 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15046 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
15047 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
15052 static struct snd_kcontrol_new alc663_two_hp_m1_mixer
[] = {
15053 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15054 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch
),
15055 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15056 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15057 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15058 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15063 static struct hda_bind_ctls alc663_asus_four_bind_switch
= {
15064 .ops
= &snd_hda_bind_sw
,
15066 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15067 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
15068 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
15073 static struct snd_kcontrol_new alc663_two_hp_m2_mixer
[] = {
15074 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15075 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch
),
15076 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15077 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15078 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15079 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15083 static struct snd_kcontrol_new alc662_1bjd_mixer
[] = {
15084 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15085 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
15086 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15087 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15088 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15089 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15090 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15094 static struct hda_bind_ctls alc663_asus_two_bind_master_vol
= {
15095 .ops
= &snd_hda_bind_vol
,
15097 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
15098 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT
),
15103 static struct hda_bind_ctls alc663_asus_two_bind_switch
= {
15104 .ops
= &snd_hda_bind_sw
,
15106 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15107 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT
),
15112 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer
[] = {
15113 HDA_BIND_VOL("Master Playback Volume",
15114 &alc663_asus_two_bind_master_vol
),
15115 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
15116 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
15118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15123 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer
[] = {
15124 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15125 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
15126 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15127 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15133 static struct snd_kcontrol_new alc663_g71v_mixer
[] = {
15134 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15135 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
15136 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15137 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15138 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
15140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15141 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15142 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15143 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15147 static struct snd_kcontrol_new alc663_g50v_mixer
[] = {
15148 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15149 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
15150 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
15152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15153 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15154 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15155 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15156 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15157 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15161 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
15163 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15164 .name
= "Channel Mode",
15165 .info
= alc_ch_mode_info
,
15166 .get
= alc_ch_mode_get
,
15167 .put
= alc_ch_mode_put
,
15172 static struct hda_verb alc662_init_verbs
[] = {
15173 /* ADC: mute amp left and right */
15174 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15175 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
15176 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15178 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
15184 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15186 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15187 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15188 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15189 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15191 /* Front Pin: output 0 (0x0c) */
15192 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15193 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15195 /* Rear Pin: output 1 (0x0d) */
15196 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15197 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15199 /* CLFE Pin: output 2 (0x0e) */
15200 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15201 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15203 /* Mic (rear) pin: input vref at 80% */
15204 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
15205 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15206 /* Front Mic pin: input vref at 80% */
15207 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
15208 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15209 /* Line In pin: input */
15210 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15211 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15212 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15213 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15214 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15215 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
15216 /* CD pin widget for input */
15217 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15219 /* FIXME: use matrix-type input source selection */
15220 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15222 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15223 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15225 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
15227 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15228 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15229 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15230 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
15232 /* always trun on EAPD */
15233 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
15234 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
15239 static struct hda_verb alc662_sue_init_verbs
[] = {
15240 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
15241 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
15245 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
15246 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15247 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15251 /* Set Unsolicited Event*/
15252 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
15253 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15254 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15259 * generic initialization of ADC, input mixers and output mixers
15261 static struct hda_verb alc662_auto_init_verbs
[] = {
15263 * Unmute ADC and set the default input to mic-in
15265 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
15266 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15268 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15270 * Note: PASD motherboards uses the Line In 2 as the input for front
15271 * panel mic (mic 2)
15273 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15274 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15275 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15276 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15277 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15278 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
15281 * Set up output mixers (0x0c - 0x0f)
15283 /* set vol=0 to output mixers */
15284 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15285 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15286 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15288 /* set up input amps for analog loopback */
15289 /* Amp Indices: DAC = 0, mixer = 1 */
15290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15292 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15293 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15294 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15298 /* FIXME: use matrix-type input source selection */
15299 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15302 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15306 /* additional verbs for ALC663 */
15307 static struct hda_verb alc663_auto_init_verbs
[] = {
15308 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15309 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15313 static struct hda_verb alc663_m51va_init_verbs
[] = {
15314 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15315 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15316 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15317 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15318 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
15319 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15320 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
15321 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15322 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15326 static struct hda_verb alc663_21jd_amic_init_verbs
[] = {
15327 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15328 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15329 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
15330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15332 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15333 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15337 static struct hda_verb alc662_1bjd_amic_init_verbs
[] = {
15338 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15339 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15340 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15341 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
15342 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15344 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15345 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15349 static struct hda_verb alc663_15jd_amic_init_verbs
[] = {
15350 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15352 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
15353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15355 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15356 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15360 static struct hda_verb alc663_two_hp_amic_m1_init_verbs
[] = {
15361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15362 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15363 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15364 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
15365 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15367 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
15368 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15370 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15371 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15372 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15376 static struct hda_verb alc663_two_hp_amic_m2_init_verbs
[] = {
15377 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15378 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15379 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15380 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
15381 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15382 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15383 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
15384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15386 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15387 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15388 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15392 static struct hda_verb alc663_g71v_init_verbs
[] = {
15393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15394 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15395 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15397 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15398 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15399 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
15401 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
15402 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
15403 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
15407 static struct hda_verb alc663_g50v_init_verbs
[] = {
15408 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15409 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15410 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
15412 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15413 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15417 static struct hda_verb alc662_ecs_init_verbs
[] = {
15418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
15419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15420 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15421 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15425 static struct snd_kcontrol_new alc662_auto_capture_mixer
[] = {
15426 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
15427 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
15431 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
15433 unsigned int present
;
15434 unsigned char bits
;
15436 present
= snd_hda_codec_read(codec
, 0x14, 0,
15437 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
15438 bits
= present
? HDA_AMP_MUTE
: 0;
15439 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
15440 HDA_AMP_MUTE
, bits
);
15443 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
15445 unsigned int present
;
15446 unsigned char bits
;
15448 present
= snd_hda_codec_read(codec
, 0x1b, 0,
15449 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
15450 bits
= present
? HDA_AMP_MUTE
: 0;
15451 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
15452 HDA_AMP_MUTE
, bits
);
15453 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
15454 HDA_AMP_MUTE
, bits
);
15457 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
15460 if ((res
>> 26) == ALC880_HP_EVENT
)
15461 alc662_lenovo_101e_all_automute(codec
);
15462 if ((res
>> 26) == ALC880_FRONT_EVENT
)
15463 alc662_lenovo_101e_ispeaker_automute(codec
);
15466 static void alc662_eeepc_mic_automute(struct hda_codec
*codec
)
15468 unsigned int present
;
15470 present
= snd_hda_codec_read(codec
, 0x18, 0,
15471 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
15472 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15473 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
15474 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15475 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
15476 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15477 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
15478 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15479 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
15482 /* unsolicited event for HP jack sensing */
15483 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
15486 if ((res
>> 26) == ALC880_HP_EVENT
)
15487 alc262_hippo1_automute( codec
);
15489 if ((res
>> 26) == ALC880_MIC_EVENT
)
15490 alc662_eeepc_mic_automute(codec
);
15493 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
15495 alc262_hippo1_automute( codec
);
15496 alc662_eeepc_mic_automute(codec
);
15499 static void alc662_eeepc_ep20_automute(struct hda_codec
*codec
)
15502 unsigned int present
;
15504 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
15505 present
= snd_hda_codec_read(codec
, 0x14, 0,
15506 AC_VERB_GET_PIN_SENSE
, 0);
15507 present
= (present
& 0x80000000) != 0;
15509 /* mute internal speaker */
15510 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
15511 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
15513 /* unmute internal speaker if necessary */
15514 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
15515 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
15516 HDA_AMP_MUTE
, mute
);
15520 /* unsolicited event for HP jack sensing */
15521 static void alc662_eeepc_ep20_unsol_event(struct hda_codec
*codec
,
15524 if ((res
>> 26) == ALC880_HP_EVENT
)
15525 alc662_eeepc_ep20_automute(codec
);
15528 static void alc662_eeepc_ep20_inithook(struct hda_codec
*codec
)
15530 alc662_eeepc_ep20_automute(codec
);
15533 static void alc663_m51va_speaker_automute(struct hda_codec
*codec
)
15535 unsigned int present
;
15536 unsigned char bits
;
15538 present
= snd_hda_codec_read(codec
, 0x21, 0,
15539 AC_VERB_GET_PIN_SENSE
, 0)
15540 & AC_PINSENSE_PRESENCE
;
15541 bits
= present
? HDA_AMP_MUTE
: 0;
15542 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
15543 AMP_IN_MUTE(0), bits
);
15544 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
15545 AMP_IN_MUTE(0), bits
);
15548 static void alc663_21jd_two_speaker_automute(struct hda_codec
*codec
)
15550 unsigned int present
;
15551 unsigned char bits
;
15553 present
= snd_hda_codec_read(codec
, 0x21, 0,
15554 AC_VERB_GET_PIN_SENSE
, 0)
15555 & AC_PINSENSE_PRESENCE
;
15556 bits
= present
? HDA_AMP_MUTE
: 0;
15557 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
15558 AMP_IN_MUTE(0), bits
);
15559 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
15560 AMP_IN_MUTE(0), bits
);
15561 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
15562 AMP_IN_MUTE(0), bits
);
15563 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
15564 AMP_IN_MUTE(0), bits
);
15567 static void alc663_15jd_two_speaker_automute(struct hda_codec
*codec
)
15569 unsigned int present
;
15570 unsigned char bits
;
15572 present
= snd_hda_codec_read(codec
, 0x15, 0,
15573 AC_VERB_GET_PIN_SENSE
, 0)
15574 & AC_PINSENSE_PRESENCE
;
15575 bits
= present
? HDA_AMP_MUTE
: 0;
15576 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
15577 AMP_IN_MUTE(0), bits
);
15578 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
15579 AMP_IN_MUTE(0), bits
);
15580 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
15581 AMP_IN_MUTE(0), bits
);
15582 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
15583 AMP_IN_MUTE(0), bits
);
15586 static void alc662_f5z_speaker_automute(struct hda_codec
*codec
)
15588 unsigned int present
;
15589 unsigned char bits
;
15591 present
= snd_hda_codec_read(codec
, 0x1b, 0,
15592 AC_VERB_GET_PIN_SENSE
, 0)
15593 & AC_PINSENSE_PRESENCE
;
15594 bits
= present
? 0 : PIN_OUT
;
15595 snd_hda_codec_write(codec
, 0x14, 0,
15596 AC_VERB_SET_PIN_WIDGET_CONTROL
, bits
);
15599 static void alc663_two_hp_m1_speaker_automute(struct hda_codec
*codec
)
15601 unsigned int present1
, present2
;
15603 present1
= snd_hda_codec_read(codec
, 0x21, 0,
15604 AC_VERB_GET_PIN_SENSE
, 0)
15605 & AC_PINSENSE_PRESENCE
;
15606 present2
= snd_hda_codec_read(codec
, 0x15, 0,
15607 AC_VERB_GET_PIN_SENSE
, 0)
15608 & AC_PINSENSE_PRESENCE
;
15610 if (present1
|| present2
) {
15611 snd_hda_codec_write_cache(codec
, 0x14, 0,
15612 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
15614 snd_hda_codec_write_cache(codec
, 0x14, 0,
15615 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
15619 static void alc663_two_hp_m2_speaker_automute(struct hda_codec
*codec
)
15621 unsigned int present1
, present2
;
15623 present1
= snd_hda_codec_read(codec
, 0x1b, 0,
15624 AC_VERB_GET_PIN_SENSE
, 0)
15625 & AC_PINSENSE_PRESENCE
;
15626 present2
= snd_hda_codec_read(codec
, 0x15, 0,
15627 AC_VERB_GET_PIN_SENSE
, 0)
15628 & AC_PINSENSE_PRESENCE
;
15630 if (present1
|| present2
) {
15631 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
15632 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15633 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
15634 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15636 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
15637 AMP_IN_MUTE(0), 0);
15638 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
15639 AMP_IN_MUTE(0), 0);
15643 static void alc663_m51va_mic_automute(struct hda_codec
*codec
)
15645 unsigned int present
;
15647 present
= snd_hda_codec_read(codec
, 0x18, 0,
15648 AC_VERB_GET_PIN_SENSE
, 0)
15649 & AC_PINSENSE_PRESENCE
;
15650 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15651 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
15652 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15653 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
15654 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15655 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
15656 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15657 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
15660 static void alc663_m51va_unsol_event(struct hda_codec
*codec
,
15663 switch (res
>> 26) {
15664 case ALC880_HP_EVENT
:
15665 alc663_m51va_speaker_automute(codec
);
15667 case ALC880_MIC_EVENT
:
15668 alc663_m51va_mic_automute(codec
);
15673 static void alc663_m51va_inithook(struct hda_codec
*codec
)
15675 alc663_m51va_speaker_automute(codec
);
15676 alc663_m51va_mic_automute(codec
);
15679 /* ***************** Mode1 ******************************/
15680 static void alc663_mode1_unsol_event(struct hda_codec
*codec
,
15683 switch (res
>> 26) {
15684 case ALC880_HP_EVENT
:
15685 alc663_m51va_speaker_automute(codec
);
15687 case ALC880_MIC_EVENT
:
15688 alc662_eeepc_mic_automute(codec
);
15693 static void alc663_mode1_inithook(struct hda_codec
*codec
)
15695 alc663_m51va_speaker_automute(codec
);
15696 alc662_eeepc_mic_automute(codec
);
15698 /* ***************** Mode2 ******************************/
15699 static void alc662_mode2_unsol_event(struct hda_codec
*codec
,
15702 switch (res
>> 26) {
15703 case ALC880_HP_EVENT
:
15704 alc662_f5z_speaker_automute(codec
);
15706 case ALC880_MIC_EVENT
:
15707 alc662_eeepc_mic_automute(codec
);
15712 static void alc662_mode2_inithook(struct hda_codec
*codec
)
15714 alc662_f5z_speaker_automute(codec
);
15715 alc662_eeepc_mic_automute(codec
);
15717 /* ***************** Mode3 ******************************/
15718 static void alc663_mode3_unsol_event(struct hda_codec
*codec
,
15721 switch (res
>> 26) {
15722 case ALC880_HP_EVENT
:
15723 alc663_two_hp_m1_speaker_automute(codec
);
15725 case ALC880_MIC_EVENT
:
15726 alc662_eeepc_mic_automute(codec
);
15731 static void alc663_mode3_inithook(struct hda_codec
*codec
)
15733 alc663_two_hp_m1_speaker_automute(codec
);
15734 alc662_eeepc_mic_automute(codec
);
15736 /* ***************** Mode4 ******************************/
15737 static void alc663_mode4_unsol_event(struct hda_codec
*codec
,
15740 switch (res
>> 26) {
15741 case ALC880_HP_EVENT
:
15742 alc663_21jd_two_speaker_automute(codec
);
15744 case ALC880_MIC_EVENT
:
15745 alc662_eeepc_mic_automute(codec
);
15750 static void alc663_mode4_inithook(struct hda_codec
*codec
)
15752 alc663_21jd_two_speaker_automute(codec
);
15753 alc662_eeepc_mic_automute(codec
);
15755 /* ***************** Mode5 ******************************/
15756 static void alc663_mode5_unsol_event(struct hda_codec
*codec
,
15759 switch (res
>> 26) {
15760 case ALC880_HP_EVENT
:
15761 alc663_15jd_two_speaker_automute(codec
);
15763 case ALC880_MIC_EVENT
:
15764 alc662_eeepc_mic_automute(codec
);
15769 static void alc663_mode5_inithook(struct hda_codec
*codec
)
15771 alc663_15jd_two_speaker_automute(codec
);
15772 alc662_eeepc_mic_automute(codec
);
15774 /* ***************** Mode6 ******************************/
15775 static void alc663_mode6_unsol_event(struct hda_codec
*codec
,
15778 switch (res
>> 26) {
15779 case ALC880_HP_EVENT
:
15780 alc663_two_hp_m2_speaker_automute(codec
);
15782 case ALC880_MIC_EVENT
:
15783 alc662_eeepc_mic_automute(codec
);
15788 static void alc663_mode6_inithook(struct hda_codec
*codec
)
15790 alc663_two_hp_m2_speaker_automute(codec
);
15791 alc662_eeepc_mic_automute(codec
);
15794 static void alc663_g71v_hp_automute(struct hda_codec
*codec
)
15796 unsigned int present
;
15797 unsigned char bits
;
15799 present
= snd_hda_codec_read(codec
, 0x21, 0,
15800 AC_VERB_GET_PIN_SENSE
, 0)
15801 & AC_PINSENSE_PRESENCE
;
15802 bits
= present
? HDA_AMP_MUTE
: 0;
15803 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
15804 HDA_AMP_MUTE
, bits
);
15805 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
15806 HDA_AMP_MUTE
, bits
);
15809 static void alc663_g71v_front_automute(struct hda_codec
*codec
)
15811 unsigned int present
;
15812 unsigned char bits
;
15814 present
= snd_hda_codec_read(codec
, 0x15, 0,
15815 AC_VERB_GET_PIN_SENSE
, 0)
15816 & AC_PINSENSE_PRESENCE
;
15817 bits
= present
? HDA_AMP_MUTE
: 0;
15818 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
15819 HDA_AMP_MUTE
, bits
);
15822 static void alc663_g71v_unsol_event(struct hda_codec
*codec
,
15825 switch (res
>> 26) {
15826 case ALC880_HP_EVENT
:
15827 alc663_g71v_hp_automute(codec
);
15829 case ALC880_FRONT_EVENT
:
15830 alc663_g71v_front_automute(codec
);
15832 case ALC880_MIC_EVENT
:
15833 alc662_eeepc_mic_automute(codec
);
15838 static void alc663_g71v_inithook(struct hda_codec
*codec
)
15840 alc663_g71v_front_automute(codec
);
15841 alc663_g71v_hp_automute(codec
);
15842 alc662_eeepc_mic_automute(codec
);
15845 static void alc663_g50v_unsol_event(struct hda_codec
*codec
,
15848 switch (res
>> 26) {
15849 case ALC880_HP_EVENT
:
15850 alc663_m51va_speaker_automute(codec
);
15852 case ALC880_MIC_EVENT
:
15853 alc662_eeepc_mic_automute(codec
);
15858 static void alc663_g50v_inithook(struct hda_codec
*codec
)
15860 alc663_m51va_speaker_automute(codec
);
15861 alc662_eeepc_mic_automute(codec
);
15864 /* bind hp and internal speaker mute (with plug check) */
15865 static int alc662_ecs_master_sw_put(struct snd_kcontrol
*kcontrol
,
15866 struct snd_ctl_elem_value
*ucontrol
)
15868 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
15869 long *valp
= ucontrol
->value
.integer
.value
;
15872 change
= snd_hda_codec_amp_update(codec
, 0x1b, 0, HDA_OUTPUT
, 0,
15874 valp
[0] ? 0 : HDA_AMP_MUTE
);
15875 change
|= snd_hda_codec_amp_update(codec
, 0x1b, 1, HDA_OUTPUT
, 0,
15877 valp
[1] ? 0 : HDA_AMP_MUTE
);
15879 alc262_hippo1_automute(codec
);
15883 static struct snd_kcontrol_new alc662_ecs_mixer
[] = {
15884 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15886 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15887 .name
= "Master Playback Switch",
15888 .info
= snd_hda_mixer_amp_switch_info
,
15889 .get
= snd_hda_mixer_amp_switch_get
,
15890 .put
= alc662_ecs_master_sw_put
,
15891 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
15894 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT
),
15895 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15896 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15898 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
15899 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15900 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15904 #ifdef CONFIG_SND_HDA_POWER_SAVE
15905 #define alc662_loopbacks alc880_loopbacks
15909 /* pcm configuration: identiacal with ALC880 */
15910 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15911 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15912 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15913 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15916 * configuration and preset
15918 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
15919 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
15920 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
15921 [ALC662_3ST_6ch
] = "3stack-6ch",
15922 [ALC662_5ST_DIG
] = "6stack-dig",
15923 [ALC662_LENOVO_101E
] = "lenovo-101e",
15924 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
15925 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
15926 [ALC662_ECS
] = "ecs",
15927 [ALC663_ASUS_M51VA
] = "m51va",
15928 [ALC663_ASUS_G71V
] = "g71v",
15929 [ALC663_ASUS_H13
] = "h13",
15930 [ALC663_ASUS_G50V
] = "g50v",
15931 [ALC663_ASUS_MODE1
] = "asus-mode1",
15932 [ALC662_ASUS_MODE2
] = "asus-mode2",
15933 [ALC663_ASUS_MODE3
] = "asus-mode3",
15934 [ALC663_ASUS_MODE4
] = "asus-mode4",
15935 [ALC663_ASUS_MODE5
] = "asus-mode5",
15936 [ALC663_ASUS_MODE6
] = "asus-mode6",
15937 [ALC662_AUTO
] = "auto",
15940 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
15941 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
15942 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V
),
15943 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
15944 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
15945 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
15946 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1
),
15947 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1
),
15948 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1
),
15949 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1
),
15950 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1
),
15951 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1
),
15952 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1
),
15953 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1
),
15954 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1
),
15955 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1
),
15956 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2
),
15957 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2
),
15958 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2
),
15959 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2
),
15960 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2
),
15961 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2
),
15962 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2
),
15963 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2
),
15964 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2
),
15965 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2
),
15966 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2
),
15967 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2
),
15968 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3
),
15969 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3
),
15970 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3
),
15971 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3
),
15972 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3
),
15973 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4
),
15974 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5
),
15975 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6
),
15976 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6
),
15977 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6
),
15978 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15979 ALC662_3ST_6ch_DIG
),
15980 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
15981 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS
),
15982 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS
),
15983 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15984 ALC662_3ST_6ch_DIG
),
15985 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG
),
15986 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15987 ALC662_3ST_6ch_DIG
),
15988 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13
),
15989 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13
),
15990 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13
),
15994 static struct alc_config_preset alc662_presets
[] = {
15995 [ALC662_3ST_2ch_DIG
] = {
15996 .mixers
= { alc662_3ST_2ch_mixer
},
15997 .init_verbs
= { alc662_init_verbs
},
15998 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15999 .dac_nids
= alc662_dac_nids
,
16000 .dig_out_nid
= ALC662_DIGOUT_NID
,
16001 .dig_in_nid
= ALC662_DIGIN_NID
,
16002 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16003 .channel_mode
= alc662_3ST_2ch_modes
,
16004 .input_mux
= &alc662_capture_source
,
16006 [ALC662_3ST_6ch_DIG
] = {
16007 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
16008 .init_verbs
= { alc662_init_verbs
},
16009 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16010 .dac_nids
= alc662_dac_nids
,
16011 .dig_out_nid
= ALC662_DIGOUT_NID
,
16012 .dig_in_nid
= ALC662_DIGIN_NID
,
16013 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16014 .channel_mode
= alc662_3ST_6ch_modes
,
16016 .input_mux
= &alc662_capture_source
,
16018 [ALC662_3ST_6ch
] = {
16019 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
16020 .init_verbs
= { alc662_init_verbs
},
16021 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16022 .dac_nids
= alc662_dac_nids
,
16023 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16024 .channel_mode
= alc662_3ST_6ch_modes
,
16026 .input_mux
= &alc662_capture_source
,
16028 [ALC662_5ST_DIG
] = {
16029 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
},
16030 .init_verbs
= { alc662_init_verbs
},
16031 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16032 .dac_nids
= alc662_dac_nids
,
16033 .dig_out_nid
= ALC662_DIGOUT_NID
,
16034 .dig_in_nid
= ALC662_DIGIN_NID
,
16035 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
16036 .channel_mode
= alc662_5stack_modes
,
16037 .input_mux
= &alc662_capture_source
,
16039 [ALC662_LENOVO_101E
] = {
16040 .mixers
= { alc662_lenovo_101e_mixer
},
16041 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
16042 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16043 .dac_nids
= alc662_dac_nids
,
16044 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16045 .channel_mode
= alc662_3ST_2ch_modes
,
16046 .input_mux
= &alc662_lenovo_101e_capture_source
,
16047 .unsol_event
= alc662_lenovo_101e_unsol_event
,
16048 .init_hook
= alc662_lenovo_101e_all_automute
,
16050 [ALC662_ASUS_EEEPC_P701
] = {
16051 .mixers
= { alc662_eeepc_p701_mixer
},
16052 .init_verbs
= { alc662_init_verbs
,
16053 alc662_eeepc_sue_init_verbs
},
16054 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16055 .dac_nids
= alc662_dac_nids
,
16056 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16057 .channel_mode
= alc662_3ST_2ch_modes
,
16058 .input_mux
= &alc662_eeepc_capture_source
,
16059 .unsol_event
= alc662_eeepc_unsol_event
,
16060 .init_hook
= alc662_eeepc_inithook
,
16062 [ALC662_ASUS_EEEPC_EP20
] = {
16063 .mixers
= { alc662_eeepc_ep20_mixer
,
16064 alc662_chmode_mixer
},
16065 .init_verbs
= { alc662_init_verbs
,
16066 alc662_eeepc_ep20_sue_init_verbs
},
16067 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16068 .dac_nids
= alc662_dac_nids
,
16069 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16070 .channel_mode
= alc662_3ST_6ch_modes
,
16071 .input_mux
= &alc662_lenovo_101e_capture_source
,
16072 .unsol_event
= alc662_eeepc_ep20_unsol_event
,
16073 .init_hook
= alc662_eeepc_ep20_inithook
,
16076 .mixers
= { alc662_ecs_mixer
},
16077 .init_verbs
= { alc662_init_verbs
,
16078 alc662_ecs_init_verbs
},
16079 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16080 .dac_nids
= alc662_dac_nids
,
16081 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16082 .channel_mode
= alc662_3ST_2ch_modes
,
16083 .input_mux
= &alc662_eeepc_capture_source
,
16084 .unsol_event
= alc662_eeepc_unsol_event
,
16085 .init_hook
= alc662_eeepc_inithook
,
16087 [ALC663_ASUS_M51VA
] = {
16088 .mixers
= { alc663_m51va_mixer
},
16089 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
16090 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16091 .dac_nids
= alc662_dac_nids
,
16092 .dig_out_nid
= ALC662_DIGOUT_NID
,
16093 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16094 .channel_mode
= alc662_3ST_2ch_modes
,
16095 .input_mux
= &alc663_m51va_capture_source
,
16096 .unsol_event
= alc663_m51va_unsol_event
,
16097 .init_hook
= alc663_m51va_inithook
,
16099 [ALC663_ASUS_G71V
] = {
16100 .mixers
= { alc663_g71v_mixer
},
16101 .init_verbs
= { alc662_init_verbs
, alc663_g71v_init_verbs
},
16102 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16103 .dac_nids
= alc662_dac_nids
,
16104 .dig_out_nid
= ALC662_DIGOUT_NID
,
16105 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16106 .channel_mode
= alc662_3ST_2ch_modes
,
16107 .input_mux
= &alc662_eeepc_capture_source
,
16108 .unsol_event
= alc663_g71v_unsol_event
,
16109 .init_hook
= alc663_g71v_inithook
,
16111 [ALC663_ASUS_H13
] = {
16112 .mixers
= { alc663_m51va_mixer
},
16113 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
16114 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16115 .dac_nids
= alc662_dac_nids
,
16116 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16117 .channel_mode
= alc662_3ST_2ch_modes
,
16118 .input_mux
= &alc663_m51va_capture_source
,
16119 .unsol_event
= alc663_m51va_unsol_event
,
16120 .init_hook
= alc663_m51va_inithook
,
16122 [ALC663_ASUS_G50V
] = {
16123 .mixers
= { alc663_g50v_mixer
},
16124 .init_verbs
= { alc662_init_verbs
, alc663_g50v_init_verbs
},
16125 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16126 .dac_nids
= alc662_dac_nids
,
16127 .dig_out_nid
= ALC662_DIGOUT_NID
,
16128 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16129 .channel_mode
= alc662_3ST_6ch_modes
,
16130 .input_mux
= &alc663_capture_source
,
16131 .unsol_event
= alc663_g50v_unsol_event
,
16132 .init_hook
= alc663_g50v_inithook
,
16134 [ALC663_ASUS_MODE1
] = {
16135 .mixers
= { alc663_m51va_mixer
},
16136 .cap_mixer
= alc662_auto_capture_mixer
,
16137 .init_verbs
= { alc662_init_verbs
,
16138 alc663_21jd_amic_init_verbs
},
16139 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16141 .dac_nids
= alc662_dac_nids
,
16142 .dig_out_nid
= ALC662_DIGOUT_NID
,
16143 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16144 .channel_mode
= alc662_3ST_2ch_modes
,
16145 .input_mux
= &alc662_eeepc_capture_source
,
16146 .unsol_event
= alc663_mode1_unsol_event
,
16147 .init_hook
= alc663_mode1_inithook
,
16149 [ALC662_ASUS_MODE2
] = {
16150 .mixers
= { alc662_1bjd_mixer
},
16151 .cap_mixer
= alc662_auto_capture_mixer
,
16152 .init_verbs
= { alc662_init_verbs
,
16153 alc662_1bjd_amic_init_verbs
},
16154 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16155 .dac_nids
= alc662_dac_nids
,
16156 .dig_out_nid
= ALC662_DIGOUT_NID
,
16157 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16158 .channel_mode
= alc662_3ST_2ch_modes
,
16159 .input_mux
= &alc662_eeepc_capture_source
,
16160 .unsol_event
= alc662_mode2_unsol_event
,
16161 .init_hook
= alc662_mode2_inithook
,
16163 [ALC663_ASUS_MODE3
] = {
16164 .mixers
= { alc663_two_hp_m1_mixer
},
16165 .cap_mixer
= alc662_auto_capture_mixer
,
16166 .init_verbs
= { alc662_init_verbs
,
16167 alc663_two_hp_amic_m1_init_verbs
},
16168 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16170 .dac_nids
= alc662_dac_nids
,
16171 .dig_out_nid
= ALC662_DIGOUT_NID
,
16172 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16173 .channel_mode
= alc662_3ST_2ch_modes
,
16174 .input_mux
= &alc662_eeepc_capture_source
,
16175 .unsol_event
= alc663_mode3_unsol_event
,
16176 .init_hook
= alc663_mode3_inithook
,
16178 [ALC663_ASUS_MODE4
] = {
16179 .mixers
= { alc663_asus_21jd_clfe_mixer
},
16180 .cap_mixer
= alc662_auto_capture_mixer
,
16181 .init_verbs
= { alc662_init_verbs
,
16182 alc663_21jd_amic_init_verbs
},
16183 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16185 .dac_nids
= alc662_dac_nids
,
16186 .dig_out_nid
= ALC662_DIGOUT_NID
,
16187 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16188 .channel_mode
= alc662_3ST_2ch_modes
,
16189 .input_mux
= &alc662_eeepc_capture_source
,
16190 .unsol_event
= alc663_mode4_unsol_event
,
16191 .init_hook
= alc663_mode4_inithook
,
16193 [ALC663_ASUS_MODE5
] = {
16194 .mixers
= { alc663_asus_15jd_clfe_mixer
},
16195 .cap_mixer
= alc662_auto_capture_mixer
,
16196 .init_verbs
= { alc662_init_verbs
,
16197 alc663_15jd_amic_init_verbs
},
16198 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16200 .dac_nids
= alc662_dac_nids
,
16201 .dig_out_nid
= ALC662_DIGOUT_NID
,
16202 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16203 .channel_mode
= alc662_3ST_2ch_modes
,
16204 .input_mux
= &alc662_eeepc_capture_source
,
16205 .unsol_event
= alc663_mode5_unsol_event
,
16206 .init_hook
= alc663_mode5_inithook
,
16208 [ALC663_ASUS_MODE6
] = {
16209 .mixers
= { alc663_two_hp_m2_mixer
},
16210 .cap_mixer
= alc662_auto_capture_mixer
,
16211 .init_verbs
= { alc662_init_verbs
,
16212 alc663_two_hp_amic_m2_init_verbs
},
16213 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16215 .dac_nids
= alc662_dac_nids
,
16216 .dig_out_nid
= ALC662_DIGOUT_NID
,
16217 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16218 .channel_mode
= alc662_3ST_2ch_modes
,
16219 .input_mux
= &alc662_eeepc_capture_source
,
16220 .unsol_event
= alc663_mode6_unsol_event
,
16221 .init_hook
= alc663_mode6_inithook
,
16227 * BIOS auto configuration
16230 /* add playback controls from the parsed DAC table */
16231 static int alc662_auto_create_multi_out_ctls(struct alc_spec
*spec
,
16232 const struct auto_pin_cfg
*cfg
)
16235 static const char *chname
[4] = {
16236 "Front", "Surround", NULL
/*CLFE*/, "Side"
16241 for (i
= 0; i
< cfg
->line_outs
; i
++) {
16242 if (!spec
->multiout
.dac_nids
[i
])
16244 nid
= alc880_idx_to_dac(i
);
16247 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
16248 "Center Playback Volume",
16249 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
16253 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
16254 "LFE Playback Volume",
16255 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
16259 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
16260 "Center Playback Switch",
16261 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16265 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
16266 "LFE Playback Switch",
16267 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16272 sprintf(name
, "%s Playback Volume", chname
[i
]);
16273 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
16274 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
16278 sprintf(name
, "%s Playback Switch", chname
[i
]);
16279 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
16280 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i
),
16289 /* add playback controls for speaker and HP outputs */
16290 static int alc662_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
16301 /* ALC663 has a mono output pin on 0x17 */
16302 sprintf(name
, "%s Playback Switch", pfx
);
16303 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
16304 HDA_COMPOSE_AMP_VAL(pin
, 2, 0, HDA_OUTPUT
));
16308 if (alc880_is_fixed_pin(pin
)) {
16309 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
16310 /* printk("DAC nid=%x\n",nid); */
16311 /* specify the DAC as the extra output */
16312 if (!spec
->multiout
.hp_nid
)
16313 spec
->multiout
.hp_nid
= nid
;
16315 spec
->multiout
.extra_out_nid
[0] = nid
;
16316 /* control HP volume/switch on the output mixer amp */
16317 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
16318 sprintf(name
, "%s Playback Volume", pfx
);
16319 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
16320 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
16323 sprintf(name
, "%s Playback Switch", pfx
);
16324 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
16325 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
16328 } else if (alc880_is_multi_pin(pin
)) {
16329 /* set manual connection */
16330 /* we have only a switch on HP-out PIN */
16331 sprintf(name
, "%s Playback Switch", pfx
);
16332 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
16333 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
16340 /* create playback/capture controls for input pins */
16341 static int alc662_auto_create_analog_input_ctls(struct alc_spec
*spec
,
16342 const struct auto_pin_cfg
*cfg
)
16344 struct hda_input_mux
*imux
= &spec
->private_imux
;
16347 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
16348 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
16349 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
16350 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
16351 auto_pin_cfg_labels
[i
],
16355 imux
->items
[imux
->num_items
].label
=
16356 auto_pin_cfg_labels
[i
];
16357 imux
->items
[imux
->num_items
].index
=
16358 alc880_input_pin_idx(cfg
->input_pins
[i
]);
16365 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
16366 hda_nid_t nid
, int pin_type
,
16369 alc_set_pin_output(codec
, nid
, pin_type
);
16370 /* need the manual connection? */
16371 if (alc880_is_multi_pin(nid
)) {
16372 struct alc_spec
*spec
= codec
->spec
;
16373 int idx
= alc880_multi_pin_idx(nid
);
16374 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
16375 AC_VERB_SET_CONNECT_SEL
,
16376 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
16380 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
16382 struct alc_spec
*spec
= codec
->spec
;
16385 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
16386 for (i
= 0; i
<= HDA_SIDE
; i
++) {
16387 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
16388 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
16390 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
16395 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
16397 struct alc_spec
*spec
= codec
->spec
;
16400 pin
= spec
->autocfg
.hp_pins
[0];
16401 if (pin
) /* connect to front */
16403 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
16404 pin
= spec
->autocfg
.speaker_pins
[0];
16406 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
16409 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16410 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16412 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
16414 struct alc_spec
*spec
= codec
->spec
;
16417 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
16418 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
16419 if (alc662_is_input_pin(nid
)) {
16420 snd_hda_codec_write(codec
, nid
, 0,
16421 AC_VERB_SET_PIN_WIDGET_CONTROL
,
16422 (i
<= AUTO_PIN_FRONT_MIC
?
16423 PIN_VREF80
: PIN_IN
));
16424 if (nid
!= ALC662_PIN_CD_NID
)
16425 snd_hda_codec_write(codec
, nid
, 0,
16426 AC_VERB_SET_AMP_GAIN_MUTE
,
16432 #define alc662_auto_init_input_src alc882_auto_init_input_src
16434 static int alc662_parse_auto_config(struct hda_codec
*codec
)
16436 struct alc_spec
*spec
= codec
->spec
;
16438 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
16440 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
16444 if (!spec
->autocfg
.line_outs
)
16445 return 0; /* can't find valid BIOS pin config */
16447 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
16450 err
= alc662_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
16453 err
= alc662_auto_create_extra_out(spec
,
16454 spec
->autocfg
.speaker_pins
[0],
16458 err
= alc662_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
16462 err
= alc662_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
16466 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
16468 if (spec
->autocfg
.dig_out_pin
)
16469 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
16471 if (spec
->kctls
.list
)
16472 add_mixer(spec
, spec
->kctls
.list
);
16474 spec
->num_mux_defs
= 1;
16475 spec
->input_mux
= &spec
->private_imux
;
16477 add_verb(spec
, alc662_auto_init_verbs
);
16478 if (codec
->vendor_id
== 0x10ec0663)
16479 add_verb(spec
, alc663_auto_init_verbs
);
16481 err
= alc_auto_add_mic_boost(codec
);
16485 store_pin_configs(codec
);
16489 /* additional initialization for auto-configuration model */
16490 static void alc662_auto_init(struct hda_codec
*codec
)
16492 struct alc_spec
*spec
= codec
->spec
;
16493 alc662_auto_init_multi_out(codec
);
16494 alc662_auto_init_hp_out(codec
);
16495 alc662_auto_init_analog_input(codec
);
16496 alc662_auto_init_input_src(codec
);
16497 if (spec
->unsol_event
)
16498 alc_inithook(codec
);
16501 static int patch_alc662(struct hda_codec
*codec
)
16503 struct alc_spec
*spec
;
16504 int err
, board_config
;
16506 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
16510 codec
->spec
= spec
;
16512 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
16514 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
16517 if (board_config
< 0) {
16518 printk(KERN_INFO
"hda_codec: Unknown model for ALC662, "
16519 "trying auto-probe from BIOS...\n");
16520 board_config
= ALC662_AUTO
;
16523 if (board_config
== ALC662_AUTO
) {
16524 /* automatic parse from the BIOS config */
16525 err
= alc662_parse_auto_config(codec
);
16531 "hda_codec: Cannot set up configuration "
16532 "from BIOS. Using base mode...\n");
16533 board_config
= ALC662_3ST_2ch_DIG
;
16537 if (board_config
!= ALC662_AUTO
)
16538 setup_preset(spec
, &alc662_presets
[board_config
]);
16540 if (codec
->vendor_id
== 0x10ec0663) {
16541 spec
->stream_name_analog
= "ALC663 Analog";
16542 spec
->stream_name_digital
= "ALC663 Digital";
16543 } else if (codec
->vendor_id
== 0x10ec0272) {
16544 spec
->stream_name_analog
= "ALC272 Analog";
16545 spec
->stream_name_digital
= "ALC272 Digital";
16547 spec
->stream_name_analog
= "ALC662 Analog";
16548 spec
->stream_name_digital
= "ALC662 Digital";
16551 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
16552 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
16554 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
16555 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
16557 spec
->adc_nids
= alc662_adc_nids
;
16558 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
16559 spec
->capsrc_nids
= alc662_capsrc_nids
;
16560 spec
->is_mix_capture
= 1;
16562 if (!spec
->cap_mixer
)
16563 set_capture_mixer(spec
);
16565 spec
->vmaster_nid
= 0x02;
16567 codec
->patch_ops
= alc_patch_ops
;
16568 if (board_config
== ALC662_AUTO
)
16569 spec
->init_hook
= alc662_auto_init
;
16570 #ifdef CONFIG_SND_HDA_POWER_SAVE
16571 if (!spec
->loopback
.amplist
)
16572 spec
->loopback
.amplist
= alc662_loopbacks
;
16581 static struct hda_codec_preset snd_hda_preset_realtek
[] = {
16582 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
16583 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
16584 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
16585 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
16586 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
16587 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
16588 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
16589 .patch
= patch_alc861
},
16590 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
16591 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
16592 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
16593 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
16594 .patch
= patch_alc883
},
16595 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
16596 .patch
= patch_alc662
},
16597 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
16598 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
16599 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
16600 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
16601 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
16602 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
16603 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
16604 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
16605 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
16606 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc883
},
16607 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
16608 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
16609 .patch
= patch_alc883
},
16610 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc883
},
16611 {} /* terminator */
16614 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16616 MODULE_LICENSE("GPL");
16617 MODULE_DESCRIPTION("Realtek HD-audio codec");
16619 static struct hda_codec_preset_list realtek_list
= {
16620 .preset
= snd_hda_preset_realtek
,
16621 .owner
= THIS_MODULE
,
16624 static int __init
patch_realtek_init(void)
16626 return snd_hda_add_codec_preset(&realtek_list
);
16629 static void __exit
patch_realtek_exit(void)
16631 snd_hda_delete_codec_preset(&realtek_list
);
16634 module_init(patch_realtek_init
)
16635 module_exit(patch_realtek_exit
)