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 <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST
/* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST
/* last tag */
97 ALC262_HP_BPC_D7000_WL
,
98 ALC262_HP_BPC_D7000_WF
,
111 ALC262_MODEL_LAST
/* last tag */
121 ALC268_ACER_ASPIRE_ONE
,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST
/* last tag */
143 ALC269_MODEL_LAST
/* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701
,
183 ALC662_ASUS_EEEPC_EP20
,
225 ALC883_TARGA_2ch_DIG
,
226 ALC883_TARGA_8ch_DIG
,
229 ALC888_ACER_ASPIRE_4930G
,
230 ALC888_ACER_ASPIRE_6530G
,
231 ALC888_ACER_ASPIRE_8930G
,
232 ALC888_ACER_ASPIRE_7730G
,
234 ALC883_MEDION_WIM2160
,
236 ALC883_LENOVO_101E_2ch
,
237 ALC883_LENOVO_NB0763
,
238 ALC888_LENOVO_MS7195_DIG
,
246 ALC883_FUJITSU_PI2515
,
247 ALC888_FUJITSU_XA3530
,
248 ALC883_3ST_6ch_INTEL
,
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
279 struct alc_mic_route
{
281 unsigned char mux_idx
;
282 unsigned char amix_idx
;
285 #define MUX_IDX_UNDEF ((unsigned char)-1)
287 struct alc_customize_define
{
288 unsigned int sku_cfg
;
289 unsigned char port_connectivity
;
290 unsigned char check_sum
;
291 unsigned char customization
;
292 unsigned char external_amp
;
293 unsigned int enable_pcbeep
:1;
294 unsigned int platform_type
:1;
296 unsigned int override
:1;
297 unsigned int fixup
:1; /* Means that this sku is set by driver, not read from hw */
303 /* codec parameterization */
304 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
305 unsigned int num_mixers
;
306 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
307 unsigned int beep_amp
; /* beep amp value, set via set_beep_amp() */
309 const struct hda_verb
*init_verbs
[10]; /* initialization verbs
313 unsigned int num_init_verbs
;
315 char stream_name_analog
[32]; /* analog PCM stream */
316 struct hda_pcm_stream
*stream_analog_playback
;
317 struct hda_pcm_stream
*stream_analog_capture
;
318 struct hda_pcm_stream
*stream_analog_alt_playback
;
319 struct hda_pcm_stream
*stream_analog_alt_capture
;
321 char stream_name_digital
[32]; /* digital PCM stream */
322 struct hda_pcm_stream
*stream_digital_playback
;
323 struct hda_pcm_stream
*stream_digital_capture
;
326 struct hda_multi_out multiout
; /* playback set-up
327 * max_channels, dacs must be set
328 * dig_out_nid and hp_nid are optional
330 hda_nid_t alt_dac_nid
;
331 hda_nid_t slave_dig_outs
[3]; /* optional - for auto-parsing */
335 unsigned int num_adc_nids
;
337 hda_nid_t
*capsrc_nids
;
338 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
340 /* capture setup for dynamic dual-adc switch */
341 unsigned int cur_adc_idx
;
343 unsigned int cur_adc_stream_tag
;
344 unsigned int cur_adc_format
;
347 unsigned int num_mux_defs
;
348 const struct hda_input_mux
*input_mux
;
349 unsigned int cur_mux
[3];
350 struct alc_mic_route ext_mic
;
351 struct alc_mic_route int_mic
;
354 const struct hda_channel_mode
*channel_mode
;
355 int num_channel_mode
;
357 int const_channel_count
;
358 int ext_channel_count
;
360 /* PCM information */
361 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
363 /* dynamic controls, init_verbs and input_mux */
364 struct auto_pin_cfg autocfg
;
365 struct alc_customize_define cdefine
;
366 struct snd_array kctls
;
367 struct hda_input_mux private_imux
[3];
368 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
369 hda_nid_t private_adc_nids
[AUTO_CFG_MAX_OUTS
];
370 hda_nid_t private_capsrc_nids
[AUTO_CFG_MAX_OUTS
];
373 void (*init_hook
)(struct hda_codec
*codec
);
374 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
375 #ifdef CONFIG_SND_HDA_POWER_SAVE
376 void (*power_hook
)(struct hda_codec
*codec
);
379 /* for pin sensing */
380 unsigned int sense_updated
: 1;
381 unsigned int jack_present
: 1;
382 unsigned int master_sw
: 1;
383 unsigned int auto_mic
:1;
386 unsigned int no_analog
:1; /* digital I/O only */
387 unsigned int dual_adc_switch
:1; /* switch ADCs (for ALC275) */
388 unsigned int single_input_src
:1;
390 int codec_variant
; /* flag for other variants */
392 /* for virtual master */
393 hda_nid_t vmaster_nid
;
394 #ifdef CONFIG_SND_HDA_POWER_SAVE
395 struct hda_loopback_check loopback
;
400 unsigned int pll_coef_idx
, pll_coef_bit
;
404 const struct alc_fixup
*fixup_list
;
405 const char *fixup_name
;
409 * configuration template - to be copied to the spec instance
411 struct alc_config_preset
{
412 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
415 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
416 const struct hda_verb
*init_verbs
[5];
417 unsigned int num_dacs
;
419 hda_nid_t dig_out_nid
; /* optional */
420 hda_nid_t hp_nid
; /* optional */
421 hda_nid_t
*slave_dig_outs
;
422 unsigned int num_adc_nids
;
424 hda_nid_t
*capsrc_nids
;
425 hda_nid_t dig_in_nid
;
426 unsigned int num_channel_mode
;
427 const struct hda_channel_mode
*channel_mode
;
429 int const_channel_count
;
430 unsigned int num_mux_defs
;
431 const struct hda_input_mux
*input_mux
;
432 void (*unsol_event
)(struct hda_codec
*, unsigned int);
433 void (*setup
)(struct hda_codec
*);
434 void (*init_hook
)(struct hda_codec
*);
435 #ifdef CONFIG_SND_HDA_POWER_SAVE
436 struct hda_amp_list
*loopbacks
;
437 void (*power_hook
)(struct hda_codec
*codec
);
445 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
446 struct snd_ctl_elem_info
*uinfo
)
448 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
449 struct alc_spec
*spec
= codec
->spec
;
450 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
451 if (mux_idx
>= spec
->num_mux_defs
)
453 if (!spec
->input_mux
[mux_idx
].num_items
&& mux_idx
> 0)
455 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
458 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
459 struct snd_ctl_elem_value
*ucontrol
)
461 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
462 struct alc_spec
*spec
= codec
->spec
;
463 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
465 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
469 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
470 struct snd_ctl_elem_value
*ucontrol
)
472 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
473 struct alc_spec
*spec
= codec
->spec
;
474 const struct hda_input_mux
*imux
;
475 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
476 unsigned int mux_idx
;
477 hda_nid_t nid
= spec
->capsrc_nids
?
478 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
481 mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
482 imux
= &spec
->input_mux
[mux_idx
];
483 if (!imux
->num_items
&& mux_idx
> 0)
484 imux
= &spec
->input_mux
[0];
486 type
= get_wcaps_type(get_wcaps(codec
, nid
));
487 if (type
== AC_WID_AUD_MIX
) {
488 /* Matrix-mixer style (e.g. ALC882) */
489 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
492 idx
= ucontrol
->value
.enumerated
.item
[0];
493 if (idx
>= imux
->num_items
)
494 idx
= imux
->num_items
- 1;
497 for (i
= 0; i
< imux
->num_items
; i
++) {
498 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
499 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
500 imux
->items
[i
].index
,
506 /* MUX style (e.g. ALC880) */
507 return snd_hda_input_mux_put(codec
, imux
, ucontrol
, nid
,
508 &spec
->cur_mux
[adc_idx
]);
513 * channel mode setting
515 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
516 struct snd_ctl_elem_info
*uinfo
)
518 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
519 struct alc_spec
*spec
= codec
->spec
;
520 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
521 spec
->num_channel_mode
);
524 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
525 struct snd_ctl_elem_value
*ucontrol
)
527 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
528 struct alc_spec
*spec
= codec
->spec
;
529 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
530 spec
->num_channel_mode
,
531 spec
->ext_channel_count
);
534 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
535 struct snd_ctl_elem_value
*ucontrol
)
537 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
538 struct alc_spec
*spec
= codec
->spec
;
539 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
540 spec
->num_channel_mode
,
541 &spec
->ext_channel_count
);
542 if (err
>= 0 && !spec
->const_channel_count
) {
543 spec
->multiout
.max_channels
= spec
->ext_channel_count
;
544 if (spec
->need_dac_fix
)
545 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
551 * Control the mode of pin widget settings via the mixer. "pc" is used
552 * instead of "%" to avoid consequences of accidently treating the % as
553 * being part of a format specifier. Maximum allowed length of a value is
554 * 63 characters plus NULL terminator.
556 * Note: some retasking pin complexes seem to ignore requests for input
557 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
558 * are requested. Therefore order this list so that this behaviour will not
559 * cause problems when mixer clients move through the enum sequentially.
560 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
563 static char *alc_pin_mode_names
[] = {
564 "Mic 50pc bias", "Mic 80pc bias",
565 "Line in", "Line out", "Headphone out",
567 static unsigned char alc_pin_mode_values
[] = {
568 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
570 /* The control can present all 5 options, or it can limit the options based
571 * in the pin being assumed to be exclusively an input or an output pin. In
572 * addition, "input" pins may or may not process the mic bias option
573 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
574 * accept requests for bias as of chip versions up to March 2006) and/or
575 * wiring in the computer.
577 #define ALC_PIN_DIR_IN 0x00
578 #define ALC_PIN_DIR_OUT 0x01
579 #define ALC_PIN_DIR_INOUT 0x02
580 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
581 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
583 /* Info about the pin modes supported by the different pin direction modes.
584 * For each direction the minimum and maximum values are given.
586 static signed char alc_pin_mode_dir_info
[5][2] = {
587 { 0, 2 }, /* ALC_PIN_DIR_IN */
588 { 3, 4 }, /* ALC_PIN_DIR_OUT */
589 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
590 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
591 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
593 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
594 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
595 #define alc_pin_mode_n_items(_dir) \
596 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
598 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
599 struct snd_ctl_elem_info
*uinfo
)
601 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
602 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
604 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
606 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
608 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
609 item_num
= alc_pin_mode_min(dir
);
610 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
614 static int alc_pin_mode_get(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 dir
= (kcontrol
->private_value
>> 16) & 0xff;
621 long *valp
= ucontrol
->value
.integer
.value
;
622 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
623 AC_VERB_GET_PIN_WIDGET_CONTROL
,
626 /* Find enumerated value for current pinctl setting */
627 i
= alc_pin_mode_min(dir
);
628 while (i
<= alc_pin_mode_max(dir
) && alc_pin_mode_values
[i
] != pinctl
)
630 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
634 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
635 struct snd_ctl_elem_value
*ucontrol
)
638 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
639 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
640 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
641 long val
= *ucontrol
->value
.integer
.value
;
642 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
643 AC_VERB_GET_PIN_WIDGET_CONTROL
,
646 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
647 val
= alc_pin_mode_min(dir
);
649 change
= pinctl
!= alc_pin_mode_values
[val
];
651 /* Set pin mode to that requested */
652 snd_hda_codec_write_cache(codec
, nid
, 0,
653 AC_VERB_SET_PIN_WIDGET_CONTROL
,
654 alc_pin_mode_values
[val
]);
656 /* Also enable the retasking pin's input/output as required
657 * for the requested pin mode. Enum values of 2 or less are
660 * Dynamically switching the input/output buffers probably
661 * reduces noise slightly (particularly on input) so we'll
662 * do it. However, having both input and output buffers
663 * enabled simultaneously doesn't seem to be problematic if
664 * this turns out to be necessary in the future.
667 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
668 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
669 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
672 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
673 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
674 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
681 #define ALC_PIN_MODE(xname, nid, dir) \
682 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
683 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
684 .info = alc_pin_mode_info, \
685 .get = alc_pin_mode_get, \
686 .put = alc_pin_mode_put, \
687 .private_value = nid | (dir<<16) }
689 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
690 * together using a mask with more than one bit set. This control is
691 * currently used only by the ALC260 test model. At this stage they are not
692 * needed for any "production" models.
694 #ifdef CONFIG_SND_DEBUG
695 #define alc_gpio_data_info snd_ctl_boolean_mono_info
697 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
698 struct snd_ctl_elem_value
*ucontrol
)
700 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
701 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
702 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
703 long *valp
= ucontrol
->value
.integer
.value
;
704 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
705 AC_VERB_GET_GPIO_DATA
, 0x00);
707 *valp
= (val
& mask
) != 0;
710 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
711 struct snd_ctl_elem_value
*ucontrol
)
714 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
715 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
716 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
717 long val
= *ucontrol
->value
.integer
.value
;
718 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
719 AC_VERB_GET_GPIO_DATA
,
722 /* Set/unset the masked GPIO bit(s) as needed */
723 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
728 snd_hda_codec_write_cache(codec
, nid
, 0,
729 AC_VERB_SET_GPIO_DATA
, gpio_data
);
733 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
734 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
735 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
736 .info = alc_gpio_data_info, \
737 .get = alc_gpio_data_get, \
738 .put = alc_gpio_data_put, \
739 .private_value = nid | (mask<<16) }
740 #endif /* CONFIG_SND_DEBUG */
742 /* A switch control to allow the enabling of the digital IO pins on the
743 * ALC260. This is incredibly simplistic; the intention of this control is
744 * to provide something in the test model allowing digital outputs to be
745 * identified if present. If models are found which can utilise these
746 * outputs a more complete mixer control can be devised for those models if
749 #ifdef CONFIG_SND_DEBUG
750 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
752 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
753 struct snd_ctl_elem_value
*ucontrol
)
755 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
756 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
757 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
758 long *valp
= ucontrol
->value
.integer
.value
;
759 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
760 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
762 *valp
= (val
& mask
) != 0;
765 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
766 struct snd_ctl_elem_value
*ucontrol
)
769 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
770 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
771 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
772 long val
= *ucontrol
->value
.integer
.value
;
773 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
774 AC_VERB_GET_DIGI_CONVERT_1
,
777 /* Set/unset the masked control bit(s) as needed */
778 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
783 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
788 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
789 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
790 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
791 .info = alc_spdif_ctrl_info, \
792 .get = alc_spdif_ctrl_get, \
793 .put = alc_spdif_ctrl_put, \
794 .private_value = nid | (mask<<16) }
795 #endif /* CONFIG_SND_DEBUG */
797 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
798 * Again, this is only used in the ALC26x test models to help identify when
799 * the EAPD line must be asserted for features to work.
801 #ifdef CONFIG_SND_DEBUG
802 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
804 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
805 struct snd_ctl_elem_value
*ucontrol
)
807 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
808 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
809 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
810 long *valp
= ucontrol
->value
.integer
.value
;
811 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
812 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
814 *valp
= (val
& mask
) != 0;
818 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
819 struct snd_ctl_elem_value
*ucontrol
)
822 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
823 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
824 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
825 long val
= *ucontrol
->value
.integer
.value
;
826 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
827 AC_VERB_GET_EAPD_BTLENABLE
,
830 /* Set/unset the masked control bit(s) as needed */
831 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
836 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
842 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
843 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
844 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
845 .info = alc_eapd_ctrl_info, \
846 .get = alc_eapd_ctrl_get, \
847 .put = alc_eapd_ctrl_put, \
848 .private_value = nid | (mask<<16) }
849 #endif /* CONFIG_SND_DEBUG */
852 * set up the input pin config (depending on the given auto-pin type)
854 static void alc_set_input_pin(struct hda_codec
*codec
, hda_nid_t nid
,
857 unsigned int val
= PIN_IN
;
859 if (auto_pin_type
== AUTO_PIN_MIC
) {
862 oldval
= snd_hda_codec_read(codec
, nid
, 0,
863 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
864 pincap
= snd_hda_query_pin_caps(codec
, nid
);
865 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
866 /* if the default pin setup is vref50, we give it priority */
867 if ((pincap
& AC_PINCAP_VREF_80
) && oldval
!= PIN_VREF50
)
869 else if (pincap
& AC_PINCAP_VREF_50
)
871 else if (pincap
& AC_PINCAP_VREF_100
)
873 else if (pincap
& AC_PINCAP_VREF_GRD
)
876 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, val
);
879 static void alc_fixup_autocfg_pin_nums(struct hda_codec
*codec
)
881 struct alc_spec
*spec
= codec
->spec
;
882 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
884 if (!cfg
->line_outs
) {
885 while (cfg
->line_outs
< AUTO_CFG_MAX_OUTS
&&
886 cfg
->line_out_pins
[cfg
->line_outs
])
889 if (!cfg
->speaker_outs
) {
890 while (cfg
->speaker_outs
< AUTO_CFG_MAX_OUTS
&&
891 cfg
->speaker_pins
[cfg
->speaker_outs
])
895 while (cfg
->hp_outs
< AUTO_CFG_MAX_OUTS
&&
896 cfg
->hp_pins
[cfg
->hp_outs
])
903 static void add_mixer(struct alc_spec
*spec
, struct snd_kcontrol_new
*mix
)
905 if (snd_BUG_ON(spec
->num_mixers
>= ARRAY_SIZE(spec
->mixers
)))
907 spec
->mixers
[spec
->num_mixers
++] = mix
;
910 static void add_verb(struct alc_spec
*spec
, const struct hda_verb
*verb
)
912 if (snd_BUG_ON(spec
->num_init_verbs
>= ARRAY_SIZE(spec
->init_verbs
)))
914 spec
->init_verbs
[spec
->num_init_verbs
++] = verb
;
918 * set up from the preset table
920 static void setup_preset(struct hda_codec
*codec
,
921 const struct alc_config_preset
*preset
)
923 struct alc_spec
*spec
= codec
->spec
;
926 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
927 add_mixer(spec
, preset
->mixers
[i
]);
928 spec
->cap_mixer
= preset
->cap_mixer
;
929 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
931 add_verb(spec
, preset
->init_verbs
[i
]);
933 spec
->channel_mode
= preset
->channel_mode
;
934 spec
->num_channel_mode
= preset
->num_channel_mode
;
935 spec
->need_dac_fix
= preset
->need_dac_fix
;
936 spec
->const_channel_count
= preset
->const_channel_count
;
938 if (preset
->const_channel_count
)
939 spec
->multiout
.max_channels
= preset
->const_channel_count
;
941 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
942 spec
->ext_channel_count
= spec
->channel_mode
[0].channels
;
944 spec
->multiout
.num_dacs
= preset
->num_dacs
;
945 spec
->multiout
.dac_nids
= preset
->dac_nids
;
946 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
947 spec
->multiout
.slave_dig_outs
= preset
->slave_dig_outs
;
948 spec
->multiout
.hp_nid
= preset
->hp_nid
;
950 spec
->num_mux_defs
= preset
->num_mux_defs
;
951 if (!spec
->num_mux_defs
)
952 spec
->num_mux_defs
= 1;
953 spec
->input_mux
= preset
->input_mux
;
955 spec
->num_adc_nids
= preset
->num_adc_nids
;
956 spec
->adc_nids
= preset
->adc_nids
;
957 spec
->capsrc_nids
= preset
->capsrc_nids
;
958 spec
->dig_in_nid
= preset
->dig_in_nid
;
960 spec
->unsol_event
= preset
->unsol_event
;
961 spec
->init_hook
= preset
->init_hook
;
962 #ifdef CONFIG_SND_HDA_POWER_SAVE
963 spec
->power_hook
= preset
->power_hook
;
964 spec
->loopback
.amplist
= preset
->loopbacks
;
968 preset
->setup(codec
);
970 alc_fixup_autocfg_pin_nums(codec
);
973 /* Enable GPIO mask and set output */
974 static struct hda_verb alc_gpio1_init_verbs
[] = {
975 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
976 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
977 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
981 static struct hda_verb alc_gpio2_init_verbs
[] = {
982 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
983 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
984 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
988 static struct hda_verb alc_gpio3_init_verbs
[] = {
989 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
990 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
991 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
996 * Fix hardware PLL issue
997 * On some codecs, the analog PLL gating control must be off while
998 * the default value is 1.
1000 static void alc_fix_pll(struct hda_codec
*codec
)
1002 struct alc_spec
*spec
= codec
->spec
;
1007 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
1008 spec
->pll_coef_idx
);
1009 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
1010 AC_VERB_GET_PROC_COEF
, 0);
1011 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
1012 spec
->pll_coef_idx
);
1013 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
1014 val
& ~(1 << spec
->pll_coef_bit
));
1017 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
1018 unsigned int coef_idx
, unsigned int coef_bit
)
1020 struct alc_spec
*spec
= codec
->spec
;
1021 spec
->pll_nid
= nid
;
1022 spec
->pll_coef_idx
= coef_idx
;
1023 spec
->pll_coef_bit
= coef_bit
;
1027 static int alc_init_jacks(struct hda_codec
*codec
)
1029 #ifdef CONFIG_SND_HDA_INPUT_JACK
1030 struct alc_spec
*spec
= codec
->spec
;
1032 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
1033 unsigned int mic_nid
= spec
->ext_mic
.pin
;
1036 err
= snd_hda_input_jack_add(codec
, hp_nid
,
1037 SND_JACK_HEADPHONE
, NULL
);
1040 snd_hda_input_jack_report(codec
, hp_nid
);
1044 err
= snd_hda_input_jack_add(codec
, mic_nid
,
1045 SND_JACK_MICROPHONE
, NULL
);
1048 snd_hda_input_jack_report(codec
, mic_nid
);
1050 #endif /* CONFIG_SND_HDA_INPUT_JACK */
1054 static void alc_automute_speaker(struct hda_codec
*codec
, int pinctl
)
1056 struct alc_spec
*spec
= codec
->spec
;
1061 spec
->jack_present
= 0;
1062 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.hp_pins
); i
++) {
1063 nid
= spec
->autocfg
.hp_pins
[i
];
1066 snd_hda_input_jack_report(codec
, nid
);
1067 spec
->jack_present
|= snd_hda_jack_detect(codec
, nid
);
1070 mute
= spec
->jack_present
? HDA_AMP_MUTE
: 0;
1071 /* Toggle internal speakers muting */
1072 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
1073 nid
= spec
->autocfg
.speaker_pins
[i
];
1077 snd_hda_codec_write(codec
, nid
, 0,
1078 AC_VERB_SET_PIN_WIDGET_CONTROL
,
1079 spec
->jack_present
? 0 : PIN_OUT
);
1081 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
1082 HDA_AMP_MUTE
, mute
);
1087 static void alc_automute_pin(struct hda_codec
*codec
)
1089 alc_automute_speaker(codec
, 1);
1092 static int get_connection_index(struct hda_codec
*codec
, hda_nid_t mux
,
1095 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
1098 nums
= snd_hda_get_connections(codec
, mux
, conn
, ARRAY_SIZE(conn
));
1099 for (i
= 0; i
< nums
; i
++)
1105 /* switch the current ADC according to the jack state */
1106 static void alc_dual_mic_adc_auto_switch(struct hda_codec
*codec
)
1108 struct alc_spec
*spec
= codec
->spec
;
1109 unsigned int present
;
1112 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1114 spec
->cur_adc_idx
= 1;
1116 spec
->cur_adc_idx
= 0;
1117 new_adc
= spec
->adc_nids
[spec
->cur_adc_idx
];
1118 if (spec
->cur_adc
&& spec
->cur_adc
!= new_adc
) {
1119 /* stream is running, let's swap the current ADC */
1120 __snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
, 1);
1121 spec
->cur_adc
= new_adc
;
1122 snd_hda_codec_setup_stream(codec
, new_adc
,
1123 spec
->cur_adc_stream_tag
, 0,
1124 spec
->cur_adc_format
);
1128 static void alc_mic_automute(struct hda_codec
*codec
)
1130 struct alc_spec
*spec
= codec
->spec
;
1131 struct alc_mic_route
*dead
, *alive
;
1132 unsigned int present
, type
;
1135 if (!spec
->auto_mic
)
1137 if (!spec
->int_mic
.pin
|| !spec
->ext_mic
.pin
)
1139 if (snd_BUG_ON(!spec
->adc_nids
))
1142 if (spec
->dual_adc_switch
) {
1143 alc_dual_mic_adc_auto_switch(codec
);
1147 cap_nid
= spec
->capsrc_nids
? spec
->capsrc_nids
[0] : spec
->adc_nids
[0];
1149 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1151 alive
= &spec
->ext_mic
;
1152 dead
= &spec
->int_mic
;
1154 alive
= &spec
->int_mic
;
1155 dead
= &spec
->ext_mic
;
1158 type
= get_wcaps_type(get_wcaps(codec
, cap_nid
));
1159 if (type
== AC_WID_AUD_MIX
) {
1160 /* Matrix-mixer style (e.g. ALC882) */
1161 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1164 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1166 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
1168 /* MUX style (e.g. ALC880) */
1169 snd_hda_codec_write_cache(codec
, cap_nid
, 0,
1170 AC_VERB_SET_CONNECT_SEL
,
1173 snd_hda_input_jack_report(codec
, spec
->ext_mic
.pin
);
1175 /* FIXME: analog mixer */
1178 /* unsolicited event for HP jack sensing */
1179 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1181 if (codec
->vendor_id
== 0x10ec0880)
1186 case ALC880_HP_EVENT
:
1187 alc_automute_pin(codec
);
1189 case ALC880_MIC_EVENT
:
1190 alc_mic_automute(codec
);
1195 static void alc_inithook(struct hda_codec
*codec
)
1197 alc_automute_pin(codec
);
1198 alc_mic_automute(codec
);
1201 /* additional initialization for ALC888 variants */
1202 static void alc888_coef_init(struct hda_codec
*codec
)
1206 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
1207 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1208 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1209 if ((tmp
& 0xf0) == 0x20)
1211 snd_hda_codec_read(codec
, 0x20, 0,
1212 AC_VERB_SET_PROC_COEF
, 0x830);
1215 snd_hda_codec_read(codec
, 0x20, 0,
1216 AC_VERB_SET_PROC_COEF
, 0x3030);
1219 static void alc889_coef_init(struct hda_codec
*codec
)
1223 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1224 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1225 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1226 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
, tmp
|0x2010);
1229 /* turn on/off EAPD control (only if available) */
1230 static void set_eapd(struct hda_codec
*codec
, hda_nid_t nid
, int on
)
1232 if (get_wcaps_type(get_wcaps(codec
, nid
)) != AC_WID_PIN
)
1234 if (snd_hda_query_pin_caps(codec
, nid
) & AC_PINCAP_EAPD
)
1235 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
1239 static void alc_auto_init_amp(struct hda_codec
*codec
, int type
)
1244 case ALC_INIT_GPIO1
:
1245 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
1247 case ALC_INIT_GPIO2
:
1248 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
1250 case ALC_INIT_GPIO3
:
1251 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
1253 case ALC_INIT_DEFAULT
:
1254 switch (codec
->vendor_id
) {
1256 set_eapd(codec
, 0x0f, 1);
1257 set_eapd(codec
, 0x10, 1);
1270 set_eapd(codec
, 0x14, 1);
1271 set_eapd(codec
, 0x15, 1);
1274 switch (codec
->vendor_id
) {
1276 snd_hda_codec_write(codec
, 0x1a, 0,
1277 AC_VERB_SET_COEF_INDEX
, 7);
1278 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
1279 AC_VERB_GET_PROC_COEF
, 0);
1280 snd_hda_codec_write(codec
, 0x1a, 0,
1281 AC_VERB_SET_COEF_INDEX
, 7);
1282 snd_hda_codec_write(codec
, 0x1a, 0,
1283 AC_VERB_SET_PROC_COEF
,
1293 alc889_coef_init(codec
);
1296 alc888_coef_init(codec
);
1298 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1301 snd_hda_codec_write(codec
, 0x20, 0,
1302 AC_VERB_SET_COEF_INDEX
, 7);
1303 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1304 AC_VERB_GET_PROC_COEF
, 0);
1305 snd_hda_codec_write(codec
, 0x20, 0,
1306 AC_VERB_SET_COEF_INDEX
, 7);
1307 snd_hda_codec_write(codec
, 0x20, 0,
1308 AC_VERB_SET_PROC_COEF
,
1317 static void alc_init_auto_hp(struct hda_codec
*codec
)
1319 struct alc_spec
*spec
= codec
->spec
;
1320 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1323 if (!cfg
->hp_pins
[0]) {
1324 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
)
1328 if (!cfg
->speaker_pins
[0]) {
1329 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
)
1331 memcpy(cfg
->speaker_pins
, cfg
->line_out_pins
,
1332 sizeof(cfg
->speaker_pins
));
1333 cfg
->speaker_outs
= cfg
->line_outs
;
1336 if (!cfg
->hp_pins
[0]) {
1337 memcpy(cfg
->hp_pins
, cfg
->line_out_pins
,
1338 sizeof(cfg
->hp_pins
));
1339 cfg
->hp_outs
= cfg
->line_outs
;
1342 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
1343 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1345 snd_hda_codec_write_cache(codec
, cfg
->hp_pins
[i
], 0,
1346 AC_VERB_SET_UNSOLICITED_ENABLE
,
1347 AC_USRSP_EN
| ALC880_HP_EVENT
);
1349 spec
->unsol_event
= alc_sku_unsol_event
;
1352 static void alc_init_auto_mic(struct hda_codec
*codec
)
1354 struct alc_spec
*spec
= codec
->spec
;
1355 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1356 hda_nid_t fixed
, ext
;
1359 /* there must be only two mic inputs exclusively */
1360 for (i
= 0; i
< cfg
->num_inputs
; i
++)
1361 if (cfg
->inputs
[i
].type
>= AUTO_PIN_LINE_IN
)
1365 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
1366 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
1367 unsigned int defcfg
;
1368 defcfg
= snd_hda_codec_get_pincfg(codec
, nid
);
1369 switch (snd_hda_get_input_pin_attr(defcfg
)) {
1370 case INPUT_PIN_ATTR_INT
:
1372 return; /* already occupied */
1375 case INPUT_PIN_ATTR_UNUSED
:
1376 return; /* invalid entry */
1379 return; /* already occupied */
1386 if (!(get_wcaps(codec
, ext
) & AC_WCAP_UNSOL_CAP
))
1387 return; /* no unsol support */
1388 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1390 spec
->ext_mic
.pin
= ext
;
1391 spec
->int_mic
.pin
= fixed
;
1392 spec
->ext_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1393 spec
->int_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1395 snd_hda_codec_write_cache(codec
, spec
->ext_mic
.pin
, 0,
1396 AC_VERB_SET_UNSOLICITED_ENABLE
,
1397 AC_USRSP_EN
| ALC880_MIC_EVENT
);
1398 spec
->unsol_event
= alc_sku_unsol_event
;
1401 /* Could be any non-zero and even value. When used as fixup, tells
1402 * the driver to ignore any present sku defines.
1404 #define ALC_FIXUP_SKU_IGNORE (2)
1406 static int alc_auto_parse_customize_define(struct hda_codec
*codec
)
1408 unsigned int ass
, tmp
, i
;
1410 struct alc_spec
*spec
= codec
->spec
;
1412 spec
->cdefine
.enable_pcbeep
= 1; /* assume always enabled */
1414 if (spec
->cdefine
.fixup
) {
1415 ass
= spec
->cdefine
.sku_cfg
;
1416 if (ass
== ALC_FIXUP_SKU_IGNORE
)
1421 ass
= codec
->subsystem_id
& 0xffff;
1422 if (ass
!= codec
->bus
->pci
->subsystem_device
&& (ass
& 1))
1426 if (codec
->vendor_id
== 0x10ec0260)
1428 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1431 printk(KERN_INFO
"hda_codec: %s: SKU not ready 0x%08x\n",
1432 codec
->chip_name
, ass
);
1438 for (i
= 1; i
< 16; i
++) {
1442 if (((ass
>> 16) & 0xf) != tmp
)
1445 spec
->cdefine
.port_connectivity
= ass
>> 30;
1446 spec
->cdefine
.enable_pcbeep
= (ass
& 0x100000) >> 20;
1447 spec
->cdefine
.check_sum
= (ass
>> 16) & 0xf;
1448 spec
->cdefine
.customization
= ass
>> 8;
1450 spec
->cdefine
.sku_cfg
= ass
;
1451 spec
->cdefine
.external_amp
= (ass
& 0x38) >> 3;
1452 spec
->cdefine
.platform_type
= (ass
& 0x4) >> 2;
1453 spec
->cdefine
.swap
= (ass
& 0x2) >> 1;
1454 spec
->cdefine
.override
= ass
& 0x1;
1456 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1457 nid
, spec
->cdefine
.sku_cfg
);
1458 snd_printd("SKU: port_connectivity=0x%x\n",
1459 spec
->cdefine
.port_connectivity
);
1460 snd_printd("SKU: enable_pcbeep=0x%x\n", spec
->cdefine
.enable_pcbeep
);
1461 snd_printd("SKU: check_sum=0x%08x\n", spec
->cdefine
.check_sum
);
1462 snd_printd("SKU: customization=0x%08x\n", spec
->cdefine
.customization
);
1463 snd_printd("SKU: external_amp=0x%x\n", spec
->cdefine
.external_amp
);
1464 snd_printd("SKU: platform_type=0x%x\n", spec
->cdefine
.platform_type
);
1465 snd_printd("SKU: swap=0x%x\n", spec
->cdefine
.swap
);
1466 snd_printd("SKU: override=0x%x\n", spec
->cdefine
.override
);
1471 /* check subsystem ID and set up device-specific initialization;
1472 * return 1 if initialized, 0 if invalid SSID
1474 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1475 * 31 ~ 16 : Manufacture ID
1477 * 7 ~ 0 : Assembly ID
1478 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1480 static int alc_subsystem_id(struct hda_codec
*codec
,
1481 hda_nid_t porta
, hda_nid_t porte
,
1482 hda_nid_t portd
, hda_nid_t porti
)
1484 unsigned int ass
, tmp
, i
;
1486 struct alc_spec
*spec
= codec
->spec
;
1488 if (spec
->cdefine
.fixup
) {
1489 ass
= spec
->cdefine
.sku_cfg
;
1490 if (ass
== ALC_FIXUP_SKU_IGNORE
)
1495 ass
= codec
->subsystem_id
& 0xffff;
1496 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
1499 /* invalid SSID, check the special NID pin defcfg instead */
1501 * 31~30 : port connectivity
1504 * 19~16 : Check sum (15:1)
1509 if (codec
->vendor_id
== 0x10ec0260)
1511 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1512 snd_printd("realtek: No valid SSID, "
1513 "checking pincfg 0x%08x for NID 0x%x\n",
1517 if ((ass
>> 30) != 1) /* no physical connection */
1522 for (i
= 1; i
< 16; i
++) {
1526 if (((ass
>> 16) & 0xf) != tmp
)
1529 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1530 ass
& 0xffff, codec
->vendor_id
);
1534 * 2 : 0 --> Desktop, 1 --> Laptop
1535 * 3~5 : External Amplifier control
1538 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
1541 spec
->init_amp
= ALC_INIT_GPIO1
;
1544 spec
->init_amp
= ALC_INIT_GPIO2
;
1547 spec
->init_amp
= ALC_INIT_GPIO3
;
1551 spec
->init_amp
= ALC_INIT_DEFAULT
;
1555 /* is laptop or Desktop and enable the function "Mute internal speaker
1556 * when the external headphone out jack is plugged"
1558 if (!(ass
& 0x8000))
1561 * 10~8 : Jack location
1562 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1564 * 15 : 1 --> enable the function "Mute internal speaker
1565 * when the external headphone out jack is plugged"
1567 if (!spec
->autocfg
.hp_pins
[0]) {
1569 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
1580 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++)
1581 if (spec
->autocfg
.line_out_pins
[i
] == nid
)
1583 spec
->autocfg
.hp_pins
[0] = nid
;
1586 alc_init_auto_hp(codec
);
1587 alc_init_auto_mic(codec
);
1591 static void alc_ssid_check(struct hda_codec
*codec
,
1592 hda_nid_t porta
, hda_nid_t porte
,
1593 hda_nid_t portd
, hda_nid_t porti
)
1595 if (!alc_subsystem_id(codec
, porta
, porte
, portd
, porti
)) {
1596 struct alc_spec
*spec
= codec
->spec
;
1597 snd_printd("realtek: "
1598 "Enable default setup for auto mode as fallback\n");
1599 spec
->init_amp
= ALC_INIT_DEFAULT
;
1600 alc_init_auto_hp(codec
);
1601 alc_init_auto_mic(codec
);
1606 * Fix-up pin default configurations and add default verbs
1614 struct alc_model_fixup
{
1625 const struct alc_pincfg
*pins
;
1626 const struct hda_verb
*verbs
;
1627 void (*func
)(struct hda_codec
*codec
,
1628 const struct alc_fixup
*fix
,
1642 ALC_FIXUP_ACT_PRE_PROBE
,
1643 ALC_FIXUP_ACT_PROBE
,
1647 static void alc_apply_fixup(struct hda_codec
*codec
, int action
)
1649 struct alc_spec
*spec
= codec
->spec
;
1650 int id
= spec
->fixup_id
;
1651 #ifdef CONFIG_SND_DEBUG_VERBOSE
1652 const char *modelname
= spec
->fixup_name
;
1656 if (!spec
->fixup_list
)
1660 const struct alc_fixup
*fix
= spec
->fixup_list
+ id
;
1661 const struct alc_pincfg
*cfg
;
1663 switch (fix
->type
) {
1665 if (action
!= ALC_FIXUP_ACT_PRE_PROBE
|| !fix
->v
.sku
)
1667 snd_printdd(KERN_INFO
"hda_codec: %s: "
1668 "Apply sku override for %s\n",
1669 codec
->chip_name
, modelname
);
1670 spec
->cdefine
.sku_cfg
= fix
->v
.sku
;
1671 spec
->cdefine
.fixup
= 1;
1673 case ALC_FIXUP_PINS
:
1675 if (action
!= ALC_FIXUP_ACT_PRE_PROBE
|| !cfg
)
1677 snd_printdd(KERN_INFO
"hda_codec: %s: "
1678 "Apply pincfg for %s\n",
1679 codec
->chip_name
, modelname
);
1680 for (; cfg
->nid
; cfg
++)
1681 snd_hda_codec_set_pincfg(codec
, cfg
->nid
,
1684 case ALC_FIXUP_VERBS
:
1685 if (action
!= ALC_FIXUP_ACT_PROBE
|| !fix
->v
.verbs
)
1687 snd_printdd(KERN_INFO
"hda_codec: %s: "
1688 "Apply fix-verbs for %s\n",
1689 codec
->chip_name
, modelname
);
1690 add_verb(codec
->spec
, fix
->v
.verbs
);
1692 case ALC_FIXUP_FUNC
:
1695 snd_printdd(KERN_INFO
"hda_codec: %s: "
1696 "Apply fix-func for %s\n",
1697 codec
->chip_name
, modelname
);
1698 fix
->v
.func(codec
, fix
, action
);
1701 snd_printk(KERN_ERR
"hda_codec: %s: "
1702 "Invalid fixup type %d\n",
1703 codec
->chip_name
, fix
->type
);
1706 if (!fix
[id
].chained
)
1710 id
= fix
[id
].chain_id
;
1714 static void alc_pick_fixup(struct hda_codec
*codec
,
1715 const struct alc_model_fixup
*models
,
1716 const struct snd_pci_quirk
*quirk
,
1717 const struct alc_fixup
*fixlist
)
1719 struct alc_spec
*spec
= codec
->spec
;
1721 const char *name
= NULL
;
1723 if (codec
->modelname
&& models
) {
1724 while (models
->name
) {
1725 if (!strcmp(codec
->modelname
, models
->name
)) {
1727 name
= models
->name
;
1734 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
1737 #ifdef CONFIG_SND_DEBUG_VERBOSE
1743 spec
->fixup_id
= id
;
1745 spec
->fixup_list
= fixlist
;
1746 spec
->fixup_name
= name
;
1750 static int alc_read_coef_idx(struct hda_codec
*codec
,
1751 unsigned int coef_idx
)
1754 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
1756 val
= snd_hda_codec_read(codec
, 0x20, 0,
1757 AC_VERB_GET_PROC_COEF
, 0);
1761 static void alc_write_coef_idx(struct hda_codec
*codec
, unsigned int coef_idx
,
1762 unsigned int coef_val
)
1764 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
1766 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
,
1770 /* set right pin controls for digital I/O */
1771 static void alc_auto_init_digital(struct hda_codec
*codec
)
1773 struct alc_spec
*spec
= codec
->spec
;
1777 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
1778 pin
= spec
->autocfg
.dig_out_pins
[i
];
1780 snd_hda_codec_write(codec
, pin
, 0,
1781 AC_VERB_SET_PIN_WIDGET_CONTROL
,
1785 pin
= spec
->autocfg
.dig_in_pin
;
1787 snd_hda_codec_write(codec
, pin
, 0,
1788 AC_VERB_SET_PIN_WIDGET_CONTROL
,
1792 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1793 static void alc_auto_parse_digital(struct hda_codec
*codec
)
1795 struct alc_spec
*spec
= codec
->spec
;
1799 /* support multiple SPDIFs; the secondary is set up as a slave */
1800 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
1801 err
= snd_hda_get_connections(codec
,
1802 spec
->autocfg
.dig_out_pins
[i
],
1807 spec
->multiout
.dig_out_nid
= dig_nid
;
1808 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
1810 spec
->multiout
.slave_dig_outs
= spec
->slave_dig_outs
;
1811 if (i
>= ARRAY_SIZE(spec
->slave_dig_outs
) - 1)
1813 spec
->slave_dig_outs
[i
- 1] = dig_nid
;
1817 if (spec
->autocfg
.dig_in_pin
) {
1818 dig_nid
= codec
->start_nid
;
1819 for (i
= 0; i
< codec
->num_nodes
; i
++, dig_nid
++) {
1820 unsigned int wcaps
= get_wcaps(codec
, dig_nid
);
1821 if (get_wcaps_type(wcaps
) != AC_WID_AUD_IN
)
1823 if (!(wcaps
& AC_WCAP_DIGITAL
))
1825 if (!(wcaps
& AC_WCAP_CONN_LIST
))
1827 err
= get_connection_index(codec
, dig_nid
,
1828 spec
->autocfg
.dig_in_pin
);
1830 spec
->dig_in_nid
= dig_nid
;
1844 static struct hda_verb alc888_4ST_ch2_intel_init
[] = {
1845 /* Mic-in jack as mic in */
1846 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1847 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1848 /* Line-in jack as Line in */
1849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1850 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1851 /* Line-Out as Front */
1852 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1859 static struct hda_verb alc888_4ST_ch4_intel_init
[] = {
1860 /* Mic-in jack as mic in */
1861 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1862 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1863 /* Line-in jack as Surround */
1864 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1865 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1866 /* Line-Out as Front */
1867 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1874 static struct hda_verb alc888_4ST_ch6_intel_init
[] = {
1875 /* Mic-in jack as CLFE */
1876 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1877 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1878 /* Line-in jack as Surround */
1879 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1880 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1881 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1882 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1889 static struct hda_verb alc888_4ST_ch8_intel_init
[] = {
1890 /* Mic-in jack as CLFE */
1891 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1892 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1893 /* Line-in jack as Surround */
1894 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1895 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1896 /* Line-Out as Side */
1897 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1901 static struct hda_channel_mode alc888_4ST_8ch_intel_modes
[4] = {
1902 { 2, alc888_4ST_ch2_intel_init
},
1903 { 4, alc888_4ST_ch4_intel_init
},
1904 { 6, alc888_4ST_ch6_intel_init
},
1905 { 8, alc888_4ST_ch8_intel_init
},
1909 * ALC888 Fujitsu Siemens Amillo xa3530
1912 static struct hda_verb alc888_fujitsu_xa3530_verbs
[] = {
1913 /* Front Mic: set to PIN_IN (empty by default) */
1914 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1915 /* Connect Internal HP to Front */
1916 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1917 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1918 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1919 /* Connect Bass HP to Front */
1920 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1921 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1922 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1923 /* Connect Line-Out side jack (SPDIF) to Side */
1924 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1925 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1926 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1927 /* Connect Mic jack to CLFE */
1928 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1929 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1930 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
1931 /* Connect Line-in jack to Surround */
1932 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1933 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1934 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
1935 /* Connect HP out jack to Front */
1936 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1937 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1938 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1939 /* Enable unsolicited event for HP jack and Line-out jack */
1940 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1941 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1945 static void alc_automute_amp(struct hda_codec
*codec
)
1947 alc_automute_speaker(codec
, 0);
1950 static void alc_automute_amp_unsol_event(struct hda_codec
*codec
,
1953 if (codec
->vendor_id
== 0x10ec0880)
1957 if (res
== ALC880_HP_EVENT
)
1958 alc_automute_amp(codec
);
1961 static void alc889_automute_setup(struct hda_codec
*codec
)
1963 struct alc_spec
*spec
= codec
->spec
;
1965 spec
->autocfg
.hp_pins
[0] = 0x15;
1966 spec
->autocfg
.speaker_pins
[0] = 0x14;
1967 spec
->autocfg
.speaker_pins
[1] = 0x16;
1968 spec
->autocfg
.speaker_pins
[2] = 0x17;
1969 spec
->autocfg
.speaker_pins
[3] = 0x19;
1970 spec
->autocfg
.speaker_pins
[4] = 0x1a;
1973 static void alc889_intel_init_hook(struct hda_codec
*codec
)
1975 alc889_coef_init(codec
);
1976 alc_automute_amp(codec
);
1979 static void alc888_fujitsu_xa3530_setup(struct hda_codec
*codec
)
1981 struct alc_spec
*spec
= codec
->spec
;
1983 spec
->autocfg
.hp_pins
[0] = 0x17; /* line-out */
1984 spec
->autocfg
.hp_pins
[1] = 0x1b; /* hp */
1985 spec
->autocfg
.speaker_pins
[0] = 0x14; /* speaker */
1986 spec
->autocfg
.speaker_pins
[1] = 0x15; /* bass */
1990 * ALC888 Acer Aspire 4930G model
1993 static struct hda_verb alc888_acer_aspire_4930g_verbs
[] = {
1994 /* Front Mic: set to PIN_IN (empty by default) */
1995 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1996 /* Unselect Front Mic by default in input mixer 3 */
1997 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
1998 /* Enable unsolicited event for HP jack */
1999 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2000 /* Connect Internal HP to front */
2001 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2002 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2003 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2004 /* Connect HP out to front */
2005 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2007 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2008 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2013 * ALC888 Acer Aspire 6530G model
2016 static struct hda_verb alc888_acer_aspire_6530g_verbs
[] = {
2017 /* Route to built-in subwoofer as well as speakers */
2018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2020 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2021 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2022 /* Bias voltage on for external mic port */
2023 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
2024 /* Front Mic: set to PIN_IN (empty by default) */
2025 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2026 /* Unselect Front Mic by default in input mixer 3 */
2027 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2028 /* Enable unsolicited event for HP jack */
2029 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2030 /* Enable speaker output */
2031 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2032 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2033 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2034 /* Enable headphone output */
2035 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2036 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2037 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2038 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2043 *ALC888 Acer Aspire 7730G model
2046 static struct hda_verb alc888_acer_aspire_7730G_verbs
[] = {
2047 /* Bias voltage on for external mic port */
2048 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
2049 /* Front Mic: set to PIN_IN (empty by default) */
2050 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2051 /* Unselect Front Mic by default in input mixer 3 */
2052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2053 /* Enable unsolicited event for HP jack */
2054 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2055 /* Enable speaker output */
2056 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2057 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2058 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2059 /* Enable headphone output */
2060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2061 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2062 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2063 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2064 /*Enable internal subwoofer */
2065 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2066 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2067 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
2068 {0x17, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2073 * ALC889 Acer Aspire 8930G model
2076 static struct hda_verb alc889_acer_aspire_8930g_verbs
[] = {
2077 /* Front Mic: set to PIN_IN (empty by default) */
2078 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2079 /* Unselect Front Mic by default in input mixer 3 */
2080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2081 /* Enable unsolicited event for HP jack */
2082 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2083 /* Connect Internal Front to Front */
2084 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2085 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2086 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2087 /* Connect Internal Rear to Rear */
2088 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2089 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2090 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
2091 /* Connect Internal CLFE to CLFE */
2092 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2093 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2094 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
2095 /* Connect HP out to Front */
2096 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2097 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2098 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2099 /* Enable all DACs */
2100 /* DAC DISABLE/MUTE 1? */
2101 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2102 {0x20, AC_VERB_SET_COEF_INDEX
, 0x03},
2103 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
2104 /* DAC DISABLE/MUTE 2? */
2105 /* some bit here disables the other DACs. Init=0x4900 */
2106 {0x20, AC_VERB_SET_COEF_INDEX
, 0x08},
2107 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
2109 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2110 * which makes the stereo useless. However, either the mic or the ALC889
2111 * makes the signal become a difference/sum signal instead of standard
2112 * stereo, which is annoying. So instead we flip this bit which makes the
2113 * codec replicate the sum signal to both channels, turning it into a
2116 /* DMIC_CONTROL? Init value = 0x0001 */
2117 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
2118 {0x20, AC_VERB_SET_PROC_COEF
, 0x0003},
2122 static struct hda_input_mux alc888_2_capture_sources
[2] = {
2123 /* Front mic only available on one ADC */
2130 { "Front Mic", 0xb },
2143 static struct hda_input_mux alc888_acer_aspire_6530_sources
[2] = {
2144 /* Interal mic only available on one ADC */
2151 { "Input Mix", 0xa },
2152 { "Internal Mic", 0xb },
2161 { "Input Mix", 0xa },
2166 static struct hda_input_mux alc889_capture_sources
[3] = {
2167 /* Digital mic only available on first "ADC" */
2174 { "Front Mic", 0xb },
2175 { "Input Mix", 0xa },
2184 { "Input Mix", 0xa },
2193 { "Input Mix", 0xa },
2198 static struct snd_kcontrol_new alc888_base_mixer
[] = {
2199 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2200 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2201 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2202 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2203 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2205 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2206 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2207 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2208 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2209 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2210 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2211 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2212 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2213 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2215 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2220 static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer
[] = {
2221 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2222 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2223 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2224 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2225 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2227 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2228 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2229 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2230 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT
),
2231 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT
),
2232 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2233 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2234 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2235 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2237 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2238 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2242 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer
[] = {
2243 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2244 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2245 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2246 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2247 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2249 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2250 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2251 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2252 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2253 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2255 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2256 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2261 static void alc888_acer_aspire_4930g_setup(struct hda_codec
*codec
)
2263 struct alc_spec
*spec
= codec
->spec
;
2265 spec
->autocfg
.hp_pins
[0] = 0x15;
2266 spec
->autocfg
.speaker_pins
[0] = 0x14;
2267 spec
->autocfg
.speaker_pins
[1] = 0x16;
2268 spec
->autocfg
.speaker_pins
[2] = 0x17;
2271 static void alc888_acer_aspire_6530g_setup(struct hda_codec
*codec
)
2273 struct alc_spec
*spec
= codec
->spec
;
2275 spec
->autocfg
.hp_pins
[0] = 0x15;
2276 spec
->autocfg
.speaker_pins
[0] = 0x14;
2277 spec
->autocfg
.speaker_pins
[1] = 0x16;
2278 spec
->autocfg
.speaker_pins
[2] = 0x17;
2281 static void alc888_acer_aspire_7730g_setup(struct hda_codec
*codec
)
2283 struct alc_spec
*spec
= codec
->spec
;
2285 spec
->autocfg
.hp_pins
[0] = 0x15;
2286 spec
->autocfg
.speaker_pins
[0] = 0x14;
2287 spec
->autocfg
.speaker_pins
[1] = 0x16;
2288 spec
->autocfg
.speaker_pins
[2] = 0x17;
2291 static void alc889_acer_aspire_8930g_setup(struct hda_codec
*codec
)
2293 struct alc_spec
*spec
= codec
->spec
;
2295 spec
->autocfg
.hp_pins
[0] = 0x15;
2296 spec
->autocfg
.speaker_pins
[0] = 0x14;
2297 spec
->autocfg
.speaker_pins
[1] = 0x16;
2298 spec
->autocfg
.speaker_pins
[2] = 0x1b;
2302 * ALC880 3-stack model
2304 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2305 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2306 * F-Mic = 0x1b, HP = 0x19
2309 static hda_nid_t alc880_dac_nids
[4] = {
2310 /* front, rear, clfe, rear_surr */
2311 0x02, 0x05, 0x04, 0x03
2314 static hda_nid_t alc880_adc_nids
[3] = {
2319 /* The datasheet says the node 0x07 is connected from inputs,
2320 * but it shows zero connection in the real implementation on some devices.
2321 * Note: this is a 915GAV bug, fixed on 915GLV
2323 static hda_nid_t alc880_adc_nids_alt
[2] = {
2328 #define ALC880_DIGOUT_NID 0x06
2329 #define ALC880_DIGIN_NID 0x0a
2331 static struct hda_input_mux alc880_capture_source
= {
2335 { "Front Mic", 0x3 },
2341 /* channel source setting (2/6 channel selection for 3-stack) */
2343 static struct hda_verb alc880_threestack_ch2_init
[] = {
2344 /* set line-in to input, mute it */
2345 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2346 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2347 /* set mic-in to input vref 80%, mute it */
2348 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2349 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2354 static struct hda_verb alc880_threestack_ch6_init
[] = {
2355 /* set line-in to output, unmute it */
2356 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2357 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2358 /* set mic-in to output, unmute it */
2359 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2360 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2364 static struct hda_channel_mode alc880_threestack_modes
[2] = {
2365 { 2, alc880_threestack_ch2_init
},
2366 { 6, alc880_threestack_ch6_init
},
2369 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
2370 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2371 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2372 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2373 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2374 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2375 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2376 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2377 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2378 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2379 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2380 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2381 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2382 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2383 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2384 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2385 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2386 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
2388 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2389 .name
= "Channel Mode",
2390 .info
= alc_ch_mode_info
,
2391 .get
= alc_ch_mode_get
,
2392 .put
= alc_ch_mode_put
,
2397 /* capture mixer elements */
2398 static int alc_cap_vol_info(struct snd_kcontrol
*kcontrol
,
2399 struct snd_ctl_elem_info
*uinfo
)
2401 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2402 struct alc_spec
*spec
= codec
->spec
;
2405 mutex_lock(&codec
->control_mutex
);
2406 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2408 err
= snd_hda_mixer_amp_volume_info(kcontrol
, uinfo
);
2409 mutex_unlock(&codec
->control_mutex
);
2413 static int alc_cap_vol_tlv(struct snd_kcontrol
*kcontrol
, int op_flag
,
2414 unsigned int size
, unsigned int __user
*tlv
)
2416 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2417 struct alc_spec
*spec
= codec
->spec
;
2420 mutex_lock(&codec
->control_mutex
);
2421 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2423 err
= snd_hda_mixer_amp_tlv(kcontrol
, op_flag
, size
, tlv
);
2424 mutex_unlock(&codec
->control_mutex
);
2428 typedef int (*getput_call_t
)(struct snd_kcontrol
*kcontrol
,
2429 struct snd_ctl_elem_value
*ucontrol
);
2431 static int alc_cap_getput_caller(struct snd_kcontrol
*kcontrol
,
2432 struct snd_ctl_elem_value
*ucontrol
,
2435 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2436 struct alc_spec
*spec
= codec
->spec
;
2437 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
2440 mutex_lock(&codec
->control_mutex
);
2441 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[adc_idx
],
2443 err
= func(kcontrol
, ucontrol
);
2444 mutex_unlock(&codec
->control_mutex
);
2448 static int alc_cap_vol_get(struct snd_kcontrol
*kcontrol
,
2449 struct snd_ctl_elem_value
*ucontrol
)
2451 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2452 snd_hda_mixer_amp_volume_get
);
2455 static int alc_cap_vol_put(struct snd_kcontrol
*kcontrol
,
2456 struct snd_ctl_elem_value
*ucontrol
)
2458 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2459 snd_hda_mixer_amp_volume_put
);
2462 /* capture mixer elements */
2463 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2465 static int alc_cap_sw_get(struct snd_kcontrol
*kcontrol
,
2466 struct snd_ctl_elem_value
*ucontrol
)
2468 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2469 snd_hda_mixer_amp_switch_get
);
2472 static int alc_cap_sw_put(struct snd_kcontrol
*kcontrol
,
2473 struct snd_ctl_elem_value
*ucontrol
)
2475 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2476 snd_hda_mixer_amp_switch_put
);
2479 #define _DEFINE_CAPMIX(num) \
2481 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2482 .name = "Capture Switch", \
2483 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2485 .info = alc_cap_sw_info, \
2486 .get = alc_cap_sw_get, \
2487 .put = alc_cap_sw_put, \
2490 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2491 .name = "Capture Volume", \
2492 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2493 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2494 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2496 .info = alc_cap_vol_info, \
2497 .get = alc_cap_vol_get, \
2498 .put = alc_cap_vol_put, \
2499 .tlv = { .c = alc_cap_vol_tlv }, \
2502 #define _DEFINE_CAPSRC(num) \
2504 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2505 /* .name = "Capture Source", */ \
2506 .name = "Input Source", \
2508 .info = alc_mux_enum_info, \
2509 .get = alc_mux_enum_get, \
2510 .put = alc_mux_enum_put, \
2513 #define DEFINE_CAPMIX(num) \
2514 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2515 _DEFINE_CAPMIX(num), \
2516 _DEFINE_CAPSRC(num), \
2520 #define DEFINE_CAPMIX_NOSRC(num) \
2521 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2522 _DEFINE_CAPMIX(num), \
2526 /* up to three ADCs */
2530 DEFINE_CAPMIX_NOSRC(1);
2531 DEFINE_CAPMIX_NOSRC(2);
2532 DEFINE_CAPMIX_NOSRC(3);
2535 * ALC880 5-stack model
2537 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2539 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2540 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2543 /* additional mixers to alc880_three_stack_mixer */
2544 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
2545 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2546 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
2550 /* channel source setting (6/8 channel selection for 5-stack) */
2552 static struct hda_verb alc880_fivestack_ch6_init
[] = {
2553 /* set line-in to input, mute it */
2554 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2555 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2560 static struct hda_verb alc880_fivestack_ch8_init
[] = {
2561 /* set line-in to output, unmute it */
2562 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2563 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2567 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
2568 { 6, alc880_fivestack_ch6_init
},
2569 { 8, alc880_fivestack_ch8_init
},
2574 * ALC880 6-stack model
2576 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2577 * Side = 0x05 (0x0f)
2578 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2579 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2582 static hda_nid_t alc880_6st_dac_nids
[4] = {
2583 /* front, rear, clfe, rear_surr */
2584 0x02, 0x03, 0x04, 0x05
2587 static struct hda_input_mux alc880_6stack_capture_source
= {
2591 { "Front Mic", 0x1 },
2597 /* fixed 8-channels */
2598 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
2602 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
2603 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2604 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2605 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2606 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2607 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2608 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2609 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2610 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2611 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2612 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2613 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2614 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2615 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2616 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2619 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2620 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2622 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2623 .name
= "Channel Mode",
2624 .info
= alc_ch_mode_info
,
2625 .get
= alc_ch_mode_get
,
2626 .put
= alc_ch_mode_put
,
2635 * W810 has rear IO for:
2638 * Center/LFE (DAC 04)
2641 * The system also has a pair of internal speakers, and a headphone jack.
2642 * These are both connected to Line2 on the codec, hence to DAC 02.
2644 * There is a variable resistor to control the speaker or headphone
2645 * volume. This is a hardware-only device without a software API.
2647 * Plugging headphones in will disable the internal speakers. This is
2648 * implemented in hardware, not via the driver using jack sense. In
2649 * a similar fashion, plugging into the rear socket marked "front" will
2650 * disable both the speakers and headphones.
2652 * For input, there's a microphone jack, and an "audio in" jack.
2653 * These may not do anything useful with this driver yet, because I
2654 * haven't setup any initialization verbs for these yet...
2657 static hda_nid_t alc880_w810_dac_nids
[3] = {
2658 /* front, rear/surround, clfe */
2662 /* fixed 6 channels */
2663 static struct hda_channel_mode alc880_w810_modes
[1] = {
2667 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2668 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
2669 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2670 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2671 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2672 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2673 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2674 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2675 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2676 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2677 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2685 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2686 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2690 static hda_nid_t alc880_z71v_dac_nids
[1] = {
2693 #define ALC880_Z71V_HP_DAC 0x03
2695 /* fixed 2 channels */
2696 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
2700 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
2701 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2702 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2703 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2704 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
2705 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2706 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2714 * ALC880 F1734 model
2716 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2717 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2720 static hda_nid_t alc880_f1734_dac_nids
[1] = {
2723 #define ALC880_F1734_HP_DAC 0x02
2725 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
2726 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2727 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2728 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2729 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2730 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2731 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2737 static struct hda_input_mux alc880_f1734_capture_source
= {
2749 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2750 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2751 * Mic = 0x18, Line = 0x1a
2754 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2755 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2757 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
2758 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2759 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2760 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2761 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2762 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2763 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2764 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2765 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2766 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2767 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2768 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2769 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2771 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2773 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2774 .name
= "Channel Mode",
2775 .info
= alc_ch_mode_info
,
2776 .get
= alc_ch_mode_get
,
2777 .put
= alc_ch_mode_put
,
2783 * ALC880 ASUS W1V model
2785 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2786 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2787 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2790 /* additional mixers to alc880_asus_mixer */
2791 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
2792 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
2793 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
2798 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
2799 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2800 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2801 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
2802 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
2803 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
2804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
2805 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
2806 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
2807 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
2812 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
2813 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2814 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2815 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2816 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2817 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2818 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2819 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2820 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2821 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2822 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2823 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2824 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2825 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2826 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2827 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2828 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2830 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2831 .name
= "Channel Mode",
2832 .info
= alc_ch_mode_info
,
2833 .get
= alc_ch_mode_get
,
2834 .put
= alc_ch_mode_put
,
2839 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
2840 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2841 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2842 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2843 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2844 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2845 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2847 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2848 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2849 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2853 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
2854 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2855 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2856 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2857 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2858 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2859 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2864 * virtual master controls
2868 * slave controls for virtual master
2870 static const char * const alc_slave_vols
[] = {
2871 "Front Playback Volume",
2872 "Surround Playback Volume",
2873 "Center Playback Volume",
2874 "LFE Playback Volume",
2875 "Side Playback Volume",
2876 "Headphone Playback Volume",
2877 "Speaker Playback Volume",
2878 "Mono Playback Volume",
2879 "Line-Out Playback Volume",
2880 "PCM Playback Volume",
2884 static const char * const alc_slave_sws
[] = {
2885 "Front Playback Switch",
2886 "Surround Playback Switch",
2887 "Center Playback Switch",
2888 "LFE Playback Switch",
2889 "Side Playback Switch",
2890 "Headphone Playback Switch",
2891 "Speaker Playback Switch",
2892 "Mono Playback Switch",
2893 "IEC958 Playback Switch",
2894 "Line-Out Playback Switch",
2895 "PCM Playback Switch",
2900 * build control elements
2903 #define NID_MAPPING (-1)
2905 #define SUBDEV_SPEAKER_ (0 << 6)
2906 #define SUBDEV_HP_ (1 << 6)
2907 #define SUBDEV_LINE_ (2 << 6)
2908 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2909 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2910 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2912 static void alc_free_kctls(struct hda_codec
*codec
);
2914 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2915 /* additional beep mixers; the actual parameters are overwritten at build */
2916 static struct snd_kcontrol_new alc_beep_mixer
[] = {
2917 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT
),
2918 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT
),
2923 static int alc_build_controls(struct hda_codec
*codec
)
2925 struct alc_spec
*spec
= codec
->spec
;
2926 struct snd_kcontrol
*kctl
= NULL
;
2927 struct snd_kcontrol_new
*knew
;
2932 for (i
= 0; i
< spec
->num_mixers
; i
++) {
2933 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
2937 if (spec
->cap_mixer
) {
2938 err
= snd_hda_add_new_ctls(codec
, spec
->cap_mixer
);
2942 if (spec
->multiout
.dig_out_nid
) {
2943 err
= snd_hda_create_spdif_out_ctls(codec
,
2944 spec
->multiout
.dig_out_nid
);
2947 if (!spec
->no_analog
) {
2948 err
= snd_hda_create_spdif_share_sw(codec
,
2952 spec
->multiout
.share_spdif
= 1;
2955 if (spec
->dig_in_nid
) {
2956 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
2961 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2962 /* create beep controls if needed */
2963 if (spec
->beep_amp
) {
2964 struct snd_kcontrol_new
*knew
;
2965 for (knew
= alc_beep_mixer
; knew
->name
; knew
++) {
2966 struct snd_kcontrol
*kctl
;
2967 kctl
= snd_ctl_new1(knew
, codec
);
2970 kctl
->private_value
= spec
->beep_amp
;
2971 err
= snd_hda_ctl_add(codec
, 0, kctl
);
2978 /* if we have no master control, let's create it */
2979 if (!spec
->no_analog
&&
2980 !snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
2981 unsigned int vmaster_tlv
[4];
2982 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
2983 HDA_OUTPUT
, vmaster_tlv
);
2984 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
2985 vmaster_tlv
, alc_slave_vols
);
2989 if (!spec
->no_analog
&&
2990 !snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
2991 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
2992 NULL
, alc_slave_sws
);
2997 /* assign Capture Source enums to NID */
2998 if (spec
->capsrc_nids
|| spec
->adc_nids
) {
2999 kctl
= snd_hda_find_mixer_ctl(codec
, "Capture Source");
3001 kctl
= snd_hda_find_mixer_ctl(codec
, "Input Source");
3002 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
3003 hda_nid_t
*nids
= spec
->capsrc_nids
;
3005 nids
= spec
->adc_nids
;
3006 err
= snd_hda_add_nid(codec
, kctl
, i
, nids
[i
]);
3011 if (spec
->cap_mixer
) {
3012 const char *kname
= kctl
? kctl
->id
.name
: NULL
;
3013 for (knew
= spec
->cap_mixer
; knew
->name
; knew
++) {
3014 if (kname
&& strcmp(knew
->name
, kname
) == 0)
3016 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
3017 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
3018 err
= snd_hda_add_nid(codec
, kctl
, i
,
3026 /* other nid->control mapping */
3027 for (i
= 0; i
< spec
->num_mixers
; i
++) {
3028 for (knew
= spec
->mixers
[i
]; knew
->name
; knew
++) {
3029 if (knew
->iface
!= NID_MAPPING
)
3031 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
3034 u
= knew
->subdevice
;
3035 for (j
= 0; j
< 4; j
++, u
>>= 8) {
3040 case SUBDEV_SPEAKER_
:
3041 nid
= spec
->autocfg
.speaker_pins
[nid
];
3044 nid
= spec
->autocfg
.line_out_pins
[nid
];
3047 nid
= spec
->autocfg
.hp_pins
[nid
];
3052 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
3056 u
= knew
->private_value
;
3057 for (j
= 0; j
< 4; j
++, u
>>= 8) {
3061 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
3068 alc_free_kctls(codec
); /* no longer needed */
3075 * initialize the codec volumes, etc
3079 * generic initialization of ADC, input mixers and output mixers
3081 static struct hda_verb alc880_volume_init_verbs
[] = {
3083 * Unmute ADC0-2 and set the default input to mic-in
3085 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
3086 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3087 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
3088 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3089 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
3090 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3092 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3094 * Note: PASD motherboards uses the Line In 2 as the input for front
3097 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3104 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3107 * Set up output mixers (0x0c - 0x0f)
3109 /* set vol=0 to output mixers */
3110 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3111 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3112 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3113 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3114 /* set up input amps for analog loopback */
3115 /* Amp Indices: DAC = 0, mixer = 1 */
3116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3118 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3119 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3120 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3121 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3122 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3123 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3129 * 3-stack pin configuration:
3130 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3132 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
3134 * preset connection lists of input pins
3135 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3137 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
3138 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3139 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
3142 * Set pin mode and muting
3144 /* set front pin widgets 0x14 for output */
3145 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3146 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3147 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3148 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3149 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3150 /* Mic2 (as headphone out) for HP output */
3151 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3152 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3153 /* Line In pin widget for input */
3154 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3155 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3156 /* Line2 (as front mic) pin widget for input and vref at 80% */
3157 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3158 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3159 /* CD pin widget for input */
3160 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3166 * 5-stack pin configuration:
3167 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3168 * line-in/side = 0x1a, f-mic = 0x1b
3170 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
3172 * preset connection lists of input pins
3173 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3175 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3176 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
3179 * Set pin mode and muting
3181 /* set pin widgets 0x14-0x17 for output */
3182 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3183 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3184 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3185 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3186 /* unmute pins for output (no gain on this amp) */
3187 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3188 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3189 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3190 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3192 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3193 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3194 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3195 /* Mic2 (as headphone out) for HP output */
3196 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3197 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3198 /* Line In pin widget for input */
3199 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3200 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3201 /* Line2 (as front mic) pin widget for input and vref at 80% */
3202 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3203 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3204 /* CD pin widget for input */
3205 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3211 * W810 pin configuration:
3212 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3214 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
3215 /* hphone/speaker input selector: front DAC */
3216 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
3218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3219 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3222 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3223 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3225 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3226 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3232 * Z71V pin configuration:
3233 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3235 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
3236 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3237 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3238 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3239 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3241 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3242 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3243 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3244 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3250 * 6-stack pin configuration:
3251 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3252 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3254 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
3255 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3257 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3258 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3259 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3261 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3262 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3263 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3264 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3266 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3267 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3268 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3269 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3271 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3272 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3273 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3274 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3280 * Uniwill pin configuration:
3281 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3284 static struct hda_verb alc880_uniwill_init_verbs
[] = {
3285 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3287 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3288 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3289 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3290 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3291 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3292 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3293 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3294 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3298 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3300 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3302 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3303 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3304 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3305 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3306 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3307 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3308 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3309 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3310 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3312 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3313 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
3320 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3322 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
3323 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3325 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3326 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3327 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3328 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3329 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3330 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3333 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3334 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3335 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3336 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3338 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3339 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3340 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3341 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3342 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3343 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3345 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3346 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
3351 static struct hda_verb alc880_beep_init_verbs
[] = {
3352 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
3356 /* auto-toggle front mic */
3357 static void alc88x_simple_mic_automute(struct hda_codec
*codec
)
3359 unsigned int present
;
3362 present
= snd_hda_jack_detect(codec
, 0x18);
3363 bits
= present
? HDA_AMP_MUTE
: 0;
3364 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
3367 static void alc880_uniwill_setup(struct hda_codec
*codec
)
3369 struct alc_spec
*spec
= codec
->spec
;
3371 spec
->autocfg
.hp_pins
[0] = 0x14;
3372 spec
->autocfg
.speaker_pins
[0] = 0x15;
3373 spec
->autocfg
.speaker_pins
[0] = 0x16;
3376 static void alc880_uniwill_init_hook(struct hda_codec
*codec
)
3378 alc_automute_amp(codec
);
3379 alc88x_simple_mic_automute(codec
);
3382 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
3385 /* Looks like the unsol event is incompatible with the standard
3386 * definition. 4bit tag is placed at 28 bit!
3388 switch (res
>> 28) {
3389 case ALC880_MIC_EVENT
:
3390 alc88x_simple_mic_automute(codec
);
3393 alc_automute_amp_unsol_event(codec
, res
);
3398 static void alc880_uniwill_p53_setup(struct hda_codec
*codec
)
3400 struct alc_spec
*spec
= codec
->spec
;
3402 spec
->autocfg
.hp_pins
[0] = 0x14;
3403 spec
->autocfg
.speaker_pins
[0] = 0x15;
3406 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
3408 unsigned int present
;
3410 present
= snd_hda_codec_read(codec
, 0x21, 0,
3411 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
3412 present
&= HDA_AMP_VOLMASK
;
3413 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
3414 HDA_AMP_VOLMASK
, present
);
3415 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
3416 HDA_AMP_VOLMASK
, present
);
3419 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
3422 /* Looks like the unsol event is incompatible with the standard
3423 * definition. 4bit tag is placed at 28 bit!
3425 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
3426 alc880_uniwill_p53_dcvol_automute(codec
);
3428 alc_automute_amp_unsol_event(codec
, res
);
3432 * F1734 pin configuration:
3433 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3435 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
3436 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
3437 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3438 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3439 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3440 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3442 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3443 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3444 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3445 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3447 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3448 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3449 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
3450 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3451 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3452 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3453 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3454 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3455 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3457 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
3458 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
3464 * ASUS pin configuration:
3465 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3467 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
3468 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3469 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3470 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3471 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3474 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3476 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3477 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3478 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3479 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3482 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3483 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3484 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3485 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3486 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3487 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3488 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3489 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3490 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3495 /* Enable GPIO mask and set output */
3496 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3497 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3498 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3500 /* Clevo m520g init */
3501 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
3502 /* headphone output */
3503 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3509 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3511 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3512 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3513 /* Mic1 (rear panel) */
3514 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3515 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3516 /* Mic2 (front panel) */
3517 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3518 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3520 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3521 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3522 /* change to EAPD mode */
3523 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3524 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3529 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
3530 /* change to EAPD mode */
3531 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3532 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3534 /* Headphone output */
3535 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3537 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3538 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
3540 /* Line In pin widget for input */
3541 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3542 /* CD pin widget for input */
3543 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3544 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3545 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3547 /* change to EAPD mode */
3548 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3549 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
3555 * LG m1 express dual
3558 * Rear Line-In/Out (blue): 0x14
3559 * Build-in Mic-In: 0x15
3561 * HP-Out (green): 0x1b
3562 * Mic-In/Out (red): 0x19
3566 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3567 static hda_nid_t alc880_lg_dac_nids
[3] = {
3571 /* seems analog CD is not working */
3572 static struct hda_input_mux alc880_lg_capture_source
= {
3577 { "Internal Mic", 0x6 },
3581 /* 2,4,6 channel modes */
3582 static struct hda_verb alc880_lg_ch2_init
[] = {
3583 /* set line-in and mic-in to input */
3584 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3585 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3589 static struct hda_verb alc880_lg_ch4_init
[] = {
3590 /* set line-in to out and mic-in to input */
3591 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3592 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3596 static struct hda_verb alc880_lg_ch6_init
[] = {
3597 /* set line-in and mic-in to output */
3598 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3599 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3603 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
3604 { 2, alc880_lg_ch2_init
},
3605 { 4, alc880_lg_ch4_init
},
3606 { 6, alc880_lg_ch6_init
},
3609 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
3610 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3611 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
3612 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3613 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
3614 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
3615 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
3616 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
3617 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
3618 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3619 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3620 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
3621 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
3622 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
3623 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
3625 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3626 .name
= "Channel Mode",
3627 .info
= alc_ch_mode_info
,
3628 .get
= alc_ch_mode_get
,
3629 .put
= alc_ch_mode_put
,
3634 static struct hda_verb alc880_lg_init_verbs
[] = {
3635 /* set capture source to mic-in */
3636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3637 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3638 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3639 /* mute all amp mixer inputs */
3640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
3641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3643 /* line-in to input */
3644 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3647 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3648 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3650 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3651 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3652 /* mic-in to input */
3653 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3654 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3655 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3657 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
3658 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3659 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3661 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3665 /* toggle speaker-output according to the hp-jack state */
3666 static void alc880_lg_setup(struct hda_codec
*codec
)
3668 struct alc_spec
*spec
= codec
->spec
;
3670 spec
->autocfg
.hp_pins
[0] = 0x1b;
3671 spec
->autocfg
.speaker_pins
[0] = 0x17;
3680 * Built-in Mic-In: 0x19
3686 static struct hda_input_mux alc880_lg_lw_capture_source
= {
3690 { "Internal Mic", 0x1 },
3695 #define alc880_lg_lw_modes alc880_threestack_modes
3697 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
3698 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3699 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3700 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3701 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
3702 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3703 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3704 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3705 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3706 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3707 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3710 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
3711 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
3713 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3714 .name
= "Channel Mode",
3715 .info
= alc_ch_mode_info
,
3716 .get
= alc_ch_mode_get
,
3717 .put
= alc_ch_mode_put
,
3722 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
3723 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3724 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
3725 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
3727 /* set capture source to mic-in */
3728 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3729 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3730 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3733 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3734 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3736 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3737 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3738 /* mic-in to input */
3739 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3745 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3749 /* toggle speaker-output according to the hp-jack state */
3750 static void alc880_lg_lw_setup(struct hda_codec
*codec
)
3752 struct alc_spec
*spec
= codec
->spec
;
3754 spec
->autocfg
.hp_pins
[0] = 0x1b;
3755 spec
->autocfg
.speaker_pins
[0] = 0x14;
3758 static struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
3759 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3760 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
3761 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3762 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3763 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3764 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3768 static struct hda_input_mux alc880_medion_rim_capture_source
= {
3772 { "Internal Mic", 0x1 },
3776 static struct hda_verb alc880_medion_rim_init_verbs
[] = {
3777 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3780 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3782 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3783 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3784 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3785 /* Mic2 (as headphone out) for HP output */
3786 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3787 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3788 /* Internal Speaker */
3789 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3790 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3792 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3793 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3795 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3799 /* toggle speaker-output according to the hp-jack state */
3800 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
3802 struct alc_spec
*spec
= codec
->spec
;
3803 alc_automute_amp(codec
);
3805 if (spec
->jack_present
)
3806 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
3808 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
3811 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
3814 /* Looks like the unsol event is incompatible with the standard
3815 * definition. 4bit tag is placed at 28 bit!
3817 if ((res
>> 28) == ALC880_HP_EVENT
)
3818 alc880_medion_rim_automute(codec
);
3821 static void alc880_medion_rim_setup(struct hda_codec
*codec
)
3823 struct alc_spec
*spec
= codec
->spec
;
3825 spec
->autocfg
.hp_pins
[0] = 0x14;
3826 spec
->autocfg
.speaker_pins
[0] = 0x1b;
3829 #ifdef CONFIG_SND_HDA_POWER_SAVE
3830 static struct hda_amp_list alc880_loopbacks
[] = {
3831 { 0x0b, HDA_INPUT
, 0 },
3832 { 0x0b, HDA_INPUT
, 1 },
3833 { 0x0b, HDA_INPUT
, 2 },
3834 { 0x0b, HDA_INPUT
, 3 },
3835 { 0x0b, HDA_INPUT
, 4 },
3839 static struct hda_amp_list alc880_lg_loopbacks
[] = {
3840 { 0x0b, HDA_INPUT
, 1 },
3841 { 0x0b, HDA_INPUT
, 6 },
3842 { 0x0b, HDA_INPUT
, 7 },
3851 static void alc_init_special_input_src(struct hda_codec
*codec
);
3853 static int alc_init(struct hda_codec
*codec
)
3855 struct alc_spec
*spec
= codec
->spec
;
3859 alc_auto_init_amp(codec
, spec
->init_amp
);
3861 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
3862 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
3863 alc_init_special_input_src(codec
);
3865 if (spec
->init_hook
)
3866 spec
->init_hook(codec
);
3868 alc_apply_fixup(codec
, ALC_FIXUP_ACT_INIT
);
3870 hda_call_check_power_status(codec
, 0x01);
3874 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
3876 struct alc_spec
*spec
= codec
->spec
;
3878 if (spec
->unsol_event
)
3879 spec
->unsol_event(codec
, res
);
3882 #ifdef CONFIG_SND_HDA_POWER_SAVE
3883 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
3885 struct alc_spec
*spec
= codec
->spec
;
3886 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
3891 * Analog playback callbacks
3893 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3894 struct hda_codec
*codec
,
3895 struct snd_pcm_substream
*substream
)
3897 struct alc_spec
*spec
= codec
->spec
;
3898 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
3902 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3903 struct hda_codec
*codec
,
3904 unsigned int stream_tag
,
3905 unsigned int format
,
3906 struct snd_pcm_substream
*substream
)
3908 struct alc_spec
*spec
= codec
->spec
;
3909 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
3910 stream_tag
, format
, substream
);
3913 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3914 struct hda_codec
*codec
,
3915 struct snd_pcm_substream
*substream
)
3917 struct alc_spec
*spec
= codec
->spec
;
3918 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
3924 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3925 struct hda_codec
*codec
,
3926 struct snd_pcm_substream
*substream
)
3928 struct alc_spec
*spec
= codec
->spec
;
3929 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
3932 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3933 struct hda_codec
*codec
,
3934 unsigned int stream_tag
,
3935 unsigned int format
,
3936 struct snd_pcm_substream
*substream
)
3938 struct alc_spec
*spec
= codec
->spec
;
3939 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
3940 stream_tag
, format
, substream
);
3943 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3944 struct hda_codec
*codec
,
3945 struct snd_pcm_substream
*substream
)
3947 struct alc_spec
*spec
= codec
->spec
;
3948 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
3951 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
3952 struct hda_codec
*codec
,
3953 struct snd_pcm_substream
*substream
)
3955 struct alc_spec
*spec
= codec
->spec
;
3956 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
3962 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3963 struct hda_codec
*codec
,
3964 unsigned int stream_tag
,
3965 unsigned int format
,
3966 struct snd_pcm_substream
*substream
)
3968 struct alc_spec
*spec
= codec
->spec
;
3970 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
3971 stream_tag
, 0, format
);
3975 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3976 struct hda_codec
*codec
,
3977 struct snd_pcm_substream
*substream
)
3979 struct alc_spec
*spec
= codec
->spec
;
3981 snd_hda_codec_cleanup_stream(codec
,
3982 spec
->adc_nids
[substream
->number
+ 1]);
3986 /* analog capture with dynamic dual-adc changes */
3987 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3988 struct hda_codec
*codec
,
3989 unsigned int stream_tag
,
3990 unsigned int format
,
3991 struct snd_pcm_substream
*substream
)
3993 struct alc_spec
*spec
= codec
->spec
;
3994 spec
->cur_adc
= spec
->adc_nids
[spec
->cur_adc_idx
];
3995 spec
->cur_adc_stream_tag
= stream_tag
;
3996 spec
->cur_adc_format
= format
;
3997 snd_hda_codec_setup_stream(codec
, spec
->cur_adc
, stream_tag
, 0, format
);
4001 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4002 struct hda_codec
*codec
,
4003 struct snd_pcm_substream
*substream
)
4005 struct alc_spec
*spec
= codec
->spec
;
4006 snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
);
4011 static struct hda_pcm_stream dualmic_pcm_analog_capture
= {
4015 .nid
= 0, /* fill later */
4017 .prepare
= dualmic_capture_pcm_prepare
,
4018 .cleanup
= dualmic_capture_pcm_cleanup
4024 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
4028 /* NID is set in alc_build_pcms */
4030 .open
= alc880_playback_pcm_open
,
4031 .prepare
= alc880_playback_pcm_prepare
,
4032 .cleanup
= alc880_playback_pcm_cleanup
4036 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
4040 /* NID is set in alc_build_pcms */
4043 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
4047 /* NID is set in alc_build_pcms */
4050 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
4051 .substreams
= 2, /* can be overridden */
4054 /* NID is set in alc_build_pcms */
4056 .prepare
= alc880_alt_capture_pcm_prepare
,
4057 .cleanup
= alc880_alt_capture_pcm_cleanup
4061 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
4065 /* NID is set in alc_build_pcms */
4067 .open
= alc880_dig_playback_pcm_open
,
4068 .close
= alc880_dig_playback_pcm_close
,
4069 .prepare
= alc880_dig_playback_pcm_prepare
,
4070 .cleanup
= alc880_dig_playback_pcm_cleanup
4074 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
4078 /* NID is set in alc_build_pcms */
4081 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4082 static struct hda_pcm_stream alc_pcm_null_stream
= {
4088 static int alc_build_pcms(struct hda_codec
*codec
)
4090 struct alc_spec
*spec
= codec
->spec
;
4091 struct hda_pcm
*info
= spec
->pcm_rec
;
4094 codec
->num_pcms
= 1;
4095 codec
->pcm_info
= info
;
4097 if (spec
->no_analog
)
4100 snprintf(spec
->stream_name_analog
, sizeof(spec
->stream_name_analog
),
4101 "%s Analog", codec
->chip_name
);
4102 info
->name
= spec
->stream_name_analog
;
4104 if (spec
->stream_analog_playback
) {
4105 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
4107 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
4108 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
4110 if (spec
->stream_analog_capture
) {
4111 if (snd_BUG_ON(!spec
->adc_nids
))
4113 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
4114 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
4117 if (spec
->channel_mode
) {
4118 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
4119 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
4120 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
4121 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
4127 /* SPDIF for stream index #1 */
4128 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
4129 snprintf(spec
->stream_name_digital
,
4130 sizeof(spec
->stream_name_digital
),
4131 "%s Digital", codec
->chip_name
);
4132 codec
->num_pcms
= 2;
4133 codec
->slave_dig_outs
= spec
->multiout
.slave_dig_outs
;
4134 info
= spec
->pcm_rec
+ 1;
4135 info
->name
= spec
->stream_name_digital
;
4136 if (spec
->dig_out_type
)
4137 info
->pcm_type
= spec
->dig_out_type
;
4139 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
4140 if (spec
->multiout
.dig_out_nid
&&
4141 spec
->stream_digital_playback
) {
4142 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
4143 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
4145 if (spec
->dig_in_nid
&&
4146 spec
->stream_digital_capture
) {
4147 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
4148 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
4150 /* FIXME: do we need this for all Realtek codec models? */
4151 codec
->spdif_status_reset
= 1;
4154 if (spec
->no_analog
)
4157 /* If the use of more than one ADC is requested for the current
4158 * model, configure a second analog capture-only PCM.
4160 /* Additional Analaog capture for index #2 */
4161 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
4162 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
4163 codec
->num_pcms
= 3;
4164 info
= spec
->pcm_rec
+ 2;
4165 info
->name
= spec
->stream_name_analog
;
4166 if (spec
->alt_dac_nid
) {
4167 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
4168 *spec
->stream_analog_alt_playback
;
4169 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
4172 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
4173 alc_pcm_null_stream
;
4174 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
4176 if (spec
->num_adc_nids
> 1) {
4177 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
4178 *spec
->stream_analog_alt_capture
;
4179 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
4181 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
4182 spec
->num_adc_nids
- 1;
4184 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
4185 alc_pcm_null_stream
;
4186 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
4193 static inline void alc_shutup(struct hda_codec
*codec
)
4195 snd_hda_shutup_pins(codec
);
4198 static void alc_free_kctls(struct hda_codec
*codec
)
4200 struct alc_spec
*spec
= codec
->spec
;
4202 if (spec
->kctls
.list
) {
4203 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
4205 for (i
= 0; i
< spec
->kctls
.used
; i
++)
4206 kfree(kctl
[i
].name
);
4208 snd_array_free(&spec
->kctls
);
4211 static void alc_free(struct hda_codec
*codec
)
4213 struct alc_spec
*spec
= codec
->spec
;
4219 snd_hda_input_jack_free(codec
);
4220 alc_free_kctls(codec
);
4222 snd_hda_detach_beep_device(codec
);
4225 #ifdef CONFIG_SND_HDA_POWER_SAVE
4226 static void alc_power_eapd(struct hda_codec
*codec
)
4228 /* We currently only handle front, HP */
4229 switch (codec
->vendor_id
) {
4231 set_eapd(codec
, 0x0f, 0);
4232 set_eapd(codec
, 0x10, 0);
4245 set_eapd(codec
, 0x14, 0);
4246 set_eapd(codec
, 0x15, 0);
4251 static int alc_suspend(struct hda_codec
*codec
, pm_message_t state
)
4253 struct alc_spec
*spec
= codec
->spec
;
4255 if (spec
&& spec
->power_hook
)
4256 spec
->power_hook(codec
);
4261 #ifdef SND_HDA_NEEDS_RESUME
4262 static int alc_resume(struct hda_codec
*codec
)
4264 codec
->patch_ops
.init(codec
);
4265 snd_hda_codec_resume_amp(codec
);
4266 snd_hda_codec_resume_cache(codec
);
4267 hda_call_check_power_status(codec
, 0x01);
4274 static struct hda_codec_ops alc_patch_ops
= {
4275 .build_controls
= alc_build_controls
,
4276 .build_pcms
= alc_build_pcms
,
4279 .unsol_event
= alc_unsol_event
,
4280 #ifdef SND_HDA_NEEDS_RESUME
4281 .resume
= alc_resume
,
4283 #ifdef CONFIG_SND_HDA_POWER_SAVE
4284 .suspend
= alc_suspend
,
4285 .check_power_status
= alc_check_power_status
,
4287 .reboot_notify
= alc_shutup
,
4290 /* replace the codec chip_name with the given string */
4291 static int alc_codec_rename(struct hda_codec
*codec
, const char *name
)
4293 kfree(codec
->chip_name
);
4294 codec
->chip_name
= kstrdup(name
, GFP_KERNEL
);
4295 if (!codec
->chip_name
) {
4303 * Test configuration for debugging
4305 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4308 #ifdef CONFIG_SND_DEBUG
4309 static hda_nid_t alc880_test_dac_nids
[4] = {
4310 0x02, 0x03, 0x04, 0x05
4313 static struct hda_input_mux alc880_test_capture_source
= {
4322 { "Surround", 0x6 },
4326 static struct hda_channel_mode alc880_test_modes
[4] = {
4333 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
4334 struct snd_ctl_elem_info
*uinfo
)
4336 static char *texts
[] = {
4337 "N/A", "Line Out", "HP Out",
4338 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4340 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4342 uinfo
->value
.enumerated
.items
= 8;
4343 if (uinfo
->value
.enumerated
.item
>= 8)
4344 uinfo
->value
.enumerated
.item
= 7;
4345 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4349 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
4350 struct snd_ctl_elem_value
*ucontrol
)
4352 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4353 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4354 unsigned int pin_ctl
, item
= 0;
4356 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
4357 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4358 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
4359 if (pin_ctl
& AC_PINCTL_HP_EN
)
4363 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
4364 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
4365 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
4366 case AC_PINCTL_VREF_50
: item
= 4; break;
4367 case AC_PINCTL_VREF_GRD
: item
= 5; break;
4368 case AC_PINCTL_VREF_80
: item
= 6; break;
4369 case AC_PINCTL_VREF_100
: item
= 7; break;
4372 ucontrol
->value
.enumerated
.item
[0] = item
;
4376 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
4377 struct snd_ctl_elem_value
*ucontrol
)
4379 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4380 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4381 static unsigned int ctls
[] = {
4382 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
4383 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
4384 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
4385 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
4386 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
4387 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
4389 unsigned int old_ctl
, new_ctl
;
4391 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
4392 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4393 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
4394 if (old_ctl
!= new_ctl
) {
4396 snd_hda_codec_write_cache(codec
, nid
, 0,
4397 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4399 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
4401 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
4408 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
4409 struct snd_ctl_elem_info
*uinfo
)
4411 static char *texts
[] = {
4412 "Front", "Surround", "CLFE", "Side"
4414 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4416 uinfo
->value
.enumerated
.items
= 4;
4417 if (uinfo
->value
.enumerated
.item
>= 4)
4418 uinfo
->value
.enumerated
.item
= 3;
4419 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4423 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
4424 struct snd_ctl_elem_value
*ucontrol
)
4426 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4427 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4430 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
4431 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
4435 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
4436 struct snd_ctl_elem_value
*ucontrol
)
4438 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4439 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4442 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
4443 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
4444 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
4445 snd_hda_codec_write_cache(codec
, nid
, 0,
4446 AC_VERB_SET_CONNECT_SEL
, sel
);
4452 #define PIN_CTL_TEST(xname,nid) { \
4453 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4455 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4456 .info = alc_test_pin_ctl_info, \
4457 .get = alc_test_pin_ctl_get, \
4458 .put = alc_test_pin_ctl_put, \
4459 .private_value = nid \
4462 #define PIN_SRC_TEST(xname,nid) { \
4463 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4465 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4466 .info = alc_test_pin_src_info, \
4467 .get = alc_test_pin_src_get, \
4468 .put = alc_test_pin_src_put, \
4469 .private_value = nid \
4472 static struct snd_kcontrol_new alc880_test_mixer
[] = {
4473 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4474 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4475 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
4476 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
4477 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4478 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4479 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
4480 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
4481 PIN_CTL_TEST("Front Pin Mode", 0x14),
4482 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4483 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4484 PIN_CTL_TEST("Side Pin Mode", 0x17),
4485 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4486 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4487 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4488 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4489 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4490 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4491 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4492 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4493 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4494 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4495 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4496 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4497 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
4498 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
4499 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
4500 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
4501 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
4502 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
4504 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4505 .name
= "Channel Mode",
4506 .info
= alc_ch_mode_info
,
4507 .get
= alc_ch_mode_get
,
4508 .put
= alc_ch_mode_put
,
4513 static struct hda_verb alc880_test_init_verbs
[] = {
4514 /* Unmute inputs of 0x0c - 0x0f */
4515 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4516 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4517 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4518 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4519 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4520 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4521 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4522 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4523 /* Vol output for 0x0c-0x0f */
4524 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4525 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4526 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4527 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4528 /* Set output pins 0x14-0x17 */
4529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4530 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4531 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4532 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4533 /* Unmute output pins 0x14-0x17 */
4534 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4535 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4536 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4537 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4538 /* Set input pins 0x18-0x1c */
4539 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4540 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4541 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4542 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4543 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4544 /* Mute input pins 0x18-0x1b */
4545 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4546 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4547 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4548 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4551 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4552 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4553 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4554 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4555 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4556 /* Analog input/passthru */
4557 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4558 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4559 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4560 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4561 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4569 static const char * const alc880_models
[ALC880_MODEL_LAST
] = {
4570 [ALC880_3ST
] = "3stack",
4571 [ALC880_TCL_S700
] = "tcl",
4572 [ALC880_3ST_DIG
] = "3stack-digout",
4573 [ALC880_CLEVO
] = "clevo",
4574 [ALC880_5ST
] = "5stack",
4575 [ALC880_5ST_DIG
] = "5stack-digout",
4576 [ALC880_W810
] = "w810",
4577 [ALC880_Z71V
] = "z71v",
4578 [ALC880_6ST
] = "6stack",
4579 [ALC880_6ST_DIG
] = "6stack-digout",
4580 [ALC880_ASUS
] = "asus",
4581 [ALC880_ASUS_W1V
] = "asus-w1v",
4582 [ALC880_ASUS_DIG
] = "asus-dig",
4583 [ALC880_ASUS_DIG2
] = "asus-dig2",
4584 [ALC880_UNIWILL_DIG
] = "uniwill",
4585 [ALC880_UNIWILL_P53
] = "uniwill-p53",
4586 [ALC880_FUJITSU
] = "fujitsu",
4587 [ALC880_F1734
] = "F1734",
4589 [ALC880_LG_LW
] = "lg-lw",
4590 [ALC880_MEDION_RIM
] = "medion",
4591 #ifdef CONFIG_SND_DEBUG
4592 [ALC880_TEST
] = "test",
4594 [ALC880_AUTO
] = "auto",
4597 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
4598 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
4599 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
4600 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
4601 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
4602 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
4603 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
4604 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
4605 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
4606 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
4607 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
4608 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
4609 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
4610 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
4611 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
4612 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
4613 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
4614 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
4615 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
4616 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4617 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
4618 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
4619 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
4620 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
4621 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
4622 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
4623 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS
), /* default ASUS */
4624 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
4625 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
4626 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
4627 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
4628 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
4629 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
4630 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
4631 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
4632 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
4633 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
4634 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
4635 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
4636 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
4637 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
4638 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734
),
4639 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
4640 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
4641 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
4642 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
4643 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
4644 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
4645 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
4646 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
4647 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734
),
4648 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
4649 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
4650 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
4651 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG
),
4652 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
4653 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
4654 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
4655 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
4656 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
4657 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
4658 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
4659 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
4660 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
4661 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
4662 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
4663 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
4664 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
4665 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
4666 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
4668 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST
),
4669 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
4670 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
4675 * ALC880 codec presets
4677 static struct alc_config_preset alc880_presets
[] = {
4679 .mixers
= { alc880_three_stack_mixer
},
4680 .init_verbs
= { alc880_volume_init_verbs
,
4681 alc880_pin_3stack_init_verbs
},
4682 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4683 .dac_nids
= alc880_dac_nids
,
4684 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4685 .channel_mode
= alc880_threestack_modes
,
4687 .input_mux
= &alc880_capture_source
,
4689 [ALC880_3ST_DIG
] = {
4690 .mixers
= { alc880_three_stack_mixer
},
4691 .init_verbs
= { alc880_volume_init_verbs
,
4692 alc880_pin_3stack_init_verbs
},
4693 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4694 .dac_nids
= alc880_dac_nids
,
4695 .dig_out_nid
= ALC880_DIGOUT_NID
,
4696 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4697 .channel_mode
= alc880_threestack_modes
,
4699 .input_mux
= &alc880_capture_source
,
4701 [ALC880_TCL_S700
] = {
4702 .mixers
= { alc880_tcl_s700_mixer
},
4703 .init_verbs
= { alc880_volume_init_verbs
,
4704 alc880_pin_tcl_S700_init_verbs
,
4705 alc880_gpio2_init_verbs
},
4706 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4707 .dac_nids
= alc880_dac_nids
,
4708 .adc_nids
= alc880_adc_nids_alt
, /* FIXME: correct? */
4709 .num_adc_nids
= 1, /* single ADC */
4711 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4712 .channel_mode
= alc880_2_jack_modes
,
4713 .input_mux
= &alc880_capture_source
,
4716 .mixers
= { alc880_three_stack_mixer
,
4717 alc880_five_stack_mixer
},
4718 .init_verbs
= { alc880_volume_init_verbs
,
4719 alc880_pin_5stack_init_verbs
},
4720 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4721 .dac_nids
= alc880_dac_nids
,
4722 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
4723 .channel_mode
= alc880_fivestack_modes
,
4724 .input_mux
= &alc880_capture_source
,
4726 [ALC880_5ST_DIG
] = {
4727 .mixers
= { alc880_three_stack_mixer
,
4728 alc880_five_stack_mixer
},
4729 .init_verbs
= { alc880_volume_init_verbs
,
4730 alc880_pin_5stack_init_verbs
},
4731 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4732 .dac_nids
= alc880_dac_nids
,
4733 .dig_out_nid
= ALC880_DIGOUT_NID
,
4734 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
4735 .channel_mode
= alc880_fivestack_modes
,
4736 .input_mux
= &alc880_capture_source
,
4739 .mixers
= { alc880_six_stack_mixer
},
4740 .init_verbs
= { alc880_volume_init_verbs
,
4741 alc880_pin_6stack_init_verbs
},
4742 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
4743 .dac_nids
= alc880_6st_dac_nids
,
4744 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
4745 .channel_mode
= alc880_sixstack_modes
,
4746 .input_mux
= &alc880_6stack_capture_source
,
4748 [ALC880_6ST_DIG
] = {
4749 .mixers
= { alc880_six_stack_mixer
},
4750 .init_verbs
= { alc880_volume_init_verbs
,
4751 alc880_pin_6stack_init_verbs
},
4752 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
4753 .dac_nids
= alc880_6st_dac_nids
,
4754 .dig_out_nid
= ALC880_DIGOUT_NID
,
4755 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
4756 .channel_mode
= alc880_sixstack_modes
,
4757 .input_mux
= &alc880_6stack_capture_source
,
4760 .mixers
= { alc880_w810_base_mixer
},
4761 .init_verbs
= { alc880_volume_init_verbs
,
4762 alc880_pin_w810_init_verbs
,
4763 alc880_gpio2_init_verbs
},
4764 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
4765 .dac_nids
= alc880_w810_dac_nids
,
4766 .dig_out_nid
= ALC880_DIGOUT_NID
,
4767 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
4768 .channel_mode
= alc880_w810_modes
,
4769 .input_mux
= &alc880_capture_source
,
4772 .mixers
= { alc880_z71v_mixer
},
4773 .init_verbs
= { alc880_volume_init_verbs
,
4774 alc880_pin_z71v_init_verbs
},
4775 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
4776 .dac_nids
= alc880_z71v_dac_nids
,
4777 .dig_out_nid
= ALC880_DIGOUT_NID
,
4779 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4780 .channel_mode
= alc880_2_jack_modes
,
4781 .input_mux
= &alc880_capture_source
,
4784 .mixers
= { alc880_f1734_mixer
},
4785 .init_verbs
= { alc880_volume_init_verbs
,
4786 alc880_pin_f1734_init_verbs
},
4787 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
4788 .dac_nids
= alc880_f1734_dac_nids
,
4790 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4791 .channel_mode
= alc880_2_jack_modes
,
4792 .input_mux
= &alc880_f1734_capture_source
,
4793 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4794 .setup
= alc880_uniwill_p53_setup
,
4795 .init_hook
= alc_automute_amp
,
4798 .mixers
= { alc880_asus_mixer
},
4799 .init_verbs
= { alc880_volume_init_verbs
,
4800 alc880_pin_asus_init_verbs
,
4801 alc880_gpio1_init_verbs
},
4802 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4803 .dac_nids
= alc880_asus_dac_nids
,
4804 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4805 .channel_mode
= alc880_asus_modes
,
4807 .input_mux
= &alc880_capture_source
,
4809 [ALC880_ASUS_DIG
] = {
4810 .mixers
= { alc880_asus_mixer
},
4811 .init_verbs
= { alc880_volume_init_verbs
,
4812 alc880_pin_asus_init_verbs
,
4813 alc880_gpio1_init_verbs
},
4814 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4815 .dac_nids
= alc880_asus_dac_nids
,
4816 .dig_out_nid
= ALC880_DIGOUT_NID
,
4817 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4818 .channel_mode
= alc880_asus_modes
,
4820 .input_mux
= &alc880_capture_source
,
4822 [ALC880_ASUS_DIG2
] = {
4823 .mixers
= { alc880_asus_mixer
},
4824 .init_verbs
= { alc880_volume_init_verbs
,
4825 alc880_pin_asus_init_verbs
,
4826 alc880_gpio2_init_verbs
}, /* use GPIO2 */
4827 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4828 .dac_nids
= alc880_asus_dac_nids
,
4829 .dig_out_nid
= ALC880_DIGOUT_NID
,
4830 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4831 .channel_mode
= alc880_asus_modes
,
4833 .input_mux
= &alc880_capture_source
,
4835 [ALC880_ASUS_W1V
] = {
4836 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
4837 .init_verbs
= { alc880_volume_init_verbs
,
4838 alc880_pin_asus_init_verbs
,
4839 alc880_gpio1_init_verbs
},
4840 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4841 .dac_nids
= alc880_asus_dac_nids
,
4842 .dig_out_nid
= ALC880_DIGOUT_NID
,
4843 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4844 .channel_mode
= alc880_asus_modes
,
4846 .input_mux
= &alc880_capture_source
,
4848 [ALC880_UNIWILL_DIG
] = {
4849 .mixers
= { alc880_asus_mixer
},
4850 .init_verbs
= { alc880_volume_init_verbs
,
4851 alc880_pin_asus_init_verbs
},
4852 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4853 .dac_nids
= alc880_asus_dac_nids
,
4854 .dig_out_nid
= ALC880_DIGOUT_NID
,
4855 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4856 .channel_mode
= alc880_asus_modes
,
4858 .input_mux
= &alc880_capture_source
,
4860 [ALC880_UNIWILL
] = {
4861 .mixers
= { alc880_uniwill_mixer
},
4862 .init_verbs
= { alc880_volume_init_verbs
,
4863 alc880_uniwill_init_verbs
},
4864 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4865 .dac_nids
= alc880_asus_dac_nids
,
4866 .dig_out_nid
= ALC880_DIGOUT_NID
,
4867 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4868 .channel_mode
= alc880_threestack_modes
,
4870 .input_mux
= &alc880_capture_source
,
4871 .unsol_event
= alc880_uniwill_unsol_event
,
4872 .setup
= alc880_uniwill_setup
,
4873 .init_hook
= alc880_uniwill_init_hook
,
4875 [ALC880_UNIWILL_P53
] = {
4876 .mixers
= { alc880_uniwill_p53_mixer
},
4877 .init_verbs
= { alc880_volume_init_verbs
,
4878 alc880_uniwill_p53_init_verbs
},
4879 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4880 .dac_nids
= alc880_asus_dac_nids
,
4881 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
4882 .channel_mode
= alc880_threestack_modes
,
4883 .input_mux
= &alc880_capture_source
,
4884 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4885 .setup
= alc880_uniwill_p53_setup
,
4886 .init_hook
= alc_automute_amp
,
4888 [ALC880_FUJITSU
] = {
4889 .mixers
= { alc880_fujitsu_mixer
},
4890 .init_verbs
= { alc880_volume_init_verbs
,
4891 alc880_uniwill_p53_init_verbs
,
4892 alc880_beep_init_verbs
},
4893 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4894 .dac_nids
= alc880_dac_nids
,
4895 .dig_out_nid
= ALC880_DIGOUT_NID
,
4896 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4897 .channel_mode
= alc880_2_jack_modes
,
4898 .input_mux
= &alc880_capture_source
,
4899 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4900 .setup
= alc880_uniwill_p53_setup
,
4901 .init_hook
= alc_automute_amp
,
4904 .mixers
= { alc880_three_stack_mixer
},
4905 .init_verbs
= { alc880_volume_init_verbs
,
4906 alc880_pin_clevo_init_verbs
},
4907 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4908 .dac_nids
= alc880_dac_nids
,
4910 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4911 .channel_mode
= alc880_threestack_modes
,
4913 .input_mux
= &alc880_capture_source
,
4916 .mixers
= { alc880_lg_mixer
},
4917 .init_verbs
= { alc880_volume_init_verbs
,
4918 alc880_lg_init_verbs
},
4919 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
4920 .dac_nids
= alc880_lg_dac_nids
,
4921 .dig_out_nid
= ALC880_DIGOUT_NID
,
4922 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
4923 .channel_mode
= alc880_lg_ch_modes
,
4925 .input_mux
= &alc880_lg_capture_source
,
4926 .unsol_event
= alc_automute_amp_unsol_event
,
4927 .setup
= alc880_lg_setup
,
4928 .init_hook
= alc_automute_amp
,
4929 #ifdef CONFIG_SND_HDA_POWER_SAVE
4930 .loopbacks
= alc880_lg_loopbacks
,
4934 .mixers
= { alc880_lg_lw_mixer
},
4935 .init_verbs
= { alc880_volume_init_verbs
,
4936 alc880_lg_lw_init_verbs
},
4937 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4938 .dac_nids
= alc880_dac_nids
,
4939 .dig_out_nid
= ALC880_DIGOUT_NID
,
4940 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
4941 .channel_mode
= alc880_lg_lw_modes
,
4942 .input_mux
= &alc880_lg_lw_capture_source
,
4943 .unsol_event
= alc_automute_amp_unsol_event
,
4944 .setup
= alc880_lg_lw_setup
,
4945 .init_hook
= alc_automute_amp
,
4947 [ALC880_MEDION_RIM
] = {
4948 .mixers
= { alc880_medion_rim_mixer
},
4949 .init_verbs
= { alc880_volume_init_verbs
,
4950 alc880_medion_rim_init_verbs
,
4951 alc_gpio2_init_verbs
},
4952 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4953 .dac_nids
= alc880_dac_nids
,
4954 .dig_out_nid
= ALC880_DIGOUT_NID
,
4955 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4956 .channel_mode
= alc880_2_jack_modes
,
4957 .input_mux
= &alc880_medion_rim_capture_source
,
4958 .unsol_event
= alc880_medion_rim_unsol_event
,
4959 .setup
= alc880_medion_rim_setup
,
4960 .init_hook
= alc880_medion_rim_automute
,
4962 #ifdef CONFIG_SND_DEBUG
4964 .mixers
= { alc880_test_mixer
},
4965 .init_verbs
= { alc880_test_init_verbs
},
4966 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
4967 .dac_nids
= alc880_test_dac_nids
,
4968 .dig_out_nid
= ALC880_DIGOUT_NID
,
4969 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
4970 .channel_mode
= alc880_test_modes
,
4971 .input_mux
= &alc880_test_capture_source
,
4977 * Automatic parse of I/O pins from the BIOS configuration
4982 ALC_CTL_WIDGET_MUTE
,
4985 static struct snd_kcontrol_new alc880_control_templates
[] = {
4986 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
4987 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
4988 HDA_BIND_MUTE(NULL
, 0, 0, 0),
4991 /* add dynamic controls */
4992 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
4993 int cidx
, unsigned long val
)
4995 struct snd_kcontrol_new
*knew
;
4997 snd_array_init(&spec
->kctls
, sizeof(*knew
), 32);
4998 knew
= snd_array_new(&spec
->kctls
);
5001 *knew
= alc880_control_templates
[type
];
5002 knew
->name
= kstrdup(name
, GFP_KERNEL
);
5006 if (get_amp_nid_(val
))
5007 knew
->subdevice
= HDA_SUBDEV_AMP_FLAG
;
5008 knew
->private_value
= val
;
5012 static int add_control_with_pfx(struct alc_spec
*spec
, int type
,
5013 const char *pfx
, const char *dir
,
5014 const char *sfx
, int cidx
, unsigned long val
)
5017 snprintf(name
, sizeof(name
), "%s %s %s", pfx
, dir
, sfx
);
5018 return add_control(spec
, type
, name
, cidx
, val
);
5021 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5022 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5023 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5024 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5025 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5026 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5027 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5028 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5030 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5031 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5032 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5033 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5034 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5035 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5036 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5037 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5038 #define ALC880_PIN_CD_NID 0x1c
5040 /* fill in the dac_nids table from the parsed pin configuration */
5041 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
5042 const struct auto_pin_cfg
*cfg
)
5048 memset(assigned
, 0, sizeof(assigned
));
5049 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
5051 /* check the pins hardwired to audio widget */
5052 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5053 nid
= cfg
->line_out_pins
[i
];
5054 if (alc880_is_fixed_pin(nid
)) {
5055 int idx
= alc880_fixed_pin_idx(nid
);
5056 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
5060 /* left pins can be connect to any audio widget */
5061 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5062 nid
= cfg
->line_out_pins
[i
];
5063 if (alc880_is_fixed_pin(nid
))
5065 /* search for an empty channel */
5066 for (j
= 0; j
< cfg
->line_outs
; j
++) {
5068 spec
->multiout
.dac_nids
[i
] =
5069 alc880_idx_to_dac(j
);
5075 spec
->multiout
.num_dacs
= cfg
->line_outs
;
5079 static const char *alc_get_line_out_pfx(const struct auto_pin_cfg
*cfg
,
5082 if (!cfg
->hp_outs
&& !cfg
->speaker_outs
&& can_be_master
)
5085 switch (cfg
->line_out_type
) {
5086 case AUTO_PIN_SPEAKER_OUT
:
5087 if (cfg
->line_outs
== 1)
5090 case AUTO_PIN_HP_OUT
:
5093 if (cfg
->line_outs
== 1)
5100 /* add playback controls from the parsed DAC table */
5101 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
5102 const struct auto_pin_cfg
*cfg
)
5104 static const char * const chname
[4] = {
5105 "Front", "Surround", NULL
/*CLFE*/, "Side"
5107 const char *pfx
= alc_get_line_out_pfx(cfg
, false);
5111 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5112 if (!spec
->multiout
.dac_nids
[i
])
5114 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
5115 if (!pfx
&& i
== 2) {
5117 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5119 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
5123 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5125 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
5129 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5131 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
5135 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5137 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
5142 const char *name
= pfx
;
5148 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5150 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
5154 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5156 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
5165 /* add playback controls for speaker and HP outputs */
5166 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
5175 if (alc880_is_fixed_pin(pin
)) {
5176 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
5177 /* specify the DAC as the extra output */
5178 if (!spec
->multiout
.hp_nid
)
5179 spec
->multiout
.hp_nid
= nid
;
5181 spec
->multiout
.extra_out_nid
[0] = nid
;
5182 /* control HP volume/switch on the output mixer amp */
5183 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
5184 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
5185 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
5188 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
5189 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
5192 } else if (alc880_is_multi_pin(pin
)) {
5193 /* set manual connection */
5194 /* we have only a switch on HP-out PIN */
5195 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
5196 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
5203 /* create input playback/capture controls for the given pin */
5204 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
5205 const char *ctlname
, int ctlidx
,
5206 int idx
, hda_nid_t mix_nid
)
5210 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
, ctlidx
,
5211 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
5214 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
, ctlidx
,
5215 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
5221 static int alc_is_input_pin(struct hda_codec
*codec
, hda_nid_t nid
)
5223 unsigned int pincap
= snd_hda_query_pin_caps(codec
, nid
);
5224 return (pincap
& AC_PINCAP_IN
) != 0;
5227 /* create playback/capture controls for input pins */
5228 static int alc_auto_create_input_ctls(struct hda_codec
*codec
,
5229 const struct auto_pin_cfg
*cfg
,
5231 hda_nid_t cap1
, hda_nid_t cap2
)
5233 struct alc_spec
*spec
= codec
->spec
;
5234 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
5235 int i
, err
, idx
, type_idx
= 0;
5236 const char *prev_label
= NULL
;
5238 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5242 pin
= cfg
->inputs
[i
].pin
;
5243 if (!alc_is_input_pin(codec
, pin
))
5246 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
5247 if (prev_label
&& !strcmp(label
, prev_label
))
5254 idx
= get_connection_index(codec
, mixer
, pin
);
5256 err
= new_analog_input(spec
, pin
,
5266 idx
= get_connection_index(codec
, cap1
, pin
);
5267 if (idx
< 0 && cap2
)
5268 idx
= get_connection_index(codec
, cap2
, pin
);
5270 snd_hda_add_imux_item(imux
, label
, idx
, NULL
);
5275 static int alc880_auto_create_input_ctls(struct hda_codec
*codec
,
5276 const struct auto_pin_cfg
*cfg
)
5278 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x08, 0x09);
5281 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
5282 unsigned int pin_type
)
5284 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5287 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5291 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
5292 hda_nid_t nid
, int pin_type
,
5295 alc_set_pin_output(codec
, nid
, pin_type
);
5296 /* need the manual connection? */
5297 if (alc880_is_multi_pin(nid
)) {
5298 struct alc_spec
*spec
= codec
->spec
;
5299 int idx
= alc880_multi_pin_idx(nid
);
5300 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
5301 AC_VERB_SET_CONNECT_SEL
,
5302 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
5306 static int get_pin_type(int line_out_type
)
5308 if (line_out_type
== AUTO_PIN_HP_OUT
)
5314 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
5316 struct alc_spec
*spec
= codec
->spec
;
5319 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
5320 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
5321 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5322 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
5326 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
5328 struct alc_spec
*spec
= codec
->spec
;
5331 pin
= spec
->autocfg
.speaker_pins
[0];
5332 if (pin
) /* connect to front */
5333 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
5334 pin
= spec
->autocfg
.hp_pins
[0];
5335 if (pin
) /* connect to front */
5336 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
5339 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
5341 struct alc_spec
*spec
= codec
->spec
;
5342 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5345 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5346 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5347 if (alc_is_input_pin(codec
, nid
)) {
5348 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
5349 if (nid
!= ALC880_PIN_CD_NID
&&
5350 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
5351 snd_hda_codec_write(codec
, nid
, 0,
5352 AC_VERB_SET_AMP_GAIN_MUTE
,
5358 static void alc880_auto_init_input_src(struct hda_codec
*codec
)
5360 struct alc_spec
*spec
= codec
->spec
;
5363 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
5364 unsigned int mux_idx
;
5365 const struct hda_input_mux
*imux
;
5366 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
5367 imux
= &spec
->input_mux
[mux_idx
];
5368 if (!imux
->num_items
&& mux_idx
> 0)
5369 imux
= &spec
->input_mux
[0];
5371 snd_hda_codec_write(codec
, spec
->adc_nids
[c
], 0,
5372 AC_VERB_SET_CONNECT_SEL
,
5373 imux
->items
[0].index
);
5377 /* parse the BIOS configuration and set up the alc_spec */
5378 /* return 1 if successful, 0 if the proper config is not found,
5379 * or a negative error code
5381 static int alc880_parse_auto_config(struct hda_codec
*codec
)
5383 struct alc_spec
*spec
= codec
->spec
;
5385 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
5387 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5391 if (!spec
->autocfg
.line_outs
)
5392 return 0; /* can't find valid BIOS pin config */
5394 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
5397 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5400 err
= alc880_auto_create_extra_out(spec
,
5401 spec
->autocfg
.speaker_pins
[0],
5405 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
5409 err
= alc880_auto_create_input_ctls(codec
, &spec
->autocfg
);
5413 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
5415 alc_auto_parse_digital(codec
);
5417 if (spec
->kctls
.list
)
5418 add_mixer(spec
, spec
->kctls
.list
);
5420 add_verb(spec
, alc880_volume_init_verbs
);
5422 spec
->num_mux_defs
= 1;
5423 spec
->input_mux
= &spec
->private_imux
[0];
5425 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
5430 /* additional initialization for auto-configuration model */
5431 static void alc880_auto_init(struct hda_codec
*codec
)
5433 struct alc_spec
*spec
= codec
->spec
;
5434 alc880_auto_init_multi_out(codec
);
5435 alc880_auto_init_extra_out(codec
);
5436 alc880_auto_init_analog_input(codec
);
5437 alc880_auto_init_input_src(codec
);
5438 alc_auto_init_digital(codec
);
5439 if (spec
->unsol_event
)
5440 alc_inithook(codec
);
5443 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5444 * one of two digital mic pins, e.g. on ALC272
5446 static void fixup_automic_adc(struct hda_codec
*codec
)
5448 struct alc_spec
*spec
= codec
->spec
;
5451 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5452 hda_nid_t cap
= spec
->capsrc_nids
?
5453 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5456 iidx
= get_connection_index(codec
, cap
, spec
->int_mic
.pin
);
5459 eidx
= get_connection_index(codec
, cap
, spec
->ext_mic
.pin
);
5462 spec
->int_mic
.mux_idx
= iidx
;
5463 spec
->ext_mic
.mux_idx
= eidx
;
5464 if (spec
->capsrc_nids
)
5465 spec
->capsrc_nids
+= i
;
5466 spec
->adc_nids
+= i
;
5467 spec
->num_adc_nids
= 1;
5470 snd_printd(KERN_INFO
"hda_codec: %s: "
5471 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5472 codec
->chip_name
, spec
->int_mic
.pin
, spec
->ext_mic
.pin
);
5473 spec
->auto_mic
= 0; /* disable auto-mic to be sure */
5476 /* select or unmute the given capsrc route */
5477 static void select_or_unmute_capsrc(struct hda_codec
*codec
, hda_nid_t cap
,
5480 if (get_wcaps_type(get_wcaps(codec
, cap
)) == AC_WID_AUD_MIX
) {
5481 snd_hda_codec_amp_stereo(codec
, cap
, HDA_INPUT
, idx
,
5484 snd_hda_codec_write_cache(codec
, cap
, 0,
5485 AC_VERB_SET_CONNECT_SEL
, idx
);
5489 /* set the default connection to that pin */
5490 static int init_capsrc_for_pin(struct hda_codec
*codec
, hda_nid_t pin
)
5492 struct alc_spec
*spec
= codec
->spec
;
5495 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5496 hda_nid_t cap
= spec
->capsrc_nids
?
5497 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5500 idx
= get_connection_index(codec
, cap
, pin
);
5503 select_or_unmute_capsrc(codec
, cap
, idx
);
5504 return i
; /* return the found index */
5506 return -1; /* not found */
5509 /* choose the ADC/MUX containing the input pin and initialize the setup */
5510 static void fixup_single_adc(struct hda_codec
*codec
)
5512 struct alc_spec
*spec
= codec
->spec
;
5513 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5516 /* search for the input pin; there must be only one */
5517 if (cfg
->num_inputs
!= 1)
5519 i
= init_capsrc_for_pin(codec
, cfg
->inputs
[0].pin
);
5521 /* use only this ADC */
5522 if (spec
->capsrc_nids
)
5523 spec
->capsrc_nids
+= i
;
5524 spec
->adc_nids
+= i
;
5525 spec
->num_adc_nids
= 1;
5526 spec
->single_input_src
= 1;
5530 /* initialize dual adcs */
5531 static void fixup_dual_adc_switch(struct hda_codec
*codec
)
5533 struct alc_spec
*spec
= codec
->spec
;
5534 init_capsrc_for_pin(codec
, spec
->ext_mic
.pin
);
5535 init_capsrc_for_pin(codec
, spec
->int_mic
.pin
);
5538 /* initialize some special cases for input sources */
5539 static void alc_init_special_input_src(struct hda_codec
*codec
)
5541 struct alc_spec
*spec
= codec
->spec
;
5542 if (spec
->dual_adc_switch
)
5543 fixup_dual_adc_switch(codec
);
5544 else if (spec
->single_input_src
)
5545 init_capsrc_for_pin(codec
, spec
->autocfg
.inputs
[0].pin
);
5548 static void set_capture_mixer(struct hda_codec
*codec
)
5550 struct alc_spec
*spec
= codec
->spec
;
5551 static struct snd_kcontrol_new
*caps
[2][3] = {
5552 { alc_capture_mixer_nosrc1
,
5553 alc_capture_mixer_nosrc2
,
5554 alc_capture_mixer_nosrc3
},
5555 { alc_capture_mixer1
,
5557 alc_capture_mixer3
},
5559 if (spec
->num_adc_nids
> 0 && spec
->num_adc_nids
<= 3) {
5561 int num_adcs
= spec
->num_adc_nids
;
5562 if (spec
->dual_adc_switch
)
5564 else if (spec
->auto_mic
)
5565 fixup_automic_adc(codec
);
5566 else if (spec
->input_mux
) {
5567 if (spec
->input_mux
->num_items
> 1)
5569 else if (spec
->input_mux
->num_items
== 1)
5570 fixup_single_adc(codec
);
5572 spec
->cap_mixer
= caps
[mux
][num_adcs
- 1];
5576 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5577 static void fillup_priv_adc_nids(struct hda_codec
*codec
, hda_nid_t
*nids
,
5580 struct alc_spec
*spec
= codec
->spec
;
5581 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5583 hda_nid_t fallback_adc
= 0, fallback_cap
= 0;
5585 for (n
= 0; n
< num_nids
; n
++) {
5587 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
5591 if (get_wcaps_type(get_wcaps(codec
, adc
)) != AC_WID_AUD_IN
)
5594 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5598 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5603 if (!fallback_adc
) {
5607 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5608 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5609 for (j
= 0; j
< nconns
; j
++) {
5616 if (i
>= cfg
->num_inputs
) {
5617 int num_adcs
= spec
->num_adc_nids
;
5618 spec
->private_adc_nids
[num_adcs
] = adc
;
5619 spec
->private_capsrc_nids
[num_adcs
] = cap
;
5620 spec
->num_adc_nids
++;
5621 spec
->adc_nids
= spec
->private_adc_nids
;
5623 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
5626 if (!spec
->num_adc_nids
) {
5627 printk(KERN_WARNING
"hda_codec: %s: no valid ADC found;"
5628 " using fallback 0x%x\n",
5629 codec
->chip_name
, fallback_adc
);
5630 spec
->private_adc_nids
[0] = fallback_adc
;
5631 spec
->adc_nids
= spec
->private_adc_nids
;
5632 if (fallback_adc
!= fallback_cap
) {
5633 spec
->private_capsrc_nids
[0] = fallback_cap
;
5634 spec
->capsrc_nids
= spec
->private_adc_nids
;
5639 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5640 #define set_beep_amp(spec, nid, idx, dir) \
5641 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5643 static struct snd_pci_quirk beep_white_list
[] = {
5644 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5645 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5646 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5650 static inline int has_cdefine_beep(struct hda_codec
*codec
)
5652 struct alc_spec
*spec
= codec
->spec
;
5653 const struct snd_pci_quirk
*q
;
5654 q
= snd_pci_quirk_lookup(codec
->bus
->pci
, beep_white_list
);
5657 return spec
->cdefine
.enable_pcbeep
;
5660 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5661 #define has_cdefine_beep(codec) 0
5665 * OK, here we have finally the patch for ALC880
5668 static int patch_alc880(struct hda_codec
*codec
)
5670 struct alc_spec
*spec
;
5674 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5680 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
5683 if (board_config
< 0) {
5684 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5686 board_config
= ALC880_AUTO
;
5689 if (board_config
== ALC880_AUTO
) {
5690 /* automatic parse from the BIOS config */
5691 err
= alc880_parse_auto_config(codec
);
5697 "hda_codec: Cannot set up configuration "
5698 "from BIOS. Using 3-stack mode...\n");
5699 board_config
= ALC880_3ST
;
5703 err
= snd_hda_attach_beep_device(codec
, 0x1);
5709 if (board_config
!= ALC880_AUTO
)
5710 setup_preset(codec
, &alc880_presets
[board_config
]);
5712 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
5713 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
5714 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
5716 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
5717 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
5719 if (!spec
->adc_nids
&& spec
->input_mux
) {
5720 /* check whether NID 0x07 is valid */
5721 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
5723 wcap
= get_wcaps_type(wcap
);
5724 if (wcap
!= AC_WID_AUD_IN
) {
5725 spec
->adc_nids
= alc880_adc_nids_alt
;
5726 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
5728 spec
->adc_nids
= alc880_adc_nids
;
5729 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
5732 set_capture_mixer(codec
);
5733 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
5735 spec
->vmaster_nid
= 0x0c;
5737 codec
->patch_ops
= alc_patch_ops
;
5738 if (board_config
== ALC880_AUTO
)
5739 spec
->init_hook
= alc880_auto_init
;
5740 #ifdef CONFIG_SND_HDA_POWER_SAVE
5741 if (!spec
->loopback
.amplist
)
5742 spec
->loopback
.amplist
= alc880_loopbacks
;
5753 static hda_nid_t alc260_dac_nids
[1] = {
5758 static hda_nid_t alc260_adc_nids
[1] = {
5763 static hda_nid_t alc260_adc_nids_alt
[1] = {
5768 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5769 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5771 static hda_nid_t alc260_dual_adc_nids
[2] = {
5776 #define ALC260_DIGOUT_NID 0x03
5777 #define ALC260_DIGIN_NID 0x06
5779 static struct hda_input_mux alc260_capture_source
= {
5783 { "Front Mic", 0x1 },
5789 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5790 * headphone jack and the internal CD lines since these are the only pins at
5791 * which audio can appear. For flexibility, also allow the option of
5792 * recording the mixer output on the second ADC (ADC0 doesn't have a
5793 * connection to the mixer output).
5795 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
5799 { "Mic/Line", 0x0 },
5801 { "Headphone", 0x2 },
5807 { "Mic/Line", 0x0 },
5809 { "Headphone", 0x2 },
5816 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5817 * the Fujitsu S702x, but jacks are marked differently.
5819 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
5826 { "Headphone", 0x5 },
5835 { "Headphone", 0x6 },
5841 /* Maxdata Favorit 100XS */
5842 static struct hda_input_mux alc260_favorit100_capture_sources
[2] = {
5846 { "Line/Mic", 0x0 },
5853 { "Line/Mic", 0x0 },
5861 * This is just place-holder, so there's something for alc_build_pcms to look
5862 * at when it calculates the maximum number of channels. ALC260 has no mixer
5863 * element which allows changing the channel mode, so the verb list is
5866 static struct hda_channel_mode alc260_modes
[1] = {
5871 /* Mixer combinations
5873 * basic: base_output + input + pc_beep + capture
5874 * HP: base_output + input + capture_alt
5875 * HP_3013: hp_3013 + input + capture
5876 * fujitsu: fujitsu + capture
5877 * acer: acer + capture
5880 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
5881 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5882 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
5883 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5884 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
5885 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
5886 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
5890 static struct snd_kcontrol_new alc260_input_mixer
[] = {
5891 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5892 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5893 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5894 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5896 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5897 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
5898 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
5902 /* update HP, line and mono out pins according to the master switch */
5903 static void alc260_hp_master_update(struct hda_codec
*codec
,
5904 hda_nid_t hp
, hda_nid_t line
,
5907 struct alc_spec
*spec
= codec
->spec
;
5908 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
5909 /* change HP and line-out pins */
5910 snd_hda_codec_write(codec
, hp
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5912 snd_hda_codec_write(codec
, line
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5914 /* mono (speaker) depending on the HP jack sense */
5915 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
5916 snd_hda_codec_write(codec
, mono
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5920 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
5921 struct snd_ctl_elem_value
*ucontrol
)
5923 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5924 struct alc_spec
*spec
= codec
->spec
;
5925 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
5929 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
5930 struct snd_ctl_elem_value
*ucontrol
)
5932 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5933 struct alc_spec
*spec
= codec
->spec
;
5934 int val
= !!*ucontrol
->value
.integer
.value
;
5935 hda_nid_t hp
, line
, mono
;
5937 if (val
== spec
->master_sw
)
5939 spec
->master_sw
= val
;
5940 hp
= (kcontrol
->private_value
>> 16) & 0xff;
5941 line
= (kcontrol
->private_value
>> 8) & 0xff;
5942 mono
= kcontrol
->private_value
& 0xff;
5943 alc260_hp_master_update(codec
, hp
, line
, mono
);
5947 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
5949 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5950 .name
= "Master Playback Switch",
5951 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
5952 .info
= snd_ctl_boolean_mono_info
,
5953 .get
= alc260_hp_master_sw_get
,
5954 .put
= alc260_hp_master_sw_put
,
5955 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
5957 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5958 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
5959 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5960 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
5961 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5963 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
5967 static struct hda_verb alc260_hp_unsol_verbs
[] = {
5968 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5972 static void alc260_hp_automute(struct hda_codec
*codec
)
5974 struct alc_spec
*spec
= codec
->spec
;
5976 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x10);
5977 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
5980 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5982 if ((res
>> 26) == ALC880_HP_EVENT
)
5983 alc260_hp_automute(codec
);
5986 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
5988 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5989 .name
= "Master Playback Switch",
5990 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
5991 .info
= snd_ctl_boolean_mono_info
,
5992 .get
= alc260_hp_master_sw_get
,
5993 .put
= alc260_hp_master_sw_put
,
5994 .private_value
= (0x15 << 16) | (0x10 << 8) | 0x11
5996 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5997 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
5998 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
5999 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
6000 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6001 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6002 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6003 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
6007 static struct hda_bind_ctls alc260_dc7600_bind_master_vol
= {
6008 .ops
= &snd_hda_bind_vol
,
6010 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT
),
6011 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
6012 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT
),
6017 static struct hda_bind_ctls alc260_dc7600_bind_switch
= {
6018 .ops
= &snd_hda_bind_sw
,
6020 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT
),
6021 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
6026 static struct snd_kcontrol_new alc260_hp_dc7600_mixer
[] = {
6027 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol
),
6028 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch
),
6029 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT
),
6030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
6034 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
6035 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6039 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
6041 struct alc_spec
*spec
= codec
->spec
;
6043 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
6044 alc260_hp_master_update(codec
, 0x15, 0x10, 0x11);
6047 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
6050 if ((res
>> 26) == ALC880_HP_EVENT
)
6051 alc260_hp_3013_automute(codec
);
6054 static void alc260_hp_3012_automute(struct hda_codec
*codec
)
6056 unsigned int bits
= snd_hda_jack_detect(codec
, 0x10) ? 0 : PIN_OUT
;
6058 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
6060 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
6062 snd_hda_codec_write(codec
, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
6066 static void alc260_hp_3012_unsol_event(struct hda_codec
*codec
,
6069 if ((res
>> 26) == ALC880_HP_EVENT
)
6070 alc260_hp_3012_automute(codec
);
6073 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6074 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6076 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
6077 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6078 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
6079 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6080 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6081 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6082 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
6083 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
6084 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6085 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6086 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
6090 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6091 * versions of the ALC260 don't act on requests to enable mic bias from NID
6092 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6093 * datasheet doesn't mention this restriction. At this stage it's not clear
6094 * whether this behaviour is intentional or is a hardware bug in chip
6095 * revisions available in early 2006. Therefore for now allow the
6096 * "Headphone Jack Mode" control to span all choices, but if it turns out
6097 * that the lack of mic bias for this NID is intentional we could change the
6098 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6100 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6101 * don't appear to make the mic bias available from the "line" jack, even
6102 * though the NID used for this jack (0x14) can supply it. The theory is
6103 * that perhaps Acer have included blocking capacitors between the ALC260
6104 * and the output jack. If this turns out to be the case for all such
6105 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6106 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6108 * The C20x Tablet series have a mono internal speaker which is controlled
6109 * via the chip's Mono sum widget and pin complex, so include the necessary
6110 * controls for such models. On models without a "mono speaker" the control
6111 * won't do anything.
6113 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
6114 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6115 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
6116 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
6117 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6119 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6121 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6122 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6124 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6125 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6126 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6127 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6128 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6132 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6134 static struct snd_kcontrol_new alc260_favorit100_mixer
[] = {
6135 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6136 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
6137 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
6138 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6139 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6140 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6144 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6145 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6147 static struct snd_kcontrol_new alc260_will_mixer
[] = {
6148 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6149 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
6150 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6151 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6152 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6153 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6154 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6155 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6156 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6157 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6161 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6162 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6164 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
6165 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6166 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
6167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6168 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6169 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6170 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
6171 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
6172 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6173 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6174 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6179 * initialization verbs
6181 static struct hda_verb alc260_init_verbs
[] = {
6182 /* Line In pin widget for input */
6183 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6184 /* CD pin widget for input */
6185 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6186 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6187 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6188 /* Mic2 (front panel) pin widget for input and vref at 80% */
6189 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6190 /* LINE-2 is used for line-out in rear */
6191 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6192 /* select line-out */
6193 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
6195 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6197 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6199 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6200 /* mute capture amp left and right */
6201 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6202 /* set connection select to line in (default select for this ADC) */
6203 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6204 /* mute capture amp left and right */
6205 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6206 /* set connection select to line in (default select for this ADC) */
6207 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
6208 /* set vol=0 Line-Out mixer amp left and right */
6209 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6210 /* unmute pin widget amp left and right (no gain on this amp) */
6211 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6212 /* set vol=0 HP mixer amp left and right */
6213 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6214 /* unmute pin widget amp left and right (no gain on this amp) */
6215 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6216 /* set vol=0 Mono mixer amp left and right */
6217 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6218 /* unmute pin widget amp left and right (no gain on this amp) */
6219 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6220 /* unmute LINE-2 out pin */
6221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6222 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6225 /* mute analog inputs */
6226 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6227 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6230 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6231 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6232 /* mute Front out path */
6233 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6235 /* mute Headphone out path */
6236 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6238 /* mute Mono out path */
6239 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6240 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6244 #if 0 /* should be identical with alc260_init_verbs? */
6245 static struct hda_verb alc260_hp_init_verbs
[] = {
6246 /* Headphone and output */
6247 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6249 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6250 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6251 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6252 /* Mic2 (front panel) pin widget for input and vref at 80% */
6253 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6254 /* Line In pin widget for input */
6255 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6256 /* Line-2 pin widget for output */
6257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6258 /* CD pin widget for input */
6259 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6260 /* unmute amp left and right */
6261 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
6262 /* set connection select to line in (default select for this ADC) */
6263 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6264 /* unmute Line-Out mixer amp left and right (volume = 0) */
6265 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6266 /* mute pin widget amp left and right (no gain on this amp) */
6267 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6268 /* unmute HP mixer amp left and right (volume = 0) */
6269 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6270 /* mute pin widget amp left and right (no gain on this amp) */
6271 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6272 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6275 /* mute analog inputs */
6276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6281 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6282 /* Unmute Front out path */
6283 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6284 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6285 /* Unmute Headphone out path */
6286 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6287 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6288 /* Unmute Mono out path */
6289 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6290 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6295 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
6296 /* Line out and output */
6297 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6299 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6300 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6301 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6302 /* Mic2 (front panel) pin widget for input and vref at 80% */
6303 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6304 /* Line In pin widget for input */
6305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6306 /* Headphone pin widget for output */
6307 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6308 /* CD pin widget for input */
6309 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6310 /* unmute amp left and right */
6311 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
6312 /* set connection select to line in (default select for this ADC) */
6313 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6314 /* unmute Line-Out mixer amp left and right (volume = 0) */
6315 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6316 /* mute pin widget amp left and right (no gain on this amp) */
6317 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6318 /* unmute HP mixer amp left and right (volume = 0) */
6319 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6320 /* mute pin widget amp left and right (no gain on this amp) */
6321 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6322 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6325 /* mute analog inputs */
6326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6331 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6332 /* Unmute Front out path */
6333 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6335 /* Unmute Headphone out path */
6336 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6337 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6338 /* Unmute Mono out path */
6339 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6340 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6344 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6345 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6346 * audio = 0x16, internal speaker = 0x10.
6348 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
6349 /* Disable all GPIOs */
6350 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
6351 /* Internal speaker is connected to headphone pin */
6352 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6353 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6354 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6355 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6356 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6357 /* Ensure all other unused pins are disabled and muted. */
6358 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6359 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6360 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6361 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6362 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6363 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6364 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6365 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6367 /* Disable digital (SPDIF) pins */
6368 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6369 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6371 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6372 * when acting as an output.
6374 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6376 /* Start with output sum widgets muted and their output gains at min */
6377 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6378 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6379 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6380 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6381 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6382 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6383 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6384 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6385 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6387 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6388 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6389 /* Unmute Line1 pin widget output buffer since it starts as an output.
6390 * If the pin mode is changed by the user the pin mode control will
6391 * take care of enabling the pin's input/output buffers as needed.
6392 * Therefore there's no need to enable the input buffer at this
6395 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6396 /* Unmute input buffer of pin widget used for Line-in (no equiv
6399 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6401 /* Mute capture amp left and right */
6402 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6403 /* Set ADC connection select to match default mixer setting - line
6406 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6408 /* Do the same for the second ADC: mute capture input amp and
6409 * set ADC connection to line in (on mic1 pin)
6411 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6412 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6414 /* Mute all inputs to mixer widget (even unconnected ones) */
6415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6427 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6428 * similar laptops (adapted from Fujitsu init verbs).
6430 static struct hda_verb alc260_acer_init_verbs
[] = {
6431 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6432 * the headphone jack. Turn this on and rely on the standard mute
6433 * methods whenever the user wants to turn these outputs off.
6435 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6436 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6437 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6438 /* Internal speaker/Headphone jack is connected to Line-out pin */
6439 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6440 /* Internal microphone/Mic jack is connected to Mic1 pin */
6441 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6442 /* Line In jack is connected to Line1 pin */
6443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6444 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6445 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6446 /* Ensure all other unused pins are disabled and muted. */
6447 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6448 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6449 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6450 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6451 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6452 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6453 /* Disable digital (SPDIF) pins */
6454 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6455 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6457 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6458 * bus when acting as outputs.
6460 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6461 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6463 /* Start with output sum widgets muted and their output gains at min */
6464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6466 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6468 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6469 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6470 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6471 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6472 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6474 /* Unmute Line-out pin widget amp left and right
6475 * (no equiv mixer ctrl)
6477 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6478 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6479 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6480 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6481 * inputs. If the pin mode is changed by the user the pin mode control
6482 * will take care of enabling the pin's input/output buffers as needed.
6483 * Therefore there's no need to enable the input buffer at this
6486 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6487 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6489 /* Mute capture amp left and right */
6490 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6491 /* Set ADC connection select to match default mixer setting - mic
6494 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6496 /* Do similar with the second ADC: mute capture input amp and
6497 * set ADC connection to mic to match ALSA's default state.
6499 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6500 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6502 /* Mute all inputs to mixer widget (even unconnected ones) */
6503 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6504 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6505 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6510 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6515 /* Initialisation sequence for Maxdata Favorit 100XS
6516 * (adapted from Acer init verbs).
6518 static struct hda_verb alc260_favorit100_init_verbs
[] = {
6519 /* GPIO 0 enables the output jack.
6520 * Turn this on and rely on the standard mute
6521 * methods whenever the user wants to turn these outputs off.
6523 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6524 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6525 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6526 /* Line/Mic input jack is connected to Mic1 pin */
6527 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6528 /* Ensure all other unused pins are disabled and muted. */
6529 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6530 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6531 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6532 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6533 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6534 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6535 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6536 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6537 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6538 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6539 /* Disable digital (SPDIF) pins */
6540 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6541 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6543 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6544 * bus when acting as outputs.
6546 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6547 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6549 /* Start with output sum widgets muted and their output gains at min */
6550 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6552 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6553 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6554 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6555 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6556 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6557 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6558 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6560 /* Unmute Line-out pin widget amp left and right
6561 * (no equiv mixer ctrl)
6563 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6564 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6565 * inputs. If the pin mode is changed by the user the pin mode control
6566 * will take care of enabling the pin's input/output buffers as needed.
6567 * Therefore there's no need to enable the input buffer at this
6570 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6572 /* Mute capture amp left and right */
6573 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6574 /* Set ADC connection select to match default mixer setting - mic
6577 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6579 /* Do similar with the second ADC: mute capture input amp and
6580 * set ADC connection to mic to match ALSA's default state.
6582 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6583 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6585 /* Mute all inputs to mixer widget (even unconnected ones) */
6586 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6587 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6588 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6589 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6590 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6591 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6592 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6593 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6598 static struct hda_verb alc260_will_verbs
[] = {
6599 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6600 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6601 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
6602 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6603 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6604 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
6608 static struct hda_verb alc260_replacer_672v_verbs
[] = {
6609 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6610 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6611 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
6613 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6614 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6615 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
6617 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6621 /* toggle speaker-output according to the hp-jack state */
6622 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
6624 unsigned int present
;
6626 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6627 present
= snd_hda_jack_detect(codec
, 0x0f);
6629 snd_hda_codec_write_cache(codec
, 0x01, 0,
6630 AC_VERB_SET_GPIO_DATA
, 1);
6631 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6632 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6635 snd_hda_codec_write_cache(codec
, 0x01, 0,
6636 AC_VERB_SET_GPIO_DATA
, 0);
6637 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6638 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6643 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
6646 if ((res
>> 26) == ALC880_HP_EVENT
)
6647 alc260_replacer_672v_automute(codec
);
6650 static struct hda_verb alc260_hp_dc7600_verbs
[] = {
6651 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x01},
6652 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6653 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6654 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6655 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6656 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6657 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6658 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6659 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6660 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6664 /* Test configuration for debugging, modelled after the ALC880 test
6667 #ifdef CONFIG_SND_DEBUG
6668 static hda_nid_t alc260_test_dac_nids
[1] = {
6671 static hda_nid_t alc260_test_adc_nids
[2] = {
6674 /* For testing the ALC260, each input MUX needs its own definition since
6675 * the signal assignments are different. This assumes that the first ADC
6678 static struct hda_input_mux alc260_test_capture_sources
[2] = {
6682 { "MIC1 pin", 0x0 },
6683 { "MIC2 pin", 0x1 },
6684 { "LINE1 pin", 0x2 },
6685 { "LINE2 pin", 0x3 },
6687 { "LINE-OUT pin", 0x5 },
6688 { "HP-OUT pin", 0x6 },
6694 { "MIC1 pin", 0x0 },
6695 { "MIC2 pin", 0x1 },
6696 { "LINE1 pin", 0x2 },
6697 { "LINE2 pin", 0x3 },
6700 { "LINE-OUT pin", 0x6 },
6701 { "HP-OUT pin", 0x7 },
6705 static struct snd_kcontrol_new alc260_test_mixer
[] = {
6706 /* Output driver widgets */
6707 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6708 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6709 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6710 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
6711 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6712 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
6714 /* Modes for retasking pin widgets
6715 * Note: the ALC260 doesn't seem to act on requests to enable mic
6716 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6717 * mention this restriction. At this stage it's not clear whether
6718 * this behaviour is intentional or is a hardware bug in chip
6719 * revisions available at least up until early 2006. Therefore for
6720 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6721 * choices, but if it turns out that the lack of mic bias for these
6722 * NIDs is intentional we could change their modes from
6723 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6725 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
6726 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
6727 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
6728 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
6729 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
6730 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
6732 /* Loopback mixer controls */
6733 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
6734 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
6735 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
6736 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
6737 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
6738 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
6739 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
6740 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
6741 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6742 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6743 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
6744 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
6745 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
6746 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
6748 /* Controls for GPIO pins, assuming they are configured as outputs */
6749 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6750 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6751 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6752 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6754 /* Switches to allow the digital IO pins to be enabled. The datasheet
6755 * is ambigious as to which NID is which; testing on laptops which
6756 * make this output available should provide clarification.
6758 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6759 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6761 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6762 * this output to turn on an external amplifier.
6764 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6765 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6769 static struct hda_verb alc260_test_init_verbs
[] = {
6770 /* Enable all GPIOs as outputs with an initial value of 0 */
6771 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
6772 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
6773 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
6775 /* Enable retasking pins as output, initially without power amp */
6776 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6777 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6778 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6780 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6781 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6783 /* Disable digital (SPDIF) pins initially, but users can enable
6784 * them via a mixer switch. In the case of SPDIF-out, this initverb
6785 * payload also sets the generation to 0, output to be in "consumer"
6786 * PCM format, copyright asserted, no pre-emphasis and no validity
6789 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6790 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6792 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6793 * OUT1 sum bus when acting as an output.
6795 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6796 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
6797 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6798 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
6800 /* Start with output sum widgets muted and their output gains at min */
6801 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6802 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6803 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6804 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6805 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6806 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6807 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6808 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6809 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6811 /* Unmute retasking pin widget output buffers since the default
6812 * state appears to be output. As the pin mode is changed by the
6813 * user the pin mode control will take care of enabling the pin's
6814 * input/output buffers as needed.
6816 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6817 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6818 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6819 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6820 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6821 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6822 /* Also unmute the mono-out pin widget */
6823 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6825 /* Mute capture amp left and right */
6826 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6827 /* Set ADC connection select to match default mixer setting (mic1
6830 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6832 /* Do the same for the second ADC: mute capture input amp and
6833 * set ADC connection to mic1 pin
6835 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6836 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6838 /* Mute all inputs to mixer widget (even unconnected ones) */
6839 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6840 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6844 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6852 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6853 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6855 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6856 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6859 * for BIOS auto-configuration
6862 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
6863 const char *pfx
, int *vol_bits
)
6866 unsigned long vol_val
, sw_val
;
6869 if (nid
>= 0x0f && nid
< 0x11) {
6870 nid_vol
= nid
- 0x7;
6871 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
6872 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
6873 } else if (nid
== 0x11) {
6874 nid_vol
= nid
- 0x7;
6875 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
6876 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
6877 } else if (nid
>= 0x12 && nid
<= 0x15) {
6879 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
6880 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
6884 if (!(*vol_bits
& (1 << nid_vol
))) {
6885 /* first control for the volume widget */
6886 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, vol_val
);
6889 *vol_bits
|= (1 << nid_vol
);
6891 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, sw_val
);
6897 /* add playback controls from the parsed DAC table */
6898 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
6899 const struct auto_pin_cfg
*cfg
)
6905 spec
->multiout
.num_dacs
= 1;
6906 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
6907 spec
->multiout
.dac_nids
[0] = 0x02;
6909 nid
= cfg
->line_out_pins
[0];
6912 if (!cfg
->speaker_pins
[0] && !cfg
->hp_pins
[0])
6914 else if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
6918 err
= alc260_add_playback_controls(spec
, nid
, pfx
, &vols
);
6923 nid
= cfg
->speaker_pins
[0];
6925 err
= alc260_add_playback_controls(spec
, nid
, "Speaker", &vols
);
6930 nid
= cfg
->hp_pins
[0];
6932 err
= alc260_add_playback_controls(spec
, nid
, "Headphone",
6940 /* create playback/capture controls for input pins */
6941 static int alc260_auto_create_input_ctls(struct hda_codec
*codec
,
6942 const struct auto_pin_cfg
*cfg
)
6944 return alc_auto_create_input_ctls(codec
, cfg
, 0x07, 0x04, 0x05);
6947 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
6948 hda_nid_t nid
, int pin_type
,
6951 alc_set_pin_output(codec
, nid
, pin_type
);
6952 /* need the manual connection? */
6954 int idx
= nid
- 0x12;
6955 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
6956 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
6960 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
6962 struct alc_spec
*spec
= codec
->spec
;
6965 nid
= spec
->autocfg
.line_out_pins
[0];
6967 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
6968 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
6971 nid
= spec
->autocfg
.speaker_pins
[0];
6973 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
6975 nid
= spec
->autocfg
.hp_pins
[0];
6977 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
6980 #define ALC260_PIN_CD_NID 0x16
6981 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
6983 struct alc_spec
*spec
= codec
->spec
;
6984 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
6987 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
6988 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
6990 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
6991 if (nid
!= ALC260_PIN_CD_NID
&&
6992 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
6993 snd_hda_codec_write(codec
, nid
, 0,
6994 AC_VERB_SET_AMP_GAIN_MUTE
,
7000 #define alc260_auto_init_input_src alc880_auto_init_input_src
7003 * generic initialization of ADC, input mixers and output mixers
7005 static struct hda_verb alc260_volume_init_verbs
[] = {
7007 * Unmute ADC0-1 and set the default input to mic-in
7009 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
7010 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7011 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
7012 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7014 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7016 * Note: PASD motherboards uses the Line In 2 as the input for
7017 * front panel mic (mic 2)
7019 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7020 /* mute analog inputs */
7021 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7022 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7028 * Set up output mixers (0x08 - 0x0a)
7030 /* set vol=0 to output mixers */
7031 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7032 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7033 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7034 /* set up input amps for analog loopback */
7035 /* Amp Indices: DAC = 0, mixer = 1 */
7036 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7037 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7038 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7039 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7040 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7041 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7046 static int alc260_parse_auto_config(struct hda_codec
*codec
)
7048 struct alc_spec
*spec
= codec
->spec
;
7050 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
7052 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
7056 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
7059 if (!spec
->kctls
.list
)
7060 return 0; /* can't find valid BIOS pin config */
7061 err
= alc260_auto_create_input_ctls(codec
, &spec
->autocfg
);
7065 spec
->multiout
.max_channels
= 2;
7067 if (spec
->autocfg
.dig_outs
)
7068 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
7069 if (spec
->kctls
.list
)
7070 add_mixer(spec
, spec
->kctls
.list
);
7072 add_verb(spec
, alc260_volume_init_verbs
);
7074 spec
->num_mux_defs
= 1;
7075 spec
->input_mux
= &spec
->private_imux
[0];
7077 alc_ssid_check(codec
, 0x10, 0x15, 0x0f, 0);
7082 /* additional initialization for auto-configuration model */
7083 static void alc260_auto_init(struct hda_codec
*codec
)
7085 struct alc_spec
*spec
= codec
->spec
;
7086 alc260_auto_init_multi_out(codec
);
7087 alc260_auto_init_analog_input(codec
);
7088 alc260_auto_init_input_src(codec
);
7089 alc_auto_init_digital(codec
);
7090 if (spec
->unsol_event
)
7091 alc_inithook(codec
);
7094 #ifdef CONFIG_SND_HDA_POWER_SAVE
7095 static struct hda_amp_list alc260_loopbacks
[] = {
7096 { 0x07, HDA_INPUT
, 0 },
7097 { 0x07, HDA_INPUT
, 1 },
7098 { 0x07, HDA_INPUT
, 2 },
7099 { 0x07, HDA_INPUT
, 3 },
7100 { 0x07, HDA_INPUT
, 4 },
7112 static const struct alc_fixup alc260_fixups
[] = {
7113 [PINFIX_HP_DC5750
] = {
7114 .type
= ALC_FIXUP_PINS
,
7115 .v
.pins
= (const struct alc_pincfg
[]) {
7116 { 0x11, 0x90130110 }, /* speaker */
7122 static struct snd_pci_quirk alc260_fixup_tbl
[] = {
7123 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750
),
7128 * ALC260 configurations
7130 static const char * const alc260_models
[ALC260_MODEL_LAST
] = {
7131 [ALC260_BASIC
] = "basic",
7133 [ALC260_HP_3013
] = "hp-3013",
7134 [ALC260_HP_DC7600
] = "hp-dc7600",
7135 [ALC260_FUJITSU_S702X
] = "fujitsu",
7136 [ALC260_ACER
] = "acer",
7137 [ALC260_WILL
] = "will",
7138 [ALC260_REPLACER_672V
] = "replacer",
7139 [ALC260_FAVORIT100
] = "favorit100",
7140 #ifdef CONFIG_SND_DEBUG
7141 [ALC260_TEST
] = "test",
7143 [ALC260_AUTO
] = "auto",
7146 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
7147 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
7148 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL
),
7149 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
7150 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100
),
7151 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
7152 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO
), /* no quirk */
7153 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
7154 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
7155 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600
),
7156 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
7157 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
7158 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
7159 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
7160 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
7161 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
7162 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
7163 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
7164 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
7165 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
7166 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
7170 static struct alc_config_preset alc260_presets
[] = {
7172 .mixers
= { alc260_base_output_mixer
,
7173 alc260_input_mixer
},
7174 .init_verbs
= { alc260_init_verbs
},
7175 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7176 .dac_nids
= alc260_dac_nids
,
7177 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7178 .adc_nids
= alc260_dual_adc_nids
,
7179 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7180 .channel_mode
= alc260_modes
,
7181 .input_mux
= &alc260_capture_source
,
7184 .mixers
= { alc260_hp_output_mixer
,
7185 alc260_input_mixer
},
7186 .init_verbs
= { alc260_init_verbs
,
7187 alc260_hp_unsol_verbs
},
7188 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7189 .dac_nids
= alc260_dac_nids
,
7190 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7191 .adc_nids
= alc260_adc_nids_alt
,
7192 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7193 .channel_mode
= alc260_modes
,
7194 .input_mux
= &alc260_capture_source
,
7195 .unsol_event
= alc260_hp_unsol_event
,
7196 .init_hook
= alc260_hp_automute
,
7198 [ALC260_HP_DC7600
] = {
7199 .mixers
= { alc260_hp_dc7600_mixer
,
7200 alc260_input_mixer
},
7201 .init_verbs
= { alc260_init_verbs
,
7202 alc260_hp_dc7600_verbs
},
7203 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7204 .dac_nids
= alc260_dac_nids
,
7205 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7206 .adc_nids
= alc260_adc_nids_alt
,
7207 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7208 .channel_mode
= alc260_modes
,
7209 .input_mux
= &alc260_capture_source
,
7210 .unsol_event
= alc260_hp_3012_unsol_event
,
7211 .init_hook
= alc260_hp_3012_automute
,
7213 [ALC260_HP_3013
] = {
7214 .mixers
= { alc260_hp_3013_mixer
,
7215 alc260_input_mixer
},
7216 .init_verbs
= { alc260_hp_3013_init_verbs
,
7217 alc260_hp_3013_unsol_verbs
},
7218 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7219 .dac_nids
= alc260_dac_nids
,
7220 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7221 .adc_nids
= alc260_adc_nids_alt
,
7222 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7223 .channel_mode
= alc260_modes
,
7224 .input_mux
= &alc260_capture_source
,
7225 .unsol_event
= alc260_hp_3013_unsol_event
,
7226 .init_hook
= alc260_hp_3013_automute
,
7228 [ALC260_FUJITSU_S702X
] = {
7229 .mixers
= { alc260_fujitsu_mixer
},
7230 .init_verbs
= { alc260_fujitsu_init_verbs
},
7231 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7232 .dac_nids
= alc260_dac_nids
,
7233 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7234 .adc_nids
= alc260_dual_adc_nids
,
7235 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7236 .channel_mode
= alc260_modes
,
7237 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
7238 .input_mux
= alc260_fujitsu_capture_sources
,
7241 .mixers
= { alc260_acer_mixer
},
7242 .init_verbs
= { alc260_acer_init_verbs
},
7243 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7244 .dac_nids
= alc260_dac_nids
,
7245 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7246 .adc_nids
= alc260_dual_adc_nids
,
7247 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7248 .channel_mode
= alc260_modes
,
7249 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
7250 .input_mux
= alc260_acer_capture_sources
,
7252 [ALC260_FAVORIT100
] = {
7253 .mixers
= { alc260_favorit100_mixer
},
7254 .init_verbs
= { alc260_favorit100_init_verbs
},
7255 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7256 .dac_nids
= alc260_dac_nids
,
7257 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7258 .adc_nids
= alc260_dual_adc_nids
,
7259 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7260 .channel_mode
= alc260_modes
,
7261 .num_mux_defs
= ARRAY_SIZE(alc260_favorit100_capture_sources
),
7262 .input_mux
= alc260_favorit100_capture_sources
,
7265 .mixers
= { alc260_will_mixer
},
7266 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
7267 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7268 .dac_nids
= alc260_dac_nids
,
7269 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
7270 .adc_nids
= alc260_adc_nids
,
7271 .dig_out_nid
= ALC260_DIGOUT_NID
,
7272 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7273 .channel_mode
= alc260_modes
,
7274 .input_mux
= &alc260_capture_source
,
7276 [ALC260_REPLACER_672V
] = {
7277 .mixers
= { alc260_replacer_672v_mixer
},
7278 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
7279 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7280 .dac_nids
= alc260_dac_nids
,
7281 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
7282 .adc_nids
= alc260_adc_nids
,
7283 .dig_out_nid
= ALC260_DIGOUT_NID
,
7284 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7285 .channel_mode
= alc260_modes
,
7286 .input_mux
= &alc260_capture_source
,
7287 .unsol_event
= alc260_replacer_672v_unsol_event
,
7288 .init_hook
= alc260_replacer_672v_automute
,
7290 #ifdef CONFIG_SND_DEBUG
7292 .mixers
= { alc260_test_mixer
},
7293 .init_verbs
= { alc260_test_init_verbs
},
7294 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
7295 .dac_nids
= alc260_test_dac_nids
,
7296 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
7297 .adc_nids
= alc260_test_adc_nids
,
7298 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7299 .channel_mode
= alc260_modes
,
7300 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
7301 .input_mux
= alc260_test_capture_sources
,
7306 static int patch_alc260(struct hda_codec
*codec
)
7308 struct alc_spec
*spec
;
7309 int err
, board_config
;
7311 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
7317 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
7320 if (board_config
< 0) {
7321 snd_printd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
7323 board_config
= ALC260_AUTO
;
7326 if (board_config
== ALC260_AUTO
) {
7327 alc_pick_fixup(codec
, NULL
, alc260_fixup_tbl
, alc260_fixups
);
7328 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
7331 if (board_config
== ALC260_AUTO
) {
7332 /* automatic parse from the BIOS config */
7333 err
= alc260_parse_auto_config(codec
);
7339 "hda_codec: Cannot set up configuration "
7340 "from BIOS. Using base mode...\n");
7341 board_config
= ALC260_BASIC
;
7345 err
= snd_hda_attach_beep_device(codec
, 0x1);
7351 if (board_config
!= ALC260_AUTO
)
7352 setup_preset(codec
, &alc260_presets
[board_config
]);
7354 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
7355 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
7356 spec
->stream_analog_alt_capture
= &alc260_pcm_analog_capture
;
7358 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
7359 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
7361 if (!spec
->adc_nids
&& spec
->input_mux
) {
7362 /* check whether NID 0x04 is valid */
7363 unsigned int wcap
= get_wcaps(codec
, 0x04);
7364 wcap
= get_wcaps_type(wcap
);
7366 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
7367 spec
->adc_nids
= alc260_adc_nids_alt
;
7368 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
7370 spec
->adc_nids
= alc260_adc_nids
;
7371 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
7374 set_capture_mixer(codec
);
7375 set_beep_amp(spec
, 0x07, 0x05, HDA_INPUT
);
7377 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
7379 spec
->vmaster_nid
= 0x08;
7381 codec
->patch_ops
= alc_patch_ops
;
7382 if (board_config
== ALC260_AUTO
)
7383 spec
->init_hook
= alc260_auto_init
;
7384 #ifdef CONFIG_SND_HDA_POWER_SAVE
7385 if (!spec
->loopback
.amplist
)
7386 spec
->loopback
.amplist
= alc260_loopbacks
;
7394 * ALC882/883/885/888/889 support
7396 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7397 * configuration. Each pin widget can choose any input DACs and a mixer.
7398 * Each ADC is connected from a mixer of all inputs. This makes possible
7399 * 6-channel independent captures.
7401 * In addition, an independent DAC for the multi-playback (not used in this
7404 #define ALC882_DIGOUT_NID 0x06
7405 #define ALC882_DIGIN_NID 0x0a
7406 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7407 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7408 #define ALC1200_DIGOUT_NID 0x10
7411 static struct hda_channel_mode alc882_ch_modes
[1] = {
7416 static hda_nid_t alc882_dac_nids
[4] = {
7417 /* front, rear, clfe, rear_surr */
7418 0x02, 0x03, 0x04, 0x05
7420 #define alc883_dac_nids alc882_dac_nids
7423 #define alc882_adc_nids alc880_adc_nids
7424 #define alc882_adc_nids_alt alc880_adc_nids_alt
7425 #define alc883_adc_nids alc882_adc_nids_alt
7426 static hda_nid_t alc883_adc_nids_alt
[1] = { 0x08 };
7427 static hda_nid_t alc883_adc_nids_rev
[2] = { 0x09, 0x08 };
7428 #define alc889_adc_nids alc880_adc_nids
7430 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
7431 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
7432 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7433 static hda_nid_t alc883_capsrc_nids_rev
[2] = { 0x22, 0x23 };
7434 #define alc889_capsrc_nids alc882_capsrc_nids
7437 /* FIXME: should be a matrix-type input source selection */
7439 static struct hda_input_mux alc882_capture_source
= {
7443 { "Front Mic", 0x1 },
7449 #define alc883_capture_source alc882_capture_source
7451 static struct hda_input_mux alc889_capture_source
= {
7454 { "Front Mic", 0x0 },
7460 static struct hda_input_mux mb5_capture_source
= {
7469 static struct hda_input_mux macmini3_capture_source
= {
7477 static struct hda_input_mux alc883_3stack_6ch_intel
= {
7481 { "Front Mic", 0x0 },
7487 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
7495 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
7499 { "Internal Mic", 0x1 },
7505 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
7509 { "Internal Mic", 0x1 },
7513 static struct hda_input_mux alc883_lenovo_sky_capture_source
= {
7517 { "Front Mic", 0x1 },
7522 static struct hda_input_mux alc883_asus_eee1601_capture_source
= {
7530 static struct hda_input_mux alc889A_mb31_capture_source
= {
7534 /* Front Mic (0x01) unused */
7536 /* Line 2 (0x03) unused */
7537 /* CD (0x04) unused? */
7541 static struct hda_input_mux alc889A_imac91_capture_source
= {
7545 { "Line", 0x2 }, /* Not sure! */
7552 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
7559 static struct hda_verb alc882_3ST_ch2_init
[] = {
7560 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7561 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7562 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7563 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7570 static struct hda_verb alc882_3ST_ch4_init
[] = {
7571 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7572 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7573 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7574 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7575 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7582 static struct hda_verb alc882_3ST_ch6_init
[] = {
7583 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7584 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7585 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7586 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7587 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7588 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7592 static struct hda_channel_mode alc882_3ST_6ch_modes
[3] = {
7593 { 2, alc882_3ST_ch2_init
},
7594 { 4, alc882_3ST_ch4_init
},
7595 { 6, alc882_3ST_ch6_init
},
7598 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7603 static struct hda_verb alc883_3ST_ch2_clevo_init
[] = {
7604 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7605 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7606 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7607 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7608 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7615 static struct hda_verb alc883_3ST_ch4_clevo_init
[] = {
7616 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7617 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7618 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7619 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7620 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7621 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7628 static struct hda_verb alc883_3ST_ch6_clevo_init
[] = {
7629 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7630 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7631 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7632 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7633 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7634 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7635 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7639 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes
[3] = {
7640 { 2, alc883_3ST_ch2_clevo_init
},
7641 { 4, alc883_3ST_ch4_clevo_init
},
7642 { 6, alc883_3ST_ch6_clevo_init
},
7649 static struct hda_verb alc882_sixstack_ch6_init
[] = {
7650 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7651 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7652 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7653 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7660 static struct hda_verb alc882_sixstack_ch8_init
[] = {
7661 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7662 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7663 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7664 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7668 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
7669 { 6, alc882_sixstack_ch6_init
},
7670 { 8, alc882_sixstack_ch8_init
},
7674 /* Macbook Air 2,1 */
7676 static struct hda_channel_mode alc885_mba21_ch_modes
[1] = {
7681 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7687 static struct hda_verb alc885_mbp_ch2_init
[] = {
7688 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7689 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7690 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7697 static struct hda_verb alc885_mbp_ch4_init
[] = {
7698 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7699 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7700 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7701 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7702 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7706 static struct hda_channel_mode alc885_mbp_4ch_modes
[2] = {
7707 { 2, alc885_mbp_ch2_init
},
7708 { 4, alc885_mbp_ch4_init
},
7713 * Speakers/Woofer/HP = Front
7716 static struct hda_verb alc885_mb5_ch2_init
[] = {
7717 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7718 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7724 * Speakers/HP = Front
7728 static struct hda_verb alc885_mb5_ch6_init
[] = {
7729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7731 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7735 static struct hda_channel_mode alc885_mb5_6ch_modes
[2] = {
7736 { 2, alc885_mb5_ch2_init
},
7737 { 6, alc885_mb5_ch6_init
},
7740 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7745 static struct hda_verb alc883_4ST_ch2_init
[] = {
7746 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7747 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7748 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7749 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7750 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7751 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7758 static struct hda_verb alc883_4ST_ch4_init
[] = {
7759 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7760 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7761 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7762 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7763 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7764 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7765 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7772 static struct hda_verb alc883_4ST_ch6_init
[] = {
7773 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7774 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7775 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7776 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7777 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7778 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7779 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7780 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7787 static struct hda_verb alc883_4ST_ch8_init
[] = {
7788 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7789 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7790 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7791 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7792 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7793 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7794 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7795 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7796 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7800 static struct hda_channel_mode alc883_4ST_8ch_modes
[4] = {
7801 { 2, alc883_4ST_ch2_init
},
7802 { 4, alc883_4ST_ch4_init
},
7803 { 6, alc883_4ST_ch6_init
},
7804 { 8, alc883_4ST_ch8_init
},
7811 static struct hda_verb alc883_3ST_ch2_intel_init
[] = {
7812 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7813 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7814 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7815 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7822 static struct hda_verb alc883_3ST_ch4_intel_init
[] = {
7823 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7824 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7825 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7826 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7827 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7834 static struct hda_verb alc883_3ST_ch6_intel_init
[] = {
7835 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7836 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7837 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7838 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7839 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7840 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7844 static struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
7845 { 2, alc883_3ST_ch2_intel_init
},
7846 { 4, alc883_3ST_ch4_intel_init
},
7847 { 6, alc883_3ST_ch6_intel_init
},
7853 static struct hda_verb alc889_ch2_intel_init
[] = {
7854 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7855 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7856 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7857 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7858 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7859 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7866 static struct hda_verb alc889_ch6_intel_init
[] = {
7867 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7868 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7869 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7870 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7871 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7872 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7879 static struct hda_verb alc889_ch8_intel_init
[] = {
7880 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7881 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7882 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7883 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7884 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7890 static struct hda_channel_mode alc889_8ch_intel_modes
[3] = {
7891 { 2, alc889_ch2_intel_init
},
7892 { 6, alc889_ch6_intel_init
},
7893 { 8, alc889_ch8_intel_init
},
7899 static struct hda_verb alc883_sixstack_ch6_init
[] = {
7900 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7901 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7902 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7903 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7910 static struct hda_verb alc883_sixstack_ch8_init
[] = {
7911 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7912 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7913 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7914 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7918 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
7919 { 6, alc883_sixstack_ch6_init
},
7920 { 8, alc883_sixstack_ch8_init
},
7924 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7925 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7927 static struct snd_kcontrol_new alc882_base_mixer
[] = {
7928 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7929 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7930 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7931 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7932 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7933 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7934 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7935 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7936 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
7937 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
7938 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7939 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7940 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7941 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7942 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7943 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7944 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
7945 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7946 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7947 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
7948 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7952 /* Macbook Air 2,1 same control for HP and internal Speaker */
7954 static struct snd_kcontrol_new alc885_mba21_mixer
[] = {
7955 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7956 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT
),
7961 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
7962 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7963 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7964 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
7965 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT
),
7966 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
7967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7968 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
7970 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
7971 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT
),
7972 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT
),
7976 static struct snd_kcontrol_new alc885_mb5_mixer
[] = {
7977 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7978 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7979 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
7980 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
7981 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
7982 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
7983 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
7984 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
7985 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
7986 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
7987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7988 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7989 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT
),
7990 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT
),
7994 static struct snd_kcontrol_new alc885_macmini3_mixer
[] = {
7995 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7996 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7997 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
7998 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
7999 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
8000 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
8001 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
8002 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
8003 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
8004 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
8005 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT
),
8009 static struct snd_kcontrol_new alc885_imac91_mixer
[] = {
8010 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8011 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8016 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
8017 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8018 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8019 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8020 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8021 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8022 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8024 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8025 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8029 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
8030 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8031 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8032 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8033 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8034 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8035 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8036 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8037 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8038 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8039 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8040 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8041 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8042 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8046 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8047 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8049 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
8050 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8051 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8052 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8053 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
8054 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8055 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8056 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8057 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8058 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
8059 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
8060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8061 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8062 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8066 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
8067 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8068 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8069 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8070 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8071 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8072 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8073 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8074 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8075 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8076 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8080 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
8082 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8083 .name
= "Channel Mode",
8084 .info
= alc_ch_mode_info
,
8085 .get
= alc_ch_mode_get
,
8086 .put
= alc_ch_mode_put
,
8091 static struct hda_verb alc882_base_init_verbs
[] = {
8092 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8093 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8094 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8096 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8097 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8099 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8100 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8102 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8103 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8105 /* Front Pin: output 0 (0x0c) */
8106 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8108 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8109 /* Rear Pin: output 1 (0x0d) */
8110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8112 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8113 /* CLFE Pin: output 2 (0x0e) */
8114 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8115 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8116 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8117 /* Side Pin: output 3 (0x0f) */
8118 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8119 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8120 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8121 /* Mic (rear) pin: input vref at 80% */
8122 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8123 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8124 /* Front Mic pin: input vref at 80% */
8125 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8127 /* Line In pin: input */
8128 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8129 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8130 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8131 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8132 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8133 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8134 /* CD pin widget for input */
8135 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8137 /* FIXME: use matrix-type input source selection */
8138 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8140 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8142 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8143 /* ADC2: mute amp left and right */
8144 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8145 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8146 /* ADC3: mute amp left and right */
8147 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8148 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8153 static struct hda_verb alc882_adc1_init_verbs
[] = {
8154 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8155 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8156 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8157 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8159 /* ADC1: mute amp left and right */
8160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8161 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8165 static struct hda_verb alc882_eapd_verbs
[] = {
8166 /* change to EAPD mode */
8167 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8168 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
8172 static struct hda_verb alc889_eapd_verbs
[] = {
8173 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8174 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8178 static struct hda_verb alc_hp15_unsol_verbs
[] = {
8179 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8180 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8184 static struct hda_verb alc885_init_verbs
[] = {
8185 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8192 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8193 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8195 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8196 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8198 /* Front HP Pin: output 0 (0x0c) */
8199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8201 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8202 /* Front Pin: output 0 (0x0c) */
8203 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8204 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8205 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8206 /* Rear Pin: output 1 (0x0d) */
8207 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8208 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8209 {0x19, AC_VERB_SET_CONNECT_SEL
, 0x01},
8210 /* CLFE Pin: output 2 (0x0e) */
8211 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8212 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8213 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8214 /* Side Pin: output 3 (0x0f) */
8215 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8216 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8217 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8218 /* Mic (rear) pin: input vref at 80% */
8219 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8220 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8221 /* Front Mic pin: input vref at 80% */
8222 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8223 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8224 /* Line In pin: input */
8225 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8226 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8228 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8232 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8234 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8235 /* ADC2: mute amp left and right */
8236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8237 /* ADC3: mute amp left and right */
8238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8243 static struct hda_verb alc885_init_input_verbs
[] = {
8244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8245 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
8251 /* Unmute Selector 24h and set the default input to front mic */
8252 static struct hda_verb alc889_init_input_verbs
[] = {
8253 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
8254 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8259 #define alc883_init_verbs alc882_base_init_verbs
8262 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
8263 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8264 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8265 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
8266 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8267 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8268 /* FIXME: this looks suspicious...
8269 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8270 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8275 static struct hda_verb alc882_macpro_init_verbs
[] = {
8276 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8280 /* Front Pin: output 0 (0x0c) */
8281 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8283 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8284 /* Front Mic pin: input vref at 80% */
8285 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8286 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8287 /* Speaker: output */
8288 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8289 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8290 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
8291 /* Headphone output (output 0 - 0x0c) */
8292 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8293 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8294 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8296 /* FIXME: use matrix-type input source selection */
8297 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8298 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8313 /* ADC1: mute amp left and right */
8314 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8315 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8316 /* ADC2: mute amp left and right */
8317 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8318 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8319 /* ADC3: mute amp left and right */
8320 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8321 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8327 static struct hda_verb alc885_mb5_init_verbs
[] = {
8329 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8330 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8331 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8332 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8337 /* Surround mixer */
8338 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8339 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8340 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8342 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8343 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8344 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8346 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8348 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8349 /* Front Pin (0x0c) */
8350 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8351 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8352 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8353 /* LFE Pin (0x0e) */
8354 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8355 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8356 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
8358 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8359 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8360 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
8361 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8362 /* Front Mic pin: input vref at 80% */
8363 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8364 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0x1)},
8370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x7)},
8371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x4)},
8376 static struct hda_verb alc885_macmini3_init_verbs
[] = {
8378 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8379 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8380 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8381 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8385 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8386 /* Surround mixer */
8387 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8388 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8389 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8391 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8392 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8393 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8395 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8396 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8397 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8398 /* Front Pin (0x0c) */
8399 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8400 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8401 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8402 /* LFE Pin (0x0e) */
8403 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8404 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8405 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
8407 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8408 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8409 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
8410 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8413 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8416 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8423 static struct hda_verb alc885_mba21_init_verbs
[] = {
8424 /*Internal and HP Speaker Mixer*/
8425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8428 /*Internal Speaker Pin (0x0c)*/
8429 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8430 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8431 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8432 /* HP Pin: output 0 (0x0e) */
8433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
8434 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8435 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8436 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8437 /* Line in (is hp when jack connected)*/
8438 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8439 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8445 /* Macbook Pro rev3 */
8446 static struct hda_verb alc885_mbp3_init_verbs
[] = {
8447 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8449 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8450 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8452 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8453 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8454 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8456 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8457 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8459 /* Front Pin: output 0 (0x0c) */
8460 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8461 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8462 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8463 /* HP Pin: output 0 (0x0e) */
8464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
8465 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8466 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x02},
8467 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8468 /* Mic (rear) pin: input vref at 80% */
8469 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8470 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8471 /* Front Mic pin: input vref at 80% */
8472 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8473 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8474 /* Line In pin: use output 1 when in LineOut mode */
8475 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8476 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8477 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
8479 /* FIXME: use matrix-type input source selection */
8480 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8481 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8482 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8483 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8484 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8485 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8488 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8490 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8492 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8496 /* ADC1: mute amp left and right */
8497 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8498 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8499 /* ADC2: mute amp left and right */
8500 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8501 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8502 /* ADC3: mute amp left and right */
8503 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8504 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8510 static struct hda_verb alc885_imac91_init_verbs
[] = {
8511 /* Internal Speaker Pin (0x0c) */
8512 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8513 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8514 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8516 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8517 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8519 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8520 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8521 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8522 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8524 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8525 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8526 /* Front Mic pin: input vref at 80% */
8527 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8528 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8530 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8531 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8532 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8533 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8537 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8538 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8539 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8540 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8542 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8543 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8544 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8545 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8547 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8548 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8549 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8552 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8554 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8555 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8556 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8557 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8558 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8559 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8560 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8564 /* iMac 24 mixer. */
8565 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
8566 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8567 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
8571 /* iMac 24 init verbs. */
8572 static struct hda_verb alc885_imac24_init_verbs
[] = {
8573 /* Internal speakers: output 0 (0x0c) */
8574 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8575 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8576 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8577 /* Internal speakers: output 0 (0x0c) */
8578 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8579 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8580 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8581 /* Headphone: output 0 (0x0c) */
8582 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8583 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8584 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8585 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8586 /* Front Mic: input vref at 80% */
8587 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8588 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8592 /* Toggle speaker-output according to the hp-jack state */
8593 static void alc885_imac24_setup(struct hda_codec
*codec
)
8595 struct alc_spec
*spec
= codec
->spec
;
8597 spec
->autocfg
.hp_pins
[0] = 0x14;
8598 spec
->autocfg
.speaker_pins
[0] = 0x18;
8599 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8602 #define alc885_mb5_setup alc885_imac24_setup
8603 #define alc885_macmini3_setup alc885_imac24_setup
8605 /* Macbook Air 2,1 */
8606 static void alc885_mba21_setup(struct hda_codec
*codec
)
8608 struct alc_spec
*spec
= codec
->spec
;
8610 spec
->autocfg
.hp_pins
[0] = 0x14;
8611 spec
->autocfg
.speaker_pins
[0] = 0x18;
8616 static void alc885_mbp3_setup(struct hda_codec
*codec
)
8618 struct alc_spec
*spec
= codec
->spec
;
8620 spec
->autocfg
.hp_pins
[0] = 0x15;
8621 spec
->autocfg
.speaker_pins
[0] = 0x14;
8624 static void alc885_imac91_setup(struct hda_codec
*codec
)
8626 struct alc_spec
*spec
= codec
->spec
;
8628 spec
->autocfg
.hp_pins
[0] = 0x14;
8629 spec
->autocfg
.speaker_pins
[0] = 0x18;
8630 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8633 static struct hda_verb alc882_targa_verbs
[] = {
8634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8635 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8638 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8640 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8641 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8642 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8644 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8648 /* toggle speaker-output according to the hp-jack state */
8649 static void alc882_targa_automute(struct hda_codec
*codec
)
8651 struct alc_spec
*spec
= codec
->spec
;
8652 alc_automute_amp(codec
);
8653 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
8654 spec
->jack_present
? 1 : 3);
8657 static void alc882_targa_setup(struct hda_codec
*codec
)
8659 struct alc_spec
*spec
= codec
->spec
;
8661 spec
->autocfg
.hp_pins
[0] = 0x14;
8662 spec
->autocfg
.speaker_pins
[0] = 0x1b;
8665 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8667 if ((res
>> 26) == ALC880_HP_EVENT
)
8668 alc882_targa_automute(codec
);
8671 static struct hda_verb alc882_asus_a7j_verbs
[] = {
8672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8673 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8676 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8677 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8679 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8680 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8681 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8683 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8684 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8685 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8689 static struct hda_verb alc882_asus_a7m_verbs
[] = {
8690 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8691 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8693 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8694 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8695 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8697 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8698 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8699 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8701 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8702 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8703 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8707 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
8709 unsigned int gpiostate
, gpiomask
, gpiodir
;
8711 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8712 AC_VERB_GET_GPIO_DATA
, 0);
8715 gpiostate
|= (1 << pin
);
8717 gpiostate
&= ~(1 << pin
);
8719 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8720 AC_VERB_GET_GPIO_MASK
, 0);
8721 gpiomask
|= (1 << pin
);
8723 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8724 AC_VERB_GET_GPIO_DIRECTION
, 0);
8725 gpiodir
|= (1 << pin
);
8728 snd_hda_codec_write(codec
, codec
->afg
, 0,
8729 AC_VERB_SET_GPIO_MASK
, gpiomask
);
8730 snd_hda_codec_write(codec
, codec
->afg
, 0,
8731 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
8735 snd_hda_codec_write(codec
, codec
->afg
, 0,
8736 AC_VERB_SET_GPIO_DATA
, gpiostate
);
8739 /* set up GPIO at initialization */
8740 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
8742 alc882_gpio_mute(codec
, 0, 0);
8743 alc882_gpio_mute(codec
, 1, 0);
8746 /* set up GPIO and update auto-muting at initialization */
8747 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
8749 alc885_macpro_init_hook(codec
);
8750 alc_automute_amp(codec
);
8754 * generic initialization of ADC, input mixers and output mixers
8756 static struct hda_verb alc883_auto_init_verbs
[] = {
8758 * Unmute ADC0-2 and set the default input to mic-in
8760 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8761 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8762 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8763 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8766 * Set up output mixers (0x0c - 0x0f)
8768 /* set vol=0 to output mixers */
8769 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8770 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8771 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8772 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8773 /* set up input amps for analog loopback */
8774 /* Amp Indices: DAC = 0, mixer = 1 */
8775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8776 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8778 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8779 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8780 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8782 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8783 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8784 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8786 /* FIXME: use matrix-type input source selection */
8787 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8789 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8791 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8795 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8796 static struct hda_verb alc889A_mb31_ch2_init
[] = {
8797 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
8798 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8799 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
8800 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
8804 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8805 static struct hda_verb alc889A_mb31_ch4_init
[] = {
8806 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
8807 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8808 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
8809 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
8813 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8814 static struct hda_verb alc889A_mb31_ch5_init
[] = {
8815 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as rear */
8816 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8817 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
8818 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
8822 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8823 static struct hda_verb alc889A_mb31_ch6_init
[] = {
8824 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as front */
8825 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Subwoofer off */
8826 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
8827 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
8831 static struct hda_channel_mode alc889A_mb31_6ch_modes
[4] = {
8832 { 2, alc889A_mb31_ch2_init
},
8833 { 4, alc889A_mb31_ch4_init
},
8834 { 5, alc889A_mb31_ch5_init
},
8835 { 6, alc889A_mb31_ch6_init
},
8838 static struct hda_verb alc883_medion_eapd_verbs
[] = {
8839 /* eanable EAPD on medion laptop */
8840 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8841 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
8845 #define alc883_base_mixer alc882_base_mixer
8847 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
8848 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8849 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8850 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8851 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8852 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8853 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8855 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8856 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8857 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8858 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8859 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8860 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8864 static struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
8865 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8866 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8867 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8868 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8869 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8870 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8871 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8872 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8873 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8874 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8878 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
8879 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8880 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8881 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8882 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8884 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8885 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8886 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8887 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8888 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8892 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
8893 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8894 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8895 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8896 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8897 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8898 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8899 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8901 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8902 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8903 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8904 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8905 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8909 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
8910 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8911 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8912 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8913 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8914 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8915 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8916 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8917 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8918 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8919 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8920 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8921 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8922 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8923 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8924 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8926 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8927 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8928 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8932 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
8933 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8934 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8935 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8936 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8937 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8939 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8940 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8941 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8942 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8943 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8944 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8948 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8950 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8951 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8952 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8956 static struct snd_kcontrol_new alc885_8ch_intel_mixer
[] = {
8957 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8958 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8959 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8960 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8961 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8963 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8964 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8965 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8966 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8967 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT
),
8968 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8969 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8970 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
8972 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT
),
8973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
8974 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8975 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8976 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8980 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
8981 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8982 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8983 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8984 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8985 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8986 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8987 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8988 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8989 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8990 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8991 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8992 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8993 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8995 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8997 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8998 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8999 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9003 static struct snd_kcontrol_new alc883_targa_mixer
[] = {
9004 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9005 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9006 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9007 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9008 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9009 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9010 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9011 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9012 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9013 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9014 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9015 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9016 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9017 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9019 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9024 static struct snd_kcontrol_new alc883_targa_2ch_mixer
[] = {
9025 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9026 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9027 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9028 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9029 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9030 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9032 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9034 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9035 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9036 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9040 static struct snd_kcontrol_new alc883_targa_8ch_mixer
[] = {
9041 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9042 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
9043 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9044 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9045 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9049 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
9050 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9051 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9052 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9053 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
9054 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9055 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9056 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9057 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9061 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
9062 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9063 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
9064 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9065 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9066 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9069 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9070 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9074 static struct snd_kcontrol_new alc883_medion_wim2160_mixer
[] = {
9075 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9076 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9077 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9078 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT
),
9079 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT
),
9080 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT
),
9084 static struct hda_verb alc883_medion_wim2160_verbs
[] = {
9085 /* Unmute front mixer */
9086 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9087 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9089 /* Set speaker pin to front mixer */
9090 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9092 /* Init headphone pin */
9093 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9094 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9095 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
9096 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9101 /* toggle speaker-output according to the hp-jack state */
9102 static void alc883_medion_wim2160_setup(struct hda_codec
*codec
)
9104 struct alc_spec
*spec
= codec
->spec
;
9106 spec
->autocfg
.hp_pins
[0] = 0x1a;
9107 spec
->autocfg
.speaker_pins
[0] = 0x15;
9110 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
9111 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9112 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9113 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9114 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9115 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9117 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9118 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9122 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer
[] = {
9123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9124 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9125 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9126 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9127 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9128 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9130 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9135 static struct snd_kcontrol_new alc888_lenovo_sky_mixer
[] = {
9136 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9137 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9138 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
9139 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
9140 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9141 0x0d, 1, 0x0, HDA_OUTPUT
),
9142 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
9143 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
9144 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
9145 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9146 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
9147 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9148 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9149 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9150 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9152 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9153 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9154 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9155 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9156 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9160 static struct snd_kcontrol_new alc889A_mb31_mixer
[] = {
9162 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
9163 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
9164 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
9165 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
9166 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9168 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT
),
9169 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT
),
9170 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT
),
9171 /* Output switches */
9172 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT
),
9173 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT
),
9174 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT
),
9176 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT
),
9177 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT
),
9179 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
9180 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
9181 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9182 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9186 static struct snd_kcontrol_new alc883_vaiott_mixer
[] = {
9187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9188 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9189 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9191 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9192 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9196 static struct hda_bind_ctls alc883_bind_cap_vol
= {
9197 .ops
= &snd_hda_bind_vol
,
9199 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
9200 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
9205 static struct hda_bind_ctls alc883_bind_cap_switch
= {
9206 .ops
= &snd_hda_bind_sw
,
9208 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
9209 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
9214 static struct snd_kcontrol_new alc883_asus_eee1601_mixer
[] = {
9215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9216 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9218 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9219 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9221 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9226 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer
[] = {
9227 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol
),
9228 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch
),
9230 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9231 /* .name = "Capture Source", */
9232 .name
= "Input Source",
9234 .info
= alc_mux_enum_info
,
9235 .get
= alc_mux_enum_get
,
9236 .put
= alc_mux_enum_put
,
9241 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
9243 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9244 .name
= "Channel Mode",
9245 .info
= alc_ch_mode_info
,
9246 .get
= alc_ch_mode_get
,
9247 .put
= alc_ch_mode_put
,
9252 /* toggle speaker-output according to the hp-jack state */
9253 static void alc883_mitac_setup(struct hda_codec
*codec
)
9255 struct alc_spec
*spec
= codec
->spec
;
9257 spec
->autocfg
.hp_pins
[0] = 0x15;
9258 spec
->autocfg
.speaker_pins
[0] = 0x14;
9259 spec
->autocfg
.speaker_pins
[1] = 0x17;
9262 static struct hda_verb alc883_mitac_verbs
[] = {
9264 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9265 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9267 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
9268 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9270 /* enable unsolicited event */
9271 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9272 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9277 static struct hda_verb alc883_clevo_m540r_verbs
[] = {
9279 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9282 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9284 /* enable unsolicited event */
9286 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9287 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9293 static struct hda_verb alc883_clevo_m720_verbs
[] = {
9295 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9298 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
9299 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9301 /* enable unsolicited event */
9302 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9303 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9308 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
9310 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9311 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9313 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9314 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9316 /* enable unsolicited event */
9317 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9322 static struct hda_verb alc883_targa_verbs
[] = {
9323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9327 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9329 /* Connect Line-Out side jack (SPDIF) to Side */
9330 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9331 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9332 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
9333 /* Connect Mic jack to CLFE */
9334 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9335 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9336 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
9337 /* Connect Line-in jack to Surround */
9338 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9339 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9340 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
9341 /* Connect HP out jack to Front */
9342 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9343 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9344 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9346 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9351 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
9352 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9353 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
9354 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
9358 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
9359 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9361 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9362 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9366 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
9367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9368 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9369 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9370 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
9371 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9375 static struct hda_verb alc883_haier_w66_verbs
[] = {
9376 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9377 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9379 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9381 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9382 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9383 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9388 static struct hda_verb alc888_lenovo_sky_verbs
[] = {
9389 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9391 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9392 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9393 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9394 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9395 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
9396 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9400 static struct hda_verb alc888_6st_dell_verbs
[] = {
9401 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9405 static struct hda_verb alc883_vaiott_verbs
[] = {
9407 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9408 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9410 /* enable unsolicited event */
9411 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9416 static void alc888_3st_hp_setup(struct hda_codec
*codec
)
9418 struct alc_spec
*spec
= codec
->spec
;
9420 spec
->autocfg
.hp_pins
[0] = 0x1b;
9421 spec
->autocfg
.speaker_pins
[0] = 0x14;
9422 spec
->autocfg
.speaker_pins
[1] = 0x16;
9423 spec
->autocfg
.speaker_pins
[2] = 0x18;
9426 static struct hda_verb alc888_3st_hp_verbs
[] = {
9427 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
9428 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
9429 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
9430 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9437 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
9438 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9439 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9440 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
9441 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9448 static struct hda_verb alc888_3st_hp_4ch_init
[] = {
9449 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9450 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9451 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9452 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9453 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9460 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
9461 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9462 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9463 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
9464 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9465 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9466 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9470 static struct hda_channel_mode alc888_3st_hp_modes
[3] = {
9471 { 2, alc888_3st_hp_2ch_init
},
9472 { 4, alc888_3st_hp_4ch_init
},
9473 { 6, alc888_3st_hp_6ch_init
},
9476 /* toggle front-jack and RCA according to the hp-jack state */
9477 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
9479 unsigned int present
= snd_hda_jack_detect(codec
, 0x1b);
9481 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9482 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9483 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9484 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9487 /* toggle RCA according to the front-jack state */
9488 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
9490 unsigned int present
= snd_hda_jack_detect(codec
, 0x14);
9492 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9493 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9496 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
9499 if ((res
>> 26) == ALC880_HP_EVENT
)
9500 alc888_lenovo_ms7195_front_automute(codec
);
9501 if ((res
>> 26) == ALC880_FRONT_EVENT
)
9502 alc888_lenovo_ms7195_rca_automute(codec
);
9505 /* toggle speaker-output according to the hp-jack state */
9506 static void alc883_lenovo_nb0763_setup(struct hda_codec
*codec
)
9508 struct alc_spec
*spec
= codec
->spec
;
9510 spec
->autocfg
.hp_pins
[0] = 0x14;
9511 spec
->autocfg
.speaker_pins
[0] = 0x15;
9514 /* toggle speaker-output according to the hp-jack state */
9515 #define alc883_targa_init_hook alc882_targa_init_hook
9516 #define alc883_targa_unsol_event alc882_targa_unsol_event
9518 static void alc883_clevo_m720_setup(struct hda_codec
*codec
)
9520 struct alc_spec
*spec
= codec
->spec
;
9522 spec
->autocfg
.hp_pins
[0] = 0x15;
9523 spec
->autocfg
.speaker_pins
[0] = 0x14;
9526 static void alc883_clevo_m720_init_hook(struct hda_codec
*codec
)
9528 alc_automute_amp(codec
);
9529 alc88x_simple_mic_automute(codec
);
9532 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
9535 switch (res
>> 26) {
9536 case ALC880_MIC_EVENT
:
9537 alc88x_simple_mic_automute(codec
);
9540 alc_automute_amp_unsol_event(codec
, res
);
9545 /* toggle speaker-output according to the hp-jack state */
9546 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec
*codec
)
9548 struct alc_spec
*spec
= codec
->spec
;
9550 spec
->autocfg
.hp_pins
[0] = 0x14;
9551 spec
->autocfg
.speaker_pins
[0] = 0x15;
9554 static void alc883_haier_w66_setup(struct hda_codec
*codec
)
9556 struct alc_spec
*spec
= codec
->spec
;
9558 spec
->autocfg
.hp_pins
[0] = 0x1b;
9559 spec
->autocfg
.speaker_pins
[0] = 0x14;
9562 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
9564 int bits
= snd_hda_jack_detect(codec
, 0x14) ? HDA_AMP_MUTE
: 0;
9566 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9567 HDA_AMP_MUTE
, bits
);
9570 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
9572 int bits
= snd_hda_jack_detect(codec
, 0x1b) ? HDA_AMP_MUTE
: 0;
9574 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9575 HDA_AMP_MUTE
, bits
);
9576 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9577 HDA_AMP_MUTE
, bits
);
9580 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
9583 if ((res
>> 26) == ALC880_HP_EVENT
)
9584 alc883_lenovo_101e_all_automute(codec
);
9585 if ((res
>> 26) == ALC880_FRONT_EVENT
)
9586 alc883_lenovo_101e_ispeaker_automute(codec
);
9589 /* toggle speaker-output according to the hp-jack state */
9590 static void alc883_acer_aspire_setup(struct hda_codec
*codec
)
9592 struct alc_spec
*spec
= codec
->spec
;
9594 spec
->autocfg
.hp_pins
[0] = 0x14;
9595 spec
->autocfg
.speaker_pins
[0] = 0x15;
9596 spec
->autocfg
.speaker_pins
[1] = 0x16;
9599 static struct hda_verb alc883_acer_eapd_verbs
[] = {
9600 /* HP Pin: output 0 (0x0c) */
9601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9603 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9604 /* Front Pin: output 0 (0x0c) */
9605 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9606 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9607 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9608 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
9609 /* eanable EAPD on medion laptop */
9610 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9611 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9612 /* enable unsolicited event */
9613 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9617 static void alc888_6st_dell_setup(struct hda_codec
*codec
)
9619 struct alc_spec
*spec
= codec
->spec
;
9621 spec
->autocfg
.hp_pins
[0] = 0x1b;
9622 spec
->autocfg
.speaker_pins
[0] = 0x14;
9623 spec
->autocfg
.speaker_pins
[1] = 0x15;
9624 spec
->autocfg
.speaker_pins
[2] = 0x16;
9625 spec
->autocfg
.speaker_pins
[3] = 0x17;
9628 static void alc888_lenovo_sky_setup(struct hda_codec
*codec
)
9630 struct alc_spec
*spec
= codec
->spec
;
9632 spec
->autocfg
.hp_pins
[0] = 0x1b;
9633 spec
->autocfg
.speaker_pins
[0] = 0x14;
9634 spec
->autocfg
.speaker_pins
[1] = 0x15;
9635 spec
->autocfg
.speaker_pins
[2] = 0x16;
9636 spec
->autocfg
.speaker_pins
[3] = 0x17;
9637 spec
->autocfg
.speaker_pins
[4] = 0x1a;
9640 static void alc883_vaiott_setup(struct hda_codec
*codec
)
9642 struct alc_spec
*spec
= codec
->spec
;
9644 spec
->autocfg
.hp_pins
[0] = 0x15;
9645 spec
->autocfg
.speaker_pins
[0] = 0x14;
9646 spec
->autocfg
.speaker_pins
[1] = 0x17;
9649 static struct hda_verb alc888_asus_m90v_verbs
[] = {
9650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9653 /* enable unsolicited event */
9654 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9655 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9659 static void alc883_mode2_setup(struct hda_codec
*codec
)
9661 struct alc_spec
*spec
= codec
->spec
;
9663 spec
->autocfg
.hp_pins
[0] = 0x1b;
9664 spec
->autocfg
.speaker_pins
[0] = 0x14;
9665 spec
->autocfg
.speaker_pins
[1] = 0x15;
9666 spec
->autocfg
.speaker_pins
[2] = 0x16;
9667 spec
->ext_mic
.pin
= 0x18;
9668 spec
->int_mic
.pin
= 0x19;
9669 spec
->ext_mic
.mux_idx
= 0;
9670 spec
->int_mic
.mux_idx
= 1;
9674 static struct hda_verb alc888_asus_eee1601_verbs
[] = {
9675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9676 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9677 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9678 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9679 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9680 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
9681 {0x20, AC_VERB_SET_PROC_COEF
, 0x0838},
9682 /* enable unsolicited event */
9683 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9687 static void alc883_eee1601_inithook(struct hda_codec
*codec
)
9689 struct alc_spec
*spec
= codec
->spec
;
9691 spec
->autocfg
.hp_pins
[0] = 0x14;
9692 spec
->autocfg
.speaker_pins
[0] = 0x1b;
9693 alc_automute_pin(codec
);
9696 static struct hda_verb alc889A_mb31_verbs
[] = {
9697 /* Init rear pin (used as headphone output) */
9698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4}, /* Apple Headphones */
9699 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Connect to front */
9700 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9701 /* Init line pin (used as output in 4ch and 6ch mode) */
9702 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Connect to CLFE */
9703 /* Init line 2 pin (used as headphone out by default) */
9704 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Use as input */
9705 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Mute output */
9709 /* Mute speakers according to the headphone jack state */
9710 static void alc889A_mb31_automute(struct hda_codec
*codec
)
9712 unsigned int present
;
9714 /* Mute only in 2ch or 4ch mode */
9715 if (snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_CONNECT_SEL
, 0)
9717 present
= snd_hda_jack_detect(codec
, 0x15);
9718 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9719 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9720 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9721 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9725 static void alc889A_mb31_unsol_event(struct hda_codec
*codec
, unsigned int res
)
9727 if ((res
>> 26) == ALC880_HP_EVENT
)
9728 alc889A_mb31_automute(codec
);
9732 #ifdef CONFIG_SND_HDA_POWER_SAVE
9733 #define alc882_loopbacks alc880_loopbacks
9736 /* pcm configuration: identical with ALC880 */
9737 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9738 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9739 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9740 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9742 static hda_nid_t alc883_slave_dig_outs
[] = {
9743 ALC1200_DIGOUT_NID
, 0,
9746 static hda_nid_t alc1200_slave_dig_outs
[] = {
9747 ALC883_DIGOUT_NID
, 0,
9751 * configuration and preset
9753 static const char * const alc882_models
[ALC882_MODEL_LAST
] = {
9754 [ALC882_3ST_DIG
] = "3stack-dig",
9755 [ALC882_6ST_DIG
] = "6stack-dig",
9756 [ALC882_ARIMA
] = "arima",
9757 [ALC882_W2JC
] = "w2jc",
9758 [ALC882_TARGA
] = "targa",
9759 [ALC882_ASUS_A7J
] = "asus-a7j",
9760 [ALC882_ASUS_A7M
] = "asus-a7m",
9761 [ALC885_MACPRO
] = "macpro",
9762 [ALC885_MB5
] = "mb5",
9763 [ALC885_MACMINI3
] = "macmini3",
9764 [ALC885_MBA21
] = "mba21",
9765 [ALC885_MBP3
] = "mbp3",
9766 [ALC885_IMAC24
] = "imac24",
9767 [ALC885_IMAC91
] = "imac91",
9768 [ALC883_3ST_2ch_DIG
] = "3stack-2ch-dig",
9769 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
9770 [ALC883_3ST_6ch
] = "3stack-6ch",
9771 [ALC883_6ST_DIG
] = "alc883-6stack-dig",
9772 [ALC883_TARGA_DIG
] = "targa-dig",
9773 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
9774 [ALC883_TARGA_8ch_DIG
] = "targa-8ch-dig",
9775 [ALC883_ACER
] = "acer",
9776 [ALC883_ACER_ASPIRE
] = "acer-aspire",
9777 [ALC888_ACER_ASPIRE_4930G
] = "acer-aspire-4930g",
9778 [ALC888_ACER_ASPIRE_6530G
] = "acer-aspire-6530g",
9779 [ALC888_ACER_ASPIRE_8930G
] = "acer-aspire-8930g",
9780 [ALC888_ACER_ASPIRE_7730G
] = "acer-aspire-7730g",
9781 [ALC883_MEDION
] = "medion",
9782 [ALC883_MEDION_WIM2160
] = "medion-wim2160",
9783 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
9784 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
9785 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
9786 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
9787 [ALC888_LENOVO_SKY
] = "lenovo-sky",
9788 [ALC883_HAIER_W66
] = "haier-w66",
9789 [ALC888_3ST_HP
] = "3stack-hp",
9790 [ALC888_6ST_DELL
] = "6stack-dell",
9791 [ALC883_MITAC
] = "mitac",
9792 [ALC883_CLEVO_M540R
] = "clevo-m540r",
9793 [ALC883_CLEVO_M720
] = "clevo-m720",
9794 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
9795 [ALC888_FUJITSU_XA3530
] = "fujitsu-xa3530",
9796 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
9797 [ALC889A_INTEL
] = "intel-alc889a",
9798 [ALC889_INTEL
] = "intel-x58",
9799 [ALC1200_ASUS_P5Q
] = "asus-p5q",
9800 [ALC889A_MB31
] = "mb31",
9801 [ALC883_SONY_VAIO_TT
] = "sony-vaio-tt",
9802 [ALC882_AUTO
] = "auto",
9805 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
9806 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
9808 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
9809 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE
),
9810 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE
),
9811 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
9812 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
9813 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
9814 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9815 ALC888_ACER_ASPIRE_4930G
),
9816 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9817 ALC888_ACER_ASPIRE_4930G
),
9818 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9819 ALC888_ACER_ASPIRE_8930G
),
9820 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9821 ALC888_ACER_ASPIRE_8930G
),
9822 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO
),
9823 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO
),
9824 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9825 ALC888_ACER_ASPIRE_6530G
),
9826 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9827 ALC888_ACER_ASPIRE_6530G
),
9828 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9829 ALC888_ACER_ASPIRE_7730G
),
9830 /* default Acer -- disabled as it causes more problems.
9831 * model=auto should work fine now
9833 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9835 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
9837 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
9838 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
9839 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
9840 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
9841 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP
),
9842 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP
),
9844 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
9845 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
9846 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
9847 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V
),
9848 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
9849 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
9850 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
9851 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
9852 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG
),
9853 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q
),
9854 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601
),
9856 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT
),
9857 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
9858 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
9859 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC
),
9860 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
9861 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
9862 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL
),
9863 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
9864 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
9866 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
9867 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
9868 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
9869 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
9870 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO
),
9871 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
9872 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
9873 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
9874 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
9875 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
9876 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
9877 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
9878 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
9879 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
9880 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG
),
9881 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
9882 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
9883 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
9884 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG
),
9885 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG
),
9886 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
9887 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
9888 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
9889 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG
),
9890 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
9891 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
9892 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
9893 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG
),
9894 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG
),
9895 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
9896 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG
),
9898 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
9899 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG
),
9900 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
9901 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
9902 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R
),
9903 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD
),
9904 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
9905 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9906 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
9907 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9908 ALC883_FUJITSU_PI2515
),
9909 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9910 ALC888_FUJITSU_XA3530
),
9911 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
9912 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9913 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9914 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9915 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY
),
9916 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG
),
9917 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
9918 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
9920 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
9921 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
9922 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC
),
9923 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL
),
9924 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL
),
9925 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL
),
9926 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG
),
9931 /* codec SSID table for Intel Mac */
9932 static struct snd_pci_quirk alc882_ssid_cfg_tbl
[] = {
9933 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3
),
9934 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3
),
9935 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3
),
9936 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO
),
9937 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24
),
9938 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24
),
9939 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3
),
9940 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31
),
9941 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M
),
9942 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3
),
9943 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21
),
9944 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31
),
9945 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3
),
9946 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24
),
9947 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91
),
9948 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5
),
9949 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5
),
9950 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9951 * so apparently no perfect solution yet
9953 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5
),
9954 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5
),
9955 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3
),
9959 static struct alc_config_preset alc882_presets
[] = {
9960 [ALC882_3ST_DIG
] = {
9961 .mixers
= { alc882_base_mixer
},
9962 .init_verbs
= { alc882_base_init_verbs
,
9963 alc882_adc1_init_verbs
},
9964 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9965 .dac_nids
= alc882_dac_nids
,
9966 .dig_out_nid
= ALC882_DIGOUT_NID
,
9967 .dig_in_nid
= ALC882_DIGIN_NID
,
9968 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
9969 .channel_mode
= alc882_ch_modes
,
9971 .input_mux
= &alc882_capture_source
,
9973 [ALC882_6ST_DIG
] = {
9974 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
9975 .init_verbs
= { alc882_base_init_verbs
,
9976 alc882_adc1_init_verbs
},
9977 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9978 .dac_nids
= alc882_dac_nids
,
9979 .dig_out_nid
= ALC882_DIGOUT_NID
,
9980 .dig_in_nid
= ALC882_DIGIN_NID
,
9981 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
9982 .channel_mode
= alc882_sixstack_modes
,
9983 .input_mux
= &alc882_capture_source
,
9986 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
9987 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
9988 alc882_eapd_verbs
},
9989 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9990 .dac_nids
= alc882_dac_nids
,
9991 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
9992 .channel_mode
= alc882_sixstack_modes
,
9993 .input_mux
= &alc882_capture_source
,
9996 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
9997 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
9998 alc882_eapd_verbs
, alc880_gpio1_init_verbs
},
9999 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10000 .dac_nids
= alc882_dac_nids
,
10001 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
10002 .channel_mode
= alc880_threestack_modes
,
10004 .input_mux
= &alc882_capture_source
,
10005 .dig_out_nid
= ALC882_DIGOUT_NID
,
10008 .mixers
= { alc885_mba21_mixer
},
10009 .init_verbs
= { alc885_mba21_init_verbs
, alc880_gpio1_init_verbs
},
10011 .dac_nids
= alc882_dac_nids
,
10012 .channel_mode
= alc885_mba21_ch_modes
,
10013 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
10014 .input_mux
= &alc882_capture_source
,
10015 .unsol_event
= alc_automute_amp_unsol_event
,
10016 .setup
= alc885_mba21_setup
,
10017 .init_hook
= alc_automute_amp
,
10020 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
10021 .init_verbs
= { alc885_mbp3_init_verbs
,
10022 alc880_gpio1_init_verbs
},
10024 .dac_nids
= alc882_dac_nids
,
10026 .channel_mode
= alc885_mbp_4ch_modes
,
10027 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_4ch_modes
),
10028 .input_mux
= &alc882_capture_source
,
10029 .dig_out_nid
= ALC882_DIGOUT_NID
,
10030 .dig_in_nid
= ALC882_DIGIN_NID
,
10031 .unsol_event
= alc_automute_amp_unsol_event
,
10032 .setup
= alc885_mbp3_setup
,
10033 .init_hook
= alc_automute_amp
,
10036 .mixers
= { alc885_mb5_mixer
, alc882_chmode_mixer
},
10037 .init_verbs
= { alc885_mb5_init_verbs
,
10038 alc880_gpio1_init_verbs
},
10039 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10040 .dac_nids
= alc882_dac_nids
,
10041 .channel_mode
= alc885_mb5_6ch_modes
,
10042 .num_channel_mode
= ARRAY_SIZE(alc885_mb5_6ch_modes
),
10043 .input_mux
= &mb5_capture_source
,
10044 .dig_out_nid
= ALC882_DIGOUT_NID
,
10045 .dig_in_nid
= ALC882_DIGIN_NID
,
10046 .unsol_event
= alc_automute_amp_unsol_event
,
10047 .setup
= alc885_mb5_setup
,
10048 .init_hook
= alc_automute_amp
,
10050 [ALC885_MACMINI3
] = {
10051 .mixers
= { alc885_macmini3_mixer
, alc882_chmode_mixer
},
10052 .init_verbs
= { alc885_macmini3_init_verbs
,
10053 alc880_gpio1_init_verbs
},
10054 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10055 .dac_nids
= alc882_dac_nids
,
10056 .channel_mode
= alc885_macmini3_6ch_modes
,
10057 .num_channel_mode
= ARRAY_SIZE(alc885_macmini3_6ch_modes
),
10058 .input_mux
= &macmini3_capture_source
,
10059 .dig_out_nid
= ALC882_DIGOUT_NID
,
10060 .dig_in_nid
= ALC882_DIGIN_NID
,
10061 .unsol_event
= alc_automute_amp_unsol_event
,
10062 .setup
= alc885_macmini3_setup
,
10063 .init_hook
= alc_automute_amp
,
10065 [ALC885_MACPRO
] = {
10066 .mixers
= { alc882_macpro_mixer
},
10067 .init_verbs
= { alc882_macpro_init_verbs
},
10068 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10069 .dac_nids
= alc882_dac_nids
,
10070 .dig_out_nid
= ALC882_DIGOUT_NID
,
10071 .dig_in_nid
= ALC882_DIGIN_NID
,
10072 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10073 .channel_mode
= alc882_ch_modes
,
10074 .input_mux
= &alc882_capture_source
,
10075 .init_hook
= alc885_macpro_init_hook
,
10077 [ALC885_IMAC24
] = {
10078 .mixers
= { alc885_imac24_mixer
},
10079 .init_verbs
= { alc885_imac24_init_verbs
},
10080 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10081 .dac_nids
= alc882_dac_nids
,
10082 .dig_out_nid
= ALC882_DIGOUT_NID
,
10083 .dig_in_nid
= ALC882_DIGIN_NID
,
10084 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10085 .channel_mode
= alc882_ch_modes
,
10086 .input_mux
= &alc882_capture_source
,
10087 .unsol_event
= alc_automute_amp_unsol_event
,
10088 .setup
= alc885_imac24_setup
,
10089 .init_hook
= alc885_imac24_init_hook
,
10091 [ALC885_IMAC91
] = {
10092 .mixers
= {alc885_imac91_mixer
},
10093 .init_verbs
= { alc885_imac91_init_verbs
,
10094 alc880_gpio1_init_verbs
},
10095 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10096 .dac_nids
= alc882_dac_nids
,
10097 .channel_mode
= alc885_mba21_ch_modes
,
10098 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
10099 .input_mux
= &alc889A_imac91_capture_source
,
10100 .dig_out_nid
= ALC882_DIGOUT_NID
,
10101 .dig_in_nid
= ALC882_DIGIN_NID
,
10102 .unsol_event
= alc_automute_amp_unsol_event
,
10103 .setup
= alc885_imac91_setup
,
10104 .init_hook
= alc_automute_amp
,
10107 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
},
10108 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10109 alc880_gpio3_init_verbs
, alc882_targa_verbs
},
10110 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10111 .dac_nids
= alc882_dac_nids
,
10112 .dig_out_nid
= ALC882_DIGOUT_NID
,
10113 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
10114 .adc_nids
= alc882_adc_nids
,
10115 .capsrc_nids
= alc882_capsrc_nids
,
10116 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
10117 .channel_mode
= alc882_3ST_6ch_modes
,
10119 .input_mux
= &alc882_capture_source
,
10120 .unsol_event
= alc882_targa_unsol_event
,
10121 .setup
= alc882_targa_setup
,
10122 .init_hook
= alc882_targa_automute
,
10124 [ALC882_ASUS_A7J
] = {
10125 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
},
10126 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10127 alc882_asus_a7j_verbs
},
10128 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10129 .dac_nids
= alc882_dac_nids
,
10130 .dig_out_nid
= ALC882_DIGOUT_NID
,
10131 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
10132 .adc_nids
= alc882_adc_nids
,
10133 .capsrc_nids
= alc882_capsrc_nids
,
10134 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
10135 .channel_mode
= alc882_3ST_6ch_modes
,
10137 .input_mux
= &alc882_capture_source
,
10139 [ALC882_ASUS_A7M
] = {
10140 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
10141 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10142 alc882_eapd_verbs
, alc880_gpio1_init_verbs
,
10143 alc882_asus_a7m_verbs
},
10144 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10145 .dac_nids
= alc882_dac_nids
,
10146 .dig_out_nid
= ALC882_DIGOUT_NID
,
10147 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
10148 .channel_mode
= alc880_threestack_modes
,
10150 .input_mux
= &alc882_capture_source
,
10152 [ALC883_3ST_2ch_DIG
] = {
10153 .mixers
= { alc883_3ST_2ch_mixer
},
10154 .init_verbs
= { alc883_init_verbs
},
10155 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10156 .dac_nids
= alc883_dac_nids
,
10157 .dig_out_nid
= ALC883_DIGOUT_NID
,
10158 .dig_in_nid
= ALC883_DIGIN_NID
,
10159 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10160 .channel_mode
= alc883_3ST_2ch_modes
,
10161 .input_mux
= &alc883_capture_source
,
10163 [ALC883_3ST_6ch_DIG
] = {
10164 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10165 .init_verbs
= { alc883_init_verbs
},
10166 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10167 .dac_nids
= alc883_dac_nids
,
10168 .dig_out_nid
= ALC883_DIGOUT_NID
,
10169 .dig_in_nid
= ALC883_DIGIN_NID
,
10170 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10171 .channel_mode
= alc883_3ST_6ch_modes
,
10173 .input_mux
= &alc883_capture_source
,
10175 [ALC883_3ST_6ch
] = {
10176 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10177 .init_verbs
= { alc883_init_verbs
},
10178 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10179 .dac_nids
= alc883_dac_nids
,
10180 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10181 .channel_mode
= alc883_3ST_6ch_modes
,
10183 .input_mux
= &alc883_capture_source
,
10185 [ALC883_3ST_6ch_INTEL
] = {
10186 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
10187 .init_verbs
= { alc883_init_verbs
},
10188 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10189 .dac_nids
= alc883_dac_nids
,
10190 .dig_out_nid
= ALC883_DIGOUT_NID
,
10191 .dig_in_nid
= ALC883_DIGIN_NID
,
10192 .slave_dig_outs
= alc883_slave_dig_outs
,
10193 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
10194 .channel_mode
= alc883_3ST_6ch_intel_modes
,
10196 .input_mux
= &alc883_3stack_6ch_intel
,
10198 [ALC889A_INTEL
] = {
10199 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
10200 .init_verbs
= { alc885_init_verbs
, alc885_init_input_verbs
,
10201 alc_hp15_unsol_verbs
},
10202 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10203 .dac_nids
= alc883_dac_nids
,
10204 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10205 .adc_nids
= alc889_adc_nids
,
10206 .dig_out_nid
= ALC883_DIGOUT_NID
,
10207 .dig_in_nid
= ALC883_DIGIN_NID
,
10208 .slave_dig_outs
= alc883_slave_dig_outs
,
10209 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
10210 .channel_mode
= alc889_8ch_intel_modes
,
10211 .capsrc_nids
= alc889_capsrc_nids
,
10212 .input_mux
= &alc889_capture_source
,
10213 .setup
= alc889_automute_setup
,
10214 .init_hook
= alc_automute_amp
,
10215 .unsol_event
= alc_automute_amp_unsol_event
,
10219 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
10220 .init_verbs
= { alc885_init_verbs
, alc889_init_input_verbs
,
10221 alc889_eapd_verbs
, alc_hp15_unsol_verbs
},
10222 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10223 .dac_nids
= alc883_dac_nids
,
10224 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10225 .adc_nids
= alc889_adc_nids
,
10226 .dig_out_nid
= ALC883_DIGOUT_NID
,
10227 .dig_in_nid
= ALC883_DIGIN_NID
,
10228 .slave_dig_outs
= alc883_slave_dig_outs
,
10229 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
10230 .channel_mode
= alc889_8ch_intel_modes
,
10231 .capsrc_nids
= alc889_capsrc_nids
,
10232 .input_mux
= &alc889_capture_source
,
10233 .setup
= alc889_automute_setup
,
10234 .init_hook
= alc889_intel_init_hook
,
10235 .unsol_event
= alc_automute_amp_unsol_event
,
10238 [ALC883_6ST_DIG
] = {
10239 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10240 .init_verbs
= { alc883_init_verbs
},
10241 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10242 .dac_nids
= alc883_dac_nids
,
10243 .dig_out_nid
= ALC883_DIGOUT_NID
,
10244 .dig_in_nid
= ALC883_DIGIN_NID
,
10245 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10246 .channel_mode
= alc883_sixstack_modes
,
10247 .input_mux
= &alc883_capture_source
,
10249 [ALC883_TARGA_DIG
] = {
10250 .mixers
= { alc883_targa_mixer
, alc883_chmode_mixer
},
10251 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10252 alc883_targa_verbs
},
10253 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10254 .dac_nids
= alc883_dac_nids
,
10255 .dig_out_nid
= ALC883_DIGOUT_NID
,
10256 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10257 .channel_mode
= alc883_3ST_6ch_modes
,
10259 .input_mux
= &alc883_capture_source
,
10260 .unsol_event
= alc883_targa_unsol_event
,
10261 .setup
= alc882_targa_setup
,
10262 .init_hook
= alc882_targa_automute
,
10264 [ALC883_TARGA_2ch_DIG
] = {
10265 .mixers
= { alc883_targa_2ch_mixer
},
10266 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10267 alc883_targa_verbs
},
10268 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10269 .dac_nids
= alc883_dac_nids
,
10270 .adc_nids
= alc883_adc_nids_alt
,
10271 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10272 .capsrc_nids
= alc883_capsrc_nids
,
10273 .dig_out_nid
= ALC883_DIGOUT_NID
,
10274 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10275 .channel_mode
= alc883_3ST_2ch_modes
,
10276 .input_mux
= &alc883_capture_source
,
10277 .unsol_event
= alc883_targa_unsol_event
,
10278 .setup
= alc882_targa_setup
,
10279 .init_hook
= alc882_targa_automute
,
10281 [ALC883_TARGA_8ch_DIG
] = {
10282 .mixers
= { alc883_targa_mixer
, alc883_targa_8ch_mixer
,
10283 alc883_chmode_mixer
},
10284 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10285 alc883_targa_verbs
},
10286 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10287 .dac_nids
= alc883_dac_nids
,
10288 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10289 .adc_nids
= alc883_adc_nids_rev
,
10290 .capsrc_nids
= alc883_capsrc_nids_rev
,
10291 .dig_out_nid
= ALC883_DIGOUT_NID
,
10292 .dig_in_nid
= ALC883_DIGIN_NID
,
10293 .num_channel_mode
= ARRAY_SIZE(alc883_4ST_8ch_modes
),
10294 .channel_mode
= alc883_4ST_8ch_modes
,
10296 .input_mux
= &alc883_capture_source
,
10297 .unsol_event
= alc883_targa_unsol_event
,
10298 .setup
= alc882_targa_setup
,
10299 .init_hook
= alc882_targa_automute
,
10302 .mixers
= { alc883_base_mixer
},
10303 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10304 * and the headphone jack. Turn this on and rely on the
10305 * standard mute methods whenever the user wants to turn
10306 * these outputs off.
10308 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
10309 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10310 .dac_nids
= alc883_dac_nids
,
10311 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10312 .channel_mode
= alc883_3ST_2ch_modes
,
10313 .input_mux
= &alc883_capture_source
,
10315 [ALC883_ACER_ASPIRE
] = {
10316 .mixers
= { alc883_acer_aspire_mixer
},
10317 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
10318 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10319 .dac_nids
= alc883_dac_nids
,
10320 .dig_out_nid
= ALC883_DIGOUT_NID
,
10321 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10322 .channel_mode
= alc883_3ST_2ch_modes
,
10323 .input_mux
= &alc883_capture_source
,
10324 .unsol_event
= alc_automute_amp_unsol_event
,
10325 .setup
= alc883_acer_aspire_setup
,
10326 .init_hook
= alc_automute_amp
,
10328 [ALC888_ACER_ASPIRE_4930G
] = {
10329 .mixers
= { alc888_acer_aspire_4930g_mixer
,
10330 alc883_chmode_mixer
},
10331 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10332 alc888_acer_aspire_4930g_verbs
},
10333 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10334 .dac_nids
= alc883_dac_nids
,
10335 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10336 .adc_nids
= alc883_adc_nids_rev
,
10337 .capsrc_nids
= alc883_capsrc_nids_rev
,
10338 .dig_out_nid
= ALC883_DIGOUT_NID
,
10339 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10340 .channel_mode
= alc883_3ST_6ch_modes
,
10342 .const_channel_count
= 6,
10344 ARRAY_SIZE(alc888_2_capture_sources
),
10345 .input_mux
= alc888_2_capture_sources
,
10346 .unsol_event
= alc_automute_amp_unsol_event
,
10347 .setup
= alc888_acer_aspire_4930g_setup
,
10348 .init_hook
= alc_automute_amp
,
10350 [ALC888_ACER_ASPIRE_6530G
] = {
10351 .mixers
= { alc888_acer_aspire_6530_mixer
},
10352 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10353 alc888_acer_aspire_6530g_verbs
},
10354 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10355 .dac_nids
= alc883_dac_nids
,
10356 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10357 .adc_nids
= alc883_adc_nids_rev
,
10358 .capsrc_nids
= alc883_capsrc_nids_rev
,
10359 .dig_out_nid
= ALC883_DIGOUT_NID
,
10360 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10361 .channel_mode
= alc883_3ST_2ch_modes
,
10363 ARRAY_SIZE(alc888_2_capture_sources
),
10364 .input_mux
= alc888_acer_aspire_6530_sources
,
10365 .unsol_event
= alc_automute_amp_unsol_event
,
10366 .setup
= alc888_acer_aspire_6530g_setup
,
10367 .init_hook
= alc_automute_amp
,
10369 [ALC888_ACER_ASPIRE_8930G
] = {
10370 .mixers
= { alc889_acer_aspire_8930g_mixer
,
10371 alc883_chmode_mixer
},
10372 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10373 alc889_acer_aspire_8930g_verbs
,
10374 alc889_eapd_verbs
},
10375 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10376 .dac_nids
= alc883_dac_nids
,
10377 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10378 .adc_nids
= alc889_adc_nids
,
10379 .capsrc_nids
= alc889_capsrc_nids
,
10380 .dig_out_nid
= ALC883_DIGOUT_NID
,
10381 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10382 .channel_mode
= alc883_3ST_6ch_modes
,
10384 .const_channel_count
= 6,
10386 ARRAY_SIZE(alc889_capture_sources
),
10387 .input_mux
= alc889_capture_sources
,
10388 .unsol_event
= alc_automute_amp_unsol_event
,
10389 .setup
= alc889_acer_aspire_8930g_setup
,
10390 .init_hook
= alc_automute_amp
,
10391 #ifdef CONFIG_SND_HDA_POWER_SAVE
10392 .power_hook
= alc_power_eapd
,
10395 [ALC888_ACER_ASPIRE_7730G
] = {
10396 .mixers
= { alc883_3ST_6ch_mixer
,
10397 alc883_chmode_mixer
},
10398 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10399 alc888_acer_aspire_7730G_verbs
},
10400 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10401 .dac_nids
= alc883_dac_nids
,
10402 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10403 .adc_nids
= alc883_adc_nids_rev
,
10404 .capsrc_nids
= alc883_capsrc_nids_rev
,
10405 .dig_out_nid
= ALC883_DIGOUT_NID
,
10406 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10407 .channel_mode
= alc883_3ST_6ch_modes
,
10409 .const_channel_count
= 6,
10410 .input_mux
= &alc883_capture_source
,
10411 .unsol_event
= alc_automute_amp_unsol_event
,
10412 .setup
= alc888_acer_aspire_7730g_setup
,
10413 .init_hook
= alc_automute_amp
,
10415 [ALC883_MEDION
] = {
10416 .mixers
= { alc883_fivestack_mixer
,
10417 alc883_chmode_mixer
},
10418 .init_verbs
= { alc883_init_verbs
,
10419 alc883_medion_eapd_verbs
},
10420 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10421 .dac_nids
= alc883_dac_nids
,
10422 .adc_nids
= alc883_adc_nids_alt
,
10423 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10424 .capsrc_nids
= alc883_capsrc_nids
,
10425 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10426 .channel_mode
= alc883_sixstack_modes
,
10427 .input_mux
= &alc883_capture_source
,
10429 [ALC883_MEDION_WIM2160
] = {
10430 .mixers
= { alc883_medion_wim2160_mixer
},
10431 .init_verbs
= { alc883_init_verbs
, alc883_medion_wim2160_verbs
},
10432 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10433 .dac_nids
= alc883_dac_nids
,
10434 .dig_out_nid
= ALC883_DIGOUT_NID
,
10435 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10436 .adc_nids
= alc883_adc_nids
,
10437 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10438 .channel_mode
= alc883_3ST_2ch_modes
,
10439 .input_mux
= &alc883_capture_source
,
10440 .unsol_event
= alc_automute_amp_unsol_event
,
10441 .setup
= alc883_medion_wim2160_setup
,
10442 .init_hook
= alc_automute_amp
,
10444 [ALC883_LAPTOP_EAPD
] = {
10445 .mixers
= { alc883_base_mixer
},
10446 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
10447 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10448 .dac_nids
= alc883_dac_nids
,
10449 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10450 .channel_mode
= alc883_3ST_2ch_modes
,
10451 .input_mux
= &alc883_capture_source
,
10453 [ALC883_CLEVO_M540R
] = {
10454 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10455 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m540r_verbs
},
10456 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10457 .dac_nids
= alc883_dac_nids
,
10458 .dig_out_nid
= ALC883_DIGOUT_NID
,
10459 .dig_in_nid
= ALC883_DIGIN_NID
,
10460 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_clevo_modes
),
10461 .channel_mode
= alc883_3ST_6ch_clevo_modes
,
10463 .input_mux
= &alc883_capture_source
,
10464 /* This machine has the hardware HP auto-muting, thus
10465 * we need no software mute via unsol event
10468 [ALC883_CLEVO_M720
] = {
10469 .mixers
= { alc883_clevo_m720_mixer
},
10470 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
10471 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10472 .dac_nids
= alc883_dac_nids
,
10473 .dig_out_nid
= ALC883_DIGOUT_NID
,
10474 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10475 .channel_mode
= alc883_3ST_2ch_modes
,
10476 .input_mux
= &alc883_capture_source
,
10477 .unsol_event
= alc883_clevo_m720_unsol_event
,
10478 .setup
= alc883_clevo_m720_setup
,
10479 .init_hook
= alc883_clevo_m720_init_hook
,
10481 [ALC883_LENOVO_101E_2ch
] = {
10482 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
10483 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
10484 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10485 .dac_nids
= alc883_dac_nids
,
10486 .adc_nids
= alc883_adc_nids_alt
,
10487 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10488 .capsrc_nids
= alc883_capsrc_nids
,
10489 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10490 .channel_mode
= alc883_3ST_2ch_modes
,
10491 .input_mux
= &alc883_lenovo_101e_capture_source
,
10492 .unsol_event
= alc883_lenovo_101e_unsol_event
,
10493 .init_hook
= alc883_lenovo_101e_all_automute
,
10495 [ALC883_LENOVO_NB0763
] = {
10496 .mixers
= { alc883_lenovo_nb0763_mixer
},
10497 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
10498 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10499 .dac_nids
= alc883_dac_nids
,
10500 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10501 .channel_mode
= alc883_3ST_2ch_modes
,
10503 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
10504 .unsol_event
= alc_automute_amp_unsol_event
,
10505 .setup
= alc883_lenovo_nb0763_setup
,
10506 .init_hook
= alc_automute_amp
,
10508 [ALC888_LENOVO_MS7195_DIG
] = {
10509 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10510 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
10511 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10512 .dac_nids
= alc883_dac_nids
,
10513 .dig_out_nid
= ALC883_DIGOUT_NID
,
10514 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10515 .channel_mode
= alc883_3ST_6ch_modes
,
10517 .input_mux
= &alc883_capture_source
,
10518 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
10519 .init_hook
= alc888_lenovo_ms7195_front_automute
,
10521 [ALC883_HAIER_W66
] = {
10522 .mixers
= { alc883_targa_2ch_mixer
},
10523 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
10524 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10525 .dac_nids
= alc883_dac_nids
,
10526 .dig_out_nid
= ALC883_DIGOUT_NID
,
10527 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10528 .channel_mode
= alc883_3ST_2ch_modes
,
10529 .input_mux
= &alc883_capture_source
,
10530 .unsol_event
= alc_automute_amp_unsol_event
,
10531 .setup
= alc883_haier_w66_setup
,
10532 .init_hook
= alc_automute_amp
,
10534 [ALC888_3ST_HP
] = {
10535 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10536 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
10537 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10538 .dac_nids
= alc883_dac_nids
,
10539 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
10540 .channel_mode
= alc888_3st_hp_modes
,
10542 .input_mux
= &alc883_capture_source
,
10543 .unsol_event
= alc_automute_amp_unsol_event
,
10544 .setup
= alc888_3st_hp_setup
,
10545 .init_hook
= alc_automute_amp
,
10547 [ALC888_6ST_DELL
] = {
10548 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10549 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
10550 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10551 .dac_nids
= alc883_dac_nids
,
10552 .dig_out_nid
= ALC883_DIGOUT_NID
,
10553 .dig_in_nid
= ALC883_DIGIN_NID
,
10554 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10555 .channel_mode
= alc883_sixstack_modes
,
10556 .input_mux
= &alc883_capture_source
,
10557 .unsol_event
= alc_automute_amp_unsol_event
,
10558 .setup
= alc888_6st_dell_setup
,
10559 .init_hook
= alc_automute_amp
,
10562 .mixers
= { alc883_mitac_mixer
},
10563 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
10564 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10565 .dac_nids
= alc883_dac_nids
,
10566 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10567 .channel_mode
= alc883_3ST_2ch_modes
,
10568 .input_mux
= &alc883_capture_source
,
10569 .unsol_event
= alc_automute_amp_unsol_event
,
10570 .setup
= alc883_mitac_setup
,
10571 .init_hook
= alc_automute_amp
,
10573 [ALC883_FUJITSU_PI2515
] = {
10574 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
10575 .init_verbs
= { alc883_init_verbs
,
10576 alc883_2ch_fujitsu_pi2515_verbs
},
10577 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10578 .dac_nids
= alc883_dac_nids
,
10579 .dig_out_nid
= ALC883_DIGOUT_NID
,
10580 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10581 .channel_mode
= alc883_3ST_2ch_modes
,
10582 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10583 .unsol_event
= alc_automute_amp_unsol_event
,
10584 .setup
= alc883_2ch_fujitsu_pi2515_setup
,
10585 .init_hook
= alc_automute_amp
,
10587 [ALC888_FUJITSU_XA3530
] = {
10588 .mixers
= { alc888_base_mixer
, alc883_chmode_mixer
},
10589 .init_verbs
= { alc883_init_verbs
,
10590 alc888_fujitsu_xa3530_verbs
},
10591 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10592 .dac_nids
= alc883_dac_nids
,
10593 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10594 .adc_nids
= alc883_adc_nids_rev
,
10595 .capsrc_nids
= alc883_capsrc_nids_rev
,
10596 .dig_out_nid
= ALC883_DIGOUT_NID
,
10597 .num_channel_mode
= ARRAY_SIZE(alc888_4ST_8ch_intel_modes
),
10598 .channel_mode
= alc888_4ST_8ch_intel_modes
,
10600 ARRAY_SIZE(alc888_2_capture_sources
),
10601 .input_mux
= alc888_2_capture_sources
,
10602 .unsol_event
= alc_automute_amp_unsol_event
,
10603 .setup
= alc888_fujitsu_xa3530_setup
,
10604 .init_hook
= alc_automute_amp
,
10606 [ALC888_LENOVO_SKY
] = {
10607 .mixers
= { alc888_lenovo_sky_mixer
, alc883_chmode_mixer
},
10608 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_sky_verbs
},
10609 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10610 .dac_nids
= alc883_dac_nids
,
10611 .dig_out_nid
= ALC883_DIGOUT_NID
,
10612 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10613 .channel_mode
= alc883_sixstack_modes
,
10615 .input_mux
= &alc883_lenovo_sky_capture_source
,
10616 .unsol_event
= alc_automute_amp_unsol_event
,
10617 .setup
= alc888_lenovo_sky_setup
,
10618 .init_hook
= alc_automute_amp
,
10620 [ALC888_ASUS_M90V
] = {
10621 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10622 .init_verbs
= { alc883_init_verbs
, alc888_asus_m90v_verbs
},
10623 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10624 .dac_nids
= alc883_dac_nids
,
10625 .dig_out_nid
= ALC883_DIGOUT_NID
,
10626 .dig_in_nid
= ALC883_DIGIN_NID
,
10627 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10628 .channel_mode
= alc883_3ST_6ch_modes
,
10630 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10631 .unsol_event
= alc_sku_unsol_event
,
10632 .setup
= alc883_mode2_setup
,
10633 .init_hook
= alc_inithook
,
10635 [ALC888_ASUS_EEE1601
] = {
10636 .mixers
= { alc883_asus_eee1601_mixer
},
10637 .cap_mixer
= alc883_asus_eee1601_cap_mixer
,
10638 .init_verbs
= { alc883_init_verbs
, alc888_asus_eee1601_verbs
},
10639 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10640 .dac_nids
= alc883_dac_nids
,
10641 .dig_out_nid
= ALC883_DIGOUT_NID
,
10642 .dig_in_nid
= ALC883_DIGIN_NID
,
10643 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10644 .channel_mode
= alc883_3ST_2ch_modes
,
10646 .input_mux
= &alc883_asus_eee1601_capture_source
,
10647 .unsol_event
= alc_sku_unsol_event
,
10648 .init_hook
= alc883_eee1601_inithook
,
10650 [ALC1200_ASUS_P5Q
] = {
10651 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10652 .init_verbs
= { alc883_init_verbs
},
10653 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10654 .dac_nids
= alc883_dac_nids
,
10655 .dig_out_nid
= ALC1200_DIGOUT_NID
,
10656 .dig_in_nid
= ALC883_DIGIN_NID
,
10657 .slave_dig_outs
= alc1200_slave_dig_outs
,
10658 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10659 .channel_mode
= alc883_sixstack_modes
,
10660 .input_mux
= &alc883_capture_source
,
10663 .mixers
= { alc889A_mb31_mixer
, alc883_chmode_mixer
},
10664 .init_verbs
= { alc883_init_verbs
, alc889A_mb31_verbs
,
10665 alc880_gpio1_init_verbs
},
10666 .adc_nids
= alc883_adc_nids
,
10667 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10668 .capsrc_nids
= alc883_capsrc_nids
,
10669 .dac_nids
= alc883_dac_nids
,
10670 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10671 .channel_mode
= alc889A_mb31_6ch_modes
,
10672 .num_channel_mode
= ARRAY_SIZE(alc889A_mb31_6ch_modes
),
10673 .input_mux
= &alc889A_mb31_capture_source
,
10674 .dig_out_nid
= ALC883_DIGOUT_NID
,
10675 .unsol_event
= alc889A_mb31_unsol_event
,
10676 .init_hook
= alc889A_mb31_automute
,
10678 [ALC883_SONY_VAIO_TT
] = {
10679 .mixers
= { alc883_vaiott_mixer
},
10680 .init_verbs
= { alc883_init_verbs
, alc883_vaiott_verbs
},
10681 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10682 .dac_nids
= alc883_dac_nids
,
10683 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10684 .channel_mode
= alc883_3ST_2ch_modes
,
10685 .input_mux
= &alc883_capture_source
,
10686 .unsol_event
= alc_automute_amp_unsol_event
,
10687 .setup
= alc883_vaiott_setup
,
10688 .init_hook
= alc_automute_amp
,
10697 PINFIX_ABIT_AW9D_MAX
,
10698 PINFIX_LENOVO_Y530
,
10700 PINFIX_ACER_ASPIRE_7736
,
10703 static const struct alc_fixup alc882_fixups
[] = {
10704 [PINFIX_ABIT_AW9D_MAX
] = {
10705 .type
= ALC_FIXUP_PINS
,
10706 .v
.pins
= (const struct alc_pincfg
[]) {
10707 { 0x15, 0x01080104 }, /* side */
10708 { 0x16, 0x01011012 }, /* rear */
10709 { 0x17, 0x01016011 }, /* clfe */
10713 [PINFIX_LENOVO_Y530
] = {
10714 .type
= ALC_FIXUP_PINS
,
10715 .v
.pins
= (const struct alc_pincfg
[]) {
10716 { 0x15, 0x99130112 }, /* rear int speakers */
10717 { 0x16, 0x99130111 }, /* subwoofer */
10721 [PINFIX_PB_M5210
] = {
10722 .type
= ALC_FIXUP_VERBS
,
10723 .v
.verbs
= (const struct hda_verb
[]) {
10724 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
10728 [PINFIX_ACER_ASPIRE_7736
] = {
10729 .type
= ALC_FIXUP_SKU
,
10730 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
10734 static struct snd_pci_quirk alc882_fixup_tbl
[] = {
10735 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210
),
10736 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530
),
10737 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
10738 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736
),
10743 * BIOS auto configuration
10745 static int alc882_auto_create_input_ctls(struct hda_codec
*codec
,
10746 const struct auto_pin_cfg
*cfg
)
10748 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x23, 0x22);
10751 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
10752 hda_nid_t nid
, int pin_type
,
10757 /* set as output */
10758 alc_set_pin_output(codec
, nid
, pin_type
);
10762 else if (dac
>= 0x02 && dac
<= 0x05)
10766 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
10769 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
10771 struct alc_spec
*spec
= codec
->spec
;
10774 for (i
= 0; i
<= HDA_SIDE
; i
++) {
10775 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
10776 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
10778 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
10779 spec
->multiout
.dac_nids
[i
]);
10783 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
10785 struct alc_spec
*spec
= codec
->spec
;
10786 hda_nid_t pin
, dac
;
10789 if (spec
->autocfg
.line_out_type
!= AUTO_PIN_HP_OUT
) {
10790 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.hp_pins
); i
++) {
10791 pin
= spec
->autocfg
.hp_pins
[i
];
10794 dac
= spec
->multiout
.hp_nid
;
10796 dac
= spec
->multiout
.dac_nids
[0]; /* to front */
10797 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, dac
);
10801 if (spec
->autocfg
.line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
10802 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
10803 pin
= spec
->autocfg
.speaker_pins
[i
];
10806 dac
= spec
->multiout
.extra_out_nid
[0];
10808 dac
= spec
->multiout
.dac_nids
[0]; /* to front */
10809 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, dac
);
10814 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
10816 struct alc_spec
*spec
= codec
->spec
;
10817 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
10820 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
10821 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
10822 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
10823 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
10824 snd_hda_codec_write(codec
, nid
, 0,
10825 AC_VERB_SET_AMP_GAIN_MUTE
,
10830 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
10832 struct alc_spec
*spec
= codec
->spec
;
10835 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
10836 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
10837 hda_nid_t nid
= spec
->capsrc_nids
[c
];
10838 unsigned int mux_idx
;
10839 const struct hda_input_mux
*imux
;
10840 int conns
, mute
, idx
, item
;
10842 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
10843 ARRAY_SIZE(conn_list
));
10846 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
10847 imux
= &spec
->input_mux
[mux_idx
];
10848 if (!imux
->num_items
&& mux_idx
> 0)
10849 imux
= &spec
->input_mux
[0];
10850 for (idx
= 0; idx
< conns
; idx
++) {
10851 /* if the current connection is the selected one,
10852 * unmute it as default - otherwise mute it
10854 mute
= AMP_IN_MUTE(idx
);
10855 for (item
= 0; item
< imux
->num_items
; item
++) {
10856 if (imux
->items
[item
].index
== idx
) {
10857 if (spec
->cur_mux
[c
] == item
)
10858 mute
= AMP_IN_UNMUTE(idx
);
10862 /* check if we have a selector or mixer
10863 * we could check for the widget type instead, but
10864 * just check for Amp-In presence (in case of mixer
10865 * without amp-in there is something wrong, this
10866 * function shouldn't be used or capsrc nid is wrong)
10868 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)
10869 snd_hda_codec_write(codec
, nid
, 0,
10870 AC_VERB_SET_AMP_GAIN_MUTE
,
10872 else if (mute
!= AMP_IN_MUTE(idx
))
10873 snd_hda_codec_write(codec
, nid
, 0,
10874 AC_VERB_SET_CONNECT_SEL
,
10880 /* add mic boosts if needed */
10881 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
10883 struct alc_spec
*spec
= codec
->spec
;
10884 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
10888 const char *prev_label
= NULL
;
10890 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
10891 if (cfg
->inputs
[i
].type
> AUTO_PIN_MIC
)
10893 nid
= cfg
->inputs
[i
].pin
;
10894 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
) {
10896 char boost_label
[32];
10898 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
10899 if (prev_label
&& !strcmp(label
, prev_label
))
10903 prev_label
= label
;
10905 snprintf(boost_label
, sizeof(boost_label
),
10906 "%s Boost Volume", label
);
10907 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10908 boost_label
, type_idx
,
10909 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
10917 /* almost identical with ALC880 parser... */
10918 static int alc882_parse_auto_config(struct hda_codec
*codec
)
10920 struct alc_spec
*spec
= codec
->spec
;
10921 static hda_nid_t alc882_ignore
[] = { 0x1d, 0 };
10924 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10928 if (!spec
->autocfg
.line_outs
)
10929 return 0; /* can't find valid BIOS pin config */
10931 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
10934 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10937 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
10941 err
= alc880_auto_create_extra_out(spec
,
10942 spec
->autocfg
.speaker_pins
[0],
10946 err
= alc882_auto_create_input_ctls(codec
, &spec
->autocfg
);
10950 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
10952 alc_auto_parse_digital(codec
);
10954 if (spec
->kctls
.list
)
10955 add_mixer(spec
, spec
->kctls
.list
);
10957 add_verb(spec
, alc883_auto_init_verbs
);
10958 /* if ADC 0x07 is available, initialize it, too */
10959 if (get_wcaps_type(get_wcaps(codec
, 0x07)) == AC_WID_AUD_IN
)
10960 add_verb(spec
, alc882_adc1_init_verbs
);
10962 spec
->num_mux_defs
= 1;
10963 spec
->input_mux
= &spec
->private_imux
[0];
10965 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
10967 err
= alc_auto_add_mic_boost(codec
);
10971 return 1; /* config found */
10974 /* additional initialization for auto-configuration model */
10975 static void alc882_auto_init(struct hda_codec
*codec
)
10977 struct alc_spec
*spec
= codec
->spec
;
10978 alc882_auto_init_multi_out(codec
);
10979 alc882_auto_init_hp_out(codec
);
10980 alc882_auto_init_analog_input(codec
);
10981 alc882_auto_init_input_src(codec
);
10982 alc_auto_init_digital(codec
);
10983 if (spec
->unsol_event
)
10984 alc_inithook(codec
);
10987 static int patch_alc882(struct hda_codec
*codec
)
10989 struct alc_spec
*spec
;
10990 int err
, board_config
;
10992 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10996 codec
->spec
= spec
;
10998 switch (codec
->vendor_id
) {
11003 /* ALC883 and variants */
11004 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
11008 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
11012 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
)
11013 board_config
= snd_hda_check_board_codec_sid_config(codec
,
11014 ALC882_MODEL_LAST
, alc882_models
, alc882_ssid_cfg_tbl
);
11016 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
11017 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
11019 board_config
= ALC882_AUTO
;
11022 if (board_config
== ALC882_AUTO
) {
11023 alc_pick_fixup(codec
, NULL
, alc882_fixup_tbl
, alc882_fixups
);
11024 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
11027 alc_auto_parse_customize_define(codec
);
11029 if (board_config
== ALC882_AUTO
) {
11030 /* automatic parse from the BIOS config */
11031 err
= alc882_parse_auto_config(codec
);
11037 "hda_codec: Cannot set up configuration "
11038 "from BIOS. Using base mode...\n");
11039 board_config
= ALC882_3ST_DIG
;
11043 if (has_cdefine_beep(codec
)) {
11044 err
= snd_hda_attach_beep_device(codec
, 0x1);
11051 if (board_config
!= ALC882_AUTO
)
11052 setup_preset(codec
, &alc882_presets
[board_config
]);
11054 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
11055 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
11056 /* FIXME: setup DAC5 */
11057 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11058 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
11060 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
11061 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
11063 if (!spec
->adc_nids
&& spec
->input_mux
) {
11065 spec
->num_adc_nids
= 0;
11066 for (i
= 0; i
< ARRAY_SIZE(alc882_adc_nids
); i
++) {
11067 const struct hda_input_mux
*imux
= spec
->input_mux
;
11069 hda_nid_t items
[16];
11070 hda_nid_t nid
= alc882_adc_nids
[i
];
11071 unsigned int wcap
= get_wcaps(codec
, nid
);
11073 wcap
= get_wcaps_type(wcap
);
11074 if (wcap
!= AC_WID_AUD_IN
)
11076 spec
->private_adc_nids
[spec
->num_adc_nids
] = nid
;
11077 err
= snd_hda_get_connections(codec
, nid
, &cap
, 1);
11080 err
= snd_hda_get_connections(codec
, cap
, items
,
11081 ARRAY_SIZE(items
));
11084 for (j
= 0; j
< imux
->num_items
; j
++)
11085 if (imux
->items
[j
].index
>= err
)
11087 if (j
< imux
->num_items
)
11089 spec
->private_capsrc_nids
[spec
->num_adc_nids
] = cap
;
11090 spec
->num_adc_nids
++;
11092 spec
->adc_nids
= spec
->private_adc_nids
;
11093 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
11096 set_capture_mixer(codec
);
11098 if (has_cdefine_beep(codec
))
11099 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
11101 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
11103 spec
->vmaster_nid
= 0x0c;
11105 codec
->patch_ops
= alc_patch_ops
;
11106 if (board_config
== ALC882_AUTO
)
11107 spec
->init_hook
= alc882_auto_init
;
11109 alc_init_jacks(codec
);
11110 #ifdef CONFIG_SND_HDA_POWER_SAVE
11111 if (!spec
->loopback
.amplist
)
11112 spec
->loopback
.amplist
= alc882_loopbacks
;
11123 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11124 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11126 #define alc262_dac_nids alc260_dac_nids
11127 #define alc262_adc_nids alc882_adc_nids
11128 #define alc262_adc_nids_alt alc882_adc_nids_alt
11129 #define alc262_capsrc_nids alc882_capsrc_nids
11130 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11132 #define alc262_modes alc260_modes
11133 #define alc262_capture_source alc882_capture_source
11135 static hda_nid_t alc262_dmic_adc_nids
[1] = {
11140 static hda_nid_t alc262_dmic_capsrc_nids
[1] = { 0x22 };
11142 static struct snd_kcontrol_new alc262_base_mixer
[] = {
11143 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11144 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11145 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11146 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11147 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11148 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11150 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11151 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11152 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11153 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11154 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11155 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
11156 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11157 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
11158 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
11162 /* update HP, line and mono-out pins according to the master switch */
11163 static void alc262_hp_master_update(struct hda_codec
*codec
)
11165 struct alc_spec
*spec
= codec
->spec
;
11166 int val
= spec
->master_sw
;
11168 /* HP & line-out */
11169 snd_hda_codec_write_cache(codec
, 0x1b, 0,
11170 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11172 snd_hda_codec_write_cache(codec
, 0x15, 0,
11173 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11175 /* mono (speaker) depending on the HP jack sense */
11176 val
= val
&& !spec
->jack_present
;
11177 snd_hda_codec_write_cache(codec
, 0x16, 0,
11178 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11179 val
? PIN_OUT
: 0);
11182 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
11184 struct alc_spec
*spec
= codec
->spec
;
11186 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x1b);
11187 alc262_hp_master_update(codec
);
11190 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
11192 if ((res
>> 26) != ALC880_HP_EVENT
)
11194 alc262_hp_bpc_automute(codec
);
11197 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
11199 struct alc_spec
*spec
= codec
->spec
;
11201 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
11202 alc262_hp_master_update(codec
);
11205 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
11208 if ((res
>> 26) != ALC880_HP_EVENT
)
11210 alc262_hp_wildwest_automute(codec
);
11213 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11215 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
11216 struct snd_ctl_elem_value
*ucontrol
)
11218 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11219 struct alc_spec
*spec
= codec
->spec
;
11220 int val
= !!*ucontrol
->value
.integer
.value
;
11222 if (val
== spec
->master_sw
)
11224 spec
->master_sw
= val
;
11225 alc262_hp_master_update(codec
);
11229 #define ALC262_HP_MASTER_SWITCH \
11231 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11232 .name = "Master Playback Switch", \
11233 .info = snd_ctl_boolean_mono_info, \
11234 .get = alc262_hp_master_sw_get, \
11235 .put = alc262_hp_master_sw_put, \
11238 .iface = NID_MAPPING, \
11239 .name = "Master Playback Switch", \
11240 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11244 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
11245 ALC262_HP_MASTER_SWITCH
,
11246 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11247 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11248 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11249 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11251 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11255 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11256 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11257 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11258 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11259 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11260 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11261 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11262 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11263 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11264 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11268 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
11269 ALC262_HP_MASTER_SWITCH
,
11270 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11271 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11272 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11273 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11274 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11276 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11278 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11279 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11280 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT
),
11281 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11282 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11283 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11284 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11288 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
11289 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11290 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11291 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11295 /* mute/unmute internal speaker according to the hp jack and mute state */
11296 static void alc262_hp_t5735_setup(struct hda_codec
*codec
)
11298 struct alc_spec
*spec
= codec
->spec
;
11300 spec
->autocfg
.hp_pins
[0] = 0x15;
11301 spec
->autocfg
.speaker_pins
[0] = 0x14;
11304 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
11305 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11306 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11307 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11308 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11309 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11310 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11311 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11315 static struct hda_verb alc262_hp_t5735_verbs
[] = {
11316 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11323 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
11324 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11325 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11326 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
11327 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
11328 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11329 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11333 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
11334 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11335 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11336 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11337 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11338 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11339 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11342 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
11343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
11347 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
11354 /* bind hp and internal speaker mute (with plug check) as master switch */
11355 static void alc262_hippo_master_update(struct hda_codec
*codec
)
11357 struct alc_spec
*spec
= codec
->spec
;
11358 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
11359 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
11360 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
11364 mute
= spec
->master_sw
? 0 : HDA_AMP_MUTE
;
11365 snd_hda_codec_amp_stereo(codec
, hp_nid
, HDA_OUTPUT
, 0,
11366 HDA_AMP_MUTE
, mute
);
11367 /* mute internal speaker per jack sense */
11368 if (spec
->jack_present
)
11369 mute
= HDA_AMP_MUTE
;
11371 snd_hda_codec_amp_stereo(codec
, line_nid
, HDA_OUTPUT
, 0,
11372 HDA_AMP_MUTE
, mute
);
11373 if (speaker_nid
&& speaker_nid
!= line_nid
)
11374 snd_hda_codec_amp_stereo(codec
, speaker_nid
, HDA_OUTPUT
, 0,
11375 HDA_AMP_MUTE
, mute
);
11378 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11380 static int alc262_hippo_master_sw_put(struct snd_kcontrol
*kcontrol
,
11381 struct snd_ctl_elem_value
*ucontrol
)
11383 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11384 struct alc_spec
*spec
= codec
->spec
;
11385 int val
= !!*ucontrol
->value
.integer
.value
;
11387 if (val
== spec
->master_sw
)
11389 spec
->master_sw
= val
;
11390 alc262_hippo_master_update(codec
);
11394 #define ALC262_HIPPO_MASTER_SWITCH \
11396 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11397 .name = "Master Playback Switch", \
11398 .info = snd_ctl_boolean_mono_info, \
11399 .get = alc262_hippo_master_sw_get, \
11400 .put = alc262_hippo_master_sw_put, \
11403 .iface = NID_MAPPING, \
11404 .name = "Master Playback Switch", \
11405 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11406 (SUBDEV_SPEAKER(0) << 16), \
11409 static struct snd_kcontrol_new alc262_hippo_mixer
[] = {
11410 ALC262_HIPPO_MASTER_SWITCH
,
11411 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11412 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11413 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11414 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11415 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11416 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11417 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11418 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11419 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11420 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11421 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11422 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11426 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
11427 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11428 ALC262_HIPPO_MASTER_SWITCH
,
11429 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11430 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11431 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11432 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11435 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11436 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11437 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11438 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11442 /* mute/unmute internal speaker according to the hp jack and mute state */
11443 static void alc262_hippo_automute(struct hda_codec
*codec
)
11445 struct alc_spec
*spec
= codec
->spec
;
11446 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
11448 spec
->jack_present
= snd_hda_jack_detect(codec
, hp_nid
);
11449 alc262_hippo_master_update(codec
);
11452 static void alc262_hippo_unsol_event(struct hda_codec
*codec
, unsigned int res
)
11454 if ((res
>> 26) != ALC880_HP_EVENT
)
11456 alc262_hippo_automute(codec
);
11459 static void alc262_hippo_setup(struct hda_codec
*codec
)
11461 struct alc_spec
*spec
= codec
->spec
;
11463 spec
->autocfg
.hp_pins
[0] = 0x15;
11464 spec
->autocfg
.speaker_pins
[0] = 0x14;
11467 static void alc262_hippo1_setup(struct hda_codec
*codec
)
11469 struct alc_spec
*spec
= codec
->spec
;
11471 spec
->autocfg
.hp_pins
[0] = 0x1b;
11472 spec
->autocfg
.speaker_pins
[0] = 0x14;
11476 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
11477 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11478 ALC262_HIPPO_MASTER_SWITCH
,
11479 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11480 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11481 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11482 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11486 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
11487 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11488 ALC262_HIPPO_MASTER_SWITCH
,
11489 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11491 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11492 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11493 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11497 static struct snd_kcontrol_new alc262_tyan_mixer
[] = {
11498 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11499 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
11500 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11501 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11502 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11503 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11504 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11505 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11506 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11507 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11508 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11509 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11513 static struct hda_verb alc262_tyan_verbs
[] = {
11514 /* Headphone automute */
11515 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11516 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11517 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11519 /* P11 AUX_IN, white 4-pin connector */
11520 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11521 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
, 0xe1},
11522 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
, 0x93},
11523 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
, 0x19},
11528 /* unsolicited event for HP jack sensing */
11529 static void alc262_tyan_setup(struct hda_codec
*codec
)
11531 struct alc_spec
*spec
= codec
->spec
;
11533 spec
->autocfg
.hp_pins
[0] = 0x1b;
11534 spec
->autocfg
.speaker_pins
[0] = 0x15;
11538 #define alc262_capture_mixer alc882_capture_mixer
11539 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11542 * generic initialization of ADC, input mixers and output mixers
11544 static struct hda_verb alc262_init_verbs
[] = {
11546 * Unmute ADC0-2 and set the default input to mic-in
11548 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11550 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11552 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11553 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11555 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11557 * Note: PASD motherboards uses the Line In 2 as the input for
11558 * front panel mic (mic 2)
11560 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11561 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11562 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11563 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11564 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11565 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11568 * Set up output mixers (0x0c - 0x0e)
11570 /* set vol=0 to output mixers */
11571 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11572 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11573 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11574 /* set up input amps for analog loopback */
11575 /* Amp Indices: DAC = 0, mixer = 1 */
11576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11578 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11579 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11580 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11581 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11583 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11585 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11586 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11587 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11588 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11590 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11591 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11592 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11593 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11594 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11596 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11597 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11599 /* FIXME: use matrix-type input source selection */
11600 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11601 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11602 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11603 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11604 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11605 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11607 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11608 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11609 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11610 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11612 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11614 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11615 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11620 static struct hda_verb alc262_eapd_verbs
[] = {
11621 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11622 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11626 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
11627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11628 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11629 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11631 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11632 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11636 static struct hda_verb alc262_sony_unsol_verbs
[] = {
11637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11638 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11639 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
11641 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11646 static struct snd_kcontrol_new alc262_toshiba_s06_mixer
[] = {
11647 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11648 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11649 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11651 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11655 static struct hda_verb alc262_toshiba_s06_verbs
[] = {
11656 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11657 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11658 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11659 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11660 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x09},
11661 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11662 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11663 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11667 static void alc262_toshiba_s06_setup(struct hda_codec
*codec
)
11669 struct alc_spec
*spec
= codec
->spec
;
11671 spec
->autocfg
.hp_pins
[0] = 0x15;
11672 spec
->autocfg
.speaker_pins
[0] = 0x14;
11673 spec
->ext_mic
.pin
= 0x18;
11674 spec
->ext_mic
.mux_idx
= 0;
11675 spec
->int_mic
.pin
= 0x12;
11676 spec
->int_mic
.mux_idx
= 9;
11677 spec
->auto_mic
= 1;
11683 * 0x16 = internal speaker
11684 * 0x18 = external mic
11687 static struct snd_kcontrol_new alc262_nec_mixer
[] = {
11688 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
11689 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
11691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11693 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11695 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11696 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11700 static struct hda_verb alc262_nec_verbs
[] = {
11701 /* Unmute Speaker */
11702 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11705 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11706 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11708 /* External mic to headphone */
11709 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11710 /* External mic to speaker */
11711 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11717 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11718 * 0x1b = port replicator headphone out
11721 #define ALC_HP_EVENT 0x37
11723 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
11724 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11725 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11726 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11727 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11731 static struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
11732 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11733 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11737 static struct hda_verb alc262_lenovo_3000_init_verbs
[] = {
11738 /* Front Mic pin: input vref at 50% */
11739 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11740 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11744 static struct hda_input_mux alc262_fujitsu_capture_source
= {
11748 { "Internal Mic", 0x1 },
11753 static struct hda_input_mux alc262_HP_capture_source
= {
11757 { "Front Mic", 0x1 },
11764 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
11768 { "Front Mic", 0x2 },
11774 /* mute/unmute internal speaker according to the hp jacks and mute state */
11775 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
11777 struct alc_spec
*spec
= codec
->spec
;
11780 if (force
|| !spec
->sense_updated
) {
11781 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x14) ||
11782 snd_hda_jack_detect(codec
, 0x1b);
11783 spec
->sense_updated
= 1;
11785 /* unmute internal speaker only if both HPs are unplugged and
11786 * master switch is on
11788 if (spec
->jack_present
)
11789 mute
= HDA_AMP_MUTE
;
11791 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
11792 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
11793 HDA_AMP_MUTE
, mute
);
11796 /* unsolicited event for HP jack sensing */
11797 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
11800 if ((res
>> 26) != ALC_HP_EVENT
)
11802 alc262_fujitsu_automute(codec
, 1);
11805 static void alc262_fujitsu_init_hook(struct hda_codec
*codec
)
11807 alc262_fujitsu_automute(codec
, 1);
11810 /* bind volumes of both NID 0x0c and 0x0d */
11811 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
11812 .ops
= &snd_hda_bind_vol
,
11814 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
11815 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
11820 /* mute/unmute internal speaker according to the hp jack and mute state */
11821 static void alc262_lenovo_3000_automute(struct hda_codec
*codec
, int force
)
11823 struct alc_spec
*spec
= codec
->spec
;
11826 if (force
|| !spec
->sense_updated
) {
11827 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x1b);
11828 spec
->sense_updated
= 1;
11830 if (spec
->jack_present
) {
11831 /* mute internal speaker */
11832 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11833 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
11834 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
11835 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
11837 /* unmute internal speaker if necessary */
11838 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
11839 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11840 HDA_AMP_MUTE
, mute
);
11841 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
11842 HDA_AMP_MUTE
, mute
);
11846 /* unsolicited event for HP jack sensing */
11847 static void alc262_lenovo_3000_unsol_event(struct hda_codec
*codec
,
11850 if ((res
>> 26) != ALC_HP_EVENT
)
11852 alc262_lenovo_3000_automute(codec
, 1);
11855 static int amp_stereo_mute_update(struct hda_codec
*codec
, hda_nid_t nid
,
11856 int dir
, int idx
, long *valp
)
11860 for (i
= 0; i
< 2; i
++, valp
++)
11861 change
|= snd_hda_codec_amp_update(codec
, nid
, i
, dir
, idx
,
11863 *valp
? 0 : HDA_AMP_MUTE
);
11867 /* bind hp and internal speaker mute (with plug check) */
11868 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
11869 struct snd_ctl_elem_value
*ucontrol
)
11871 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11872 long *valp
= ucontrol
->value
.integer
.value
;
11875 change
= amp_stereo_mute_update(codec
, 0x14, HDA_OUTPUT
, 0, valp
);
11876 change
|= amp_stereo_mute_update(codec
, 0x1b, HDA_OUTPUT
, 0, valp
);
11878 alc262_fujitsu_automute(codec
, 0);
11882 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
11883 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11885 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11886 .name
= "Master Playback Switch",
11887 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
11888 .info
= snd_hda_mixer_amp_switch_info
,
11889 .get
= snd_hda_mixer_amp_switch_get
,
11890 .put
= alc262_fujitsu_master_sw_put
,
11891 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11894 .iface
= NID_MAPPING
,
11895 .name
= "Master Playback Switch",
11896 .private_value
= 0x1b,
11898 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11899 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11900 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11902 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11903 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11904 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11905 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11909 /* bind hp and internal speaker mute (with plug check) */
11910 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol
*kcontrol
,
11911 struct snd_ctl_elem_value
*ucontrol
)
11913 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11914 long *valp
= ucontrol
->value
.integer
.value
;
11917 change
= amp_stereo_mute_update(codec
, 0x1b, HDA_OUTPUT
, 0, valp
);
11919 alc262_lenovo_3000_automute(codec
, 0);
11923 static struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
11924 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11926 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11927 .name
= "Master Playback Switch",
11928 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
11929 .info
= snd_hda_mixer_amp_switch_info
,
11930 .get
= snd_hda_mixer_amp_switch_get
,
11931 .put
= alc262_lenovo_3000_master_sw_put
,
11932 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
11934 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11935 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11936 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11939 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11940 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11941 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11945 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer
[] = {
11946 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11947 ALC262_HIPPO_MASTER_SWITCH
,
11948 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11950 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11951 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11952 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11953 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11957 /* additional init verbs for Benq laptops */
11958 static struct hda_verb alc262_EAPD_verbs
[] = {
11959 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
11960 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
11964 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
11965 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11966 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11968 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
11969 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
11973 /* Samsung Q1 Ultra Vista model setup */
11974 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
11975 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11976 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
11977 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11978 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11979 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11980 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT
),
11984 static struct hda_verb alc262_ultra_verbs
[] = {
11986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11987 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11988 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11990 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11991 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11992 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11993 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11995 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11997 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11998 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11999 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12001 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12003 /* ADC, choose mic */
12004 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12005 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12006 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12007 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12008 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12009 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12010 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12011 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12012 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
12013 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
12017 /* mute/unmute internal speaker according to the hp jack and mute state */
12018 static void alc262_ultra_automute(struct hda_codec
*codec
)
12020 struct alc_spec
*spec
= codec
->spec
;
12024 /* auto-mute only when HP is used as HP */
12025 if (!spec
->cur_mux
[0]) {
12026 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
12027 if (spec
->jack_present
)
12028 mute
= HDA_AMP_MUTE
;
12030 /* mute/unmute internal speaker */
12031 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
12032 HDA_AMP_MUTE
, mute
);
12033 /* mute/unmute HP */
12034 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
12035 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
12038 /* unsolicited event for HP jack sensing */
12039 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
12042 if ((res
>> 26) != ALC880_HP_EVENT
)
12044 alc262_ultra_automute(codec
);
12047 static struct hda_input_mux alc262_ultra_capture_source
= {
12051 { "Headphone", 0x7 },
12055 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
12056 struct snd_ctl_elem_value
*ucontrol
)
12058 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
12059 struct alc_spec
*spec
= codec
->spec
;
12062 ret
= alc_mux_enum_put(kcontrol
, ucontrol
);
12065 /* reprogram the HP pin as mic or HP according to the input source */
12066 snd_hda_codec_write_cache(codec
, 0x15, 0,
12067 AC_VERB_SET_PIN_WIDGET_CONTROL
,
12068 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
12069 alc262_ultra_automute(codec
); /* mute/unmute HP */
12073 static struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
12074 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
12075 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
12077 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12078 .name
= "Capture Source",
12079 .info
= alc_mux_enum_info
,
12080 .get
= alc_mux_enum_get
,
12081 .put
= alc262_ultra_mux_enum_put
,
12084 .iface
= NID_MAPPING
,
12085 .name
= "Capture Source",
12086 .private_value
= 0x15,
12091 /* We use two mixers depending on the output pin; 0x16 is a mono output
12092 * and thus it's bound with a different mixer.
12093 * This function returns which mixer amp should be used.
12095 static int alc262_check_volbit(hda_nid_t nid
)
12099 else if (nid
== 0x16)
12105 static int alc262_add_out_vol_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
12106 const char *pfx
, int *vbits
, int idx
)
12111 vbit
= alc262_check_volbit(nid
);
12114 if (*vbits
& vbit
) /* a volume control for this mixer already there */
12118 val
= HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
);
12120 val
= HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
);
12121 return __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, idx
, val
);
12124 static int alc262_add_out_sw_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
12125 const char *pfx
, int idx
)
12132 val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
12134 val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
12135 return __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
, val
);
12138 /* add playback controls from the parsed DAC table */
12139 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12140 const struct auto_pin_cfg
*cfg
)
12146 spec
->multiout
.num_dacs
= 1; /* only use one dac */
12147 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
12148 spec
->multiout
.dac_nids
[0] = 2;
12150 pfx
= alc_get_line_out_pfx(cfg
, true);
12153 for (i
= 0; i
< 2; i
++) {
12154 err
= alc262_add_out_sw_ctl(spec
, cfg
->line_out_pins
[i
], pfx
, i
);
12157 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
12158 err
= alc262_add_out_sw_ctl(spec
, cfg
->speaker_pins
[i
],
12163 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
) {
12164 err
= alc262_add_out_sw_ctl(spec
, cfg
->hp_pins
[i
],
12171 vbits
= alc262_check_volbit(cfg
->line_out_pins
[0]) |
12172 alc262_check_volbit(cfg
->speaker_pins
[0]) |
12173 alc262_check_volbit(cfg
->hp_pins
[0]);
12174 if (vbits
== 1 || vbits
== 2)
12175 pfx
= "Master"; /* only one mixer is used */
12177 for (i
= 0; i
< 2; i
++) {
12178 err
= alc262_add_out_vol_ctl(spec
, cfg
->line_out_pins
[i
], pfx
,
12182 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
12183 err
= alc262_add_out_vol_ctl(spec
, cfg
->speaker_pins
[i
],
12184 "Speaker", &vbits
, i
);
12188 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
) {
12189 err
= alc262_add_out_vol_ctl(spec
, cfg
->hp_pins
[i
],
12190 "Headphone", &vbits
, i
);
12198 #define alc262_auto_create_input_ctls \
12199 alc882_auto_create_input_ctls
12202 * generic initialization of ADC, input mixers and output mixers
12204 static struct hda_verb alc262_volume_init_verbs
[] = {
12206 * Unmute ADC0-2 and set the default input to mic-in
12208 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12209 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12210 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12211 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12212 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12213 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12215 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12217 * Note: PASD motherboards uses the Line In 2 as the input for
12218 * front panel mic (mic 2)
12220 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12221 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12222 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12223 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12224 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12225 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12228 * Set up output mixers (0x0c - 0x0f)
12230 /* set vol=0 to output mixers */
12231 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12232 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12233 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12235 /* set up input amps for analog loopback */
12236 /* Amp Indices: DAC = 0, mixer = 1 */
12237 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12238 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12239 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12240 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12241 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12242 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12244 /* FIXME: use matrix-type input source selection */
12245 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12246 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12247 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12248 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12249 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12250 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12252 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12253 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12254 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12255 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12257 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12258 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12259 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12265 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
12267 * Unmute ADC0-2 and set the default input to mic-in
12269 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12270 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12271 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12273 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12274 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12276 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12278 * Note: PASD motherboards uses the Line In 2 as the input for
12279 * front panel mic (mic 2)
12281 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12291 * Set up output mixers (0x0c - 0x0e)
12293 /* set vol=0 to output mixers */
12294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12295 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12296 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12298 /* set up input amps for analog loopback */
12299 /* Amp Indices: DAC = 0, mixer = 1 */
12300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12302 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12303 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12304 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12305 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12307 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12308 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12309 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12311 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12312 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12314 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12315 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12317 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12318 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12319 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12320 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12321 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12323 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12324 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12325 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12326 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12327 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12328 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12331 /* FIXME: use matrix-type input source selection */
12332 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12333 /* Input mixer1: only unmute Mic */
12334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12339 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12340 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12342 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12344 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12350 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12351 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12352 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12355 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12356 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12357 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12358 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12359 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12360 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12361 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12364 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12369 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
12371 * Unmute ADC0-2 and set the default input to mic-in
12373 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12375 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12376 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12377 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12378 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12380 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12382 * Note: PASD motherboards uses the Line In 2 as the input for front
12383 * panel mic (mic 2)
12385 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12391 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12392 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12393 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
12395 * Set up output mixers (0x0c - 0x0e)
12397 /* set vol=0 to output mixers */
12398 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12399 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12400 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12402 /* set up input amps for analog loopback */
12403 /* Amp Indices: DAC = 0, mixer = 1 */
12404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12405 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12406 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12407 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12408 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12409 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
12413 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
12414 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
12415 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
12416 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
12417 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
12418 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
12420 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12421 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12423 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12424 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12426 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12427 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12428 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12429 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
12430 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12431 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12433 /* FIXME: use matrix-type input source selection */
12434 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12435 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12436 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
12438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
12439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
12440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
12441 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12442 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
12444 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12445 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
12446 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
12447 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
12448 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
12449 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12450 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
12452 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12453 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
12454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
12455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
12456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
12457 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
12460 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12465 static struct hda_verb alc262_toshiba_rx1_unsol_verbs
[] = {
12467 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Front Speaker */
12468 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12469 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
12471 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* MIC jack */
12472 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
12473 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
12474 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
12476 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP jack */
12477 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12478 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12489 static const struct alc_fixup alc262_fixups
[] = {
12490 [PINFIX_FSC_H270
] = {
12491 .type
= ALC_FIXUP_PINS
,
12492 .v
.pins
= (const struct alc_pincfg
[]) {
12493 { 0x14, 0x99130110 }, /* speaker */
12494 { 0x15, 0x0221142f }, /* front HP */
12495 { 0x1b, 0x0121141f }, /* rear HP */
12501 static struct snd_pci_quirk alc262_fixup_tbl
[] = {
12502 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270
),
12507 #ifdef CONFIG_SND_HDA_POWER_SAVE
12508 #define alc262_loopbacks alc880_loopbacks
12511 /* pcm configuration: identical with ALC880 */
12512 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12513 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12514 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12515 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12518 * BIOS auto configuration
12520 static int alc262_parse_auto_config(struct hda_codec
*codec
)
12522 struct alc_spec
*spec
= codec
->spec
;
12524 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
12526 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12530 if (!spec
->autocfg
.line_outs
) {
12531 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
12532 spec
->multiout
.max_channels
= 2;
12533 spec
->no_analog
= 1;
12536 return 0; /* can't find valid BIOS pin config */
12538 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12541 err
= alc262_auto_create_input_ctls(codec
, &spec
->autocfg
);
12545 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12548 alc_auto_parse_digital(codec
);
12550 if (spec
->kctls
.list
)
12551 add_mixer(spec
, spec
->kctls
.list
);
12553 add_verb(spec
, alc262_volume_init_verbs
);
12554 spec
->num_mux_defs
= 1;
12555 spec
->input_mux
= &spec
->private_imux
[0];
12557 err
= alc_auto_add_mic_boost(codec
);
12561 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
12566 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12567 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12568 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12569 #define alc262_auto_init_input_src alc882_auto_init_input_src
12572 /* init callback for auto-configuration model -- overriding the default init */
12573 static void alc262_auto_init(struct hda_codec
*codec
)
12575 struct alc_spec
*spec
= codec
->spec
;
12576 alc262_auto_init_multi_out(codec
);
12577 alc262_auto_init_hp_out(codec
);
12578 alc262_auto_init_analog_input(codec
);
12579 alc262_auto_init_input_src(codec
);
12580 alc_auto_init_digital(codec
);
12581 if (spec
->unsol_event
)
12582 alc_inithook(codec
);
12586 * configuration and preset
12588 static const char * const alc262_models
[ALC262_MODEL_LAST
] = {
12589 [ALC262_BASIC
] = "basic",
12590 [ALC262_HIPPO
] = "hippo",
12591 [ALC262_HIPPO_1
] = "hippo_1",
12592 [ALC262_FUJITSU
] = "fujitsu",
12593 [ALC262_HP_BPC
] = "hp-bpc",
12594 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
12595 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
12596 [ALC262_HP_RP5700
] = "hp-rp5700",
12597 [ALC262_BENQ_ED8
] = "benq",
12598 [ALC262_BENQ_T31
] = "benq-t31",
12599 [ALC262_SONY_ASSAMD
] = "sony-assamd",
12600 [ALC262_TOSHIBA_S06
] = "toshiba-s06",
12601 [ALC262_TOSHIBA_RX1
] = "toshiba-rx1",
12602 [ALC262_ULTRA
] = "ultra",
12603 [ALC262_LENOVO_3000
] = "lenovo-3000",
12604 [ALC262_NEC
] = "nec",
12605 [ALC262_TYAN
] = "tyan",
12606 [ALC262_AUTO
] = "auto",
12609 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
12610 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
12611 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
12612 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12614 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12616 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12618 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12620 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12621 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12622 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12623 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12624 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12625 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12626 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12627 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12628 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
12629 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
12630 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
12631 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12632 ALC262_HP_TC_T5735
),
12633 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
12634 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12635 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
12636 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12637 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO
), /* dig-only */
12638 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06
),
12639 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO
),
12640 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO
),
12641 #if 0 /* disable the quirk since model=auto works better in recent versions */
12642 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12643 ALC262_SONY_ASSAMD
),
12645 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12646 ALC262_TOSHIBA_RX1
),
12647 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06
),
12648 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
12649 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
12650 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN
),
12651 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12653 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO
),
12654 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
12655 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
12656 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
12657 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
12661 static struct alc_config_preset alc262_presets
[] = {
12663 .mixers
= { alc262_base_mixer
},
12664 .init_verbs
= { alc262_init_verbs
},
12665 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12666 .dac_nids
= alc262_dac_nids
,
12668 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12669 .channel_mode
= alc262_modes
,
12670 .input_mux
= &alc262_capture_source
,
12673 .mixers
= { alc262_hippo_mixer
},
12674 .init_verbs
= { alc262_init_verbs
, alc_hp15_unsol_verbs
},
12675 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12676 .dac_nids
= alc262_dac_nids
,
12678 .dig_out_nid
= ALC262_DIGOUT_NID
,
12679 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12680 .channel_mode
= alc262_modes
,
12681 .input_mux
= &alc262_capture_source
,
12682 .unsol_event
= alc262_hippo_unsol_event
,
12683 .setup
= alc262_hippo_setup
,
12684 .init_hook
= alc262_hippo_automute
,
12686 [ALC262_HIPPO_1
] = {
12687 .mixers
= { alc262_hippo1_mixer
},
12688 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
12689 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12690 .dac_nids
= alc262_dac_nids
,
12692 .dig_out_nid
= ALC262_DIGOUT_NID
,
12693 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12694 .channel_mode
= alc262_modes
,
12695 .input_mux
= &alc262_capture_source
,
12696 .unsol_event
= alc262_hippo_unsol_event
,
12697 .setup
= alc262_hippo1_setup
,
12698 .init_hook
= alc262_hippo_automute
,
12700 [ALC262_FUJITSU
] = {
12701 .mixers
= { alc262_fujitsu_mixer
},
12702 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12703 alc262_fujitsu_unsol_verbs
},
12704 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12705 .dac_nids
= alc262_dac_nids
,
12707 .dig_out_nid
= ALC262_DIGOUT_NID
,
12708 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12709 .channel_mode
= alc262_modes
,
12710 .input_mux
= &alc262_fujitsu_capture_source
,
12711 .unsol_event
= alc262_fujitsu_unsol_event
,
12712 .init_hook
= alc262_fujitsu_init_hook
,
12714 [ALC262_HP_BPC
] = {
12715 .mixers
= { alc262_HP_BPC_mixer
},
12716 .init_verbs
= { alc262_HP_BPC_init_verbs
},
12717 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12718 .dac_nids
= alc262_dac_nids
,
12720 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12721 .channel_mode
= alc262_modes
,
12722 .input_mux
= &alc262_HP_capture_source
,
12723 .unsol_event
= alc262_hp_bpc_unsol_event
,
12724 .init_hook
= alc262_hp_bpc_automute
,
12726 [ALC262_HP_BPC_D7000_WF
] = {
12727 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
12728 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12729 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12730 .dac_nids
= alc262_dac_nids
,
12732 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12733 .channel_mode
= alc262_modes
,
12734 .input_mux
= &alc262_HP_D7000_capture_source
,
12735 .unsol_event
= alc262_hp_wildwest_unsol_event
,
12736 .init_hook
= alc262_hp_wildwest_automute
,
12738 [ALC262_HP_BPC_D7000_WL
] = {
12739 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
12740 alc262_HP_BPC_WildWest_option_mixer
},
12741 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12742 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12743 .dac_nids
= alc262_dac_nids
,
12745 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12746 .channel_mode
= alc262_modes
,
12747 .input_mux
= &alc262_HP_D7000_capture_source
,
12748 .unsol_event
= alc262_hp_wildwest_unsol_event
,
12749 .init_hook
= alc262_hp_wildwest_automute
,
12751 [ALC262_HP_TC_T5735
] = {
12752 .mixers
= { alc262_hp_t5735_mixer
},
12753 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
12754 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12755 .dac_nids
= alc262_dac_nids
,
12757 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12758 .channel_mode
= alc262_modes
,
12759 .input_mux
= &alc262_capture_source
,
12760 .unsol_event
= alc_sku_unsol_event
,
12761 .setup
= alc262_hp_t5735_setup
,
12762 .init_hook
= alc_inithook
,
12764 [ALC262_HP_RP5700
] = {
12765 .mixers
= { alc262_hp_rp5700_mixer
},
12766 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
12767 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12768 .dac_nids
= alc262_dac_nids
,
12769 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12770 .channel_mode
= alc262_modes
,
12771 .input_mux
= &alc262_hp_rp5700_capture_source
,
12773 [ALC262_BENQ_ED8
] = {
12774 .mixers
= { alc262_base_mixer
},
12775 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
12776 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12777 .dac_nids
= alc262_dac_nids
,
12779 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12780 .channel_mode
= alc262_modes
,
12781 .input_mux
= &alc262_capture_source
,
12783 [ALC262_SONY_ASSAMD
] = {
12784 .mixers
= { alc262_sony_mixer
},
12785 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
12786 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12787 .dac_nids
= alc262_dac_nids
,
12789 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12790 .channel_mode
= alc262_modes
,
12791 .input_mux
= &alc262_capture_source
,
12792 .unsol_event
= alc262_hippo_unsol_event
,
12793 .setup
= alc262_hippo_setup
,
12794 .init_hook
= alc262_hippo_automute
,
12796 [ALC262_BENQ_T31
] = {
12797 .mixers
= { alc262_benq_t31_mixer
},
12798 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
,
12799 alc_hp15_unsol_verbs
},
12800 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12801 .dac_nids
= alc262_dac_nids
,
12803 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12804 .channel_mode
= alc262_modes
,
12805 .input_mux
= &alc262_capture_source
,
12806 .unsol_event
= alc262_hippo_unsol_event
,
12807 .setup
= alc262_hippo_setup
,
12808 .init_hook
= alc262_hippo_automute
,
12811 .mixers
= { alc262_ultra_mixer
},
12812 .cap_mixer
= alc262_ultra_capture_mixer
,
12813 .init_verbs
= { alc262_ultra_verbs
},
12814 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12815 .dac_nids
= alc262_dac_nids
,
12816 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12817 .channel_mode
= alc262_modes
,
12818 .input_mux
= &alc262_ultra_capture_source
,
12819 .adc_nids
= alc262_adc_nids
, /* ADC0 */
12820 .capsrc_nids
= alc262_capsrc_nids
,
12821 .num_adc_nids
= 1, /* single ADC */
12822 .unsol_event
= alc262_ultra_unsol_event
,
12823 .init_hook
= alc262_ultra_automute
,
12825 [ALC262_LENOVO_3000
] = {
12826 .mixers
= { alc262_lenovo_3000_mixer
},
12827 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12828 alc262_lenovo_3000_unsol_verbs
,
12829 alc262_lenovo_3000_init_verbs
},
12830 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12831 .dac_nids
= alc262_dac_nids
,
12833 .dig_out_nid
= ALC262_DIGOUT_NID
,
12834 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12835 .channel_mode
= alc262_modes
,
12836 .input_mux
= &alc262_fujitsu_capture_source
,
12837 .unsol_event
= alc262_lenovo_3000_unsol_event
,
12840 .mixers
= { alc262_nec_mixer
},
12841 .init_verbs
= { alc262_nec_verbs
},
12842 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12843 .dac_nids
= alc262_dac_nids
,
12845 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12846 .channel_mode
= alc262_modes
,
12847 .input_mux
= &alc262_capture_source
,
12849 [ALC262_TOSHIBA_S06
] = {
12850 .mixers
= { alc262_toshiba_s06_mixer
},
12851 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_s06_verbs
,
12852 alc262_eapd_verbs
},
12853 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12854 .capsrc_nids
= alc262_dmic_capsrc_nids
,
12855 .dac_nids
= alc262_dac_nids
,
12856 .adc_nids
= alc262_dmic_adc_nids
, /* ADC0 */
12857 .num_adc_nids
= 1, /* single ADC */
12858 .dig_out_nid
= ALC262_DIGOUT_NID
,
12859 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12860 .channel_mode
= alc262_modes
,
12861 .unsol_event
= alc_sku_unsol_event
,
12862 .setup
= alc262_toshiba_s06_setup
,
12863 .init_hook
= alc_inithook
,
12865 [ALC262_TOSHIBA_RX1
] = {
12866 .mixers
= { alc262_toshiba_rx1_mixer
},
12867 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_rx1_unsol_verbs
},
12868 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12869 .dac_nids
= alc262_dac_nids
,
12871 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12872 .channel_mode
= alc262_modes
,
12873 .input_mux
= &alc262_capture_source
,
12874 .unsol_event
= alc262_hippo_unsol_event
,
12875 .setup
= alc262_hippo_setup
,
12876 .init_hook
= alc262_hippo_automute
,
12879 .mixers
= { alc262_tyan_mixer
},
12880 .init_verbs
= { alc262_init_verbs
, alc262_tyan_verbs
},
12881 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12882 .dac_nids
= alc262_dac_nids
,
12884 .dig_out_nid
= ALC262_DIGOUT_NID
,
12885 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12886 .channel_mode
= alc262_modes
,
12887 .input_mux
= &alc262_capture_source
,
12888 .unsol_event
= alc_automute_amp_unsol_event
,
12889 .setup
= alc262_tyan_setup
,
12890 .init_hook
= alc_automute_amp
,
12894 static int patch_alc262(struct hda_codec
*codec
)
12896 struct alc_spec
*spec
;
12900 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12904 codec
->spec
= spec
;
12906 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12911 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
12912 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
12913 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
12914 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
12917 alc_auto_parse_customize_define(codec
);
12919 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
12921 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
12925 if (board_config
< 0) {
12926 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
12928 board_config
= ALC262_AUTO
;
12931 if (board_config
== ALC262_AUTO
) {
12932 alc_pick_fixup(codec
, NULL
, alc262_fixup_tbl
, alc262_fixups
);
12933 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
12936 if (board_config
== ALC262_AUTO
) {
12937 /* automatic parse from the BIOS config */
12938 err
= alc262_parse_auto_config(codec
);
12944 "hda_codec: Cannot set up configuration "
12945 "from BIOS. Using base mode...\n");
12946 board_config
= ALC262_BASIC
;
12950 if (!spec
->no_analog
&& has_cdefine_beep(codec
)) {
12951 err
= snd_hda_attach_beep_device(codec
, 0x1);
12958 if (board_config
!= ALC262_AUTO
)
12959 setup_preset(codec
, &alc262_presets
[board_config
]);
12961 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
12962 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
12964 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
12965 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
12967 if (!spec
->adc_nids
&& spec
->input_mux
) {
12969 /* check whether the digital-mic has to be supported */
12970 for (i
= 0; i
< spec
->input_mux
->num_items
; i
++) {
12971 if (spec
->input_mux
->items
[i
].index
>= 9)
12974 if (i
< spec
->input_mux
->num_items
) {
12975 /* use only ADC0 */
12976 spec
->adc_nids
= alc262_dmic_adc_nids
;
12977 spec
->num_adc_nids
= 1;
12978 spec
->capsrc_nids
= alc262_dmic_capsrc_nids
;
12980 /* all analog inputs */
12981 /* check whether NID 0x07 is valid */
12982 unsigned int wcap
= get_wcaps(codec
, 0x07);
12985 wcap
= get_wcaps_type(wcap
);
12986 if (wcap
!= AC_WID_AUD_IN
) {
12987 spec
->adc_nids
= alc262_adc_nids_alt
;
12988 spec
->num_adc_nids
=
12989 ARRAY_SIZE(alc262_adc_nids_alt
);
12990 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
12992 spec
->adc_nids
= alc262_adc_nids
;
12993 spec
->num_adc_nids
=
12994 ARRAY_SIZE(alc262_adc_nids
);
12995 spec
->capsrc_nids
= alc262_capsrc_nids
;
12999 if (!spec
->cap_mixer
&& !spec
->no_analog
)
13000 set_capture_mixer(codec
);
13001 if (!spec
->no_analog
&& has_cdefine_beep(codec
))
13002 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
13004 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
13006 spec
->vmaster_nid
= 0x0c;
13008 codec
->patch_ops
= alc_patch_ops
;
13009 if (board_config
== ALC262_AUTO
)
13010 spec
->init_hook
= alc262_auto_init
;
13012 alc_init_jacks(codec
);
13013 #ifdef CONFIG_SND_HDA_POWER_SAVE
13014 if (!spec
->loopback
.amplist
)
13015 spec
->loopback
.amplist
= alc262_loopbacks
;
13022 * ALC268 channel source setting (2 channel)
13024 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13025 #define alc268_modes alc260_modes
13027 static hda_nid_t alc268_dac_nids
[2] = {
13032 static hda_nid_t alc268_adc_nids
[2] = {
13037 static hda_nid_t alc268_adc_nids_alt
[1] = {
13042 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
13044 static struct snd_kcontrol_new alc268_base_mixer
[] = {
13045 /* output mixer control */
13046 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13047 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13048 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13049 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13050 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13051 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13052 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13056 static struct snd_kcontrol_new alc268_toshiba_mixer
[] = {
13057 /* output mixer control */
13058 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13059 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13060 ALC262_HIPPO_MASTER_SWITCH
,
13061 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13062 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13063 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13067 /* bind Beep switches of both NID 0x0f and 0x10 */
13068 static struct hda_bind_ctls alc268_bind_beep_sw
= {
13069 .ops
= &snd_hda_bind_sw
,
13071 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
13072 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
13077 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
13078 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
13079 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
13083 static struct hda_verb alc268_eapd_verbs
[] = {
13084 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13085 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13089 /* Toshiba specific */
13090 static struct hda_verb alc268_toshiba_verbs
[] = {
13091 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13095 /* Acer specific */
13096 /* bind volumes of both NID 0x02 and 0x03 */
13097 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
13098 .ops
= &snd_hda_bind_vol
,
13100 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
13101 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
13106 /* mute/unmute internal speaker according to the hp jack and mute state */
13107 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
13109 struct alc_spec
*spec
= codec
->spec
;
13112 if (force
|| !spec
->sense_updated
) {
13113 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x14);
13114 spec
->sense_updated
= 1;
13116 if (spec
->jack_present
)
13117 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
13118 else /* unmute internal speaker if necessary */
13119 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
13120 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
13121 HDA_AMP_MUTE
, mute
);
13125 /* bind hp and internal speaker mute (with plug check) */
13126 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
13127 struct snd_ctl_elem_value
*ucontrol
)
13129 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
13130 long *valp
= ucontrol
->value
.integer
.value
;
13133 change
= amp_stereo_mute_update(codec
, 0x14, HDA_OUTPUT
, 0, valp
);
13135 alc268_acer_automute(codec
, 0);
13139 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer
[] = {
13140 /* output mixer control */
13141 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13143 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13144 .name
= "Master Playback Switch",
13145 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
13146 .info
= snd_hda_mixer_amp_switch_info
,
13147 .get
= snd_hda_mixer_amp_switch_get
,
13148 .put
= alc268_acer_master_sw_put
,
13149 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
13151 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT
),
13155 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
13156 /* output mixer control */
13157 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13159 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13160 .name
= "Master Playback Switch",
13161 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
13162 .info
= snd_hda_mixer_amp_switch_info
,
13163 .get
= snd_hda_mixer_amp_switch_get
,
13164 .put
= alc268_acer_master_sw_put
,
13165 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
13167 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13168 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13169 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13173 static struct snd_kcontrol_new alc268_acer_dmic_mixer
[] = {
13174 /* output mixer control */
13175 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13177 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13178 .name
= "Master Playback Switch",
13179 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
13180 .info
= snd_hda_mixer_amp_switch_info
,
13181 .get
= snd_hda_mixer_amp_switch_get
,
13182 .put
= alc268_acer_master_sw_put
,
13183 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
13185 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13186 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13190 static struct hda_verb alc268_acer_aspire_one_verbs
[] = {
13191 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13192 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13193 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13194 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13195 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x06},
13196 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, 0xa017},
13200 static struct hda_verb alc268_acer_verbs
[] = {
13201 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
13202 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13203 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13204 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13205 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13206 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13207 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13211 /* unsolicited event for HP jack sensing */
13212 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13213 #define alc268_toshiba_setup alc262_hippo_setup
13214 #define alc268_toshiba_automute alc262_hippo_automute
13216 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
13219 if ((res
>> 26) != ALC880_HP_EVENT
)
13221 alc268_acer_automute(codec
, 1);
13224 static void alc268_acer_init_hook(struct hda_codec
*codec
)
13226 alc268_acer_automute(codec
, 1);
13229 /* toggle speaker-output according to the hp-jack state */
13230 static void alc268_aspire_one_speaker_automute(struct hda_codec
*codec
)
13232 unsigned int present
;
13233 unsigned char bits
;
13235 present
= snd_hda_jack_detect(codec
, 0x15);
13236 bits
= present
? HDA_AMP_MUTE
: 0;
13237 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 0,
13238 HDA_AMP_MUTE
, bits
);
13239 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 1,
13240 HDA_AMP_MUTE
, bits
);
13243 static void alc268_acer_lc_unsol_event(struct hda_codec
*codec
,
13246 switch (res
>> 26) {
13247 case ALC880_HP_EVENT
:
13248 alc268_aspire_one_speaker_automute(codec
);
13250 case ALC880_MIC_EVENT
:
13251 alc_mic_automute(codec
);
13256 static void alc268_acer_lc_setup(struct hda_codec
*codec
)
13258 struct alc_spec
*spec
= codec
->spec
;
13259 spec
->ext_mic
.pin
= 0x18;
13260 spec
->ext_mic
.mux_idx
= 0;
13261 spec
->int_mic
.pin
= 0x12;
13262 spec
->int_mic
.mux_idx
= 6;
13263 spec
->auto_mic
= 1;
13266 static void alc268_acer_lc_init_hook(struct hda_codec
*codec
)
13268 alc268_aspire_one_speaker_automute(codec
);
13269 alc_mic_automute(codec
);
13272 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
13273 /* output mixer control */
13274 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13275 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13276 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13277 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13278 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13279 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13283 static struct hda_verb alc268_dell_verbs
[] = {
13284 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13285 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13286 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13287 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
13291 /* mute/unmute internal speaker according to the hp jack and mute state */
13292 static void alc268_dell_setup(struct hda_codec
*codec
)
13294 struct alc_spec
*spec
= codec
->spec
;
13296 spec
->autocfg
.hp_pins
[0] = 0x15;
13297 spec
->autocfg
.speaker_pins
[0] = 0x14;
13298 spec
->ext_mic
.pin
= 0x18;
13299 spec
->ext_mic
.mux_idx
= 0;
13300 spec
->int_mic
.pin
= 0x19;
13301 spec
->int_mic
.mux_idx
= 1;
13302 spec
->auto_mic
= 1;
13305 static struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
13306 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13307 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13308 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13309 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13310 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13311 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
13312 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13313 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13317 static struct hda_verb alc267_quanta_il1_verbs
[] = {
13318 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13319 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
13323 static void alc267_quanta_il1_setup(struct hda_codec
*codec
)
13325 struct alc_spec
*spec
= codec
->spec
;
13326 spec
->autocfg
.hp_pins
[0] = 0x15;
13327 spec
->autocfg
.speaker_pins
[0] = 0x14;
13328 spec
->ext_mic
.pin
= 0x18;
13329 spec
->ext_mic
.mux_idx
= 0;
13330 spec
->int_mic
.pin
= 0x19;
13331 spec
->int_mic
.mux_idx
= 1;
13332 spec
->auto_mic
= 1;
13336 * generic initialization of ADC, input mixers and output mixers
13338 static struct hda_verb alc268_base_init_verbs
[] = {
13339 /* Unmute DAC0-1 and set vol = 0 */
13340 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13341 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13344 * Set up output mixers (0x0c - 0x0e)
13346 /* set vol=0 to output mixers */
13347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13348 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
13350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13351 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13353 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
13354 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
13355 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
13356 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13357 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13358 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13359 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13360 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13362 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13363 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13364 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13365 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13366 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13368 /* set PCBEEP vol = 0, mute connections */
13369 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13370 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13371 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13373 /* Unmute Selector 23h,24h and set the default input to mic-in */
13375 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
13376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13377 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
13378 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13384 * generic initialization of ADC, input mixers and output mixers
13386 static struct hda_verb alc268_volume_init_verbs
[] = {
13387 /* set output DAC */
13388 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13389 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13391 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13392 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13393 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13394 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13395 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13397 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13398 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13399 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13401 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13402 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13404 /* set PCBEEP vol = 0, mute connections */
13405 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13406 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13407 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13412 static struct snd_kcontrol_new alc268_capture_nosrc_mixer
[] = {
13413 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13414 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13418 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
13419 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13420 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13425 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
13426 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13427 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13428 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
13429 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
13434 static struct hda_input_mux alc268_capture_source
= {
13438 { "Front Mic", 0x1 },
13444 static struct hda_input_mux alc268_acer_capture_source
= {
13448 { "Internal Mic", 0x1 },
13453 static struct hda_input_mux alc268_acer_dmic_capture_source
= {
13457 { "Internal Mic", 0x6 },
13462 #ifdef CONFIG_SND_DEBUG
13463 static struct snd_kcontrol_new alc268_test_mixer
[] = {
13464 /* Volume widgets */
13465 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13466 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13467 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
13468 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
13469 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
13470 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
13471 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
13472 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
13473 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
13474 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
13475 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
13476 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
13477 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
13478 /* The below appears problematic on some hardwares */
13479 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13480 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13481 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
13482 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
13483 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
13485 /* Modes for retasking pin widgets */
13486 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
13487 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
13488 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
13489 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
13491 /* Controls for GPIO pins, assuming they are configured as outputs */
13492 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13493 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13494 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13495 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13497 /* Switches to allow the digital SPDIF output pin to be enabled.
13498 * The ALC268 does not have an SPDIF input.
13500 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13502 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13503 * this output to turn on an external amplifier.
13505 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13506 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13512 /* create input playback/capture controls for the given pin */
13513 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
13514 const char *ctlname
, int idx
)
13525 case 0x1a: /* ALC259/269 only */
13526 case 0x1b: /* ALC259/269 only */
13527 case 0x21: /* ALC269vb has this pin, too */
13531 snd_printd(KERN_WARNING
"hda_codec: "
13532 "ignoring pin 0x%x as unknown\n", nid
);
13535 if (spec
->multiout
.dac_nids
[0] != dac
&&
13536 spec
->multiout
.dac_nids
[1] != dac
) {
13537 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
13538 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
13542 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
13546 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13547 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
13549 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13550 HDA_COMPOSE_AMP_VAL(nid
, 2, idx
, HDA_OUTPUT
));
13556 /* add playback controls from the parsed DAC table */
13557 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13558 const struct auto_pin_cfg
*cfg
)
13563 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
13565 nid
= cfg
->line_out_pins
[0];
13568 if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
13572 err
= alc268_new_analog_output(spec
, nid
, name
, 0);
13577 nid
= cfg
->speaker_pins
[0];
13579 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, "Speaker",
13580 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
13584 err
= alc268_new_analog_output(spec
, nid
, "Speaker", 0);
13588 nid
= cfg
->hp_pins
[0];
13590 err
= alc268_new_analog_output(spec
, nid
, "Headphone", 0);
13595 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
13597 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, "Mono",
13598 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
));
13605 /* create playback/capture controls for input pins */
13606 static int alc268_auto_create_input_ctls(struct hda_codec
*codec
,
13607 const struct auto_pin_cfg
*cfg
)
13609 return alc_auto_create_input_ctls(codec
, cfg
, 0, 0x23, 0x24);
13612 static void alc268_auto_set_output_and_unmute(struct hda_codec
*codec
,
13613 hda_nid_t nid
, int pin_type
)
13617 alc_set_pin_output(codec
, nid
, pin_type
);
13618 if (nid
== 0x14 || nid
== 0x16)
13622 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
13625 static void alc268_auto_init_multi_out(struct hda_codec
*codec
)
13627 struct alc_spec
*spec
= codec
->spec
;
13630 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
13631 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13632 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13633 alc268_auto_set_output_and_unmute(codec
, nid
, pin_type
);
13637 static void alc268_auto_init_hp_out(struct hda_codec
*codec
)
13639 struct alc_spec
*spec
= codec
->spec
;
13643 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
13644 pin
= spec
->autocfg
.hp_pins
[i
];
13645 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
13647 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
13648 pin
= spec
->autocfg
.speaker_pins
[i
];
13649 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
13651 if (spec
->autocfg
.mono_out_pin
)
13652 snd_hda_codec_write(codec
, spec
->autocfg
.mono_out_pin
, 0,
13653 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13656 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
13658 struct alc_spec
*spec
= codec
->spec
;
13659 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
13660 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
13661 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
13662 unsigned int dac_vol1
, dac_vol2
;
13664 if (line_nid
== 0x1d || speaker_nid
== 0x1d) {
13665 snd_hda_codec_write(codec
, speaker_nid
, 0,
13666 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13667 /* mute mixer inputs from 0x1d */
13668 snd_hda_codec_write(codec
, 0x0f, 0,
13669 AC_VERB_SET_AMP_GAIN_MUTE
,
13671 snd_hda_codec_write(codec
, 0x10, 0,
13672 AC_VERB_SET_AMP_GAIN_MUTE
,
13675 /* unmute mixer inputs from 0x1d */
13676 snd_hda_codec_write(codec
, 0x0f, 0,
13677 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13678 snd_hda_codec_write(codec
, 0x10, 0,
13679 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13682 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
13683 if (line_nid
== 0x14)
13684 dac_vol2
= AMP_OUT_ZERO
;
13685 else if (line_nid
== 0x15)
13686 dac_vol1
= AMP_OUT_ZERO
;
13687 if (hp_nid
== 0x14)
13688 dac_vol2
= AMP_OUT_ZERO
;
13689 else if (hp_nid
== 0x15)
13690 dac_vol1
= AMP_OUT_ZERO
;
13691 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
13692 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
13693 spec
->autocfg
.line_out_pins
[2] != 0x16)
13694 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
13696 snd_hda_codec_write(codec
, 0x02, 0,
13697 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
13698 snd_hda_codec_write(codec
, 0x03, 0,
13699 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
13702 /* pcm configuration: identical with ALC880 */
13703 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13704 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13705 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13706 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13709 * BIOS auto configuration
13711 static int alc268_parse_auto_config(struct hda_codec
*codec
)
13713 struct alc_spec
*spec
= codec
->spec
;
13715 static hda_nid_t alc268_ignore
[] = { 0 };
13717 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13721 if (!spec
->autocfg
.line_outs
) {
13722 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
13723 spec
->multiout
.max_channels
= 2;
13724 spec
->no_analog
= 1;
13727 return 0; /* can't find valid BIOS pin config */
13729 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13732 err
= alc268_auto_create_input_ctls(codec
, &spec
->autocfg
);
13736 spec
->multiout
.max_channels
= 2;
13739 /* digital only support output */
13740 alc_auto_parse_digital(codec
);
13741 if (spec
->kctls
.list
)
13742 add_mixer(spec
, spec
->kctls
.list
);
13744 if (!spec
->no_analog
&& spec
->autocfg
.speaker_pins
[0] != 0x1d)
13745 add_mixer(spec
, alc268_beep_mixer
);
13747 add_verb(spec
, alc268_volume_init_verbs
);
13748 spec
->num_mux_defs
= 2;
13749 spec
->input_mux
= &spec
->private_imux
[0];
13751 err
= alc_auto_add_mic_boost(codec
);
13755 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
13760 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13761 #define alc268_auto_init_input_src alc882_auto_init_input_src
13763 /* init callback for auto-configuration model -- overriding the default init */
13764 static void alc268_auto_init(struct hda_codec
*codec
)
13766 struct alc_spec
*spec
= codec
->spec
;
13767 alc268_auto_init_multi_out(codec
);
13768 alc268_auto_init_hp_out(codec
);
13769 alc268_auto_init_mono_speaker_out(codec
);
13770 alc268_auto_init_analog_input(codec
);
13771 alc268_auto_init_input_src(codec
);
13772 alc_auto_init_digital(codec
);
13773 if (spec
->unsol_event
)
13774 alc_inithook(codec
);
13778 * configuration and preset
13780 static const char * const alc268_models
[ALC268_MODEL_LAST
] = {
13781 [ALC267_QUANTA_IL1
] = "quanta-il1",
13782 [ALC268_3ST
] = "3stack",
13783 [ALC268_TOSHIBA
] = "toshiba",
13784 [ALC268_ACER
] = "acer",
13785 [ALC268_ACER_DMIC
] = "acer-dmic",
13786 [ALC268_ACER_ASPIRE_ONE
] = "acer-aspire",
13787 [ALC268_DELL
] = "dell",
13788 [ALC268_ZEPTO
] = "zepto",
13789 #ifdef CONFIG_SND_DEBUG
13790 [ALC268_TEST
] = "test",
13792 [ALC268_AUTO
] = "auto",
13795 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
13796 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
13797 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
13798 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
13799 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
13800 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
13801 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13802 ALC268_ACER_ASPIRE_ONE
),
13803 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
13804 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13805 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL
),
13806 /* almost compatible with toshiba but with optional digital outs;
13807 * auto-probing seems working fine
13809 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13811 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
13812 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
13813 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
13814 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
13815 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
13819 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13820 static struct snd_pci_quirk alc268_ssid_cfg_tbl
[] = {
13821 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO
),
13822 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO
),
13823 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13828 static struct alc_config_preset alc268_presets
[] = {
13829 [ALC267_QUANTA_IL1
] = {
13830 .mixers
= { alc267_quanta_il1_mixer
, alc268_beep_mixer
,
13831 alc268_capture_nosrc_mixer
},
13832 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13833 alc267_quanta_il1_verbs
},
13834 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13835 .dac_nids
= alc268_dac_nids
,
13836 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13837 .adc_nids
= alc268_adc_nids_alt
,
13839 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13840 .channel_mode
= alc268_modes
,
13841 .unsol_event
= alc_sku_unsol_event
,
13842 .setup
= alc267_quanta_il1_setup
,
13843 .init_hook
= alc_inithook
,
13846 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
13847 alc268_beep_mixer
},
13848 .init_verbs
= { alc268_base_init_verbs
},
13849 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13850 .dac_nids
= alc268_dac_nids
,
13851 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13852 .adc_nids
= alc268_adc_nids_alt
,
13853 .capsrc_nids
= alc268_capsrc_nids
,
13855 .dig_out_nid
= ALC268_DIGOUT_NID
,
13856 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13857 .channel_mode
= alc268_modes
,
13858 .input_mux
= &alc268_capture_source
,
13860 [ALC268_TOSHIBA
] = {
13861 .mixers
= { alc268_toshiba_mixer
, alc268_capture_alt_mixer
,
13862 alc268_beep_mixer
},
13863 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13864 alc268_toshiba_verbs
},
13865 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13866 .dac_nids
= alc268_dac_nids
,
13867 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13868 .adc_nids
= alc268_adc_nids_alt
,
13869 .capsrc_nids
= alc268_capsrc_nids
,
13871 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13872 .channel_mode
= alc268_modes
,
13873 .input_mux
= &alc268_capture_source
,
13874 .unsol_event
= alc268_toshiba_unsol_event
,
13875 .setup
= alc268_toshiba_setup
,
13876 .init_hook
= alc268_toshiba_automute
,
13879 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
13880 alc268_beep_mixer
},
13881 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13882 alc268_acer_verbs
},
13883 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13884 .dac_nids
= alc268_dac_nids
,
13885 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13886 .adc_nids
= alc268_adc_nids_alt
,
13887 .capsrc_nids
= alc268_capsrc_nids
,
13889 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13890 .channel_mode
= alc268_modes
,
13891 .input_mux
= &alc268_acer_capture_source
,
13892 .unsol_event
= alc268_acer_unsol_event
,
13893 .init_hook
= alc268_acer_init_hook
,
13895 [ALC268_ACER_DMIC
] = {
13896 .mixers
= { alc268_acer_dmic_mixer
, alc268_capture_alt_mixer
,
13897 alc268_beep_mixer
},
13898 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13899 alc268_acer_verbs
},
13900 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13901 .dac_nids
= alc268_dac_nids
,
13902 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13903 .adc_nids
= alc268_adc_nids_alt
,
13904 .capsrc_nids
= alc268_capsrc_nids
,
13906 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13907 .channel_mode
= alc268_modes
,
13908 .input_mux
= &alc268_acer_dmic_capture_source
,
13909 .unsol_event
= alc268_acer_unsol_event
,
13910 .init_hook
= alc268_acer_init_hook
,
13912 [ALC268_ACER_ASPIRE_ONE
] = {
13913 .mixers
= { alc268_acer_aspire_one_mixer
,
13915 alc268_capture_nosrc_mixer
},
13916 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13917 alc268_acer_aspire_one_verbs
},
13918 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13919 .dac_nids
= alc268_dac_nids
,
13920 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13921 .adc_nids
= alc268_adc_nids_alt
,
13922 .capsrc_nids
= alc268_capsrc_nids
,
13924 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13925 .channel_mode
= alc268_modes
,
13926 .unsol_event
= alc268_acer_lc_unsol_event
,
13927 .setup
= alc268_acer_lc_setup
,
13928 .init_hook
= alc268_acer_lc_init_hook
,
13931 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
,
13932 alc268_capture_nosrc_mixer
},
13933 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13934 alc268_dell_verbs
},
13935 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13936 .dac_nids
= alc268_dac_nids
,
13937 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13938 .adc_nids
= alc268_adc_nids_alt
,
13939 .capsrc_nids
= alc268_capsrc_nids
,
13941 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13942 .channel_mode
= alc268_modes
,
13943 .unsol_event
= alc_sku_unsol_event
,
13944 .setup
= alc268_dell_setup
,
13945 .init_hook
= alc_inithook
,
13948 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
13949 alc268_beep_mixer
},
13950 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13951 alc268_toshiba_verbs
},
13952 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13953 .dac_nids
= alc268_dac_nids
,
13954 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13955 .adc_nids
= alc268_adc_nids_alt
,
13956 .capsrc_nids
= alc268_capsrc_nids
,
13958 .dig_out_nid
= ALC268_DIGOUT_NID
,
13959 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13960 .channel_mode
= alc268_modes
,
13961 .input_mux
= &alc268_capture_source
,
13962 .setup
= alc268_toshiba_setup
,
13963 .init_hook
= alc268_toshiba_automute
,
13965 #ifdef CONFIG_SND_DEBUG
13967 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
13968 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13969 alc268_volume_init_verbs
},
13970 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13971 .dac_nids
= alc268_dac_nids
,
13972 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13973 .adc_nids
= alc268_adc_nids_alt
,
13974 .capsrc_nids
= alc268_capsrc_nids
,
13976 .dig_out_nid
= ALC268_DIGOUT_NID
,
13977 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13978 .channel_mode
= alc268_modes
,
13979 .input_mux
= &alc268_capture_source
,
13984 static int patch_alc268(struct hda_codec
*codec
)
13986 struct alc_spec
*spec
;
13988 int i
, has_beep
, err
;
13990 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13994 codec
->spec
= spec
;
13996 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
14000 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
)
14001 board_config
= snd_hda_check_board_codec_sid_config(codec
,
14002 ALC268_MODEL_LAST
, alc268_models
, alc268_ssid_cfg_tbl
);
14004 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
14005 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
14007 board_config
= ALC268_AUTO
;
14010 if (board_config
== ALC268_AUTO
) {
14011 /* automatic parse from the BIOS config */
14012 err
= alc268_parse_auto_config(codec
);
14018 "hda_codec: Cannot set up configuration "
14019 "from BIOS. Using base mode...\n");
14020 board_config
= ALC268_3ST
;
14024 if (board_config
!= ALC268_AUTO
)
14025 setup_preset(codec
, &alc268_presets
[board_config
]);
14027 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
14028 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
14029 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
14031 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
14034 for (i
= 0; i
< spec
->num_mixers
; i
++) {
14035 if (spec
->mixers
[i
] == alc268_beep_mixer
) {
14042 err
= snd_hda_attach_beep_device(codec
, 0x1);
14047 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
14048 /* override the amp caps for beep generator */
14049 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
14050 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
14051 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
14052 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
14053 (0 << AC_AMPCAP_MUTE_SHIFT
));
14056 if (!spec
->no_analog
&& !spec
->adc_nids
&& spec
->input_mux
) {
14057 /* check whether NID 0x07 is valid */
14058 unsigned int wcap
= get_wcaps(codec
, 0x07);
14060 spec
->capsrc_nids
= alc268_capsrc_nids
;
14062 wcap
= get_wcaps_type(wcap
);
14063 if (spec
->auto_mic
||
14064 wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
14065 spec
->adc_nids
= alc268_adc_nids_alt
;
14066 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
14067 if (spec
->auto_mic
)
14068 fixup_automic_adc(codec
);
14069 if (spec
->auto_mic
|| spec
->input_mux
->num_items
== 1)
14070 add_mixer(spec
, alc268_capture_nosrc_mixer
);
14072 add_mixer(spec
, alc268_capture_alt_mixer
);
14074 spec
->adc_nids
= alc268_adc_nids
;
14075 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
14076 add_mixer(spec
, alc268_capture_mixer
);
14080 spec
->vmaster_nid
= 0x02;
14082 codec
->patch_ops
= alc_patch_ops
;
14083 if (board_config
== ALC268_AUTO
)
14084 spec
->init_hook
= alc268_auto_init
;
14086 alc_init_jacks(codec
);
14092 * ALC269 channel source setting (2 channel)
14094 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14096 #define alc269_dac_nids alc260_dac_nids
14098 static hda_nid_t alc269_adc_nids
[1] = {
14103 static hda_nid_t alc269_capsrc_nids
[1] = {
14107 static hda_nid_t alc269vb_adc_nids
[1] = {
14112 static hda_nid_t alc269vb_capsrc_nids
[1] = {
14116 static hda_nid_t alc269_adc_candidates
[] = {
14120 #define alc269_modes alc260_modes
14121 #define alc269_capture_source alc880_lg_lw_capture_source
14123 static struct snd_kcontrol_new alc269_base_mixer
[] = {
14124 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14125 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14126 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14127 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14130 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14131 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14132 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14133 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14134 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14135 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
14139 static struct snd_kcontrol_new alc269_quanta_fl1_mixer
[] = {
14140 /* output mixer control */
14141 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
14143 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14144 .name
= "Master Playback Switch",
14145 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
14146 .info
= snd_hda_mixer_amp_switch_info
,
14147 .get
= snd_hda_mixer_amp_switch_get
,
14148 .put
= alc268_acer_master_sw_put
,
14149 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14153 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14154 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14155 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14156 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14160 static struct snd_kcontrol_new alc269_lifebook_mixer
[] = {
14161 /* output mixer control */
14162 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
14164 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14165 .name
= "Master Playback Switch",
14166 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
14167 .info
= snd_hda_mixer_amp_switch_info
,
14168 .get
= snd_hda_mixer_amp_switch_get
,
14169 .put
= alc268_acer_master_sw_put
,
14170 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14174 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14175 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14176 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14177 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14178 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT
),
14179 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT
),
14180 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT
),
14184 static struct snd_kcontrol_new alc269_laptop_mixer
[] = {
14185 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14186 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14188 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14192 static struct snd_kcontrol_new alc269vb_laptop_mixer
[] = {
14193 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14194 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14195 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
14196 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14200 static struct snd_kcontrol_new alc269_asus_mixer
[] = {
14201 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14202 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT
),
14206 /* capture mixer elements */
14207 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer
[] = {
14208 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
14209 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
14210 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14211 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14215 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer
[] = {
14216 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
14217 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
14218 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14222 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer
[] = {
14223 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
14224 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
14225 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14226 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14230 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer
[] = {
14231 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
14232 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
14233 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14238 #define alc269_fujitsu_mixer alc269_laptop_mixer
14240 static struct hda_verb alc269_quanta_fl1_verbs
[] = {
14241 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14242 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14243 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14244 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14245 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14246 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14250 static struct hda_verb alc269_lifebook_verbs
[] = {
14251 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14252 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
14253 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14255 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14256 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14257 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14258 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14259 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14260 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14264 /* toggle speaker-output according to the hp-jack state */
14265 static void alc269_quanta_fl1_speaker_automute(struct hda_codec
*codec
)
14267 unsigned int present
;
14268 unsigned char bits
;
14270 present
= snd_hda_jack_detect(codec
, 0x15);
14271 bits
= present
? HDA_AMP_MUTE
: 0;
14272 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
14273 HDA_AMP_MUTE
, bits
);
14274 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
14275 HDA_AMP_MUTE
, bits
);
14277 snd_hda_codec_write(codec
, 0x20, 0,
14278 AC_VERB_SET_COEF_INDEX
, 0x0c);
14279 snd_hda_codec_write(codec
, 0x20, 0,
14280 AC_VERB_SET_PROC_COEF
, 0x680);
14282 snd_hda_codec_write(codec
, 0x20, 0,
14283 AC_VERB_SET_COEF_INDEX
, 0x0c);
14284 snd_hda_codec_write(codec
, 0x20, 0,
14285 AC_VERB_SET_PROC_COEF
, 0x480);
14288 /* toggle speaker-output according to the hp-jacks state */
14289 static void alc269_lifebook_speaker_automute(struct hda_codec
*codec
)
14291 unsigned int present
;
14292 unsigned char bits
;
14294 /* Check laptop headphone socket */
14295 present
= snd_hda_jack_detect(codec
, 0x15);
14297 /* Check port replicator headphone socket */
14298 present
|= snd_hda_jack_detect(codec
, 0x1a);
14300 bits
= present
? HDA_AMP_MUTE
: 0;
14301 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
14302 HDA_AMP_MUTE
, bits
);
14303 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
14304 HDA_AMP_MUTE
, bits
);
14306 snd_hda_codec_write(codec
, 0x20, 0,
14307 AC_VERB_SET_COEF_INDEX
, 0x0c);
14308 snd_hda_codec_write(codec
, 0x20, 0,
14309 AC_VERB_SET_PROC_COEF
, 0x680);
14311 snd_hda_codec_write(codec
, 0x20, 0,
14312 AC_VERB_SET_COEF_INDEX
, 0x0c);
14313 snd_hda_codec_write(codec
, 0x20, 0,
14314 AC_VERB_SET_PROC_COEF
, 0x480);
14317 static void alc269_lifebook_mic_autoswitch(struct hda_codec
*codec
)
14319 unsigned int present_laptop
;
14320 unsigned int present_dock
;
14322 present_laptop
= snd_hda_jack_detect(codec
, 0x18);
14323 present_dock
= snd_hda_jack_detect(codec
, 0x1b);
14325 /* Laptop mic port overrides dock mic port, design decision */
14327 snd_hda_codec_write(codec
, 0x23, 0,
14328 AC_VERB_SET_CONNECT_SEL
, 0x3);
14329 if (present_laptop
)
14330 snd_hda_codec_write(codec
, 0x23, 0,
14331 AC_VERB_SET_CONNECT_SEL
, 0x0);
14332 if (!present_dock
&& !present_laptop
)
14333 snd_hda_codec_write(codec
, 0x23, 0,
14334 AC_VERB_SET_CONNECT_SEL
, 0x1);
14337 static void alc269_quanta_fl1_unsol_event(struct hda_codec
*codec
,
14340 switch (res
>> 26) {
14341 case ALC880_HP_EVENT
:
14342 alc269_quanta_fl1_speaker_automute(codec
);
14344 case ALC880_MIC_EVENT
:
14345 alc_mic_automute(codec
);
14350 static void alc269_lifebook_unsol_event(struct hda_codec
*codec
,
14353 if ((res
>> 26) == ALC880_HP_EVENT
)
14354 alc269_lifebook_speaker_automute(codec
);
14355 if ((res
>> 26) == ALC880_MIC_EVENT
)
14356 alc269_lifebook_mic_autoswitch(codec
);
14359 static void alc269_quanta_fl1_setup(struct hda_codec
*codec
)
14361 struct alc_spec
*spec
= codec
->spec
;
14362 spec
->autocfg
.hp_pins
[0] = 0x15;
14363 spec
->autocfg
.speaker_pins
[0] = 0x14;
14364 spec
->ext_mic
.pin
= 0x18;
14365 spec
->ext_mic
.mux_idx
= 0;
14366 spec
->int_mic
.pin
= 0x19;
14367 spec
->int_mic
.mux_idx
= 1;
14368 spec
->auto_mic
= 1;
14371 static void alc269_quanta_fl1_init_hook(struct hda_codec
*codec
)
14373 alc269_quanta_fl1_speaker_automute(codec
);
14374 alc_mic_automute(codec
);
14377 static void alc269_lifebook_init_hook(struct hda_codec
*codec
)
14379 alc269_lifebook_speaker_automute(codec
);
14380 alc269_lifebook_mic_autoswitch(codec
);
14383 static struct hda_verb alc269_laptop_dmic_init_verbs
[] = {
14384 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14385 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
14386 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14387 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14388 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14389 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14390 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14394 static struct hda_verb alc269_laptop_amic_init_verbs
[] = {
14395 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14396 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
14397 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14398 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
14399 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14400 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14404 static struct hda_verb alc269vb_laptop_dmic_init_verbs
[] = {
14405 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
14406 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x06},
14407 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14408 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14409 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14410 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14411 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14415 static struct hda_verb alc269vb_laptop_amic_init_verbs
[] = {
14416 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
14417 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x01},
14418 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14419 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14420 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14421 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14422 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14426 static struct hda_verb alc271_acer_dmic_verbs
[] = {
14427 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0d},
14428 {0x20, AC_VERB_SET_PROC_COEF
, 0x4000},
14429 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14430 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14431 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14432 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14433 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00},
14434 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14435 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14436 {0x22, AC_VERB_SET_CONNECT_SEL
, 6},
14440 /* toggle speaker-output according to the hp-jack state */
14441 static void alc269_speaker_automute(struct hda_codec
*codec
)
14443 struct alc_spec
*spec
= codec
->spec
;
14444 unsigned int nid
= spec
->autocfg
.hp_pins
[0];
14445 unsigned int present
;
14446 unsigned char bits
;
14448 present
= snd_hda_jack_detect(codec
, nid
);
14449 bits
= present
? HDA_AMP_MUTE
: 0;
14450 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
14451 HDA_AMP_MUTE
, bits
);
14452 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
14453 HDA_AMP_MUTE
, bits
);
14454 snd_hda_input_jack_report(codec
, nid
);
14457 /* unsolicited event for HP jack sensing */
14458 static void alc269_laptop_unsol_event(struct hda_codec
*codec
,
14461 switch (res
>> 26) {
14462 case ALC880_HP_EVENT
:
14463 alc269_speaker_automute(codec
);
14465 case ALC880_MIC_EVENT
:
14466 alc_mic_automute(codec
);
14471 static void alc269_laptop_amic_setup(struct hda_codec
*codec
)
14473 struct alc_spec
*spec
= codec
->spec
;
14474 spec
->autocfg
.hp_pins
[0] = 0x15;
14475 spec
->autocfg
.speaker_pins
[0] = 0x14;
14476 spec
->ext_mic
.pin
= 0x18;
14477 spec
->ext_mic
.mux_idx
= 0;
14478 spec
->int_mic
.pin
= 0x19;
14479 spec
->int_mic
.mux_idx
= 1;
14480 spec
->auto_mic
= 1;
14483 static void alc269_laptop_dmic_setup(struct hda_codec
*codec
)
14485 struct alc_spec
*spec
= codec
->spec
;
14486 spec
->autocfg
.hp_pins
[0] = 0x15;
14487 spec
->autocfg
.speaker_pins
[0] = 0x14;
14488 spec
->ext_mic
.pin
= 0x18;
14489 spec
->ext_mic
.mux_idx
= 0;
14490 spec
->int_mic
.pin
= 0x12;
14491 spec
->int_mic
.mux_idx
= 5;
14492 spec
->auto_mic
= 1;
14495 static void alc269vb_laptop_amic_setup(struct hda_codec
*codec
)
14497 struct alc_spec
*spec
= codec
->spec
;
14498 spec
->autocfg
.hp_pins
[0] = 0x21;
14499 spec
->autocfg
.speaker_pins
[0] = 0x14;
14500 spec
->ext_mic
.pin
= 0x18;
14501 spec
->ext_mic
.mux_idx
= 0;
14502 spec
->int_mic
.pin
= 0x19;
14503 spec
->int_mic
.mux_idx
= 1;
14504 spec
->auto_mic
= 1;
14507 static void alc269vb_laptop_dmic_setup(struct hda_codec
*codec
)
14509 struct alc_spec
*spec
= codec
->spec
;
14510 spec
->autocfg
.hp_pins
[0] = 0x21;
14511 spec
->autocfg
.speaker_pins
[0] = 0x14;
14512 spec
->ext_mic
.pin
= 0x18;
14513 spec
->ext_mic
.mux_idx
= 0;
14514 spec
->int_mic
.pin
= 0x12;
14515 spec
->int_mic
.mux_idx
= 6;
14516 spec
->auto_mic
= 1;
14519 static void alc269_laptop_inithook(struct hda_codec
*codec
)
14521 alc269_speaker_automute(codec
);
14522 alc_mic_automute(codec
);
14526 * generic initialization of ADC, input mixers and output mixers
14528 static struct hda_verb alc269_init_verbs
[] = {
14530 * Unmute ADC0 and set the default input to mic-in
14532 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14535 * Set up output mixers (0x02 - 0x03)
14537 /* set vol=0 to output mixers */
14538 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14539 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14541 /* set up input amps for analog loopback */
14542 /* Amp Indices: DAC = 0, mixer = 1 */
14543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14545 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14546 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14547 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14548 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14550 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14551 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14552 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14553 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14555 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14556 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14561 /* FIXME: use Mux-type input source selection */
14562 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14563 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14564 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
14567 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14571 static struct hda_verb alc269vb_init_verbs
[] = {
14573 * Unmute ADC0 and set the default input to mic-in
14575 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14578 * Set up output mixers (0x02 - 0x03)
14580 /* set vol=0 to output mixers */
14581 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14582 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14584 /* set up input amps for analog loopback */
14585 /* Amp Indices: DAC = 0, mixer = 1 */
14586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14590 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14591 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14593 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14594 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14595 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14596 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14597 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14598 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14599 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14601 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14602 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14604 /* FIXME: use Mux-type input source selection */
14605 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14606 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14607 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x00},
14610 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14614 #define alc269_auto_create_multi_out_ctls \
14615 alc268_auto_create_multi_out_ctls
14616 #define alc269_auto_create_input_ctls \
14617 alc268_auto_create_input_ctls
14619 #ifdef CONFIG_SND_HDA_POWER_SAVE
14620 #define alc269_loopbacks alc880_loopbacks
14623 /* pcm configuration: identical with ALC880 */
14624 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14625 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14626 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14627 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14629 static struct hda_pcm_stream alc269_44k_pcm_analog_playback
= {
14633 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14634 /* NID is set in alc_build_pcms */
14636 .open
= alc880_playback_pcm_open
,
14637 .prepare
= alc880_playback_pcm_prepare
,
14638 .cleanup
= alc880_playback_pcm_cleanup
14642 static struct hda_pcm_stream alc269_44k_pcm_analog_capture
= {
14646 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14647 /* NID is set in alc_build_pcms */
14650 #ifdef CONFIG_SND_HDA_POWER_SAVE
14651 static int alc269_mic2_for_mute_led(struct hda_codec
*codec
)
14653 switch (codec
->subsystem_id
) {
14660 static int alc269_mic2_mute_check_ps(struct hda_codec
*codec
, hda_nid_t nid
)
14662 /* update mute-LED according to the speaker mute state */
14663 if (nid
== 0x01 || nid
== 0x14) {
14665 if (snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0) &
14670 /* mic2 vref pin is used for mute LED control */
14671 snd_hda_codec_update_cache(codec
, 0x19, 0,
14672 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14675 return alc_check_power_status(codec
, nid
);
14677 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14679 static int alc275_setup_dual_adc(struct hda_codec
*codec
)
14681 struct alc_spec
*spec
= codec
->spec
;
14683 if (codec
->vendor_id
!= 0x10ec0275 || !spec
->auto_mic
)
14685 if ((spec
->ext_mic
.pin
>= 0x18 && spec
->int_mic
.pin
<= 0x13) ||
14686 (spec
->ext_mic
.pin
<= 0x12 && spec
->int_mic
.pin
>= 0x18)) {
14687 if (spec
->ext_mic
.pin
<= 0x12) {
14688 spec
->private_adc_nids
[0] = 0x08;
14689 spec
->private_adc_nids
[1] = 0x11;
14690 spec
->private_capsrc_nids
[0] = 0x23;
14691 spec
->private_capsrc_nids
[1] = 0x22;
14693 spec
->private_adc_nids
[0] = 0x11;
14694 spec
->private_adc_nids
[1] = 0x08;
14695 spec
->private_capsrc_nids
[0] = 0x22;
14696 spec
->private_capsrc_nids
[1] = 0x23;
14698 spec
->adc_nids
= spec
->private_adc_nids
;
14699 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
14700 spec
->num_adc_nids
= 2;
14701 spec
->dual_adc_switch
= 1;
14702 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14703 spec
->adc_nids
[0], spec
->adc_nids
[1]);
14709 /* different alc269-variants */
14711 ALC269_TYPE_NORMAL
,
14712 ALC269_TYPE_ALC258
,
14713 ALC269_TYPE_ALC259
,
14714 ALC269_TYPE_ALC269VB
,
14715 ALC269_TYPE_ALC270
,
14716 ALC269_TYPE_ALC271X
,
14720 * BIOS auto configuration
14722 static int alc269_parse_auto_config(struct hda_codec
*codec
)
14724 struct alc_spec
*spec
= codec
->spec
;
14726 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
14728 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14733 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14736 if (spec
->codec_variant
== ALC269_TYPE_NORMAL
)
14737 err
= alc269_auto_create_input_ctls(codec
, &spec
->autocfg
);
14739 err
= alc_auto_create_input_ctls(codec
, &spec
->autocfg
, 0,
14744 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14746 alc_auto_parse_digital(codec
);
14748 if (spec
->kctls
.list
)
14749 add_mixer(spec
, spec
->kctls
.list
);
14751 if (spec
->codec_variant
!= ALC269_TYPE_NORMAL
) {
14752 add_verb(spec
, alc269vb_init_verbs
);
14753 alc_ssid_check(codec
, 0, 0x1b, 0x14, 0x21);
14755 add_verb(spec
, alc269_init_verbs
);
14756 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
14759 spec
->num_mux_defs
= 1;
14760 spec
->input_mux
= &spec
->private_imux
[0];
14762 if (!alc275_setup_dual_adc(codec
))
14763 fillup_priv_adc_nids(codec
, alc269_adc_candidates
,
14764 sizeof(alc269_adc_candidates
));
14766 err
= alc_auto_add_mic_boost(codec
);
14770 if (!spec
->cap_mixer
&& !spec
->no_analog
)
14771 set_capture_mixer(codec
);
14776 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14777 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14778 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14779 #define alc269_auto_init_input_src alc882_auto_init_input_src
14782 /* init callback for auto-configuration model -- overriding the default init */
14783 static void alc269_auto_init(struct hda_codec
*codec
)
14785 struct alc_spec
*spec
= codec
->spec
;
14786 alc269_auto_init_multi_out(codec
);
14787 alc269_auto_init_hp_out(codec
);
14788 alc269_auto_init_analog_input(codec
);
14789 if (!spec
->dual_adc_switch
)
14790 alc269_auto_init_input_src(codec
);
14791 alc_auto_init_digital(codec
);
14792 if (spec
->unsol_event
)
14793 alc_inithook(codec
);
14796 #ifdef SND_HDA_NEEDS_RESUME
14797 static void alc269_toggle_power_output(struct hda_codec
*codec
, int power_up
)
14799 int val
= alc_read_coef_idx(codec
, 0x04);
14804 alc_write_coef_idx(codec
, 0x04, val
);
14807 #ifdef CONFIG_SND_HDA_POWER_SAVE
14808 static int alc269_suspend(struct hda_codec
*codec
, pm_message_t state
)
14810 struct alc_spec
*spec
= codec
->spec
;
14812 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017)
14813 alc269_toggle_power_output(codec
, 0);
14814 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14815 alc269_toggle_power_output(codec
, 0);
14820 if (spec
&& spec
->power_hook
)
14821 spec
->power_hook(codec
);
14824 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14826 static int alc269_resume(struct hda_codec
*codec
)
14828 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14829 alc269_toggle_power_output(codec
, 0);
14833 codec
->patch_ops
.init(codec
);
14835 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017) {
14836 alc269_toggle_power_output(codec
, 1);
14840 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018)
14841 alc269_toggle_power_output(codec
, 1);
14843 snd_hda_codec_resume_amp(codec
);
14844 snd_hda_codec_resume_cache(codec
);
14845 hda_call_check_power_status(codec
, 0x01);
14848 #endif /* SND_HDA_NEEDS_RESUME */
14850 static void alc269_fixup_hweq(struct hda_codec
*codec
,
14851 const struct alc_fixup
*fix
, int action
)
14855 if (action
!= ALC_FIXUP_ACT_INIT
)
14857 coef
= alc_read_coef_idx(codec
, 0x1e);
14858 alc_write_coef_idx(codec
, 0x1e, coef
| 0x80);
14862 ALC269_FIXUP_SONY_VAIO
,
14863 ALC275_FIXUP_SONY_VAIO_GPIO2
,
14864 ALC269_FIXUP_DELL_M101Z
,
14865 ALC269_FIXUP_SKU_IGNORE
,
14866 ALC269_FIXUP_ASUS_G73JW
,
14867 ALC269_FIXUP_LENOVO_EAPD
,
14868 ALC275_FIXUP_SONY_HWEQ
,
14871 static const struct alc_fixup alc269_fixups
[] = {
14872 [ALC269_FIXUP_SONY_VAIO
] = {
14873 .type
= ALC_FIXUP_VERBS
,
14874 .v
.verbs
= (const struct hda_verb
[]) {
14875 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREFGRD
},
14879 [ALC275_FIXUP_SONY_VAIO_GPIO2
] = {
14880 .type
= ALC_FIXUP_VERBS
,
14881 .v
.verbs
= (const struct hda_verb
[]) {
14882 {0x01, AC_VERB_SET_GPIO_MASK
, 0x04},
14883 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x04},
14884 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
14888 .chain_id
= ALC269_FIXUP_SONY_VAIO
14890 [ALC269_FIXUP_DELL_M101Z
] = {
14891 .type
= ALC_FIXUP_VERBS
,
14892 .v
.verbs
= (const struct hda_verb
[]) {
14893 /* Enables internal speaker */
14894 {0x20, AC_VERB_SET_COEF_INDEX
, 13},
14895 {0x20, AC_VERB_SET_PROC_COEF
, 0x4040},
14899 [ALC269_FIXUP_SKU_IGNORE
] = {
14900 .type
= ALC_FIXUP_SKU
,
14901 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
14903 [ALC269_FIXUP_ASUS_G73JW
] = {
14904 .type
= ALC_FIXUP_PINS
,
14905 .v
.pins
= (const struct alc_pincfg
[]) {
14906 { 0x17, 0x99130111 }, /* subwoofer */
14910 [ALC269_FIXUP_LENOVO_EAPD
] = {
14911 .type
= ALC_FIXUP_VERBS
,
14912 .v
.verbs
= (const struct hda_verb
[]) {
14913 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
14917 [ALC275_FIXUP_SONY_HWEQ
] = {
14918 .type
= ALC_FIXUP_FUNC
,
14919 .v
.func
= alc269_fixup_hweq
,
14921 .chain_id
= ALC275_FIXUP_SONY_VAIO_GPIO2
14925 static struct snd_pci_quirk alc269_fixup_tbl
[] = {
14926 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2
),
14927 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ
),
14928 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ
),
14929 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO
),
14930 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z
),
14931 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE
),
14932 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE
),
14933 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE
),
14934 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE
),
14935 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE
),
14936 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW
),
14937 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD
),
14943 * configuration and preset
14945 static const char * const alc269_models
[ALC269_MODEL_LAST
] = {
14946 [ALC269_BASIC
] = "basic",
14947 [ALC269_QUANTA_FL1
] = "quanta",
14948 [ALC269_AMIC
] = "laptop-amic",
14949 [ALC269_DMIC
] = "laptop-dmic",
14950 [ALC269_FUJITSU
] = "fujitsu",
14951 [ALC269_LIFEBOOK
] = "lifebook",
14952 [ALC269_AUTO
] = "auto",
14955 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
14956 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1
),
14957 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER
),
14958 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14960 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC
),
14961 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC
),
14962 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC
),
14963 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC
),
14964 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC
),
14965 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC
),
14966 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC
),
14967 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC
),
14968 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC
),
14969 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC
),
14970 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC
),
14971 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC
),
14972 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC
),
14973 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC
),
14974 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC
),
14975 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC
),
14976 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC
),
14977 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC
),
14978 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC
),
14979 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC
),
14980 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC
),
14981 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC
),
14982 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC
),
14983 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC
),
14984 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC
),
14985 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC
),
14986 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC
),
14987 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC
),
14988 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC
),
14989 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC
),
14990 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC
),
14991 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC
),
14992 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC
),
14993 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC
),
14994 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC
),
14995 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC
),
14996 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14998 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15000 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC
),
15001 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC
),
15002 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO
),
15003 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK
),
15004 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC
),
15005 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU
),
15006 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC
),
15007 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC
),
15008 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC
),
15009 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC
),
15013 static struct alc_config_preset alc269_presets
[] = {
15015 .mixers
= { alc269_base_mixer
},
15016 .init_verbs
= { alc269_init_verbs
},
15017 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15018 .dac_nids
= alc269_dac_nids
,
15020 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15021 .channel_mode
= alc269_modes
,
15022 .input_mux
= &alc269_capture_source
,
15024 [ALC269_QUANTA_FL1
] = {
15025 .mixers
= { alc269_quanta_fl1_mixer
},
15026 .init_verbs
= { alc269_init_verbs
, alc269_quanta_fl1_verbs
},
15027 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15028 .dac_nids
= alc269_dac_nids
,
15030 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15031 .channel_mode
= alc269_modes
,
15032 .input_mux
= &alc269_capture_source
,
15033 .unsol_event
= alc269_quanta_fl1_unsol_event
,
15034 .setup
= alc269_quanta_fl1_setup
,
15035 .init_hook
= alc269_quanta_fl1_init_hook
,
15038 .mixers
= { alc269_laptop_mixer
},
15039 .cap_mixer
= alc269_laptop_analog_capture_mixer
,
15040 .init_verbs
= { alc269_init_verbs
,
15041 alc269_laptop_amic_init_verbs
},
15042 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15043 .dac_nids
= alc269_dac_nids
,
15045 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15046 .channel_mode
= alc269_modes
,
15047 .unsol_event
= alc269_laptop_unsol_event
,
15048 .setup
= alc269_laptop_amic_setup
,
15049 .init_hook
= alc269_laptop_inithook
,
15052 .mixers
= { alc269_laptop_mixer
},
15053 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
15054 .init_verbs
= { alc269_init_verbs
,
15055 alc269_laptop_dmic_init_verbs
},
15056 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15057 .dac_nids
= alc269_dac_nids
,
15059 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15060 .channel_mode
= alc269_modes
,
15061 .unsol_event
= alc269_laptop_unsol_event
,
15062 .setup
= alc269_laptop_dmic_setup
,
15063 .init_hook
= alc269_laptop_inithook
,
15065 [ALC269VB_AMIC
] = {
15066 .mixers
= { alc269vb_laptop_mixer
},
15067 .cap_mixer
= alc269vb_laptop_analog_capture_mixer
,
15068 .init_verbs
= { alc269vb_init_verbs
,
15069 alc269vb_laptop_amic_init_verbs
},
15070 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15071 .dac_nids
= alc269_dac_nids
,
15073 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15074 .channel_mode
= alc269_modes
,
15075 .unsol_event
= alc269_laptop_unsol_event
,
15076 .setup
= alc269vb_laptop_amic_setup
,
15077 .init_hook
= alc269_laptop_inithook
,
15079 [ALC269VB_DMIC
] = {
15080 .mixers
= { alc269vb_laptop_mixer
},
15081 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
15082 .init_verbs
= { alc269vb_init_verbs
,
15083 alc269vb_laptop_dmic_init_verbs
},
15084 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15085 .dac_nids
= alc269_dac_nids
,
15087 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15088 .channel_mode
= alc269_modes
,
15089 .unsol_event
= alc269_laptop_unsol_event
,
15090 .setup
= alc269vb_laptop_dmic_setup
,
15091 .init_hook
= alc269_laptop_inithook
,
15093 [ALC269_FUJITSU
] = {
15094 .mixers
= { alc269_fujitsu_mixer
},
15095 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
15096 .init_verbs
= { alc269_init_verbs
,
15097 alc269_laptop_dmic_init_verbs
},
15098 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15099 .dac_nids
= alc269_dac_nids
,
15101 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15102 .channel_mode
= alc269_modes
,
15103 .unsol_event
= alc269_laptop_unsol_event
,
15104 .setup
= alc269_laptop_dmic_setup
,
15105 .init_hook
= alc269_laptop_inithook
,
15107 [ALC269_LIFEBOOK
] = {
15108 .mixers
= { alc269_lifebook_mixer
},
15109 .init_verbs
= { alc269_init_verbs
, alc269_lifebook_verbs
},
15110 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15111 .dac_nids
= alc269_dac_nids
,
15113 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15114 .channel_mode
= alc269_modes
,
15115 .input_mux
= &alc269_capture_source
,
15116 .unsol_event
= alc269_lifebook_unsol_event
,
15117 .init_hook
= alc269_lifebook_init_hook
,
15120 .mixers
= { alc269_asus_mixer
},
15121 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
15122 .init_verbs
= { alc269_init_verbs
, alc271_acer_dmic_verbs
},
15123 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15124 .dac_nids
= alc269_dac_nids
,
15125 .adc_nids
= alc262_dmic_adc_nids
,
15126 .num_adc_nids
= ARRAY_SIZE(alc262_dmic_adc_nids
),
15127 .capsrc_nids
= alc262_dmic_capsrc_nids
,
15128 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15129 .channel_mode
= alc269_modes
,
15130 .input_mux
= &alc269_capture_source
,
15131 .dig_out_nid
= ALC880_DIGOUT_NID
,
15132 .unsol_event
= alc_sku_unsol_event
,
15133 .setup
= alc269vb_laptop_dmic_setup
,
15134 .init_hook
= alc_inithook
,
15138 static int alc269_fill_coef(struct hda_codec
*codec
)
15142 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) < 0x015) {
15143 alc_write_coef_idx(codec
, 0xf, 0x960b);
15144 alc_write_coef_idx(codec
, 0xe, 0x8817);
15147 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x016) {
15148 alc_write_coef_idx(codec
, 0xf, 0x960b);
15149 alc_write_coef_idx(codec
, 0xe, 0x8814);
15152 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017) {
15153 val
= alc_read_coef_idx(codec
, 0x04);
15154 /* Power up output pin */
15155 alc_write_coef_idx(codec
, 0x04, val
| (1<<11));
15158 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
15159 val
= alc_read_coef_idx(codec
, 0xd);
15160 if ((val
& 0x0c00) >> 10 != 0x1) {
15161 /* Capless ramp up clock control */
15162 alc_write_coef_idx(codec
, 0xd, val
| 1<<10);
15164 val
= alc_read_coef_idx(codec
, 0x17);
15165 if ((val
& 0x01c0) >> 6 != 0x4) {
15166 /* Class D power on reset */
15167 alc_write_coef_idx(codec
, 0x17, val
| 1<<7);
15173 static int patch_alc269(struct hda_codec
*codec
)
15175 struct alc_spec
*spec
;
15176 int board_config
, coef
;
15179 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
15183 codec
->spec
= spec
;
15185 alc_auto_parse_customize_define(codec
);
15187 if (codec
->vendor_id
== 0x10ec0269) {
15188 coef
= alc_read_coef_idx(codec
, 0);
15189 if ((coef
& 0x00f0) == 0x0010) {
15190 if (codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
15191 spec
->cdefine
.platform_type
== 1) {
15192 alc_codec_rename(codec
, "ALC271X");
15193 spec
->codec_variant
= ALC269_TYPE_ALC271X
;
15194 } else if ((coef
& 0xf000) == 0x1000) {
15195 spec
->codec_variant
= ALC269_TYPE_ALC270
;
15196 } else if ((coef
& 0xf000) == 0x2000) {
15197 alc_codec_rename(codec
, "ALC259");
15198 spec
->codec_variant
= ALC269_TYPE_ALC259
;
15199 } else if ((coef
& 0xf000) == 0x3000) {
15200 alc_codec_rename(codec
, "ALC258");
15201 spec
->codec_variant
= ALC269_TYPE_ALC258
;
15203 alc_codec_rename(codec
, "ALC269VB");
15204 spec
->codec_variant
= ALC269_TYPE_ALC269VB
;
15207 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
15208 alc269_fill_coef(codec
);
15211 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
15215 if (board_config
< 0) {
15216 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
15218 board_config
= ALC269_AUTO
;
15221 if (board_config
== ALC269_AUTO
) {
15222 alc_pick_fixup(codec
, NULL
, alc269_fixup_tbl
, alc269_fixups
);
15223 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
15226 if (board_config
== ALC269_AUTO
) {
15227 /* automatic parse from the BIOS config */
15228 err
= alc269_parse_auto_config(codec
);
15234 "hda_codec: Cannot set up configuration "
15235 "from BIOS. Using base mode...\n");
15236 board_config
= ALC269_BASIC
;
15240 if (has_cdefine_beep(codec
)) {
15241 err
= snd_hda_attach_beep_device(codec
, 0x1);
15248 if (board_config
!= ALC269_AUTO
)
15249 setup_preset(codec
, &alc269_presets
[board_config
]);
15251 if (board_config
== ALC269_QUANTA_FL1
) {
15252 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15253 * fix the sample rate of analog I/O to 44.1kHz
15255 spec
->stream_analog_playback
= &alc269_44k_pcm_analog_playback
;
15256 spec
->stream_analog_capture
= &alc269_44k_pcm_analog_capture
;
15257 } else if (spec
->dual_adc_switch
) {
15258 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
15259 /* switch ADC dynamically */
15260 spec
->stream_analog_capture
= &dualmic_pcm_analog_capture
;
15262 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
15263 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
15265 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
15266 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
15268 if (!spec
->adc_nids
) { /* wasn't filled automatically? use default */
15269 if (spec
->codec_variant
== ALC269_TYPE_NORMAL
) {
15270 spec
->adc_nids
= alc269_adc_nids
;
15271 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
15272 spec
->capsrc_nids
= alc269_capsrc_nids
;
15274 spec
->adc_nids
= alc269vb_adc_nids
;
15275 spec
->num_adc_nids
= ARRAY_SIZE(alc269vb_adc_nids
);
15276 spec
->capsrc_nids
= alc269vb_capsrc_nids
;
15280 if (!spec
->cap_mixer
)
15281 set_capture_mixer(codec
);
15282 if (has_cdefine_beep(codec
))
15283 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
15285 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
15287 spec
->vmaster_nid
= 0x02;
15289 codec
->patch_ops
= alc_patch_ops
;
15290 #ifdef CONFIG_SND_HDA_POWER_SAVE
15291 codec
->patch_ops
.suspend
= alc269_suspend
;
15293 #ifdef SND_HDA_NEEDS_RESUME
15294 codec
->patch_ops
.resume
= alc269_resume
;
15296 if (board_config
== ALC269_AUTO
)
15297 spec
->init_hook
= alc269_auto_init
;
15299 alc_init_jacks(codec
);
15300 #ifdef CONFIG_SND_HDA_POWER_SAVE
15301 if (!spec
->loopback
.amplist
)
15302 spec
->loopback
.amplist
= alc269_loopbacks
;
15303 if (alc269_mic2_for_mute_led(codec
))
15304 codec
->patch_ops
.check_power_status
= alc269_mic2_mute_check_ps
;
15311 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15315 * set the path ways for 2 channel output
15316 * need to set the codec line out and mic 1 pin widgets to inputs
15318 static struct hda_verb alc861_threestack_ch2_init
[] = {
15319 /* set pin widget 1Ah (line in) for input */
15320 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15321 /* set pin widget 18h (mic1/2) for input, for mic also enable
15324 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15326 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
15328 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15329 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
15335 * need to set the codec line out and mic 1 pin widgets to outputs
15337 static struct hda_verb alc861_threestack_ch6_init
[] = {
15338 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15339 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15340 /* set pin widget 18h (mic1) for output (CLFE)*/
15341 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15343 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15344 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15346 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
15348 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15349 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
15354 static struct hda_channel_mode alc861_threestack_modes
[2] = {
15355 { 2, alc861_threestack_ch2_init
},
15356 { 6, alc861_threestack_ch6_init
},
15358 /* Set mic1 as input and unmute the mixer */
15359 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
15360 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15361 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15364 /* Set mic1 as output and mute mixer */
15365 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
15366 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15367 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15371 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
15372 { 2, alc861_uniwill_m31_ch2_init
},
15373 { 4, alc861_uniwill_m31_ch4_init
},
15376 /* Set mic1 and line-in as input and unmute the mixer */
15377 static struct hda_verb alc861_asus_ch2_init
[] = {
15378 /* set pin widget 1Ah (line in) for input */
15379 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15380 /* set pin widget 18h (mic1/2) for input, for mic also enable
15383 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15385 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
15387 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15388 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
15392 /* Set mic1 nad line-in as output and mute mixer */
15393 static struct hda_verb alc861_asus_ch6_init
[] = {
15394 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15395 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15396 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15397 /* set pin widget 18h (mic1) for output (CLFE)*/
15398 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15399 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15400 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15401 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15403 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
15405 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15406 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
15411 static struct hda_channel_mode alc861_asus_modes
[2] = {
15412 { 2, alc861_asus_ch2_init
},
15413 { 6, alc861_asus_ch6_init
},
15418 static struct snd_kcontrol_new alc861_base_mixer
[] = {
15419 /* output mixer control */
15420 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15421 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15422 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15423 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15424 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
15426 /*Input mixer control */
15427 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15428 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15429 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15430 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15431 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15432 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15434 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15435 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15436 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15441 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
15442 /* output mixer control */
15443 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15444 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15445 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15446 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15447 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15449 /* Input mixer control */
15450 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15451 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15452 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15453 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15454 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15455 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15457 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15458 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15462 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15463 .name
= "Channel Mode",
15464 .info
= alc_ch_mode_info
,
15465 .get
= alc_ch_mode_get
,
15466 .put
= alc_ch_mode_put
,
15467 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
15472 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
15473 /* output mixer control */
15474 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15476 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15481 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
15482 /* output mixer control */
15483 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15484 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15485 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15486 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15487 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15489 /* Input mixer control */
15490 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15491 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15492 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15493 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15494 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15495 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15496 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15497 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15498 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15499 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15502 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15503 .name
= "Channel Mode",
15504 .info
= alc_ch_mode_info
,
15505 .get
= alc_ch_mode_get
,
15506 .put
= alc_ch_mode_put
,
15507 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
15512 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
15513 /* output mixer control */
15514 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15515 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15516 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15517 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15518 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
15520 /* Input mixer control */
15521 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
15522 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15523 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15524 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15525 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15526 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15527 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15528 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15529 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15530 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
15533 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15534 .name
= "Channel Mode",
15535 .info
= alc_ch_mode_info
,
15536 .get
= alc_ch_mode_get
,
15537 .put
= alc_ch_mode_put
,
15538 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
15543 /* additional mixer */
15544 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
15545 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15546 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15551 * generic initialization of ADC, input mixers and output mixers
15553 static struct hda_verb alc861_base_init_verbs
[] = {
15555 * Unmute ADC0 and set the default input to mic-in
15557 /* port-A for surround (rear panel) */
15558 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15559 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15560 /* port-B for mic-in (rear panel) with vref */
15561 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15562 /* port-C for line-in (rear panel) */
15563 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15564 /* port-D for Front */
15565 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15566 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15567 /* port-E for HP out (front panel) */
15568 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
15569 /* route front PCM to HP */
15570 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15571 /* port-F for mic-in (front panel) with vref */
15572 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15573 /* port-G for CLFE (rear panel) */
15574 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15575 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15576 /* port-H for side (rear panel) */
15577 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15578 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15580 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15581 /* route front mic to ADC1*/
15582 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15583 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15585 /* Unmute DAC0~3 & spdif out*/
15586 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15587 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15588 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15589 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15590 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15592 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15593 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15594 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15595 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15596 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15598 /* Unmute Stereo Mixer 15 */
15599 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15600 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15601 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15604 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15605 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15606 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15607 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15608 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15609 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15610 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15611 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15612 /* hp used DAC 3 (Front) */
15613 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15614 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15619 static struct hda_verb alc861_threestack_init_verbs
[] = {
15621 * Unmute ADC0 and set the default input to mic-in
15623 /* port-A for surround (rear panel) */
15624 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15625 /* port-B for mic-in (rear panel) with vref */
15626 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15627 /* port-C for line-in (rear panel) */
15628 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15629 /* port-D for Front */
15630 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15631 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15632 /* port-E for HP out (front panel) */
15633 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
15634 /* route front PCM to HP */
15635 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15636 /* port-F for mic-in (front panel) with vref */
15637 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15638 /* port-G for CLFE (rear panel) */
15639 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15640 /* port-H for side (rear panel) */
15641 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15643 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15644 /* route front mic to ADC1*/
15645 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15646 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15647 /* Unmute DAC0~3 & spdif out*/
15648 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15649 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15650 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15651 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15652 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15654 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15655 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15656 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15657 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15658 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15660 /* Unmute Stereo Mixer 15 */
15661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15663 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15664 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15666 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15667 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15668 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15669 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15670 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15671 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15672 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15673 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15674 /* hp used DAC 3 (Front) */
15675 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15676 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15680 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
15682 * Unmute ADC0 and set the default input to mic-in
15684 /* port-A for surround (rear panel) */
15685 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15686 /* port-B for mic-in (rear panel) with vref */
15687 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15688 /* port-C for line-in (rear panel) */
15689 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15690 /* port-D for Front */
15691 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15692 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15693 /* port-E for HP out (front panel) */
15694 /* this has to be set to VREF80 */
15695 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15696 /* route front PCM to HP */
15697 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15698 /* port-F for mic-in (front panel) with vref */
15699 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15700 /* port-G for CLFE (rear panel) */
15701 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15702 /* port-H for side (rear panel) */
15703 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15705 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15706 /* route front mic to ADC1*/
15707 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15708 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15709 /* Unmute DAC0~3 & spdif out*/
15710 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15711 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15712 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15713 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15714 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15716 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15717 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15718 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15719 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15720 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15722 /* Unmute Stereo Mixer 15 */
15723 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15724 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15725 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15726 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15728 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15729 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15730 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15731 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15732 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15733 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15734 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15735 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15736 /* hp used DAC 3 (Front) */
15737 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15738 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15742 static struct hda_verb alc861_asus_init_verbs
[] = {
15744 * Unmute ADC0 and set the default input to mic-in
15746 /* port-A for surround (rear panel)
15747 * according to codec#0 this is the HP jack
15749 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
15750 /* route front PCM to HP */
15751 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
15752 /* port-B for mic-in (rear panel) with vref */
15753 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15754 /* port-C for line-in (rear panel) */
15755 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15756 /* port-D for Front */
15757 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15758 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15759 /* port-E for HP out (front panel) */
15760 /* this has to be set to VREF80 */
15761 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15762 /* route front PCM to HP */
15763 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15764 /* port-F for mic-in (front panel) with vref */
15765 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15766 /* port-G for CLFE (rear panel) */
15767 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15768 /* port-H for side (rear panel) */
15769 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15771 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15772 /* route front mic to ADC1*/
15773 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15774 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15775 /* Unmute DAC0~3 & spdif out*/
15776 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15777 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15778 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15779 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15780 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15781 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15782 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15783 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15784 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15785 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15787 /* Unmute Stereo Mixer 15 */
15788 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15789 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15793 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15794 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15795 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15796 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15797 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15798 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15799 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15800 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15801 /* hp used DAC 3 (Front) */
15802 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15807 /* additional init verbs for ASUS laptops */
15808 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
15809 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
15810 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
15815 * generic initialization of ADC, input mixers and output mixers
15817 static struct hda_verb alc861_auto_init_verbs
[] = {
15819 * Unmute ADC0 and set the default input to mic-in
15821 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15822 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15824 /* Unmute DAC0~3 & spdif out*/
15825 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15826 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15827 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15828 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15829 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15831 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15832 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15833 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15834 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15835 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15837 /* Unmute Stereo Mixer 15 */
15838 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15839 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15840 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15841 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
15843 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15844 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15845 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15846 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15847 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15848 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15849 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15850 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15852 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15853 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15855 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15856 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15857 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15858 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15859 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15861 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
15866 static struct hda_verb alc861_toshiba_init_verbs
[] = {
15867 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15872 /* toggle speaker-output according to the hp-jack state */
15873 static void alc861_toshiba_automute(struct hda_codec
*codec
)
15875 unsigned int present
= snd_hda_jack_detect(codec
, 0x0f);
15877 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
15878 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
15879 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
15880 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
15883 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
15886 if ((res
>> 26) == ALC880_HP_EVENT
)
15887 alc861_toshiba_automute(codec
);
15890 /* pcm configuration: identical with ALC880 */
15891 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15892 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15893 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15894 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15897 #define ALC861_DIGOUT_NID 0x07
15899 static struct hda_channel_mode alc861_8ch_modes
[1] = {
15903 static hda_nid_t alc861_dac_nids
[4] = {
15904 /* front, surround, clfe, side */
15905 0x03, 0x06, 0x05, 0x04
15908 static hda_nid_t alc660_dac_nids
[3] = {
15909 /* front, clfe, surround */
15913 static hda_nid_t alc861_adc_nids
[1] = {
15918 static struct hda_input_mux alc861_capture_source
= {
15922 { "Front Mic", 0x3 },
15929 static hda_nid_t
alc861_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
15931 struct alc_spec
*spec
= codec
->spec
;
15932 hda_nid_t mix
, srcs
[5];
15935 if (snd_hda_get_connections(codec
, pin
, &mix
, 1) != 1)
15937 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
15940 for (i
= 0; i
< num
; i
++) {
15942 type
= get_wcaps_type(get_wcaps(codec
, srcs
[i
]));
15943 if (type
!= AC_WID_AUD_OUT
)
15945 for (j
= 0; j
< spec
->multiout
.num_dacs
; j
++)
15946 if (spec
->multiout
.dac_nids
[j
] == srcs
[i
])
15948 if (j
>= spec
->multiout
.num_dacs
)
15954 /* fill in the dac_nids table from the parsed pin configuration */
15955 static int alc861_auto_fill_dac_nids(struct hda_codec
*codec
,
15956 const struct auto_pin_cfg
*cfg
)
15958 struct alc_spec
*spec
= codec
->spec
;
15960 hda_nid_t nid
, dac
;
15962 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
15963 for (i
= 0; i
< cfg
->line_outs
; i
++) {
15964 nid
= cfg
->line_out_pins
[i
];
15965 dac
= alc861_look_for_dac(codec
, nid
);
15968 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
15973 static int __alc861_create_out_sw(struct hda_codec
*codec
, const char *pfx
,
15974 hda_nid_t nid
, int idx
, unsigned int chs
)
15976 return __add_pb_sw_ctrl(codec
->spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
,
15977 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
15980 #define alc861_create_out_sw(codec, pfx, nid, chs) \
15981 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
15983 /* add playback controls from the parsed DAC table */
15984 static int alc861_auto_create_multi_out_ctls(struct hda_codec
*codec
,
15985 const struct auto_pin_cfg
*cfg
)
15987 struct alc_spec
*spec
= codec
->spec
;
15988 static const char * const chname
[4] = {
15989 "Front", "Surround", NULL
/*CLFE*/, "Side"
15991 const char *pfx
= alc_get_line_out_pfx(cfg
, true);
15995 for (i
= 0; i
< cfg
->line_outs
; i
++) {
15996 nid
= spec
->multiout
.dac_nids
[i
];
15999 if (!pfx
&& i
== 2) {
16001 err
= alc861_create_out_sw(codec
, "Center", nid
, 1);
16004 err
= alc861_create_out_sw(codec
, "LFE", nid
, 2);
16008 const char *name
= pfx
;
16011 err
= __alc861_create_out_sw(codec
, name
, nid
, i
, 3);
16019 static int alc861_auto_create_hp_ctls(struct hda_codec
*codec
, hda_nid_t pin
)
16021 struct alc_spec
*spec
= codec
->spec
;
16028 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
16029 nid
= alc861_look_for_dac(codec
, pin
);
16031 err
= alc861_create_out_sw(codec
, "Headphone", nid
, 3);
16034 spec
->multiout
.hp_nid
= nid
;
16040 /* create playback/capture controls for input pins */
16041 static int alc861_auto_create_input_ctls(struct hda_codec
*codec
,
16042 const struct auto_pin_cfg
*cfg
)
16044 return alc_auto_create_input_ctls(codec
, cfg
, 0x15, 0x08, 0);
16047 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
16049 int pin_type
, hda_nid_t dac
)
16051 hda_nid_t mix
, srcs
[5];
16054 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
16056 snd_hda_codec_write(codec
, dac
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16058 if (snd_hda_get_connections(codec
, nid
, &mix
, 1) != 1)
16060 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
16063 for (i
= 0; i
< num
; i
++) {
16065 if (srcs
[i
] == dac
|| srcs
[i
] == 0x15)
16066 mute
= AMP_IN_UNMUTE(i
);
16068 mute
= AMP_IN_MUTE(i
);
16069 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16074 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
16076 struct alc_spec
*spec
= codec
->spec
;
16079 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
16080 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
16081 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
16083 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
16084 spec
->multiout
.dac_nids
[i
]);
16088 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
16090 struct alc_spec
*spec
= codec
->spec
;
16092 if (spec
->autocfg
.hp_outs
)
16093 alc861_auto_set_output_and_unmute(codec
,
16094 spec
->autocfg
.hp_pins
[0],
16096 spec
->multiout
.hp_nid
);
16097 if (spec
->autocfg
.speaker_outs
)
16098 alc861_auto_set_output_and_unmute(codec
,
16099 spec
->autocfg
.speaker_pins
[0],
16101 spec
->multiout
.dac_nids
[0]);
16104 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
16106 struct alc_spec
*spec
= codec
->spec
;
16107 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
16110 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
16111 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
16112 if (nid
>= 0x0c && nid
<= 0x11)
16113 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
16117 /* parse the BIOS configuration and set up the alc_spec */
16118 /* return 1 if successful, 0 if the proper config is not found,
16119 * or a negative error code
16121 static int alc861_parse_auto_config(struct hda_codec
*codec
)
16123 struct alc_spec
*spec
= codec
->spec
;
16125 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
16127 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
16131 if (!spec
->autocfg
.line_outs
)
16132 return 0; /* can't find valid BIOS pin config */
16134 err
= alc861_auto_fill_dac_nids(codec
, &spec
->autocfg
);
16137 err
= alc861_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
16140 err
= alc861_auto_create_hp_ctls(codec
, spec
->autocfg
.hp_pins
[0]);
16143 err
= alc861_auto_create_input_ctls(codec
, &spec
->autocfg
);
16147 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
16149 alc_auto_parse_digital(codec
);
16151 if (spec
->kctls
.list
)
16152 add_mixer(spec
, spec
->kctls
.list
);
16154 add_verb(spec
, alc861_auto_init_verbs
);
16156 spec
->num_mux_defs
= 1;
16157 spec
->input_mux
= &spec
->private_imux
[0];
16159 spec
->adc_nids
= alc861_adc_nids
;
16160 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
16161 set_capture_mixer(codec
);
16163 alc_ssid_check(codec
, 0x0e, 0x0f, 0x0b, 0);
16168 /* additional initialization for auto-configuration model */
16169 static void alc861_auto_init(struct hda_codec
*codec
)
16171 struct alc_spec
*spec
= codec
->spec
;
16172 alc861_auto_init_multi_out(codec
);
16173 alc861_auto_init_hp_out(codec
);
16174 alc861_auto_init_analog_input(codec
);
16175 alc_auto_init_digital(codec
);
16176 if (spec
->unsol_event
)
16177 alc_inithook(codec
);
16180 #ifdef CONFIG_SND_HDA_POWER_SAVE
16181 static struct hda_amp_list alc861_loopbacks
[] = {
16182 { 0x15, HDA_INPUT
, 0 },
16183 { 0x15, HDA_INPUT
, 1 },
16184 { 0x15, HDA_INPUT
, 2 },
16185 { 0x15, HDA_INPUT
, 3 },
16192 * configuration and preset
16194 static const char * const alc861_models
[ALC861_MODEL_LAST
] = {
16195 [ALC861_3ST
] = "3stack",
16196 [ALC660_3ST
] = "3stack-660",
16197 [ALC861_3ST_DIG
] = "3stack-dig",
16198 [ALC861_6ST_DIG
] = "6stack-dig",
16199 [ALC861_UNIWILL_M31
] = "uniwill-m31",
16200 [ALC861_TOSHIBA
] = "toshiba",
16201 [ALC861_ASUS
] = "asus",
16202 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
16203 [ALC861_AUTO
] = "auto",
16206 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
16207 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
16208 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
16209 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
16210 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
16211 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
16212 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
16213 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
16214 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16215 * Any other models that need this preset?
16217 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16218 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
16219 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
16220 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
16221 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
16222 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
16223 /* FIXME: the below seems conflict */
16224 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16225 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
16226 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
16230 static struct alc_config_preset alc861_presets
[] = {
16232 .mixers
= { alc861_3ST_mixer
},
16233 .init_verbs
= { alc861_threestack_init_verbs
},
16234 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16235 .dac_nids
= alc861_dac_nids
,
16236 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16237 .channel_mode
= alc861_threestack_modes
,
16239 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16240 .adc_nids
= alc861_adc_nids
,
16241 .input_mux
= &alc861_capture_source
,
16243 [ALC861_3ST_DIG
] = {
16244 .mixers
= { alc861_base_mixer
},
16245 .init_verbs
= { alc861_threestack_init_verbs
},
16246 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16247 .dac_nids
= alc861_dac_nids
,
16248 .dig_out_nid
= ALC861_DIGOUT_NID
,
16249 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16250 .channel_mode
= alc861_threestack_modes
,
16252 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16253 .adc_nids
= alc861_adc_nids
,
16254 .input_mux
= &alc861_capture_source
,
16256 [ALC861_6ST_DIG
] = {
16257 .mixers
= { alc861_base_mixer
},
16258 .init_verbs
= { alc861_base_init_verbs
},
16259 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16260 .dac_nids
= alc861_dac_nids
,
16261 .dig_out_nid
= ALC861_DIGOUT_NID
,
16262 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
16263 .channel_mode
= alc861_8ch_modes
,
16264 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16265 .adc_nids
= alc861_adc_nids
,
16266 .input_mux
= &alc861_capture_source
,
16269 .mixers
= { alc861_3ST_mixer
},
16270 .init_verbs
= { alc861_threestack_init_verbs
},
16271 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
16272 .dac_nids
= alc660_dac_nids
,
16273 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16274 .channel_mode
= alc861_threestack_modes
,
16276 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16277 .adc_nids
= alc861_adc_nids
,
16278 .input_mux
= &alc861_capture_source
,
16280 [ALC861_UNIWILL_M31
] = {
16281 .mixers
= { alc861_uniwill_m31_mixer
},
16282 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
16283 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16284 .dac_nids
= alc861_dac_nids
,
16285 .dig_out_nid
= ALC861_DIGOUT_NID
,
16286 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
16287 .channel_mode
= alc861_uniwill_m31_modes
,
16289 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16290 .adc_nids
= alc861_adc_nids
,
16291 .input_mux
= &alc861_capture_source
,
16293 [ALC861_TOSHIBA
] = {
16294 .mixers
= { alc861_toshiba_mixer
},
16295 .init_verbs
= { alc861_base_init_verbs
,
16296 alc861_toshiba_init_verbs
},
16297 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16298 .dac_nids
= alc861_dac_nids
,
16299 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
16300 .channel_mode
= alc883_3ST_2ch_modes
,
16301 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16302 .adc_nids
= alc861_adc_nids
,
16303 .input_mux
= &alc861_capture_source
,
16304 .unsol_event
= alc861_toshiba_unsol_event
,
16305 .init_hook
= alc861_toshiba_automute
,
16308 .mixers
= { alc861_asus_mixer
},
16309 .init_verbs
= { alc861_asus_init_verbs
},
16310 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16311 .dac_nids
= alc861_dac_nids
,
16312 .dig_out_nid
= ALC861_DIGOUT_NID
,
16313 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
16314 .channel_mode
= alc861_asus_modes
,
16317 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16318 .adc_nids
= alc861_adc_nids
,
16319 .input_mux
= &alc861_capture_source
,
16321 [ALC861_ASUS_LAPTOP
] = {
16322 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
16323 .init_verbs
= { alc861_asus_init_verbs
,
16324 alc861_asus_laptop_init_verbs
},
16325 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16326 .dac_nids
= alc861_dac_nids
,
16327 .dig_out_nid
= ALC861_DIGOUT_NID
,
16328 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
16329 .channel_mode
= alc883_3ST_2ch_modes
,
16331 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16332 .adc_nids
= alc861_adc_nids
,
16333 .input_mux
= &alc861_capture_source
,
16337 /* Pin config fixes */
16339 PINFIX_FSC_AMILO_PI1505
,
16342 static const struct alc_fixup alc861_fixups
[] = {
16343 [PINFIX_FSC_AMILO_PI1505
] = {
16344 .type
= ALC_FIXUP_PINS
,
16345 .v
.pins
= (const struct alc_pincfg
[]) {
16346 { 0x0b, 0x0221101f }, /* HP */
16347 { 0x0f, 0x90170310 }, /* speaker */
16353 static struct snd_pci_quirk alc861_fixup_tbl
[] = {
16354 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505
),
16358 static int patch_alc861(struct hda_codec
*codec
)
16360 struct alc_spec
*spec
;
16364 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
16368 codec
->spec
= spec
;
16370 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
16374 if (board_config
< 0) {
16375 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
16377 board_config
= ALC861_AUTO
;
16380 if (board_config
== ALC861_AUTO
) {
16381 alc_pick_fixup(codec
, NULL
, alc861_fixup_tbl
, alc861_fixups
);
16382 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
16385 if (board_config
== ALC861_AUTO
) {
16386 /* automatic parse from the BIOS config */
16387 err
= alc861_parse_auto_config(codec
);
16393 "hda_codec: Cannot set up configuration "
16394 "from BIOS. Using base mode...\n");
16395 board_config
= ALC861_3ST_DIG
;
16399 err
= snd_hda_attach_beep_device(codec
, 0x23);
16405 if (board_config
!= ALC861_AUTO
)
16406 setup_preset(codec
, &alc861_presets
[board_config
]);
16408 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
16409 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
16411 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
16412 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
16414 if (!spec
->cap_mixer
)
16415 set_capture_mixer(codec
);
16416 set_beep_amp(spec
, 0x23, 0, HDA_OUTPUT
);
16418 spec
->vmaster_nid
= 0x03;
16420 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
16422 codec
->patch_ops
= alc_patch_ops
;
16423 if (board_config
== ALC861_AUTO
) {
16424 spec
->init_hook
= alc861_auto_init
;
16425 #ifdef CONFIG_SND_HDA_POWER_SAVE
16426 spec
->power_hook
= alc_power_eapd
;
16429 #ifdef CONFIG_SND_HDA_POWER_SAVE
16430 if (!spec
->loopback
.amplist
)
16431 spec
->loopback
.amplist
= alc861_loopbacks
;
16438 * ALC861-VD support
16442 * In addition, an independent DAC
16444 #define ALC861VD_DIGOUT_NID 0x06
16446 static hda_nid_t alc861vd_dac_nids
[4] = {
16447 /* front, surr, clfe, side surr */
16448 0x02, 0x03, 0x04, 0x05
16451 /* dac_nids for ALC660vd are in a different order - according to
16452 * Realtek's driver.
16453 * This should probably result in a different mixer for 6stack models
16454 * of ALC660vd codecs, but for now there is only 3stack mixer
16455 * - and it is the same as in 861vd.
16456 * adc_nids in ALC660vd are (is) the same as in 861vd
16458 static hda_nid_t alc660vd_dac_nids
[3] = {
16459 /* front, rear, clfe, rear_surr */
16463 static hda_nid_t alc861vd_adc_nids
[1] = {
16468 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
16471 /* FIXME: should be a matrix-type input source selection */
16472 static struct hda_input_mux alc861vd_capture_source
= {
16476 { "Front Mic", 0x1 },
16482 static struct hda_input_mux alc861vd_dallas_capture_source
= {
16486 { "Internal Mic", 0x1 },
16490 static struct hda_input_mux alc861vd_hp_capture_source
= {
16493 { "Front Mic", 0x0 },
16494 { "ATAPI Mic", 0x1 },
16501 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
16508 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
16509 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
16510 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16511 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16512 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16519 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
16520 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16521 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16522 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16523 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16527 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
16528 { 6, alc861vd_6stack_ch6_init
},
16529 { 8, alc861vd_6stack_ch8_init
},
16532 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
16534 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
16535 .name
= "Channel Mode",
16536 .info
= alc_ch_mode_info
,
16537 .get
= alc_ch_mode_get
,
16538 .put
= alc_ch_mode_put
,
16543 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16544 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16546 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
16547 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16548 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16550 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16551 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
16553 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16555 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16557 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
16558 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
16560 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
16561 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
16563 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16565 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16567 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16569 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16570 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16571 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16573 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16574 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16576 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16577 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16582 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
16583 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16584 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16586 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16588 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16589 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16590 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16592 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16593 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16594 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16596 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16597 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16599 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16600 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16605 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
16606 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16607 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16608 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
16610 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16612 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16613 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16614 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16616 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16617 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16618 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16620 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16621 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16626 /* Pin assignment: Speaker=0x14, HP = 0x15,
16627 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16629 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
16630 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16631 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
16632 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16633 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
16634 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16637 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16638 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16639 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16643 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16644 * Front Mic=0x18, ATAPI Mic = 0x19,
16646 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
16647 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16648 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16649 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16650 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
16651 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16653 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16654 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16660 * generic initialization of ADC, input mixers and output mixers
16662 static struct hda_verb alc861vd_volume_init_verbs
[] = {
16664 * Unmute ADC0 and set the default input to mic-in
16666 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16667 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16669 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16670 * the analog-loopback mixer widget
16672 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16673 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16674 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16675 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16676 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16677 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16679 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
16683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
16686 * Set up output mixers (0x02 - 0x05)
16688 /* set vol=0 to output mixers */
16689 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16690 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16691 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16692 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16694 /* set up input amps for analog loopback */
16695 /* Amp Indices: DAC = 0, mixer = 1 */
16696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16697 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16698 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16699 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16700 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16701 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16702 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16703 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16709 * 3-stack pin configuration:
16710 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16712 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
16714 * Set pin mode and muting
16716 /* set front pin widgets 0x14 for output */
16717 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16718 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16719 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
16721 /* Mic (rear) pin: input vref at 80% */
16722 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16723 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16724 /* Front Mic pin: input vref at 80% */
16725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16726 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16727 /* Line In pin: input */
16728 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16729 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16730 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16731 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16732 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16733 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16734 /* CD pin widget for input */
16735 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16741 * 6-stack pin configuration:
16743 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
16745 * Set pin mode and muting
16747 /* set front pin widgets 0x14 for output */
16748 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16749 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16750 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
16752 /* Rear Pin: output 1 (0x0d) */
16753 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16754 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16755 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
16756 /* CLFE Pin: output 2 (0x0e) */
16757 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16758 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16759 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
16760 /* Side Pin: output 3 (0x0f) */
16761 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16762 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16763 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
16765 /* Mic (rear) pin: input vref at 80% */
16766 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16767 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16768 /* Front Mic pin: input vref at 80% */
16769 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16770 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16771 /* Line In pin: input */
16772 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16773 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16774 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16775 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16776 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16777 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16778 /* CD pin widget for input */
16779 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16784 static struct hda_verb alc861vd_eapd_verbs
[] = {
16785 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16789 static struct hda_verb alc660vd_eapd_verbs
[] = {
16790 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16791 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16795 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
16796 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
16799 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16800 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16804 static void alc861vd_lenovo_setup(struct hda_codec
*codec
)
16806 struct alc_spec
*spec
= codec
->spec
;
16807 spec
->autocfg
.hp_pins
[0] = 0x1b;
16808 spec
->autocfg
.speaker_pins
[0] = 0x14;
16811 static void alc861vd_lenovo_init_hook(struct hda_codec
*codec
)
16813 alc_automute_amp(codec
);
16814 alc88x_simple_mic_automute(codec
);
16817 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
16820 switch (res
>> 26) {
16821 case ALC880_MIC_EVENT
:
16822 alc88x_simple_mic_automute(codec
);
16825 alc_automute_amp_unsol_event(codec
, res
);
16830 static struct hda_verb alc861vd_dallas_verbs
[] = {
16831 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16832 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16833 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16834 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16836 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16838 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16839 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16840 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16841 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16842 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16843 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16848 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16849 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16850 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16851 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16852 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16854 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16855 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16856 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16857 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16858 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16859 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16860 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16861 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16863 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16864 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16865 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16866 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16868 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16869 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16870 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16875 /* toggle speaker-output according to the hp-jack state */
16876 static void alc861vd_dallas_setup(struct hda_codec
*codec
)
16878 struct alc_spec
*spec
= codec
->spec
;
16880 spec
->autocfg
.hp_pins
[0] = 0x15;
16881 spec
->autocfg
.speaker_pins
[0] = 0x14;
16884 #ifdef CONFIG_SND_HDA_POWER_SAVE
16885 #define alc861vd_loopbacks alc880_loopbacks
16888 /* pcm configuration: identical with ALC880 */
16889 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16890 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16891 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16892 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16895 * configuration and preset
16897 static const char * const alc861vd_models
[ALC861VD_MODEL_LAST
] = {
16898 [ALC660VD_3ST
] = "3stack-660",
16899 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
16900 [ALC660VD_ASUS_V1S
] = "asus-v1s",
16901 [ALC861VD_3ST
] = "3stack",
16902 [ALC861VD_3ST_DIG
] = "3stack-digout",
16903 [ALC861VD_6ST_DIG
] = "6stack-digout",
16904 [ALC861VD_LENOVO
] = "lenovo",
16905 [ALC861VD_DALLAS
] = "dallas",
16906 [ALC861VD_HP
] = "hp",
16907 [ALC861VD_AUTO
] = "auto",
16910 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
16911 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
16912 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
16913 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
16914 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16915 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S
),
16916 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
16917 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
16918 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
16919 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16920 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO
),
16921 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
16922 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
16923 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
16924 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO
),
16925 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
16929 static struct alc_config_preset alc861vd_presets
[] = {
16931 .mixers
= { alc861vd_3st_mixer
},
16932 .init_verbs
= { alc861vd_volume_init_verbs
,
16933 alc861vd_3stack_init_verbs
},
16934 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16935 .dac_nids
= alc660vd_dac_nids
,
16936 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16937 .channel_mode
= alc861vd_3stack_2ch_modes
,
16938 .input_mux
= &alc861vd_capture_source
,
16940 [ALC660VD_3ST_DIG
] = {
16941 .mixers
= { alc861vd_3st_mixer
},
16942 .init_verbs
= { alc861vd_volume_init_verbs
,
16943 alc861vd_3stack_init_verbs
},
16944 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16945 .dac_nids
= alc660vd_dac_nids
,
16946 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16947 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16948 .channel_mode
= alc861vd_3stack_2ch_modes
,
16949 .input_mux
= &alc861vd_capture_source
,
16952 .mixers
= { alc861vd_3st_mixer
},
16953 .init_verbs
= { alc861vd_volume_init_verbs
,
16954 alc861vd_3stack_init_verbs
},
16955 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16956 .dac_nids
= alc861vd_dac_nids
,
16957 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16958 .channel_mode
= alc861vd_3stack_2ch_modes
,
16959 .input_mux
= &alc861vd_capture_source
,
16961 [ALC861VD_3ST_DIG
] = {
16962 .mixers
= { alc861vd_3st_mixer
},
16963 .init_verbs
= { alc861vd_volume_init_verbs
,
16964 alc861vd_3stack_init_verbs
},
16965 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16966 .dac_nids
= alc861vd_dac_nids
,
16967 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16968 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16969 .channel_mode
= alc861vd_3stack_2ch_modes
,
16970 .input_mux
= &alc861vd_capture_source
,
16972 [ALC861VD_6ST_DIG
] = {
16973 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
16974 .init_verbs
= { alc861vd_volume_init_verbs
,
16975 alc861vd_6stack_init_verbs
},
16976 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16977 .dac_nids
= alc861vd_dac_nids
,
16978 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16979 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
16980 .channel_mode
= alc861vd_6stack_modes
,
16981 .input_mux
= &alc861vd_capture_source
,
16983 [ALC861VD_LENOVO
] = {
16984 .mixers
= { alc861vd_lenovo_mixer
},
16985 .init_verbs
= { alc861vd_volume_init_verbs
,
16986 alc861vd_3stack_init_verbs
,
16987 alc861vd_eapd_verbs
,
16988 alc861vd_lenovo_unsol_verbs
},
16989 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16990 .dac_nids
= alc660vd_dac_nids
,
16991 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16992 .channel_mode
= alc861vd_3stack_2ch_modes
,
16993 .input_mux
= &alc861vd_capture_source
,
16994 .unsol_event
= alc861vd_lenovo_unsol_event
,
16995 .setup
= alc861vd_lenovo_setup
,
16996 .init_hook
= alc861vd_lenovo_init_hook
,
16998 [ALC861VD_DALLAS
] = {
16999 .mixers
= { alc861vd_dallas_mixer
},
17000 .init_verbs
= { alc861vd_dallas_verbs
},
17001 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17002 .dac_nids
= alc861vd_dac_nids
,
17003 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17004 .channel_mode
= alc861vd_3stack_2ch_modes
,
17005 .input_mux
= &alc861vd_dallas_capture_source
,
17006 .unsol_event
= alc_automute_amp_unsol_event
,
17007 .setup
= alc861vd_dallas_setup
,
17008 .init_hook
= alc_automute_amp
,
17011 .mixers
= { alc861vd_hp_mixer
},
17012 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
17013 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17014 .dac_nids
= alc861vd_dac_nids
,
17015 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17016 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17017 .channel_mode
= alc861vd_3stack_2ch_modes
,
17018 .input_mux
= &alc861vd_hp_capture_source
,
17019 .unsol_event
= alc_automute_amp_unsol_event
,
17020 .setup
= alc861vd_dallas_setup
,
17021 .init_hook
= alc_automute_amp
,
17023 [ALC660VD_ASUS_V1S
] = {
17024 .mixers
= { alc861vd_lenovo_mixer
},
17025 .init_verbs
= { alc861vd_volume_init_verbs
,
17026 alc861vd_3stack_init_verbs
,
17027 alc861vd_eapd_verbs
,
17028 alc861vd_lenovo_unsol_verbs
},
17029 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
17030 .dac_nids
= alc660vd_dac_nids
,
17031 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17032 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17033 .channel_mode
= alc861vd_3stack_2ch_modes
,
17034 .input_mux
= &alc861vd_capture_source
,
17035 .unsol_event
= alc861vd_lenovo_unsol_event
,
17036 .setup
= alc861vd_lenovo_setup
,
17037 .init_hook
= alc861vd_lenovo_init_hook
,
17042 * BIOS auto configuration
17044 static int alc861vd_auto_create_input_ctls(struct hda_codec
*codec
,
17045 const struct auto_pin_cfg
*cfg
)
17047 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x22, 0);
17051 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
17052 hda_nid_t nid
, int pin_type
, int dac_idx
)
17054 alc_set_pin_output(codec
, nid
, pin_type
);
17057 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
17059 struct alc_spec
*spec
= codec
->spec
;
17062 for (i
= 0; i
<= HDA_SIDE
; i
++) {
17063 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
17064 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
17066 alc861vd_auto_set_output_and_unmute(codec
, nid
,
17072 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
17074 struct alc_spec
*spec
= codec
->spec
;
17077 pin
= spec
->autocfg
.hp_pins
[0];
17078 if (pin
) /* connect to front and use dac 0 */
17079 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
17080 pin
= spec
->autocfg
.speaker_pins
[0];
17082 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
17085 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17087 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
17089 struct alc_spec
*spec
= codec
->spec
;
17090 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
17093 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
17094 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
17095 if (alc_is_input_pin(codec
, nid
)) {
17096 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
17097 if (nid
!= ALC861VD_PIN_CD_NID
&&
17098 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
17099 snd_hda_codec_write(codec
, nid
, 0,
17100 AC_VERB_SET_AMP_GAIN_MUTE
,
17106 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17108 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17109 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17111 /* add playback controls from the parsed DAC table */
17112 /* Based on ALC880 version. But ALC861VD has separate,
17113 * different NIDs for mute/unmute switch and volume control */
17114 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
17115 const struct auto_pin_cfg
*cfg
)
17117 static const char * const chname
[4] = {
17118 "Front", "Surround", "CLFE", "Side"
17120 const char *pfx
= alc_get_line_out_pfx(cfg
, true);
17121 hda_nid_t nid_v
, nid_s
;
17124 for (i
= 0; i
< cfg
->line_outs
; i
++) {
17125 if (!spec
->multiout
.dac_nids
[i
])
17127 nid_v
= alc861vd_idx_to_mixer_vol(
17129 spec
->multiout
.dac_nids
[i
]));
17130 nid_s
= alc861vd_idx_to_mixer_switch(
17132 spec
->multiout
.dac_nids
[i
]));
17134 if (!pfx
&& i
== 2) {
17136 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17138 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
17142 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17144 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
17148 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17150 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
17154 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17156 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
17161 const char *name
= pfx
;
17164 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17166 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
17170 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17172 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
17181 /* add playback controls for speaker and HP outputs */
17182 /* Based on ALC880 version. But ALC861VD has separate,
17183 * different NIDs for mute/unmute switch and volume control */
17184 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
17185 hda_nid_t pin
, const char *pfx
)
17187 hda_nid_t nid_v
, nid_s
;
17193 if (alc880_is_fixed_pin(pin
)) {
17194 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
17195 /* specify the DAC as the extra output */
17196 if (!spec
->multiout
.hp_nid
)
17197 spec
->multiout
.hp_nid
= nid_v
;
17199 spec
->multiout
.extra_out_nid
[0] = nid_v
;
17200 /* control HP volume/switch on the output mixer amp */
17201 nid_v
= alc861vd_idx_to_mixer_vol(
17202 alc880_fixed_pin_idx(pin
));
17203 nid_s
= alc861vd_idx_to_mixer_switch(
17204 alc880_fixed_pin_idx(pin
));
17206 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
17207 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
17210 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
17211 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
17214 } else if (alc880_is_multi_pin(pin
)) {
17215 /* set manual connection */
17216 /* we have only a switch on HP-out PIN */
17217 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
17218 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
17225 /* parse the BIOS configuration and set up the alc_spec
17226 * return 1 if successful, 0 if the proper config is not found,
17227 * or a negative error code
17228 * Based on ALC880 version - had to change it to override
17229 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17230 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
17232 struct alc_spec
*spec
= codec
->spec
;
17234 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
17236 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
17240 if (!spec
->autocfg
.line_outs
)
17241 return 0; /* can't find valid BIOS pin config */
17243 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
17246 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
17249 err
= alc861vd_auto_create_extra_out(spec
,
17250 spec
->autocfg
.speaker_pins
[0],
17254 err
= alc861vd_auto_create_extra_out(spec
,
17255 spec
->autocfg
.hp_pins
[0],
17259 err
= alc861vd_auto_create_input_ctls(codec
, &spec
->autocfg
);
17263 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
17265 alc_auto_parse_digital(codec
);
17267 if (spec
->kctls
.list
)
17268 add_mixer(spec
, spec
->kctls
.list
);
17270 add_verb(spec
, alc861vd_volume_init_verbs
);
17272 spec
->num_mux_defs
= 1;
17273 spec
->input_mux
= &spec
->private_imux
[0];
17275 err
= alc_auto_add_mic_boost(codec
);
17279 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
17284 /* additional initialization for auto-configuration model */
17285 static void alc861vd_auto_init(struct hda_codec
*codec
)
17287 struct alc_spec
*spec
= codec
->spec
;
17288 alc861vd_auto_init_multi_out(codec
);
17289 alc861vd_auto_init_hp_out(codec
);
17290 alc861vd_auto_init_analog_input(codec
);
17291 alc861vd_auto_init_input_src(codec
);
17292 alc_auto_init_digital(codec
);
17293 if (spec
->unsol_event
)
17294 alc_inithook(codec
);
17298 ALC660VD_FIX_ASUS_GPIO1
17302 static const struct alc_fixup alc861vd_fixups
[] = {
17303 [ALC660VD_FIX_ASUS_GPIO1
] = {
17304 .type
= ALC_FIXUP_VERBS
,
17305 .v
.verbs
= (const struct hda_verb
[]) {
17306 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
17307 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
17308 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
17314 static struct snd_pci_quirk alc861vd_fixup_tbl
[] = {
17315 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1
),
17319 static int patch_alc861vd(struct hda_codec
*codec
)
17321 struct alc_spec
*spec
;
17322 int err
, board_config
;
17324 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
17328 codec
->spec
= spec
;
17330 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
17334 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
17335 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
17337 board_config
= ALC861VD_AUTO
;
17340 if (board_config
== ALC861VD_AUTO
) {
17341 alc_pick_fixup(codec
, NULL
, alc861vd_fixup_tbl
, alc861vd_fixups
);
17342 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
17345 if (board_config
== ALC861VD_AUTO
) {
17346 /* automatic parse from the BIOS config */
17347 err
= alc861vd_parse_auto_config(codec
);
17353 "hda_codec: Cannot set up configuration "
17354 "from BIOS. Using base mode...\n");
17355 board_config
= ALC861VD_3ST
;
17359 err
= snd_hda_attach_beep_device(codec
, 0x23);
17365 if (board_config
!= ALC861VD_AUTO
)
17366 setup_preset(codec
, &alc861vd_presets
[board_config
]);
17368 if (codec
->vendor_id
== 0x10ec0660) {
17369 /* always turn on EAPD */
17370 add_verb(spec
, alc660vd_eapd_verbs
);
17373 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
17374 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
17376 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
17377 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
17379 if (!spec
->adc_nids
) {
17380 spec
->adc_nids
= alc861vd_adc_nids
;
17381 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
17383 if (!spec
->capsrc_nids
)
17384 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
17386 set_capture_mixer(codec
);
17387 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
17389 spec
->vmaster_nid
= 0x02;
17391 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
17393 codec
->patch_ops
= alc_patch_ops
;
17395 if (board_config
== ALC861VD_AUTO
)
17396 spec
->init_hook
= alc861vd_auto_init
;
17397 #ifdef CONFIG_SND_HDA_POWER_SAVE
17398 if (!spec
->loopback
.amplist
)
17399 spec
->loopback
.amplist
= alc861vd_loopbacks
;
17408 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17409 * configuration. Each pin widget can choose any input DACs and a mixer.
17410 * Each ADC is connected from a mixer of all inputs. This makes possible
17411 * 6-channel independent captures.
17413 * In addition, an independent DAC for the multi-playback (not used in this
17416 #define ALC662_DIGOUT_NID 0x06
17417 #define ALC662_DIGIN_NID 0x0a
17419 static hda_nid_t alc662_dac_nids
[4] = {
17420 /* front, rear, clfe, rear_surr */
17424 static hda_nid_t alc272_dac_nids
[2] = {
17428 static hda_nid_t alc662_adc_nids
[2] = {
17433 static hda_nid_t alc272_adc_nids
[1] = {
17438 static hda_nid_t alc662_capsrc_nids
[2] = { 0x22, 0x23 };
17439 static hda_nid_t alc272_capsrc_nids
[1] = { 0x23 };
17443 /* FIXME: should be a matrix-type input source selection */
17444 static struct hda_input_mux alc662_capture_source
= {
17448 { "Front Mic", 0x1 },
17454 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
17462 static struct hda_input_mux alc663_capture_source
= {
17466 { "Front Mic", 0x1 },
17471 #if 0 /* set to 1 for testing other input sources below */
17472 static struct hda_input_mux alc272_nc10_capture_source
= {
17475 { "Autoselect Mic", 0x0 },
17476 { "Internal Mic", 0x1 },
17477 { "In-0x02", 0x2 },
17478 { "In-0x03", 0x3 },
17479 { "In-0x04", 0x4 },
17480 { "In-0x05", 0x5 },
17481 { "In-0x06", 0x6 },
17482 { "In-0x07", 0x7 },
17483 { "In-0x08", 0x8 },
17484 { "In-0x09", 0x9 },
17485 { "In-0x0a", 0x0a },
17486 { "In-0x0b", 0x0b },
17487 { "In-0x0c", 0x0c },
17488 { "In-0x0d", 0x0d },
17489 { "In-0x0e", 0x0e },
17490 { "In-0x0f", 0x0f },
17498 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
17505 static struct hda_verb alc662_3ST_ch2_init
[] = {
17506 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17507 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17508 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17509 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17516 static struct hda_verb alc662_3ST_ch6_init
[] = {
17517 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17518 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17519 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
17520 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17521 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17522 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
17526 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
17527 { 2, alc662_3ST_ch2_init
},
17528 { 6, alc662_3ST_ch6_init
},
17534 static struct hda_verb alc662_sixstack_ch6_init
[] = {
17535 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
17536 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
17537 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17544 static struct hda_verb alc662_sixstack_ch8_init
[] = {
17545 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17546 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17547 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17551 static struct hda_channel_mode alc662_5stack_modes
[2] = {
17552 { 2, alc662_sixstack_ch6_init
},
17553 { 6, alc662_sixstack_ch8_init
},
17556 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17557 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17560 static struct snd_kcontrol_new alc662_base_mixer
[] = {
17561 /* output mixer control */
17562 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
17563 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17564 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
17565 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
17566 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17567 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17568 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
17569 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
17570 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17572 /*Input mixer control */
17573 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
17574 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
17575 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
17576 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
17577 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
17578 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
17579 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
17580 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
17584 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
17585 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17586 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17587 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17588 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
17589 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
17590 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17591 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17593 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17594 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17595 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17599 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
17600 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17601 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17602 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17603 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
17604 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17605 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17606 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
17607 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
17608 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17609 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
17610 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
17611 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17612 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17613 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17614 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17615 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17616 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17620 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
17621 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17622 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
17623 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17624 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
17625 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17626 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17627 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17629 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17633 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
17634 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17635 ALC262_HIPPO_MASTER_SWITCH
,
17637 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
17638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17641 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
17642 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17643 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17647 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
17648 ALC262_HIPPO_MASTER_SWITCH
,
17649 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17650 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17651 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17652 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17653 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
17654 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17655 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17656 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17657 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17661 static struct hda_bind_ctls alc663_asus_bind_master_vol
= {
17662 .ops
= &snd_hda_bind_vol
,
17664 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
17665 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
17670 static struct hda_bind_ctls alc663_asus_one_bind_switch
= {
17671 .ops
= &snd_hda_bind_sw
,
17673 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17674 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17679 static struct snd_kcontrol_new alc663_m51va_mixer
[] = {
17680 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17681 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch
),
17682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17683 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17687 static struct hda_bind_ctls alc663_asus_tree_bind_switch
= {
17688 .ops
= &snd_hda_bind_sw
,
17690 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17691 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17692 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17697 static struct snd_kcontrol_new alc663_two_hp_m1_mixer
[] = {
17698 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17699 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch
),
17700 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17701 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17702 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17703 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17708 static struct hda_bind_ctls alc663_asus_four_bind_switch
= {
17709 .ops
= &snd_hda_bind_sw
,
17711 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17712 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17713 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17718 static struct snd_kcontrol_new alc663_two_hp_m2_mixer
[] = {
17719 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17720 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch
),
17721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17723 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17724 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17728 static struct snd_kcontrol_new alc662_1bjd_mixer
[] = {
17729 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17730 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17731 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17734 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17735 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17739 static struct hda_bind_ctls alc663_asus_two_bind_master_vol
= {
17740 .ops
= &snd_hda_bind_vol
,
17742 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
17743 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT
),
17748 static struct hda_bind_ctls alc663_asus_two_bind_switch
= {
17749 .ops
= &snd_hda_bind_sw
,
17751 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17752 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT
),
17757 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer
[] = {
17758 HDA_BIND_VOL("Master Playback Volume",
17759 &alc663_asus_two_bind_master_vol
),
17760 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
17761 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17762 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17763 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17764 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17768 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer
[] = {
17769 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17770 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
17771 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17772 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17778 static struct snd_kcontrol_new alc663_g71v_mixer
[] = {
17779 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17780 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17781 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17782 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17783 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17787 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17788 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17792 static struct snd_kcontrol_new alc663_g50v_mixer
[] = {
17793 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17794 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17799 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17800 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17801 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17802 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17806 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch
= {
17807 .ops
= &snd_hda_bind_sw
,
17809 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17810 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17811 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17812 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17813 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17818 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch
= {
17819 .ops
= &snd_hda_bind_sw
,
17821 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17822 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17827 static struct snd_kcontrol_new alc663_mode7_mixer
[] = {
17828 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17829 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17830 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17831 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17832 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17833 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17834 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17835 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17836 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17840 static struct snd_kcontrol_new alc663_mode8_mixer
[] = {
17841 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17842 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17843 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17844 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17845 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17847 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17852 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
17854 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
17855 .name
= "Channel Mode",
17856 .info
= alc_ch_mode_info
,
17857 .get
= alc_ch_mode_get
,
17858 .put
= alc_ch_mode_put
,
17863 static struct hda_verb alc662_init_verbs
[] = {
17864 /* ADC: mute amp left and right */
17865 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17866 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
17868 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17869 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17870 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17871 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17872 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17873 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17875 /* Front Pin: output 0 (0x0c) */
17876 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17877 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17879 /* Rear Pin: output 1 (0x0d) */
17880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17883 /* CLFE Pin: output 2 (0x0e) */
17884 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17885 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17887 /* Mic (rear) pin: input vref at 80% */
17888 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17890 /* Front Mic pin: input vref at 80% */
17891 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17892 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17893 /* Line In pin: input */
17894 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17895 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17896 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17897 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17898 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17899 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
17900 /* CD pin widget for input */
17901 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17903 /* FIXME: use matrix-type input source selection */
17904 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17907 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17909 /* always trun on EAPD */
17910 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17911 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17916 static struct hda_verb alc663_init_verbs
[] = {
17917 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17918 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17919 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17920 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17921 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17922 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17926 static struct hda_verb alc272_init_verbs
[] = {
17927 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17928 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17929 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17930 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17931 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17932 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17933 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17934 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17938 static struct hda_verb alc662_sue_init_verbs
[] = {
17939 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
17940 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
17944 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
17945 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17946 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17950 /* Set Unsolicited Event*/
17951 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
17952 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17953 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17957 static struct hda_verb alc663_m51va_init_verbs
[] = {
17958 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17959 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17960 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17961 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17962 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17963 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17964 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17965 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17966 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17970 static struct hda_verb alc663_21jd_amic_init_verbs
[] = {
17971 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17972 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17973 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17974 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17975 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17976 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17977 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17981 static struct hda_verb alc662_1bjd_amic_init_verbs
[] = {
17982 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17983 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17984 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17985 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
17986 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17988 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17989 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17993 static struct hda_verb alc663_15jd_amic_init_verbs
[] = {
17994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17996 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17997 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17998 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17999 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18000 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18004 static struct hda_verb alc663_two_hp_amic_m1_init_verbs
[] = {
18005 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18006 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18007 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18008 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
18009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18010 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18011 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
18012 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18014 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18015 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18016 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18020 static struct hda_verb alc663_two_hp_amic_m2_init_verbs
[] = {
18021 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18022 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18023 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18024 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18025 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18027 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18030 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18031 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18032 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18036 static struct hda_verb alc663_g71v_init_verbs
[] = {
18037 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18038 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18039 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18041 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18042 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18043 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
18045 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
18046 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
18047 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
18051 static struct hda_verb alc663_g50v_init_verbs
[] = {
18052 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18053 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18054 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
18056 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18057 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18061 static struct hda_verb alc662_ecs_init_verbs
[] = {
18062 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
18063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18064 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18065 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18069 static struct hda_verb alc272_dell_zm1_init_verbs
[] = {
18070 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18071 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18072 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18073 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18074 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18075 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18076 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18079 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18080 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18084 static struct hda_verb alc272_dell_init_verbs
[] = {
18085 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18086 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18088 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18089 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18090 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18091 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18094 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18095 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18099 static struct hda_verb alc663_mode7_init_verbs
[] = {
18100 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18101 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18102 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
18103 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18104 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18105 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18106 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
18107 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18108 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18109 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18112 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18113 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18114 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18118 static struct hda_verb alc663_mode8_init_verbs
[] = {
18119 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18120 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18121 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18122 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
18123 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18124 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
18125 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18126 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18127 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18128 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18129 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18131 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18132 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18133 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18134 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18138 static struct snd_kcontrol_new alc662_auto_capture_mixer
[] = {
18139 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
18140 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
18144 static struct snd_kcontrol_new alc272_auto_capture_mixer
[] = {
18145 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
18146 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
18150 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
18152 unsigned int present
;
18153 unsigned char bits
;
18155 present
= snd_hda_jack_detect(codec
, 0x14);
18156 bits
= present
? HDA_AMP_MUTE
: 0;
18158 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
18159 HDA_AMP_MUTE
, bits
);
18162 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
18164 unsigned int present
;
18165 unsigned char bits
;
18167 present
= snd_hda_jack_detect(codec
, 0x1b);
18168 bits
= present
? HDA_AMP_MUTE
: 0;
18170 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
18171 HDA_AMP_MUTE
, bits
);
18172 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
18173 HDA_AMP_MUTE
, bits
);
18176 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
18179 if ((res
>> 26) == ALC880_HP_EVENT
)
18180 alc662_lenovo_101e_all_automute(codec
);
18181 if ((res
>> 26) == ALC880_FRONT_EVENT
)
18182 alc662_lenovo_101e_ispeaker_automute(codec
);
18185 /* unsolicited event for HP jack sensing */
18186 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
18189 if ((res
>> 26) == ALC880_MIC_EVENT
)
18190 alc_mic_automute(codec
);
18192 alc262_hippo_unsol_event(codec
, res
);
18195 static void alc662_eeepc_setup(struct hda_codec
*codec
)
18197 struct alc_spec
*spec
= codec
->spec
;
18199 alc262_hippo1_setup(codec
);
18200 spec
->ext_mic
.pin
= 0x18;
18201 spec
->ext_mic
.mux_idx
= 0;
18202 spec
->int_mic
.pin
= 0x19;
18203 spec
->int_mic
.mux_idx
= 1;
18204 spec
->auto_mic
= 1;
18207 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
18209 alc262_hippo_automute(codec
);
18210 alc_mic_automute(codec
);
18213 static void alc662_eeepc_ep20_setup(struct hda_codec
*codec
)
18215 struct alc_spec
*spec
= codec
->spec
;
18217 spec
->autocfg
.hp_pins
[0] = 0x14;
18218 spec
->autocfg
.speaker_pins
[0] = 0x1b;
18221 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18223 static void alc663_m51va_speaker_automute(struct hda_codec
*codec
)
18225 unsigned int present
;
18226 unsigned char bits
;
18228 present
= snd_hda_jack_detect(codec
, 0x21);
18229 bits
= present
? HDA_AMP_MUTE
: 0;
18230 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
18231 HDA_AMP_MUTE
, bits
);
18232 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
18233 HDA_AMP_MUTE
, bits
);
18236 static void alc663_21jd_two_speaker_automute(struct hda_codec
*codec
)
18238 unsigned int present
;
18239 unsigned char bits
;
18241 present
= snd_hda_jack_detect(codec
, 0x21);
18242 bits
= present
? HDA_AMP_MUTE
: 0;
18243 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
18244 HDA_AMP_MUTE
, bits
);
18245 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
18246 HDA_AMP_MUTE
, bits
);
18247 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
18248 HDA_AMP_MUTE
, bits
);
18249 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
18250 HDA_AMP_MUTE
, bits
);
18253 static void alc663_15jd_two_speaker_automute(struct hda_codec
*codec
)
18255 unsigned int present
;
18256 unsigned char bits
;
18258 present
= snd_hda_jack_detect(codec
, 0x15);
18259 bits
= present
? HDA_AMP_MUTE
: 0;
18260 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
18261 HDA_AMP_MUTE
, bits
);
18262 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
18263 HDA_AMP_MUTE
, bits
);
18264 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
18265 HDA_AMP_MUTE
, bits
);
18266 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
18267 HDA_AMP_MUTE
, bits
);
18270 static void alc662_f5z_speaker_automute(struct hda_codec
*codec
)
18272 unsigned int present
;
18273 unsigned char bits
;
18275 present
= snd_hda_jack_detect(codec
, 0x1b);
18276 bits
= present
? 0 : PIN_OUT
;
18277 snd_hda_codec_write(codec
, 0x14, 0,
18278 AC_VERB_SET_PIN_WIDGET_CONTROL
, bits
);
18281 static void alc663_two_hp_m1_speaker_automute(struct hda_codec
*codec
)
18283 unsigned int present1
, present2
;
18285 present1
= snd_hda_jack_detect(codec
, 0x21);
18286 present2
= snd_hda_jack_detect(codec
, 0x15);
18288 if (present1
|| present2
) {
18289 snd_hda_codec_write_cache(codec
, 0x14, 0,
18290 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
18292 snd_hda_codec_write_cache(codec
, 0x14, 0,
18293 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
18297 static void alc663_two_hp_m2_speaker_automute(struct hda_codec
*codec
)
18299 unsigned int present1
, present2
;
18301 present1
= snd_hda_jack_detect(codec
, 0x1b);
18302 present2
= snd_hda_jack_detect(codec
, 0x15);
18304 if (present1
|| present2
) {
18305 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
18306 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
18307 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
18308 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
18310 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
18312 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
18317 static void alc663_two_hp_m7_speaker_automute(struct hda_codec
*codec
)
18319 unsigned int present1
, present2
;
18321 present1
= snd_hda_codec_read(codec
, 0x1b, 0,
18322 AC_VERB_GET_PIN_SENSE
, 0)
18323 & AC_PINSENSE_PRESENCE
;
18324 present2
= snd_hda_codec_read(codec
, 0x21, 0,
18325 AC_VERB_GET_PIN_SENSE
, 0)
18326 & AC_PINSENSE_PRESENCE
;
18328 if (present1
|| present2
) {
18329 snd_hda_codec_write_cache(codec
, 0x14, 0,
18330 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
18331 snd_hda_codec_write_cache(codec
, 0x17, 0,
18332 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
18334 snd_hda_codec_write_cache(codec
, 0x14, 0,
18335 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
18336 snd_hda_codec_write_cache(codec
, 0x17, 0,
18337 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
18341 static void alc663_two_hp_m8_speaker_automute(struct hda_codec
*codec
)
18343 unsigned int present1
, present2
;
18345 present1
= snd_hda_codec_read(codec
, 0x21, 0,
18346 AC_VERB_GET_PIN_SENSE
, 0)
18347 & AC_PINSENSE_PRESENCE
;
18348 present2
= snd_hda_codec_read(codec
, 0x15, 0,
18349 AC_VERB_GET_PIN_SENSE
, 0)
18350 & AC_PINSENSE_PRESENCE
;
18352 if (present1
|| present2
) {
18353 snd_hda_codec_write_cache(codec
, 0x14, 0,
18354 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
18355 snd_hda_codec_write_cache(codec
, 0x17, 0,
18356 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
18358 snd_hda_codec_write_cache(codec
, 0x14, 0,
18359 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
18360 snd_hda_codec_write_cache(codec
, 0x17, 0,
18361 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
18365 static void alc663_m51va_unsol_event(struct hda_codec
*codec
,
18368 switch (res
>> 26) {
18369 case ALC880_HP_EVENT
:
18370 alc663_m51va_speaker_automute(codec
);
18372 case ALC880_MIC_EVENT
:
18373 alc_mic_automute(codec
);
18378 static void alc663_m51va_setup(struct hda_codec
*codec
)
18380 struct alc_spec
*spec
= codec
->spec
;
18381 spec
->ext_mic
.pin
= 0x18;
18382 spec
->ext_mic
.mux_idx
= 0;
18383 spec
->int_mic
.pin
= 0x12;
18384 spec
->int_mic
.mux_idx
= 9;
18385 spec
->auto_mic
= 1;
18388 static void alc663_m51va_inithook(struct hda_codec
*codec
)
18390 alc663_m51va_speaker_automute(codec
);
18391 alc_mic_automute(codec
);
18394 /* ***************** Mode1 ******************************/
18395 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18397 static void alc663_mode1_setup(struct hda_codec
*codec
)
18399 struct alc_spec
*spec
= codec
->spec
;
18400 spec
->ext_mic
.pin
= 0x18;
18401 spec
->ext_mic
.mux_idx
= 0;
18402 spec
->int_mic
.pin
= 0x19;
18403 spec
->int_mic
.mux_idx
= 1;
18404 spec
->auto_mic
= 1;
18407 #define alc663_mode1_inithook alc663_m51va_inithook
18409 /* ***************** Mode2 ******************************/
18410 static void alc662_mode2_unsol_event(struct hda_codec
*codec
,
18413 switch (res
>> 26) {
18414 case ALC880_HP_EVENT
:
18415 alc662_f5z_speaker_automute(codec
);
18417 case ALC880_MIC_EVENT
:
18418 alc_mic_automute(codec
);
18423 #define alc662_mode2_setup alc663_mode1_setup
18425 static void alc662_mode2_inithook(struct hda_codec
*codec
)
18427 alc662_f5z_speaker_automute(codec
);
18428 alc_mic_automute(codec
);
18430 /* ***************** Mode3 ******************************/
18431 static void alc663_mode3_unsol_event(struct hda_codec
*codec
,
18434 switch (res
>> 26) {
18435 case ALC880_HP_EVENT
:
18436 alc663_two_hp_m1_speaker_automute(codec
);
18438 case ALC880_MIC_EVENT
:
18439 alc_mic_automute(codec
);
18444 #define alc663_mode3_setup alc663_mode1_setup
18446 static void alc663_mode3_inithook(struct hda_codec
*codec
)
18448 alc663_two_hp_m1_speaker_automute(codec
);
18449 alc_mic_automute(codec
);
18451 /* ***************** Mode4 ******************************/
18452 static void alc663_mode4_unsol_event(struct hda_codec
*codec
,
18455 switch (res
>> 26) {
18456 case ALC880_HP_EVENT
:
18457 alc663_21jd_two_speaker_automute(codec
);
18459 case ALC880_MIC_EVENT
:
18460 alc_mic_automute(codec
);
18465 #define alc663_mode4_setup alc663_mode1_setup
18467 static void alc663_mode4_inithook(struct hda_codec
*codec
)
18469 alc663_21jd_two_speaker_automute(codec
);
18470 alc_mic_automute(codec
);
18472 /* ***************** Mode5 ******************************/
18473 static void alc663_mode5_unsol_event(struct hda_codec
*codec
,
18476 switch (res
>> 26) {
18477 case ALC880_HP_EVENT
:
18478 alc663_15jd_two_speaker_automute(codec
);
18480 case ALC880_MIC_EVENT
:
18481 alc_mic_automute(codec
);
18486 #define alc663_mode5_setup alc663_mode1_setup
18488 static void alc663_mode5_inithook(struct hda_codec
*codec
)
18490 alc663_15jd_two_speaker_automute(codec
);
18491 alc_mic_automute(codec
);
18493 /* ***************** Mode6 ******************************/
18494 static void alc663_mode6_unsol_event(struct hda_codec
*codec
,
18497 switch (res
>> 26) {
18498 case ALC880_HP_EVENT
:
18499 alc663_two_hp_m2_speaker_automute(codec
);
18501 case ALC880_MIC_EVENT
:
18502 alc_mic_automute(codec
);
18507 #define alc663_mode6_setup alc663_mode1_setup
18509 static void alc663_mode6_inithook(struct hda_codec
*codec
)
18511 alc663_two_hp_m2_speaker_automute(codec
);
18512 alc_mic_automute(codec
);
18515 /* ***************** Mode7 ******************************/
18516 static void alc663_mode7_unsol_event(struct hda_codec
*codec
,
18519 switch (res
>> 26) {
18520 case ALC880_HP_EVENT
:
18521 alc663_two_hp_m7_speaker_automute(codec
);
18523 case ALC880_MIC_EVENT
:
18524 alc_mic_automute(codec
);
18529 #define alc663_mode7_setup alc663_mode1_setup
18531 static void alc663_mode7_inithook(struct hda_codec
*codec
)
18533 alc663_two_hp_m7_speaker_automute(codec
);
18534 alc_mic_automute(codec
);
18537 /* ***************** Mode8 ******************************/
18538 static void alc663_mode8_unsol_event(struct hda_codec
*codec
,
18541 switch (res
>> 26) {
18542 case ALC880_HP_EVENT
:
18543 alc663_two_hp_m8_speaker_automute(codec
);
18545 case ALC880_MIC_EVENT
:
18546 alc_mic_automute(codec
);
18551 #define alc663_mode8_setup alc663_m51va_setup
18553 static void alc663_mode8_inithook(struct hda_codec
*codec
)
18555 alc663_two_hp_m8_speaker_automute(codec
);
18556 alc_mic_automute(codec
);
18559 static void alc663_g71v_hp_automute(struct hda_codec
*codec
)
18561 unsigned int present
;
18562 unsigned char bits
;
18564 present
= snd_hda_jack_detect(codec
, 0x21);
18565 bits
= present
? HDA_AMP_MUTE
: 0;
18566 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
18567 HDA_AMP_MUTE
, bits
);
18568 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
18569 HDA_AMP_MUTE
, bits
);
18572 static void alc663_g71v_front_automute(struct hda_codec
*codec
)
18574 unsigned int present
;
18575 unsigned char bits
;
18577 present
= snd_hda_jack_detect(codec
, 0x15);
18578 bits
= present
? HDA_AMP_MUTE
: 0;
18579 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
18580 HDA_AMP_MUTE
, bits
);
18583 static void alc663_g71v_unsol_event(struct hda_codec
*codec
,
18586 switch (res
>> 26) {
18587 case ALC880_HP_EVENT
:
18588 alc663_g71v_hp_automute(codec
);
18590 case ALC880_FRONT_EVENT
:
18591 alc663_g71v_front_automute(codec
);
18593 case ALC880_MIC_EVENT
:
18594 alc_mic_automute(codec
);
18599 #define alc663_g71v_setup alc663_m51va_setup
18601 static void alc663_g71v_inithook(struct hda_codec
*codec
)
18603 alc663_g71v_front_automute(codec
);
18604 alc663_g71v_hp_automute(codec
);
18605 alc_mic_automute(codec
);
18608 static void alc663_g50v_unsol_event(struct hda_codec
*codec
,
18611 switch (res
>> 26) {
18612 case ALC880_HP_EVENT
:
18613 alc663_m51va_speaker_automute(codec
);
18615 case ALC880_MIC_EVENT
:
18616 alc_mic_automute(codec
);
18621 #define alc663_g50v_setup alc663_m51va_setup
18623 static void alc663_g50v_inithook(struct hda_codec
*codec
)
18625 alc663_m51va_speaker_automute(codec
);
18626 alc_mic_automute(codec
);
18629 static struct snd_kcontrol_new alc662_ecs_mixer
[] = {
18630 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
18631 ALC262_HIPPO_MASTER_SWITCH
,
18633 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT
),
18634 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT
),
18635 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT
),
18637 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
18638 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
18639 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
18643 static struct snd_kcontrol_new alc272_nc10_mixer
[] = {
18644 /* Master Playback automatically created from Speaker and Headphone */
18645 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
18646 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
18647 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
18648 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
18650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
18651 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
18652 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
18654 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
18655 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
18656 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
18660 #ifdef CONFIG_SND_HDA_POWER_SAVE
18661 #define alc662_loopbacks alc880_loopbacks
18665 /* pcm configuration: identical with ALC880 */
18666 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18667 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18668 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18669 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18672 * configuration and preset
18674 static const char * const alc662_models
[ALC662_MODEL_LAST
] = {
18675 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
18676 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
18677 [ALC662_3ST_6ch
] = "3stack-6ch",
18678 [ALC662_5ST_DIG
] = "6stack-dig",
18679 [ALC662_LENOVO_101E
] = "lenovo-101e",
18680 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
18681 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
18682 [ALC662_ECS
] = "ecs",
18683 [ALC663_ASUS_M51VA
] = "m51va",
18684 [ALC663_ASUS_G71V
] = "g71v",
18685 [ALC663_ASUS_H13
] = "h13",
18686 [ALC663_ASUS_G50V
] = "g50v",
18687 [ALC663_ASUS_MODE1
] = "asus-mode1",
18688 [ALC662_ASUS_MODE2
] = "asus-mode2",
18689 [ALC663_ASUS_MODE3
] = "asus-mode3",
18690 [ALC663_ASUS_MODE4
] = "asus-mode4",
18691 [ALC663_ASUS_MODE5
] = "asus-mode5",
18692 [ALC663_ASUS_MODE6
] = "asus-mode6",
18693 [ALC663_ASUS_MODE7
] = "asus-mode7",
18694 [ALC663_ASUS_MODE8
] = "asus-mode8",
18695 [ALC272_DELL
] = "dell",
18696 [ALC272_DELL_ZM1
] = "dell-zm1",
18697 [ALC272_SAMSUNG_NC10
] = "samsung-nc10",
18698 [ALC662_AUTO
] = "auto",
18701 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
18702 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS
),
18703 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL
),
18704 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1
),
18705 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1
),
18706 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3
),
18707 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1
),
18708 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3
),
18709 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1
),
18710 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2
),
18711 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1
),
18712 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1
),
18713 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1
),
18714 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2
),
18715 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7
),
18716 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7
),
18717 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8
),
18718 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3
),
18719 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1
),
18720 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2
),
18721 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2
),
18722 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1
),
18723 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2
),
18724 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6
),
18725 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6
),
18726 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2
),
18727 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1
),
18728 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3
),
18729 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA
),
18730 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2
),
18731 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2
),
18732 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5
),
18733 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6
),
18734 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2
),
18735 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1
),
18736 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2
),
18737 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2
),
18738 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
18739 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18740 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3
),
18741 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3
),
18742 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1
),
18743 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1
),
18744 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1
),
18745 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1
),
18746 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1
),
18747 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2
),
18748 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2
),
18749 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1
),
18750 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1
),
18751 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3
),
18752 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1
),
18753 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1
),
18754 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V
),
18755 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18756 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1
),
18757 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2
),
18758 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA
),
18759 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1
),
18760 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4
),
18761 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
18762 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
18763 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
18764 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS
),
18765 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18766 ALC662_3ST_6ch_DIG
),
18767 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO
),
18768 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10
),
18769 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18770 ALC662_3ST_6ch_DIG
),
18771 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13
),
18772 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG
),
18773 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA
),
18774 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
18775 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18776 ALC662_3ST_6ch_DIG
),
18777 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18779 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E
),
18783 static struct alc_config_preset alc662_presets
[] = {
18784 [ALC662_3ST_2ch_DIG
] = {
18785 .mixers
= { alc662_3ST_2ch_mixer
},
18786 .init_verbs
= { alc662_init_verbs
},
18787 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18788 .dac_nids
= alc662_dac_nids
,
18789 .dig_out_nid
= ALC662_DIGOUT_NID
,
18790 .dig_in_nid
= ALC662_DIGIN_NID
,
18791 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18792 .channel_mode
= alc662_3ST_2ch_modes
,
18793 .input_mux
= &alc662_capture_source
,
18795 [ALC662_3ST_6ch_DIG
] = {
18796 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18797 .init_verbs
= { alc662_init_verbs
},
18798 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18799 .dac_nids
= alc662_dac_nids
,
18800 .dig_out_nid
= ALC662_DIGOUT_NID
,
18801 .dig_in_nid
= ALC662_DIGIN_NID
,
18802 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18803 .channel_mode
= alc662_3ST_6ch_modes
,
18805 .input_mux
= &alc662_capture_source
,
18807 [ALC662_3ST_6ch
] = {
18808 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18809 .init_verbs
= { alc662_init_verbs
},
18810 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18811 .dac_nids
= alc662_dac_nids
,
18812 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18813 .channel_mode
= alc662_3ST_6ch_modes
,
18815 .input_mux
= &alc662_capture_source
,
18817 [ALC662_5ST_DIG
] = {
18818 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
},
18819 .init_verbs
= { alc662_init_verbs
},
18820 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18821 .dac_nids
= alc662_dac_nids
,
18822 .dig_out_nid
= ALC662_DIGOUT_NID
,
18823 .dig_in_nid
= ALC662_DIGIN_NID
,
18824 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
18825 .channel_mode
= alc662_5stack_modes
,
18826 .input_mux
= &alc662_capture_source
,
18828 [ALC662_LENOVO_101E
] = {
18829 .mixers
= { alc662_lenovo_101e_mixer
},
18830 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
18831 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18832 .dac_nids
= alc662_dac_nids
,
18833 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18834 .channel_mode
= alc662_3ST_2ch_modes
,
18835 .input_mux
= &alc662_lenovo_101e_capture_source
,
18836 .unsol_event
= alc662_lenovo_101e_unsol_event
,
18837 .init_hook
= alc662_lenovo_101e_all_automute
,
18839 [ALC662_ASUS_EEEPC_P701
] = {
18840 .mixers
= { alc662_eeepc_p701_mixer
},
18841 .init_verbs
= { alc662_init_verbs
,
18842 alc662_eeepc_sue_init_verbs
},
18843 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18844 .dac_nids
= alc662_dac_nids
,
18845 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18846 .channel_mode
= alc662_3ST_2ch_modes
,
18847 .unsol_event
= alc662_eeepc_unsol_event
,
18848 .setup
= alc662_eeepc_setup
,
18849 .init_hook
= alc662_eeepc_inithook
,
18851 [ALC662_ASUS_EEEPC_EP20
] = {
18852 .mixers
= { alc662_eeepc_ep20_mixer
,
18853 alc662_chmode_mixer
},
18854 .init_verbs
= { alc662_init_verbs
,
18855 alc662_eeepc_ep20_sue_init_verbs
},
18856 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18857 .dac_nids
= alc662_dac_nids
,
18858 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18859 .channel_mode
= alc662_3ST_6ch_modes
,
18860 .input_mux
= &alc662_lenovo_101e_capture_source
,
18861 .unsol_event
= alc662_eeepc_unsol_event
,
18862 .setup
= alc662_eeepc_ep20_setup
,
18863 .init_hook
= alc662_eeepc_ep20_inithook
,
18866 .mixers
= { alc662_ecs_mixer
},
18867 .init_verbs
= { alc662_init_verbs
,
18868 alc662_ecs_init_verbs
},
18869 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18870 .dac_nids
= alc662_dac_nids
,
18871 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18872 .channel_mode
= alc662_3ST_2ch_modes
,
18873 .unsol_event
= alc662_eeepc_unsol_event
,
18874 .setup
= alc662_eeepc_setup
,
18875 .init_hook
= alc662_eeepc_inithook
,
18877 [ALC663_ASUS_M51VA
] = {
18878 .mixers
= { alc663_m51va_mixer
},
18879 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
18880 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18881 .dac_nids
= alc662_dac_nids
,
18882 .dig_out_nid
= ALC662_DIGOUT_NID
,
18883 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18884 .channel_mode
= alc662_3ST_2ch_modes
,
18885 .unsol_event
= alc663_m51va_unsol_event
,
18886 .setup
= alc663_m51va_setup
,
18887 .init_hook
= alc663_m51va_inithook
,
18889 [ALC663_ASUS_G71V
] = {
18890 .mixers
= { alc663_g71v_mixer
},
18891 .init_verbs
= { alc662_init_verbs
, alc663_g71v_init_verbs
},
18892 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18893 .dac_nids
= alc662_dac_nids
,
18894 .dig_out_nid
= ALC662_DIGOUT_NID
,
18895 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18896 .channel_mode
= alc662_3ST_2ch_modes
,
18897 .unsol_event
= alc663_g71v_unsol_event
,
18898 .setup
= alc663_g71v_setup
,
18899 .init_hook
= alc663_g71v_inithook
,
18901 [ALC663_ASUS_H13
] = {
18902 .mixers
= { alc663_m51va_mixer
},
18903 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
18904 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18905 .dac_nids
= alc662_dac_nids
,
18906 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18907 .channel_mode
= alc662_3ST_2ch_modes
,
18908 .unsol_event
= alc663_m51va_unsol_event
,
18909 .init_hook
= alc663_m51va_inithook
,
18911 [ALC663_ASUS_G50V
] = {
18912 .mixers
= { alc663_g50v_mixer
},
18913 .init_verbs
= { alc662_init_verbs
, alc663_g50v_init_verbs
},
18914 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18915 .dac_nids
= alc662_dac_nids
,
18916 .dig_out_nid
= ALC662_DIGOUT_NID
,
18917 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18918 .channel_mode
= alc662_3ST_6ch_modes
,
18919 .input_mux
= &alc663_capture_source
,
18920 .unsol_event
= alc663_g50v_unsol_event
,
18921 .setup
= alc663_g50v_setup
,
18922 .init_hook
= alc663_g50v_inithook
,
18924 [ALC663_ASUS_MODE1
] = {
18925 .mixers
= { alc663_m51va_mixer
},
18926 .cap_mixer
= alc662_auto_capture_mixer
,
18927 .init_verbs
= { alc662_init_verbs
,
18928 alc663_21jd_amic_init_verbs
},
18929 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18931 .dac_nids
= alc662_dac_nids
,
18932 .dig_out_nid
= ALC662_DIGOUT_NID
,
18933 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18934 .channel_mode
= alc662_3ST_2ch_modes
,
18935 .unsol_event
= alc663_mode1_unsol_event
,
18936 .setup
= alc663_mode1_setup
,
18937 .init_hook
= alc663_mode1_inithook
,
18939 [ALC662_ASUS_MODE2
] = {
18940 .mixers
= { alc662_1bjd_mixer
},
18941 .cap_mixer
= alc662_auto_capture_mixer
,
18942 .init_verbs
= { alc662_init_verbs
,
18943 alc662_1bjd_amic_init_verbs
},
18944 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18945 .dac_nids
= alc662_dac_nids
,
18946 .dig_out_nid
= ALC662_DIGOUT_NID
,
18947 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18948 .channel_mode
= alc662_3ST_2ch_modes
,
18949 .unsol_event
= alc662_mode2_unsol_event
,
18950 .setup
= alc662_mode2_setup
,
18951 .init_hook
= alc662_mode2_inithook
,
18953 [ALC663_ASUS_MODE3
] = {
18954 .mixers
= { alc663_two_hp_m1_mixer
},
18955 .cap_mixer
= alc662_auto_capture_mixer
,
18956 .init_verbs
= { alc662_init_verbs
,
18957 alc663_two_hp_amic_m1_init_verbs
},
18958 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18960 .dac_nids
= alc662_dac_nids
,
18961 .dig_out_nid
= ALC662_DIGOUT_NID
,
18962 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18963 .channel_mode
= alc662_3ST_2ch_modes
,
18964 .unsol_event
= alc663_mode3_unsol_event
,
18965 .setup
= alc663_mode3_setup
,
18966 .init_hook
= alc663_mode3_inithook
,
18968 [ALC663_ASUS_MODE4
] = {
18969 .mixers
= { alc663_asus_21jd_clfe_mixer
},
18970 .cap_mixer
= alc662_auto_capture_mixer
,
18971 .init_verbs
= { alc662_init_verbs
,
18972 alc663_21jd_amic_init_verbs
},
18973 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18975 .dac_nids
= alc662_dac_nids
,
18976 .dig_out_nid
= ALC662_DIGOUT_NID
,
18977 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18978 .channel_mode
= alc662_3ST_2ch_modes
,
18979 .unsol_event
= alc663_mode4_unsol_event
,
18980 .setup
= alc663_mode4_setup
,
18981 .init_hook
= alc663_mode4_inithook
,
18983 [ALC663_ASUS_MODE5
] = {
18984 .mixers
= { alc663_asus_15jd_clfe_mixer
},
18985 .cap_mixer
= alc662_auto_capture_mixer
,
18986 .init_verbs
= { alc662_init_verbs
,
18987 alc663_15jd_amic_init_verbs
},
18988 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18990 .dac_nids
= alc662_dac_nids
,
18991 .dig_out_nid
= ALC662_DIGOUT_NID
,
18992 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18993 .channel_mode
= alc662_3ST_2ch_modes
,
18994 .unsol_event
= alc663_mode5_unsol_event
,
18995 .setup
= alc663_mode5_setup
,
18996 .init_hook
= alc663_mode5_inithook
,
18998 [ALC663_ASUS_MODE6
] = {
18999 .mixers
= { alc663_two_hp_m2_mixer
},
19000 .cap_mixer
= alc662_auto_capture_mixer
,
19001 .init_verbs
= { alc662_init_verbs
,
19002 alc663_two_hp_amic_m2_init_verbs
},
19003 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
19005 .dac_nids
= alc662_dac_nids
,
19006 .dig_out_nid
= ALC662_DIGOUT_NID
,
19007 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
19008 .channel_mode
= alc662_3ST_2ch_modes
,
19009 .unsol_event
= alc663_mode6_unsol_event
,
19010 .setup
= alc663_mode6_setup
,
19011 .init_hook
= alc663_mode6_inithook
,
19013 [ALC663_ASUS_MODE7
] = {
19014 .mixers
= { alc663_mode7_mixer
},
19015 .cap_mixer
= alc662_auto_capture_mixer
,
19016 .init_verbs
= { alc662_init_verbs
,
19017 alc663_mode7_init_verbs
},
19018 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
19020 .dac_nids
= alc662_dac_nids
,
19021 .dig_out_nid
= ALC662_DIGOUT_NID
,
19022 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
19023 .channel_mode
= alc662_3ST_2ch_modes
,
19024 .unsol_event
= alc663_mode7_unsol_event
,
19025 .setup
= alc663_mode7_setup
,
19026 .init_hook
= alc663_mode7_inithook
,
19028 [ALC663_ASUS_MODE8
] = {
19029 .mixers
= { alc663_mode8_mixer
},
19030 .cap_mixer
= alc662_auto_capture_mixer
,
19031 .init_verbs
= { alc662_init_verbs
,
19032 alc663_mode8_init_verbs
},
19033 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
19035 .dac_nids
= alc662_dac_nids
,
19036 .dig_out_nid
= ALC662_DIGOUT_NID
,
19037 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
19038 .channel_mode
= alc662_3ST_2ch_modes
,
19039 .unsol_event
= alc663_mode8_unsol_event
,
19040 .setup
= alc663_mode8_setup
,
19041 .init_hook
= alc663_mode8_inithook
,
19044 .mixers
= { alc663_m51va_mixer
},
19045 .cap_mixer
= alc272_auto_capture_mixer
,
19046 .init_verbs
= { alc662_init_verbs
, alc272_dell_init_verbs
},
19047 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
19048 .dac_nids
= alc662_dac_nids
,
19049 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
19050 .adc_nids
= alc272_adc_nids
,
19051 .num_adc_nids
= ARRAY_SIZE(alc272_adc_nids
),
19052 .capsrc_nids
= alc272_capsrc_nids
,
19053 .channel_mode
= alc662_3ST_2ch_modes
,
19054 .unsol_event
= alc663_m51va_unsol_event
,
19055 .setup
= alc663_m51va_setup
,
19056 .init_hook
= alc663_m51va_inithook
,
19058 [ALC272_DELL_ZM1
] = {
19059 .mixers
= { alc663_m51va_mixer
},
19060 .cap_mixer
= alc662_auto_capture_mixer
,
19061 .init_verbs
= { alc662_init_verbs
, alc272_dell_zm1_init_verbs
},
19062 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
19063 .dac_nids
= alc662_dac_nids
,
19064 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
19065 .adc_nids
= alc662_adc_nids
,
19067 .capsrc_nids
= alc662_capsrc_nids
,
19068 .channel_mode
= alc662_3ST_2ch_modes
,
19069 .unsol_event
= alc663_m51va_unsol_event
,
19070 .setup
= alc663_m51va_setup
,
19071 .init_hook
= alc663_m51va_inithook
,
19073 [ALC272_SAMSUNG_NC10
] = {
19074 .mixers
= { alc272_nc10_mixer
},
19075 .init_verbs
= { alc662_init_verbs
,
19076 alc663_21jd_amic_init_verbs
},
19077 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
19078 .dac_nids
= alc272_dac_nids
,
19079 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
19080 .channel_mode
= alc662_3ST_2ch_modes
,
19081 /*.input_mux = &alc272_nc10_capture_source,*/
19082 .unsol_event
= alc663_mode4_unsol_event
,
19083 .setup
= alc663_mode4_setup
,
19084 .init_hook
= alc663_mode4_inithook
,
19090 * BIOS auto configuration
19093 /* convert from MIX nid to DAC */
19094 static inline hda_nid_t
alc662_mix_to_dac(hda_nid_t nid
)
19098 else if (nid
>= 0x0c && nid
<= 0x0e)
19099 return nid
- 0x0c + 0x02;
19100 else if (nid
== 0x26) /* ALC887-VD has this DAC too */
19106 /* get MIX nid connected to the given pin targeted to DAC */
19107 static hda_nid_t
alc662_dac_to_mix(struct hda_codec
*codec
, hda_nid_t pin
,
19113 num
= snd_hda_get_connections(codec
, pin
, mix
, ARRAY_SIZE(mix
));
19114 for (i
= 0; i
< num
; i
++) {
19115 if (alc662_mix_to_dac(mix
[i
]) == dac
)
19121 /* look for an empty DAC slot */
19122 static hda_nid_t
alc662_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
19124 struct alc_spec
*spec
= codec
->spec
;
19128 num
= snd_hda_get_connections(codec
, pin
, srcs
, ARRAY_SIZE(srcs
));
19131 for (i
= 0; i
< num
; i
++) {
19132 hda_nid_t nid
= alc662_mix_to_dac(srcs
[i
]);
19135 for (j
= 0; j
< spec
->multiout
.num_dacs
; j
++)
19136 if (spec
->multiout
.dac_nids
[j
] == nid
)
19138 if (j
>= spec
->multiout
.num_dacs
)
19144 /* fill in the dac_nids table from the parsed pin configuration */
19145 static int alc662_auto_fill_dac_nids(struct hda_codec
*codec
,
19146 const struct auto_pin_cfg
*cfg
)
19148 struct alc_spec
*spec
= codec
->spec
;
19152 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
19153 for (i
= 0; i
< cfg
->line_outs
; i
++) {
19154 dac
= alc662_look_for_dac(codec
, cfg
->line_out_pins
[i
]);
19157 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
19162 static inline int __alc662_add_vol_ctl(struct alc_spec
*spec
, const char *pfx
,
19163 hda_nid_t nid
, int idx
, unsigned int chs
)
19165 return __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, idx
,
19166 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
19169 static inline int __alc662_add_sw_ctl(struct alc_spec
*spec
, const char *pfx
,
19170 hda_nid_t nid
, int idx
, unsigned int chs
)
19172 return __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
,
19173 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_INPUT
));
19176 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19177 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19178 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19179 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19180 #define alc662_add_stereo_vol(spec, pfx, nid) \
19181 alc662_add_vol_ctl(spec, pfx, nid, 3)
19182 #define alc662_add_stereo_sw(spec, pfx, nid) \
19183 alc662_add_sw_ctl(spec, pfx, nid, 3)
19185 /* add playback controls from the parsed DAC table */
19186 static int alc662_auto_create_multi_out_ctls(struct hda_codec
*codec
,
19187 const struct auto_pin_cfg
*cfg
)
19189 struct alc_spec
*spec
= codec
->spec
;
19190 static const char * const chname
[4] = {
19191 "Front", "Surround", NULL
/*CLFE*/, "Side"
19193 const char *pfx
= alc_get_line_out_pfx(cfg
, true);
19194 hda_nid_t nid
, mix
;
19197 for (i
= 0; i
< cfg
->line_outs
; i
++) {
19198 nid
= spec
->multiout
.dac_nids
[i
];
19201 mix
= alc662_dac_to_mix(codec
, cfg
->line_out_pins
[i
], nid
);
19204 if (!pfx
&& i
== 2) {
19206 err
= alc662_add_vol_ctl(spec
, "Center", nid
, 1);
19209 err
= alc662_add_vol_ctl(spec
, "LFE", nid
, 2);
19212 err
= alc662_add_sw_ctl(spec
, "Center", mix
, 1);
19215 err
= alc662_add_sw_ctl(spec
, "LFE", mix
, 2);
19219 const char *name
= pfx
;
19222 err
= __alc662_add_vol_ctl(spec
, name
, nid
, i
, 3);
19225 err
= __alc662_add_sw_ctl(spec
, name
, mix
, i
, 3);
19233 /* add playback controls for speaker and HP outputs */
19234 /* return DAC nid if any new DAC is assigned */
19235 static int alc662_auto_create_extra_out(struct hda_codec
*codec
, hda_nid_t pin
,
19238 struct alc_spec
*spec
= codec
->spec
;
19239 hda_nid_t nid
, mix
;
19244 nid
= alc662_look_for_dac(codec
, pin
);
19246 /* the corresponding DAC is already occupied */
19247 if (!(get_wcaps(codec
, pin
) & AC_WCAP_OUT_AMP
))
19248 return 0; /* no way */
19249 /* create a switch only */
19250 return add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
19251 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
19254 mix
= alc662_dac_to_mix(codec
, pin
, nid
);
19257 err
= alc662_add_vol_ctl(spec
, pfx
, nid
, 3);
19260 err
= alc662_add_sw_ctl(spec
, pfx
, mix
, 3);
19266 /* create playback/capture controls for input pins */
19267 #define alc662_auto_create_input_ctls \
19268 alc882_auto_create_input_ctls
19270 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
19271 hda_nid_t nid
, int pin_type
,
19275 hda_nid_t srcs
[HDA_MAX_CONNECTIONS
];
19277 alc_set_pin_output(codec
, nid
, pin_type
);
19278 /* need the manual connection? */
19279 num
= snd_hda_get_connections(codec
, nid
, srcs
, ARRAY_SIZE(srcs
));
19282 for (i
= 0; i
< num
; i
++) {
19283 if (alc662_mix_to_dac(srcs
[i
]) != dac
)
19285 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, i
);
19290 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
19292 struct alc_spec
*spec
= codec
->spec
;
19293 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
19296 for (i
= 0; i
<= HDA_SIDE
; i
++) {
19297 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
19299 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
19300 spec
->multiout
.dac_nids
[i
]);
19304 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
19306 struct alc_spec
*spec
= codec
->spec
;
19309 pin
= spec
->autocfg
.hp_pins
[0];
19311 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
19312 spec
->multiout
.hp_nid
);
19313 pin
= spec
->autocfg
.speaker_pins
[0];
19315 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
,
19316 spec
->multiout
.extra_out_nid
[0]);
19319 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19321 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
19323 struct alc_spec
*spec
= codec
->spec
;
19324 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19327 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19328 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
19329 if (alc_is_input_pin(codec
, nid
)) {
19330 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
19331 if (nid
!= ALC662_PIN_CD_NID
&&
19332 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
19333 snd_hda_codec_write(codec
, nid
, 0,
19334 AC_VERB_SET_AMP_GAIN_MUTE
,
19340 #define alc662_auto_init_input_src alc882_auto_init_input_src
19342 static int alc662_parse_auto_config(struct hda_codec
*codec
)
19344 struct alc_spec
*spec
= codec
->spec
;
19346 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
19348 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
19352 if (!spec
->autocfg
.line_outs
)
19353 return 0; /* can't find valid BIOS pin config */
19355 err
= alc662_auto_fill_dac_nids(codec
, &spec
->autocfg
);
19358 err
= alc662_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
19361 err
= alc662_auto_create_extra_out(codec
,
19362 spec
->autocfg
.speaker_pins
[0],
19367 spec
->multiout
.extra_out_nid
[0] = err
;
19368 err
= alc662_auto_create_extra_out(codec
, spec
->autocfg
.hp_pins
[0],
19373 spec
->multiout
.hp_nid
= err
;
19374 err
= alc662_auto_create_input_ctls(codec
, &spec
->autocfg
);
19378 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
19380 alc_auto_parse_digital(codec
);
19382 if (spec
->kctls
.list
)
19383 add_mixer(spec
, spec
->kctls
.list
);
19385 spec
->num_mux_defs
= 1;
19386 spec
->input_mux
= &spec
->private_imux
[0];
19388 add_verb(spec
, alc662_init_verbs
);
19389 if (codec
->vendor_id
== 0x10ec0272 || codec
->vendor_id
== 0x10ec0663 ||
19390 codec
->vendor_id
== 0x10ec0665 || codec
->vendor_id
== 0x10ec0670)
19391 add_verb(spec
, alc663_init_verbs
);
19393 if (codec
->vendor_id
== 0x10ec0272)
19394 add_verb(spec
, alc272_init_verbs
);
19396 err
= alc_auto_add_mic_boost(codec
);
19400 if (codec
->vendor_id
== 0x10ec0272 || codec
->vendor_id
== 0x10ec0663 ||
19401 codec
->vendor_id
== 0x10ec0665 || codec
->vendor_id
== 0x10ec0670)
19402 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0x21);
19404 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
19409 /* additional initialization for auto-configuration model */
19410 static void alc662_auto_init(struct hda_codec
*codec
)
19412 struct alc_spec
*spec
= codec
->spec
;
19413 alc662_auto_init_multi_out(codec
);
19414 alc662_auto_init_hp_out(codec
);
19415 alc662_auto_init_analog_input(codec
);
19416 alc662_auto_init_input_src(codec
);
19417 alc_auto_init_digital(codec
);
19418 if (spec
->unsol_event
)
19419 alc_inithook(codec
);
19422 static void alc272_fixup_mario(struct hda_codec
*codec
,
19423 const struct alc_fixup
*fix
, int action
)
19425 if (action
!= ALC_FIXUP_ACT_PROBE
)
19427 if (snd_hda_override_amp_caps(codec
, 0x2, HDA_OUTPUT
,
19428 (0x3b << AC_AMPCAP_OFFSET_SHIFT
) |
19429 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT
) |
19430 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
19431 (0 << AC_AMPCAP_MUTE_SHIFT
)))
19432 printk(KERN_WARNING
19433 "hda_codec: failed to override amp caps for NID 0x2\n");
19437 ALC662_FIXUP_ASPIRE
,
19438 ALC662_FIXUP_IDEAPAD
,
19439 ALC272_FIXUP_MARIO
,
19440 ALC662_FIXUP_CZC_P10T
,
19443 static const struct alc_fixup alc662_fixups
[] = {
19444 [ALC662_FIXUP_ASPIRE
] = {
19445 .type
= ALC_FIXUP_PINS
,
19446 .v
.pins
= (const struct alc_pincfg
[]) {
19447 { 0x15, 0x99130112 }, /* subwoofer */
19451 [ALC662_FIXUP_IDEAPAD
] = {
19452 .type
= ALC_FIXUP_PINS
,
19453 .v
.pins
= (const struct alc_pincfg
[]) {
19454 { 0x17, 0x99130112 }, /* subwoofer */
19458 [ALC272_FIXUP_MARIO
] = {
19459 .type
= ALC_FIXUP_FUNC
,
19460 .v
.func
= alc272_fixup_mario
,
19462 [ALC662_FIXUP_CZC_P10T
] = {
19463 .type
= ALC_FIXUP_VERBS
,
19464 .v
.verbs
= (const struct hda_verb
[]) {
19465 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
19471 static struct snd_pci_quirk alc662_fixup_tbl
[] = {
19472 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE
),
19473 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE
),
19474 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD
),
19475 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD
),
19476 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD
),
19477 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T
),
19481 static const struct alc_model_fixup alc662_fixup_models
[] = {
19482 {.id
= ALC272_FIXUP_MARIO
, .name
= "mario"},
19487 static int patch_alc662(struct hda_codec
*codec
)
19489 struct alc_spec
*spec
;
19490 int err
, board_config
;
19493 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
19497 codec
->spec
= spec
;
19499 alc_auto_parse_customize_define(codec
);
19501 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
19503 coef
= alc_read_coef_idx(codec
, 0);
19504 if (coef
== 0x8020 || coef
== 0x8011)
19505 alc_codec_rename(codec
, "ALC661");
19506 else if (coef
& (1 << 14) &&
19507 codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
19508 spec
->cdefine
.platform_type
== 1)
19509 alc_codec_rename(codec
, "ALC272X");
19510 else if (coef
== 0x4011)
19511 alc_codec_rename(codec
, "ALC656");
19513 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
19516 if (board_config
< 0) {
19517 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
19519 board_config
= ALC662_AUTO
;
19522 if (board_config
== ALC662_AUTO
) {
19523 alc_pick_fixup(codec
, alc662_fixup_models
,
19524 alc662_fixup_tbl
, alc662_fixups
);
19525 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
19526 /* automatic parse from the BIOS config */
19527 err
= alc662_parse_auto_config(codec
);
19533 "hda_codec: Cannot set up configuration "
19534 "from BIOS. Using base mode...\n");
19535 board_config
= ALC662_3ST_2ch_DIG
;
19539 if (has_cdefine_beep(codec
)) {
19540 err
= snd_hda_attach_beep_device(codec
, 0x1);
19547 if (board_config
!= ALC662_AUTO
)
19548 setup_preset(codec
, &alc662_presets
[board_config
]);
19550 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
19551 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
19553 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
19554 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
19556 if (!spec
->adc_nids
) {
19557 spec
->adc_nids
= alc662_adc_nids
;
19558 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
19560 if (!spec
->capsrc_nids
)
19561 spec
->capsrc_nids
= alc662_capsrc_nids
;
19563 if (!spec
->cap_mixer
)
19564 set_capture_mixer(codec
);
19566 if (has_cdefine_beep(codec
)) {
19567 switch (codec
->vendor_id
) {
19569 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
19574 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
19577 set_beep_amp(spec
, 0x0b, 0x03, HDA_INPUT
);
19581 spec
->vmaster_nid
= 0x02;
19583 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
19585 codec
->patch_ops
= alc_patch_ops
;
19586 if (board_config
== ALC662_AUTO
)
19587 spec
->init_hook
= alc662_auto_init
;
19589 alc_init_jacks(codec
);
19591 #ifdef CONFIG_SND_HDA_POWER_SAVE
19592 if (!spec
->loopback
.amplist
)
19593 spec
->loopback
.amplist
= alc662_loopbacks
;
19599 static int patch_alc888(struct hda_codec
*codec
)
19601 if ((alc_read_coef_idx(codec
, 0) & 0x00f0)==0x0030){
19602 kfree(codec
->chip_name
);
19603 if (codec
->vendor_id
== 0x10ec0887)
19604 codec
->chip_name
= kstrdup("ALC887-VD", GFP_KERNEL
);
19606 codec
->chip_name
= kstrdup("ALC888-VD", GFP_KERNEL
);
19607 if (!codec
->chip_name
) {
19611 return patch_alc662(codec
);
19613 return patch_alc882(codec
);
19619 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19620 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19621 #define alc680_modes alc260_modes
19623 static hda_nid_t alc680_dac_nids
[3] = {
19624 /* Lout1, Lout2, hp */
19628 static hda_nid_t alc680_adc_nids
[3] = {
19630 /* DMIC, MIC, Line-in*/
19635 * Analog capture ADC cgange
19637 static void alc680_rec_autoswitch(struct hda_codec
*codec
)
19639 struct alc_spec
*spec
= codec
->spec
;
19640 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19642 int type_found
= AUTO_PIN_LAST
;
19646 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19647 nid
= cfg
->inputs
[i
].pin
;
19648 if (!(snd_hda_query_pin_caps(codec
, nid
) &
19649 AC_PINCAP_PRES_DETECT
))
19651 if (snd_hda_jack_detect(codec
, nid
)) {
19652 if (cfg
->inputs
[i
].type
< type_found
) {
19653 type_found
= cfg
->inputs
[i
].type
;
19661 snd_hda_get_connections(codec
, pin_found
, &nid
, 1);
19663 if (nid
!= spec
->cur_adc
)
19664 __snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
, 1);
19665 spec
->cur_adc
= nid
;
19666 snd_hda_codec_setup_stream(codec
, nid
, spec
->cur_adc_stream_tag
, 0,
19667 spec
->cur_adc_format
);
19670 static int alc680_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
19671 struct hda_codec
*codec
,
19672 unsigned int stream_tag
,
19673 unsigned int format
,
19674 struct snd_pcm_substream
*substream
)
19676 struct alc_spec
*spec
= codec
->spec
;
19678 spec
->cur_adc
= 0x07;
19679 spec
->cur_adc_stream_tag
= stream_tag
;
19680 spec
->cur_adc_format
= format
;
19682 alc680_rec_autoswitch(codec
);
19686 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
19687 struct hda_codec
*codec
,
19688 struct snd_pcm_substream
*substream
)
19690 snd_hda_codec_cleanup_stream(codec
, 0x07);
19691 snd_hda_codec_cleanup_stream(codec
, 0x08);
19692 snd_hda_codec_cleanup_stream(codec
, 0x09);
19696 static struct hda_pcm_stream alc680_pcm_analog_auto_capture
= {
19697 .substreams
= 1, /* can be overridden */
19700 /* NID is set in alc_build_pcms */
19702 .prepare
= alc680_capture_pcm_prepare
,
19703 .cleanup
= alc680_capture_pcm_cleanup
19707 static struct snd_kcontrol_new alc680_base_mixer
[] = {
19708 /* output mixer control */
19709 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
19710 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
19711 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT
),
19712 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
19713 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT
),
19714 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
19715 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT
),
19719 static struct hda_bind_ctls alc680_bind_cap_vol
= {
19720 .ops
= &snd_hda_bind_vol
,
19722 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT
),
19723 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
19724 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
19729 static struct hda_bind_ctls alc680_bind_cap_switch
= {
19730 .ops
= &snd_hda_bind_sw
,
19732 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT
),
19733 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
19734 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
19739 static struct snd_kcontrol_new alc680_master_capture_mixer
[] = {
19740 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol
),
19741 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch
),
19746 * generic initialization of ADC, input mixers and output mixers
19748 static struct hda_verb alc680_init_verbs
[] = {
19749 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19750 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19751 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19753 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
19754 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
19755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
19756 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
19757 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
19758 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
19760 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19761 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19762 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19763 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19764 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19766 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
19767 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
19768 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
19773 /* toggle speaker-output according to the hp-jack state */
19774 static void alc680_base_setup(struct hda_codec
*codec
)
19776 struct alc_spec
*spec
= codec
->spec
;
19778 spec
->autocfg
.hp_pins
[0] = 0x16;
19779 spec
->autocfg
.speaker_pins
[0] = 0x14;
19780 spec
->autocfg
.speaker_pins
[1] = 0x15;
19781 spec
->autocfg
.num_inputs
= 2;
19782 spec
->autocfg
.inputs
[0].pin
= 0x18;
19783 spec
->autocfg
.inputs
[0].type
= AUTO_PIN_MIC
;
19784 spec
->autocfg
.inputs
[1].pin
= 0x19;
19785 spec
->autocfg
.inputs
[1].type
= AUTO_PIN_LINE_IN
;
19788 static void alc680_unsol_event(struct hda_codec
*codec
,
19791 if ((res
>> 26) == ALC880_HP_EVENT
)
19792 alc_automute_amp(codec
);
19793 if ((res
>> 26) == ALC880_MIC_EVENT
)
19794 alc680_rec_autoswitch(codec
);
19797 static void alc680_inithook(struct hda_codec
*codec
)
19799 alc_automute_amp(codec
);
19800 alc680_rec_autoswitch(codec
);
19803 /* create input playback/capture controls for the given pin */
19804 static int alc680_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
19805 const char *ctlname
, int idx
)
19823 if (spec
->multiout
.dac_nids
[0] != dac
&&
19824 spec
->multiout
.dac_nids
[1] != dac
) {
19825 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
19826 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
19831 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
19832 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
19836 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
19842 /* add playback controls from the parsed DAC table */
19843 static int alc680_auto_create_multi_out_ctls(struct alc_spec
*spec
,
19844 const struct auto_pin_cfg
*cfg
)
19849 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
19851 nid
= cfg
->line_out_pins
[0];
19854 if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
19858 err
= alc680_new_analog_output(spec
, nid
, name
, 0);
19863 nid
= cfg
->speaker_pins
[0];
19865 err
= alc680_new_analog_output(spec
, nid
, "Speaker", 0);
19869 nid
= cfg
->hp_pins
[0];
19871 err
= alc680_new_analog_output(spec
, nid
, "Headphone", 0);
19879 static void alc680_auto_set_output_and_unmute(struct hda_codec
*codec
,
19880 hda_nid_t nid
, int pin_type
)
19882 alc_set_pin_output(codec
, nid
, pin_type
);
19885 static void alc680_auto_init_multi_out(struct hda_codec
*codec
)
19887 struct alc_spec
*spec
= codec
->spec
;
19888 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[0];
19890 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
19891 alc680_auto_set_output_and_unmute(codec
, nid
, pin_type
);
19895 static void alc680_auto_init_hp_out(struct hda_codec
*codec
)
19897 struct alc_spec
*spec
= codec
->spec
;
19900 pin
= spec
->autocfg
.hp_pins
[0];
19902 alc680_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
19903 pin
= spec
->autocfg
.speaker_pins
[0];
19905 alc680_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
19908 /* pcm configuration: identical with ALC880 */
19909 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19910 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19911 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19912 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19913 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19916 * BIOS auto configuration
19918 static int alc680_parse_auto_config(struct hda_codec
*codec
)
19920 struct alc_spec
*spec
= codec
->spec
;
19922 static hda_nid_t alc680_ignore
[] = { 0 };
19924 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
19929 if (!spec
->autocfg
.line_outs
) {
19930 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
19931 spec
->multiout
.max_channels
= 2;
19932 spec
->no_analog
= 1;
19935 return 0; /* can't find valid BIOS pin config */
19937 err
= alc680_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
19941 spec
->multiout
.max_channels
= 2;
19944 /* digital only support output */
19945 alc_auto_parse_digital(codec
);
19946 if (spec
->kctls
.list
)
19947 add_mixer(spec
, spec
->kctls
.list
);
19949 add_verb(spec
, alc680_init_verbs
);
19951 err
= alc_auto_add_mic_boost(codec
);
19958 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19960 /* init callback for auto-configuration model -- overriding the default init */
19961 static void alc680_auto_init(struct hda_codec
*codec
)
19963 struct alc_spec
*spec
= codec
->spec
;
19964 alc680_auto_init_multi_out(codec
);
19965 alc680_auto_init_hp_out(codec
);
19966 alc680_auto_init_analog_input(codec
);
19967 alc_auto_init_digital(codec
);
19968 if (spec
->unsol_event
)
19969 alc_inithook(codec
);
19973 * configuration and preset
19975 static const char * const alc680_models
[ALC680_MODEL_LAST
] = {
19976 [ALC680_BASE
] = "base",
19977 [ALC680_AUTO
] = "auto",
19980 static struct snd_pci_quirk alc680_cfg_tbl
[] = {
19981 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE
),
19985 static struct alc_config_preset alc680_presets
[] = {
19987 .mixers
= { alc680_base_mixer
},
19988 .cap_mixer
= alc680_master_capture_mixer
,
19989 .init_verbs
= { alc680_init_verbs
},
19990 .num_dacs
= ARRAY_SIZE(alc680_dac_nids
),
19991 .dac_nids
= alc680_dac_nids
,
19992 .dig_out_nid
= ALC680_DIGOUT_NID
,
19993 .num_channel_mode
= ARRAY_SIZE(alc680_modes
),
19994 .channel_mode
= alc680_modes
,
19995 .unsol_event
= alc680_unsol_event
,
19996 .setup
= alc680_base_setup
,
19997 .init_hook
= alc680_inithook
,
20002 static int patch_alc680(struct hda_codec
*codec
)
20004 struct alc_spec
*spec
;
20008 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
20012 codec
->spec
= spec
;
20014 board_config
= snd_hda_check_board_config(codec
, ALC680_MODEL_LAST
,
20018 if (board_config
< 0 || board_config
>= ALC680_MODEL_LAST
) {
20019 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
20021 board_config
= ALC680_AUTO
;
20024 if (board_config
== ALC680_AUTO
) {
20025 /* automatic parse from the BIOS config */
20026 err
= alc680_parse_auto_config(codec
);
20032 "hda_codec: Cannot set up configuration "
20033 "from BIOS. Using base mode...\n");
20034 board_config
= ALC680_BASE
;
20038 if (board_config
!= ALC680_AUTO
)
20039 setup_preset(codec
, &alc680_presets
[board_config
]);
20041 spec
->stream_analog_playback
= &alc680_pcm_analog_playback
;
20042 spec
->stream_analog_capture
= &alc680_pcm_analog_auto_capture
;
20043 spec
->stream_digital_playback
= &alc680_pcm_digital_playback
;
20044 spec
->stream_digital_capture
= &alc680_pcm_digital_capture
;
20046 if (!spec
->adc_nids
) {
20047 spec
->adc_nids
= alc680_adc_nids
;
20048 spec
->num_adc_nids
= ARRAY_SIZE(alc680_adc_nids
);
20051 if (!spec
->cap_mixer
)
20052 set_capture_mixer(codec
);
20054 spec
->vmaster_nid
= 0x02;
20056 codec
->patch_ops
= alc_patch_ops
;
20057 if (board_config
== ALC680_AUTO
)
20058 spec
->init_hook
= alc680_auto_init
;
20066 static struct hda_codec_preset snd_hda_preset_realtek
[] = {
20067 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
20068 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
20069 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
20070 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
20071 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
20072 { .id
= 0x10ec0270, .name
= "ALC270", .patch
= patch_alc269
},
20073 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
20074 { .id
= 0x10ec0275, .name
= "ALC275", .patch
= patch_alc269
},
20075 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
20076 .patch
= patch_alc861
},
20077 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
20078 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
20079 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
20080 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
20081 .patch
= patch_alc882
},
20082 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
20083 .patch
= patch_alc662
},
20084 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
20085 { .id
= 0x10ec0665, .name
= "ALC665", .patch
= patch_alc662
},
20086 { .id
= 0x10ec0670, .name
= "ALC670", .patch
= patch_alc662
},
20087 { .id
= 0x10ec0680, .name
= "ALC680", .patch
= patch_alc680
},
20088 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
20089 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
20090 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc882
},
20091 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
20092 .patch
= patch_alc882
},
20093 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
20094 .patch
= patch_alc882
},
20095 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
20096 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc888
},
20097 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
20098 .patch
= patch_alc882
},
20099 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc888
},
20100 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc882
},
20101 { .id
= 0x10ec0892, .name
= "ALC892", .patch
= patch_alc662
},
20102 {} /* terminator */
20105 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20107 MODULE_LICENSE("GPL");
20108 MODULE_DESCRIPTION("Realtek HD-audio codec");
20110 static struct hda_codec_preset_list realtek_list
= {
20111 .preset
= snd_hda_preset_realtek
,
20112 .owner
= THIS_MODULE
,
20115 static int __init
patch_realtek_init(void)
20117 return snd_hda_add_codec_preset(&realtek_list
);
20120 static void __exit
patch_realtek_exit(void)
20122 snd_hda_delete_codec_preset(&realtek_list
);
20125 module_init(patch_realtek_init
)
20126 module_exit(patch_realtek_exit
)