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
;
288 struct snd_jack
*jack
;
291 #define MUX_IDX_UNDEF ((unsigned char)-1)
293 struct alc_customize_define
{
294 unsigned int sku_cfg
;
295 unsigned char port_connectivity
;
296 unsigned char check_sum
;
297 unsigned char customization
;
298 unsigned char external_amp
;
299 unsigned int enable_pcbeep
:1;
300 unsigned int platform_type
:1;
302 unsigned int override
:1;
303 unsigned int fixup
:1; /* Means that this sku is set by driver, not read from hw */
307 /* codec parameterization */
308 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
309 unsigned int num_mixers
;
310 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
311 unsigned int beep_amp
; /* beep amp value, set via set_beep_amp() */
313 const struct hda_verb
*init_verbs
[10]; /* initialization verbs
317 unsigned int num_init_verbs
;
319 char stream_name_analog
[32]; /* analog PCM stream */
320 struct hda_pcm_stream
*stream_analog_playback
;
321 struct hda_pcm_stream
*stream_analog_capture
;
322 struct hda_pcm_stream
*stream_analog_alt_playback
;
323 struct hda_pcm_stream
*stream_analog_alt_capture
;
325 char stream_name_digital
[32]; /* digital PCM stream */
326 struct hda_pcm_stream
*stream_digital_playback
;
327 struct hda_pcm_stream
*stream_digital_capture
;
330 struct hda_multi_out multiout
; /* playback set-up
331 * max_channels, dacs must be set
332 * dig_out_nid and hp_nid are optional
334 hda_nid_t alt_dac_nid
;
335 hda_nid_t slave_dig_outs
[3]; /* optional - for auto-parsing */
339 unsigned int num_adc_nids
;
341 hda_nid_t
*capsrc_nids
;
342 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
344 /* capture setup for dynamic dual-adc switch */
345 unsigned int cur_adc_idx
;
347 unsigned int cur_adc_stream_tag
;
348 unsigned int cur_adc_format
;
351 unsigned int num_mux_defs
;
352 const struct hda_input_mux
*input_mux
;
353 unsigned int cur_mux
[3];
354 struct alc_mic_route ext_mic
;
355 struct alc_mic_route int_mic
;
358 const struct hda_channel_mode
*channel_mode
;
359 int num_channel_mode
;
361 int const_channel_count
;
362 int ext_channel_count
;
364 /* PCM information */
365 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
368 struct snd_array jacks
;
370 /* dynamic controls, init_verbs and input_mux */
371 struct auto_pin_cfg autocfg
;
372 struct alc_customize_define cdefine
;
373 struct snd_array kctls
;
374 struct hda_input_mux private_imux
[3];
375 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
376 hda_nid_t private_adc_nids
[AUTO_CFG_MAX_OUTS
];
377 hda_nid_t private_capsrc_nids
[AUTO_CFG_MAX_OUTS
];
380 void (*init_hook
)(struct hda_codec
*codec
);
381 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
382 #ifdef CONFIG_SND_HDA_POWER_SAVE
383 void (*power_hook
)(struct hda_codec
*codec
);
386 /* for pin sensing */
387 unsigned int sense_updated
: 1;
388 unsigned int jack_present
: 1;
389 unsigned int master_sw
: 1;
390 unsigned int auto_mic
:1;
393 unsigned int no_analog
:1; /* digital I/O only */
394 unsigned int dual_adc_switch
:1; /* switch ADCs (for ALC275) */
396 int codec_variant
; /* flag for other variants */
398 /* for virtual master */
399 hda_nid_t vmaster_nid
;
400 #ifdef CONFIG_SND_HDA_POWER_SAVE
401 struct hda_loopback_check loopback
;
406 unsigned int pll_coef_idx
, pll_coef_bit
;
410 * configuration template - to be copied to the spec instance
412 struct alc_config_preset
{
413 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
416 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
417 const struct hda_verb
*init_verbs
[5];
418 unsigned int num_dacs
;
420 hda_nid_t dig_out_nid
; /* optional */
421 hda_nid_t hp_nid
; /* optional */
422 hda_nid_t
*slave_dig_outs
;
423 unsigned int num_adc_nids
;
425 hda_nid_t
*capsrc_nids
;
426 hda_nid_t dig_in_nid
;
427 unsigned int num_channel_mode
;
428 const struct hda_channel_mode
*channel_mode
;
430 int const_channel_count
;
431 unsigned int num_mux_defs
;
432 const struct hda_input_mux
*input_mux
;
433 void (*unsol_event
)(struct hda_codec
*, unsigned int);
434 void (*setup
)(struct hda_codec
*);
435 void (*init_hook
)(struct hda_codec
*);
436 #ifdef CONFIG_SND_HDA_POWER_SAVE
437 struct hda_amp_list
*loopbacks
;
438 void (*power_hook
)(struct hda_codec
*codec
);
446 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
447 struct snd_ctl_elem_info
*uinfo
)
449 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
450 struct alc_spec
*spec
= codec
->spec
;
451 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
452 if (mux_idx
>= spec
->num_mux_defs
)
454 if (!spec
->input_mux
[mux_idx
].num_items
&& mux_idx
> 0)
456 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
459 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
460 struct snd_ctl_elem_value
*ucontrol
)
462 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
463 struct alc_spec
*spec
= codec
->spec
;
464 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
466 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
470 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
471 struct snd_ctl_elem_value
*ucontrol
)
473 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
474 struct alc_spec
*spec
= codec
->spec
;
475 const struct hda_input_mux
*imux
;
476 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
477 unsigned int mux_idx
;
478 hda_nid_t nid
= spec
->capsrc_nids
?
479 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
482 mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
483 imux
= &spec
->input_mux
[mux_idx
];
484 if (!imux
->num_items
&& mux_idx
> 0)
485 imux
= &spec
->input_mux
[0];
487 type
= get_wcaps_type(get_wcaps(codec
, nid
));
488 if (type
== AC_WID_AUD_MIX
) {
489 /* Matrix-mixer style (e.g. ALC882) */
490 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
493 idx
= ucontrol
->value
.enumerated
.item
[0];
494 if (idx
>= imux
->num_items
)
495 idx
= imux
->num_items
- 1;
498 for (i
= 0; i
< imux
->num_items
; i
++) {
499 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
500 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
501 imux
->items
[i
].index
,
507 /* MUX style (e.g. ALC880) */
508 return snd_hda_input_mux_put(codec
, imux
, ucontrol
, nid
,
509 &spec
->cur_mux
[adc_idx
]);
514 * channel mode setting
516 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
517 struct snd_ctl_elem_info
*uinfo
)
519 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
520 struct alc_spec
*spec
= codec
->spec
;
521 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
522 spec
->num_channel_mode
);
525 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
526 struct snd_ctl_elem_value
*ucontrol
)
528 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
529 struct alc_spec
*spec
= codec
->spec
;
530 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
531 spec
->num_channel_mode
,
532 spec
->ext_channel_count
);
535 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
536 struct snd_ctl_elem_value
*ucontrol
)
538 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
539 struct alc_spec
*spec
= codec
->spec
;
540 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
541 spec
->num_channel_mode
,
542 &spec
->ext_channel_count
);
543 if (err
>= 0 && !spec
->const_channel_count
) {
544 spec
->multiout
.max_channels
= spec
->ext_channel_count
;
545 if (spec
->need_dac_fix
)
546 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
552 * Control the mode of pin widget settings via the mixer. "pc" is used
553 * instead of "%" to avoid consequences of accidently treating the % as
554 * being part of a format specifier. Maximum allowed length of a value is
555 * 63 characters plus NULL terminator.
557 * Note: some retasking pin complexes seem to ignore requests for input
558 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
559 * are requested. Therefore order this list so that this behaviour will not
560 * cause problems when mixer clients move through the enum sequentially.
561 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
564 static char *alc_pin_mode_names
[] = {
565 "Mic 50pc bias", "Mic 80pc bias",
566 "Line in", "Line out", "Headphone out",
568 static unsigned char alc_pin_mode_values
[] = {
569 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
571 /* The control can present all 5 options, or it can limit the options based
572 * in the pin being assumed to be exclusively an input or an output pin. In
573 * addition, "input" pins may or may not process the mic bias option
574 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
575 * accept requests for bias as of chip versions up to March 2006) and/or
576 * wiring in the computer.
578 #define ALC_PIN_DIR_IN 0x00
579 #define ALC_PIN_DIR_OUT 0x01
580 #define ALC_PIN_DIR_INOUT 0x02
581 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
582 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
584 /* Info about the pin modes supported by the different pin direction modes.
585 * For each direction the minimum and maximum values are given.
587 static signed char alc_pin_mode_dir_info
[5][2] = {
588 { 0, 2 }, /* ALC_PIN_DIR_IN */
589 { 3, 4 }, /* ALC_PIN_DIR_OUT */
590 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
591 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
592 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
594 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
595 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
596 #define alc_pin_mode_n_items(_dir) \
597 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
599 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
600 struct snd_ctl_elem_info
*uinfo
)
602 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
603 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
605 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
607 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
609 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
610 item_num
= alc_pin_mode_min(dir
);
611 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
615 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
616 struct snd_ctl_elem_value
*ucontrol
)
619 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
620 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
621 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
622 long *valp
= ucontrol
->value
.integer
.value
;
623 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
624 AC_VERB_GET_PIN_WIDGET_CONTROL
,
627 /* Find enumerated value for current pinctl setting */
628 i
= alc_pin_mode_min(dir
);
629 while (i
<= alc_pin_mode_max(dir
) && alc_pin_mode_values
[i
] != pinctl
)
631 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
635 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
636 struct snd_ctl_elem_value
*ucontrol
)
639 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
640 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
641 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
642 long val
= *ucontrol
->value
.integer
.value
;
643 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
644 AC_VERB_GET_PIN_WIDGET_CONTROL
,
647 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
648 val
= alc_pin_mode_min(dir
);
650 change
= pinctl
!= alc_pin_mode_values
[val
];
652 /* Set pin mode to that requested */
653 snd_hda_codec_write_cache(codec
, nid
, 0,
654 AC_VERB_SET_PIN_WIDGET_CONTROL
,
655 alc_pin_mode_values
[val
]);
657 /* Also enable the retasking pin's input/output as required
658 * for the requested pin mode. Enum values of 2 or less are
661 * Dynamically switching the input/output buffers probably
662 * reduces noise slightly (particularly on input) so we'll
663 * do it. However, having both input and output buffers
664 * enabled simultaneously doesn't seem to be problematic if
665 * this turns out to be necessary in the future.
668 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
669 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
670 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
673 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
674 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
675 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
682 #define ALC_PIN_MODE(xname, nid, dir) \
683 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
684 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
685 .info = alc_pin_mode_info, \
686 .get = alc_pin_mode_get, \
687 .put = alc_pin_mode_put, \
688 .private_value = nid | (dir<<16) }
690 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
691 * together using a mask with more than one bit set. This control is
692 * currently used only by the ALC260 test model. At this stage they are not
693 * needed for any "production" models.
695 #ifdef CONFIG_SND_DEBUG
696 #define alc_gpio_data_info snd_ctl_boolean_mono_info
698 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
699 struct snd_ctl_elem_value
*ucontrol
)
701 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
702 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
703 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
704 long *valp
= ucontrol
->value
.integer
.value
;
705 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
706 AC_VERB_GET_GPIO_DATA
, 0x00);
708 *valp
= (val
& mask
) != 0;
711 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
712 struct snd_ctl_elem_value
*ucontrol
)
715 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
716 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
717 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
718 long val
= *ucontrol
->value
.integer
.value
;
719 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
720 AC_VERB_GET_GPIO_DATA
,
723 /* Set/unset the masked GPIO bit(s) as needed */
724 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
729 snd_hda_codec_write_cache(codec
, nid
, 0,
730 AC_VERB_SET_GPIO_DATA
, gpio_data
);
734 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
735 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
736 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
737 .info = alc_gpio_data_info, \
738 .get = alc_gpio_data_get, \
739 .put = alc_gpio_data_put, \
740 .private_value = nid | (mask<<16) }
741 #endif /* CONFIG_SND_DEBUG */
743 /* A switch control to allow the enabling of the digital IO pins on the
744 * ALC260. This is incredibly simplistic; the intention of this control is
745 * to provide something in the test model allowing digital outputs to be
746 * identified if present. If models are found which can utilise these
747 * outputs a more complete mixer control can be devised for those models if
750 #ifdef CONFIG_SND_DEBUG
751 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
753 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
754 struct snd_ctl_elem_value
*ucontrol
)
756 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
757 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
758 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
759 long *valp
= ucontrol
->value
.integer
.value
;
760 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
761 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
763 *valp
= (val
& mask
) != 0;
766 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
767 struct snd_ctl_elem_value
*ucontrol
)
770 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
771 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
772 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
773 long val
= *ucontrol
->value
.integer
.value
;
774 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
775 AC_VERB_GET_DIGI_CONVERT_1
,
778 /* Set/unset the masked control bit(s) as needed */
779 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
784 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
789 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
790 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
791 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
792 .info = alc_spdif_ctrl_info, \
793 .get = alc_spdif_ctrl_get, \
794 .put = alc_spdif_ctrl_put, \
795 .private_value = nid | (mask<<16) }
796 #endif /* CONFIG_SND_DEBUG */
798 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
799 * Again, this is only used in the ALC26x test models to help identify when
800 * the EAPD line must be asserted for features to work.
802 #ifdef CONFIG_SND_DEBUG
803 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
805 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
806 struct snd_ctl_elem_value
*ucontrol
)
808 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
809 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
810 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
811 long *valp
= ucontrol
->value
.integer
.value
;
812 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
813 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
815 *valp
= (val
& mask
) != 0;
819 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
820 struct snd_ctl_elem_value
*ucontrol
)
823 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
824 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
825 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
826 long val
= *ucontrol
->value
.integer
.value
;
827 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
828 AC_VERB_GET_EAPD_BTLENABLE
,
831 /* Set/unset the masked control bit(s) as needed */
832 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
837 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
843 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
844 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
845 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
846 .info = alc_eapd_ctrl_info, \
847 .get = alc_eapd_ctrl_get, \
848 .put = alc_eapd_ctrl_put, \
849 .private_value = nid | (mask<<16) }
850 #endif /* CONFIG_SND_DEBUG */
853 * set up the input pin config (depending on the given auto-pin type)
855 static void alc_set_input_pin(struct hda_codec
*codec
, hda_nid_t nid
,
858 unsigned int val
= PIN_IN
;
860 if (auto_pin_type
== AUTO_PIN_MIC
) {
863 oldval
= snd_hda_codec_read(codec
, nid
, 0,
864 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
865 pincap
= snd_hda_query_pin_caps(codec
, nid
);
866 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
867 /* if the default pin setup is vref50, we give it priority */
868 if ((pincap
& AC_PINCAP_VREF_80
) && oldval
!= PIN_VREF50
)
870 else if (pincap
& AC_PINCAP_VREF_50
)
872 else if (pincap
& AC_PINCAP_VREF_100
)
874 else if (pincap
& AC_PINCAP_VREF_GRD
)
877 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, val
);
880 static void alc_fixup_autocfg_pin_nums(struct hda_codec
*codec
)
882 struct alc_spec
*spec
= codec
->spec
;
883 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
885 if (!cfg
->line_outs
) {
886 while (cfg
->line_outs
< AUTO_CFG_MAX_OUTS
&&
887 cfg
->line_out_pins
[cfg
->line_outs
])
890 if (!cfg
->speaker_outs
) {
891 while (cfg
->speaker_outs
< AUTO_CFG_MAX_OUTS
&&
892 cfg
->speaker_pins
[cfg
->speaker_outs
])
896 while (cfg
->hp_outs
< AUTO_CFG_MAX_OUTS
&&
897 cfg
->hp_pins
[cfg
->hp_outs
])
904 static void add_mixer(struct alc_spec
*spec
, struct snd_kcontrol_new
*mix
)
906 if (snd_BUG_ON(spec
->num_mixers
>= ARRAY_SIZE(spec
->mixers
)))
908 spec
->mixers
[spec
->num_mixers
++] = mix
;
911 static void add_verb(struct alc_spec
*spec
, const struct hda_verb
*verb
)
913 if (snd_BUG_ON(spec
->num_init_verbs
>= ARRAY_SIZE(spec
->init_verbs
)))
915 spec
->init_verbs
[spec
->num_init_verbs
++] = verb
;
919 * set up from the preset table
921 static void setup_preset(struct hda_codec
*codec
,
922 const struct alc_config_preset
*preset
)
924 struct alc_spec
*spec
= codec
->spec
;
927 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
928 add_mixer(spec
, preset
->mixers
[i
]);
929 spec
->cap_mixer
= preset
->cap_mixer
;
930 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
932 add_verb(spec
, preset
->init_verbs
[i
]);
934 spec
->channel_mode
= preset
->channel_mode
;
935 spec
->num_channel_mode
= preset
->num_channel_mode
;
936 spec
->need_dac_fix
= preset
->need_dac_fix
;
937 spec
->const_channel_count
= preset
->const_channel_count
;
939 if (preset
->const_channel_count
)
940 spec
->multiout
.max_channels
= preset
->const_channel_count
;
942 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
943 spec
->ext_channel_count
= spec
->channel_mode
[0].channels
;
945 spec
->multiout
.num_dacs
= preset
->num_dacs
;
946 spec
->multiout
.dac_nids
= preset
->dac_nids
;
947 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
948 spec
->multiout
.slave_dig_outs
= preset
->slave_dig_outs
;
949 spec
->multiout
.hp_nid
= preset
->hp_nid
;
951 spec
->num_mux_defs
= preset
->num_mux_defs
;
952 if (!spec
->num_mux_defs
)
953 spec
->num_mux_defs
= 1;
954 spec
->input_mux
= preset
->input_mux
;
956 spec
->num_adc_nids
= preset
->num_adc_nids
;
957 spec
->adc_nids
= preset
->adc_nids
;
958 spec
->capsrc_nids
= preset
->capsrc_nids
;
959 spec
->dig_in_nid
= preset
->dig_in_nid
;
961 spec
->unsol_event
= preset
->unsol_event
;
962 spec
->init_hook
= preset
->init_hook
;
963 #ifdef CONFIG_SND_HDA_POWER_SAVE
964 spec
->power_hook
= preset
->power_hook
;
965 spec
->loopback
.amplist
= preset
->loopbacks
;
969 preset
->setup(codec
);
971 alc_fixup_autocfg_pin_nums(codec
);
974 /* Enable GPIO mask and set output */
975 static struct hda_verb alc_gpio1_init_verbs
[] = {
976 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
977 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
978 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
982 static struct hda_verb alc_gpio2_init_verbs
[] = {
983 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
984 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
985 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
989 static struct hda_verb alc_gpio3_init_verbs
[] = {
990 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
991 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
992 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
997 * Fix hardware PLL issue
998 * On some codecs, the analog PLL gating control must be off while
999 * the default value is 1.
1001 static void alc_fix_pll(struct hda_codec
*codec
)
1003 struct alc_spec
*spec
= codec
->spec
;
1008 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
1009 spec
->pll_coef_idx
);
1010 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
1011 AC_VERB_GET_PROC_COEF
, 0);
1012 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
1013 spec
->pll_coef_idx
);
1014 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
1015 val
& ~(1 << spec
->pll_coef_bit
));
1018 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
1019 unsigned int coef_idx
, unsigned int coef_bit
)
1021 struct alc_spec
*spec
= codec
->spec
;
1022 spec
->pll_nid
= nid
;
1023 spec
->pll_coef_idx
= coef_idx
;
1024 spec
->pll_coef_bit
= coef_bit
;
1028 #ifdef CONFIG_SND_HDA_INPUT_JACK
1029 static void alc_free_jack_priv(struct snd_jack
*jack
)
1031 struct alc_jack
*jacks
= jack
->private_data
;
1036 static int alc_add_jack(struct hda_codec
*codec
,
1037 hda_nid_t nid
, int type
)
1039 struct alc_spec
*spec
;
1040 struct alc_jack
*jack
;
1045 snd_array_init(&spec
->jacks
, sizeof(*jack
), 32);
1046 jack
= snd_array_new(&spec
->jacks
);
1052 name
= (type
== SND_JACK_HEADPHONE
) ? "Headphone" : "Mic" ;
1054 err
= snd_jack_new(codec
->bus
->card
, name
, type
, &jack
->jack
);
1057 jack
->jack
->private_data
= jack
;
1058 jack
->jack
->private_free
= alc_free_jack_priv
;
1062 static void alc_report_jack(struct hda_codec
*codec
, hda_nid_t nid
)
1064 struct alc_spec
*spec
= codec
->spec
;
1065 struct alc_jack
*jacks
= spec
->jacks
.list
;
1069 for (i
= 0; i
< spec
->jacks
.used
; i
++) {
1070 if (jacks
->nid
== nid
) {
1071 unsigned int present
;
1072 present
= snd_hda_jack_detect(codec
, nid
);
1074 present
= (present
) ? jacks
->type
: 0;
1076 snd_jack_report(jacks
->jack
, present
);
1083 static int alc_init_jacks(struct hda_codec
*codec
)
1085 struct alc_spec
*spec
= codec
->spec
;
1087 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
1088 unsigned int mic_nid
= spec
->ext_mic
.pin
;
1091 err
= alc_add_jack(codec
, hp_nid
, SND_JACK_HEADPHONE
);
1094 alc_report_jack(codec
, hp_nid
);
1098 err
= alc_add_jack(codec
, mic_nid
, SND_JACK_MICROPHONE
);
1101 alc_report_jack(codec
, mic_nid
);
1107 static inline void alc_report_jack(struct hda_codec
*codec
, hda_nid_t nid
)
1111 static inline int alc_init_jacks(struct hda_codec
*codec
)
1117 static void alc_automute_speaker(struct hda_codec
*codec
, int pinctl
)
1119 struct alc_spec
*spec
= codec
->spec
;
1124 spec
->jack_present
= 0;
1125 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.hp_pins
); i
++) {
1126 nid
= spec
->autocfg
.hp_pins
[i
];
1129 if (snd_hda_jack_detect(codec
, nid
)) {
1130 spec
->jack_present
= 1;
1133 alc_report_jack(codec
, spec
->autocfg
.hp_pins
[i
]);
1136 mute
= spec
->jack_present
? HDA_AMP_MUTE
: 0;
1137 /* Toggle internal speakers muting */
1138 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
1139 nid
= spec
->autocfg
.speaker_pins
[i
];
1143 snd_hda_codec_write(codec
, nid
, 0,
1144 AC_VERB_SET_PIN_WIDGET_CONTROL
,
1145 spec
->jack_present
? 0 : PIN_OUT
);
1147 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
1148 HDA_AMP_MUTE
, mute
);
1153 static void alc_automute_pin(struct hda_codec
*codec
)
1155 alc_automute_speaker(codec
, 1);
1158 static int get_connection_index(struct hda_codec
*codec
, hda_nid_t mux
,
1161 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
1164 nums
= snd_hda_get_connections(codec
, mux
, conn
, ARRAY_SIZE(conn
));
1165 for (i
= 0; i
< nums
; i
++)
1171 /* switch the current ADC according to the jack state */
1172 static void alc_dual_mic_adc_auto_switch(struct hda_codec
*codec
)
1174 struct alc_spec
*spec
= codec
->spec
;
1175 unsigned int present
;
1178 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1180 spec
->cur_adc_idx
= 1;
1182 spec
->cur_adc_idx
= 0;
1183 new_adc
= spec
->adc_nids
[spec
->cur_adc_idx
];
1184 if (spec
->cur_adc
&& spec
->cur_adc
!= new_adc
) {
1185 /* stream is running, let's swap the current ADC */
1186 __snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
, 1);
1187 spec
->cur_adc
= new_adc
;
1188 snd_hda_codec_setup_stream(codec
, new_adc
,
1189 spec
->cur_adc_stream_tag
, 0,
1190 spec
->cur_adc_format
);
1194 static void alc_mic_automute(struct hda_codec
*codec
)
1196 struct alc_spec
*spec
= codec
->spec
;
1197 struct alc_mic_route
*dead
, *alive
;
1198 unsigned int present
, type
;
1201 if (!spec
->auto_mic
)
1203 if (!spec
->int_mic
.pin
|| !spec
->ext_mic
.pin
)
1205 if (snd_BUG_ON(!spec
->adc_nids
))
1208 if (spec
->dual_adc_switch
) {
1209 alc_dual_mic_adc_auto_switch(codec
);
1213 cap_nid
= spec
->capsrc_nids
? spec
->capsrc_nids
[0] : spec
->adc_nids
[0];
1215 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1217 alive
= &spec
->ext_mic
;
1218 dead
= &spec
->int_mic
;
1220 alive
= &spec
->int_mic
;
1221 dead
= &spec
->ext_mic
;
1224 type
= get_wcaps_type(get_wcaps(codec
, cap_nid
));
1225 if (type
== AC_WID_AUD_MIX
) {
1226 /* Matrix-mixer style (e.g. ALC882) */
1227 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1230 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1232 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
1234 /* MUX style (e.g. ALC880) */
1235 snd_hda_codec_write_cache(codec
, cap_nid
, 0,
1236 AC_VERB_SET_CONNECT_SEL
,
1239 alc_report_jack(codec
, spec
->ext_mic
.pin
);
1241 /* FIXME: analog mixer */
1244 /* unsolicited event for HP jack sensing */
1245 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1247 if (codec
->vendor_id
== 0x10ec0880)
1252 case ALC880_HP_EVENT
:
1253 alc_automute_pin(codec
);
1255 case ALC880_MIC_EVENT
:
1256 alc_mic_automute(codec
);
1261 static void alc_inithook(struct hda_codec
*codec
)
1263 alc_automute_pin(codec
);
1264 alc_mic_automute(codec
);
1267 /* additional initialization for ALC888 variants */
1268 static void alc888_coef_init(struct hda_codec
*codec
)
1272 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
1273 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1274 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1275 if ((tmp
& 0xf0) == 0x20)
1277 snd_hda_codec_read(codec
, 0x20, 0,
1278 AC_VERB_SET_PROC_COEF
, 0x830);
1281 snd_hda_codec_read(codec
, 0x20, 0,
1282 AC_VERB_SET_PROC_COEF
, 0x3030);
1285 static void alc889_coef_init(struct hda_codec
*codec
)
1289 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1290 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1291 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1292 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
, tmp
|0x2010);
1295 /* turn on/off EAPD control (only if available) */
1296 static void set_eapd(struct hda_codec
*codec
, hda_nid_t nid
, int on
)
1298 if (get_wcaps_type(get_wcaps(codec
, nid
)) != AC_WID_PIN
)
1300 if (snd_hda_query_pin_caps(codec
, nid
) & AC_PINCAP_EAPD
)
1301 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
1305 static void alc_auto_init_amp(struct hda_codec
*codec
, int type
)
1310 case ALC_INIT_GPIO1
:
1311 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
1313 case ALC_INIT_GPIO2
:
1314 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
1316 case ALC_INIT_GPIO3
:
1317 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
1319 case ALC_INIT_DEFAULT
:
1320 switch (codec
->vendor_id
) {
1322 set_eapd(codec
, 0x0f, 1);
1323 set_eapd(codec
, 0x10, 1);
1336 set_eapd(codec
, 0x14, 1);
1337 set_eapd(codec
, 0x15, 1);
1340 switch (codec
->vendor_id
) {
1342 snd_hda_codec_write(codec
, 0x1a, 0,
1343 AC_VERB_SET_COEF_INDEX
, 7);
1344 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
1345 AC_VERB_GET_PROC_COEF
, 0);
1346 snd_hda_codec_write(codec
, 0x1a, 0,
1347 AC_VERB_SET_COEF_INDEX
, 7);
1348 snd_hda_codec_write(codec
, 0x1a, 0,
1349 AC_VERB_SET_PROC_COEF
,
1359 alc889_coef_init(codec
);
1362 alc888_coef_init(codec
);
1364 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1367 snd_hda_codec_write(codec
, 0x20, 0,
1368 AC_VERB_SET_COEF_INDEX
, 7);
1369 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1370 AC_VERB_GET_PROC_COEF
, 0);
1371 snd_hda_codec_write(codec
, 0x20, 0,
1372 AC_VERB_SET_COEF_INDEX
, 7);
1373 snd_hda_codec_write(codec
, 0x20, 0,
1374 AC_VERB_SET_PROC_COEF
,
1383 static void alc_init_auto_hp(struct hda_codec
*codec
)
1385 struct alc_spec
*spec
= codec
->spec
;
1386 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1389 if (!cfg
->hp_pins
[0]) {
1390 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
)
1394 if (!cfg
->speaker_pins
[0]) {
1395 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
)
1397 memcpy(cfg
->speaker_pins
, cfg
->line_out_pins
,
1398 sizeof(cfg
->speaker_pins
));
1399 cfg
->speaker_outs
= cfg
->line_outs
;
1402 if (!cfg
->hp_pins
[0]) {
1403 memcpy(cfg
->hp_pins
, cfg
->line_out_pins
,
1404 sizeof(cfg
->hp_pins
));
1405 cfg
->hp_outs
= cfg
->line_outs
;
1408 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
1409 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1411 snd_hda_codec_write_cache(codec
, cfg
->hp_pins
[i
], 0,
1412 AC_VERB_SET_UNSOLICITED_ENABLE
,
1413 AC_USRSP_EN
| ALC880_HP_EVENT
);
1415 spec
->unsol_event
= alc_sku_unsol_event
;
1418 static void alc_init_auto_mic(struct hda_codec
*codec
)
1420 struct alc_spec
*spec
= codec
->spec
;
1421 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1422 hda_nid_t fixed
, ext
;
1425 /* there must be only two mic inputs exclusively */
1426 for (i
= 0; i
< cfg
->num_inputs
; i
++)
1427 if (cfg
->inputs
[i
].type
>= AUTO_PIN_LINE_IN
)
1431 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
1432 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
1433 unsigned int defcfg
;
1434 defcfg
= snd_hda_codec_get_pincfg(codec
, nid
);
1435 switch (snd_hda_get_input_pin_attr(defcfg
)) {
1436 case INPUT_PIN_ATTR_INT
:
1438 return; /* already occupied */
1441 case INPUT_PIN_ATTR_UNUSED
:
1442 return; /* invalid entry */
1445 return; /* already occupied */
1452 if (!(get_wcaps(codec
, ext
) & AC_WCAP_UNSOL_CAP
))
1453 return; /* no unsol support */
1454 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1456 spec
->ext_mic
.pin
= ext
;
1457 spec
->int_mic
.pin
= fixed
;
1458 spec
->ext_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1459 spec
->int_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1461 snd_hda_codec_write_cache(codec
, spec
->ext_mic
.pin
, 0,
1462 AC_VERB_SET_UNSOLICITED_ENABLE
,
1463 AC_USRSP_EN
| ALC880_MIC_EVENT
);
1464 spec
->unsol_event
= alc_sku_unsol_event
;
1467 /* Could be any non-zero and even value. When used as fixup, tells
1468 * the driver to ignore any present sku defines.
1470 #define ALC_FIXUP_SKU_IGNORE (2)
1472 static int alc_auto_parse_customize_define(struct hda_codec
*codec
)
1474 unsigned int ass
, tmp
, i
;
1476 struct alc_spec
*spec
= codec
->spec
;
1478 spec
->cdefine
.enable_pcbeep
= 1; /* assume always enabled */
1480 if (spec
->cdefine
.fixup
) {
1481 ass
= spec
->cdefine
.sku_cfg
;
1482 if (ass
== ALC_FIXUP_SKU_IGNORE
)
1487 ass
= codec
->subsystem_id
& 0xffff;
1488 if (ass
!= codec
->bus
->pci
->subsystem_device
&& (ass
& 1))
1492 if (codec
->vendor_id
== 0x10ec0260)
1494 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1497 printk(KERN_INFO
"hda_codec: %s: SKU not ready 0x%08x\n",
1498 codec
->chip_name
, ass
);
1504 for (i
= 1; i
< 16; i
++) {
1508 if (((ass
>> 16) & 0xf) != tmp
)
1511 spec
->cdefine
.port_connectivity
= ass
>> 30;
1512 spec
->cdefine
.enable_pcbeep
= (ass
& 0x100000) >> 20;
1513 spec
->cdefine
.check_sum
= (ass
>> 16) & 0xf;
1514 spec
->cdefine
.customization
= ass
>> 8;
1516 spec
->cdefine
.sku_cfg
= ass
;
1517 spec
->cdefine
.external_amp
= (ass
& 0x38) >> 3;
1518 spec
->cdefine
.platform_type
= (ass
& 0x4) >> 2;
1519 spec
->cdefine
.swap
= (ass
& 0x2) >> 1;
1520 spec
->cdefine
.override
= ass
& 0x1;
1522 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1523 nid
, spec
->cdefine
.sku_cfg
);
1524 snd_printd("SKU: port_connectivity=0x%x\n",
1525 spec
->cdefine
.port_connectivity
);
1526 snd_printd("SKU: enable_pcbeep=0x%x\n", spec
->cdefine
.enable_pcbeep
);
1527 snd_printd("SKU: check_sum=0x%08x\n", spec
->cdefine
.check_sum
);
1528 snd_printd("SKU: customization=0x%08x\n", spec
->cdefine
.customization
);
1529 snd_printd("SKU: external_amp=0x%x\n", spec
->cdefine
.external_amp
);
1530 snd_printd("SKU: platform_type=0x%x\n", spec
->cdefine
.platform_type
);
1531 snd_printd("SKU: swap=0x%x\n", spec
->cdefine
.swap
);
1532 snd_printd("SKU: override=0x%x\n", spec
->cdefine
.override
);
1537 /* check subsystem ID and set up device-specific initialization;
1538 * return 1 if initialized, 0 if invalid SSID
1540 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1541 * 31 ~ 16 : Manufacture ID
1543 * 7 ~ 0 : Assembly ID
1544 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1546 static int alc_subsystem_id(struct hda_codec
*codec
,
1547 hda_nid_t porta
, hda_nid_t porte
,
1548 hda_nid_t portd
, hda_nid_t porti
)
1550 unsigned int ass
, tmp
, i
;
1552 struct alc_spec
*spec
= codec
->spec
;
1554 if (spec
->cdefine
.fixup
) {
1555 ass
= spec
->cdefine
.sku_cfg
;
1556 if (ass
== ALC_FIXUP_SKU_IGNORE
)
1561 ass
= codec
->subsystem_id
& 0xffff;
1562 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
1565 /* invalid SSID, check the special NID pin defcfg instead */
1567 * 31~30 : port connectivity
1570 * 19~16 : Check sum (15:1)
1575 if (codec
->vendor_id
== 0x10ec0260)
1577 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1578 snd_printd("realtek: No valid SSID, "
1579 "checking pincfg 0x%08x for NID 0x%x\n",
1583 if ((ass
>> 30) != 1) /* no physical connection */
1588 for (i
= 1; i
< 16; i
++) {
1592 if (((ass
>> 16) & 0xf) != tmp
)
1595 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1596 ass
& 0xffff, codec
->vendor_id
);
1600 * 2 : 0 --> Desktop, 1 --> Laptop
1601 * 3~5 : External Amplifier control
1604 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
1607 spec
->init_amp
= ALC_INIT_GPIO1
;
1610 spec
->init_amp
= ALC_INIT_GPIO2
;
1613 spec
->init_amp
= ALC_INIT_GPIO3
;
1617 spec
->init_amp
= ALC_INIT_DEFAULT
;
1621 /* is laptop or Desktop and enable the function "Mute internal speaker
1622 * when the external headphone out jack is plugged"
1624 if (!(ass
& 0x8000))
1627 * 10~8 : Jack location
1628 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1630 * 15 : 1 --> enable the function "Mute internal speaker
1631 * when the external headphone out jack is plugged"
1633 if (!spec
->autocfg
.hp_pins
[0]) {
1635 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
1646 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++)
1647 if (spec
->autocfg
.line_out_pins
[i
] == nid
)
1649 spec
->autocfg
.hp_pins
[0] = nid
;
1652 alc_init_auto_hp(codec
);
1653 alc_init_auto_mic(codec
);
1657 static void alc_ssid_check(struct hda_codec
*codec
,
1658 hda_nid_t porta
, hda_nid_t porte
,
1659 hda_nid_t portd
, hda_nid_t porti
)
1661 if (!alc_subsystem_id(codec
, porta
, porte
, portd
, porti
)) {
1662 struct alc_spec
*spec
= codec
->spec
;
1663 snd_printd("realtek: "
1664 "Enable default setup for auto mode as fallback\n");
1665 spec
->init_amp
= ALC_INIT_DEFAULT
;
1666 alc_init_auto_hp(codec
);
1667 alc_init_auto_mic(codec
);
1672 * Fix-up pin default configurations and add default verbs
1680 struct alc_model_fixup
{
1687 const struct alc_pincfg
*pins
;
1688 const struct hda_verb
*verbs
;
1689 void (*func
)(struct hda_codec
*codec
, const struct alc_fixup
*fix
,
1693 static void __alc_pick_fixup(struct hda_codec
*codec
,
1694 const struct alc_fixup
*fix
,
1695 const char *modelname
,
1698 const struct alc_pincfg
*cfg
;
1699 struct alc_spec
*spec
;
1702 if (pre_init
&& fix
->sku
) {
1703 #ifdef CONFIG_SND_DEBUG_VERBOSE
1704 snd_printdd(KERN_INFO
"hda_codec: %s: Apply sku override for %s\n",
1705 codec
->chip_name
, modelname
);
1708 spec
->cdefine
.sku_cfg
= fix
->sku
;
1709 spec
->cdefine
.fixup
= 1;
1711 if (pre_init
&& cfg
) {
1712 #ifdef CONFIG_SND_DEBUG_VERBOSE
1713 snd_printdd(KERN_INFO
"hda_codec: %s: Apply pincfg for %s\n",
1714 codec
->chip_name
, modelname
);
1716 for (; cfg
->nid
; cfg
++)
1717 snd_hda_codec_set_pincfg(codec
, cfg
->nid
, cfg
->val
);
1719 if (!pre_init
&& fix
->verbs
) {
1720 #ifdef CONFIG_SND_DEBUG_VERBOSE
1721 snd_printdd(KERN_INFO
"hda_codec: %s: Apply fix-verbs for %s\n",
1722 codec
->chip_name
, modelname
);
1724 add_verb(codec
->spec
, fix
->verbs
);
1727 #ifdef CONFIG_SND_DEBUG_VERBOSE
1728 snd_printdd(KERN_INFO
"hda_codec: %s: Apply fix-func for %s\n",
1729 codec
->chip_name
, modelname
);
1731 fix
->func(codec
, fix
, pre_init
);
1735 static void alc_pick_fixup(struct hda_codec
*codec
,
1736 const struct snd_pci_quirk
*quirk
,
1737 const struct alc_fixup
*fix
,
1740 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
1742 fix
+= quirk
->value
;
1743 #ifdef CONFIG_SND_DEBUG_VERBOSE
1744 __alc_pick_fixup(codec
, fix
, quirk
->name
, pre_init
);
1746 __alc_pick_fixup(codec
, fix
, NULL
, pre_init
);
1751 static void alc_pick_fixup_model(struct hda_codec
*codec
,
1752 const struct alc_model_fixup
*models
,
1753 const struct snd_pci_quirk
*quirk
,
1754 const struct alc_fixup
*fix
,
1757 if (codec
->modelname
&& models
) {
1758 while (models
->name
) {
1759 if (!strcmp(codec
->modelname
, models
->name
)) {
1765 __alc_pick_fixup(codec
, fix
, codec
->modelname
, pre_init
);
1767 alc_pick_fixup(codec
, quirk
, fix
, pre_init
);
1771 static int alc_read_coef_idx(struct hda_codec
*codec
,
1772 unsigned int coef_idx
)
1775 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
1777 val
= snd_hda_codec_read(codec
, 0x20, 0,
1778 AC_VERB_GET_PROC_COEF
, 0);
1782 static void alc_write_coef_idx(struct hda_codec
*codec
, unsigned int coef_idx
,
1783 unsigned int coef_val
)
1785 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
1787 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
,
1791 /* set right pin controls for digital I/O */
1792 static void alc_auto_init_digital(struct hda_codec
*codec
)
1794 struct alc_spec
*spec
= codec
->spec
;
1798 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
1799 pin
= spec
->autocfg
.dig_out_pins
[i
];
1801 snd_hda_codec_write(codec
, pin
, 0,
1802 AC_VERB_SET_PIN_WIDGET_CONTROL
,
1806 pin
= spec
->autocfg
.dig_in_pin
;
1808 snd_hda_codec_write(codec
, pin
, 0,
1809 AC_VERB_SET_PIN_WIDGET_CONTROL
,
1813 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1814 static void alc_auto_parse_digital(struct hda_codec
*codec
)
1816 struct alc_spec
*spec
= codec
->spec
;
1820 /* support multiple SPDIFs; the secondary is set up as a slave */
1821 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
1822 err
= snd_hda_get_connections(codec
,
1823 spec
->autocfg
.dig_out_pins
[i
],
1828 spec
->multiout
.dig_out_nid
= dig_nid
;
1829 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
1831 spec
->multiout
.slave_dig_outs
= spec
->slave_dig_outs
;
1832 if (i
>= ARRAY_SIZE(spec
->slave_dig_outs
) - 1)
1834 spec
->slave_dig_outs
[i
- 1] = dig_nid
;
1838 if (spec
->autocfg
.dig_in_pin
) {
1839 dig_nid
= codec
->start_nid
;
1840 for (i
= 0; i
< codec
->num_nodes
; i
++, dig_nid
++) {
1841 unsigned int wcaps
= get_wcaps(codec
, dig_nid
);
1842 if (get_wcaps_type(wcaps
) != AC_WID_AUD_IN
)
1844 if (!(wcaps
& AC_WCAP_DIGITAL
))
1846 if (!(wcaps
& AC_WCAP_CONN_LIST
))
1848 err
= get_connection_index(codec
, dig_nid
,
1849 spec
->autocfg
.dig_in_pin
);
1851 spec
->dig_in_nid
= dig_nid
;
1865 static struct hda_verb alc888_4ST_ch2_intel_init
[] = {
1866 /* Mic-in jack as mic in */
1867 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1868 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1869 /* Line-in jack as Line in */
1870 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1871 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1872 /* Line-Out as Front */
1873 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1880 static struct hda_verb alc888_4ST_ch4_intel_init
[] = {
1881 /* Mic-in jack as mic in */
1882 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1883 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1884 /* Line-in jack as Surround */
1885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1887 /* Line-Out as Front */
1888 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1895 static struct hda_verb alc888_4ST_ch6_intel_init
[] = {
1896 /* Mic-in jack as CLFE */
1897 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1898 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1899 /* Line-in jack as Surround */
1900 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1901 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1902 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1903 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1910 static struct hda_verb alc888_4ST_ch8_intel_init
[] = {
1911 /* Mic-in jack as CLFE */
1912 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1913 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1914 /* Line-in jack as Surround */
1915 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1916 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1917 /* Line-Out as Side */
1918 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1922 static struct hda_channel_mode alc888_4ST_8ch_intel_modes
[4] = {
1923 { 2, alc888_4ST_ch2_intel_init
},
1924 { 4, alc888_4ST_ch4_intel_init
},
1925 { 6, alc888_4ST_ch6_intel_init
},
1926 { 8, alc888_4ST_ch8_intel_init
},
1930 * ALC888 Fujitsu Siemens Amillo xa3530
1933 static struct hda_verb alc888_fujitsu_xa3530_verbs
[] = {
1934 /* Front Mic: set to PIN_IN (empty by default) */
1935 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1936 /* Connect Internal HP to Front */
1937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1939 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1940 /* Connect Bass HP to Front */
1941 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1942 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1943 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1944 /* Connect Line-Out side jack (SPDIF) to Side */
1945 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1946 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1947 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1948 /* Connect Mic jack to CLFE */
1949 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1950 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1951 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
1952 /* Connect Line-in jack to Surround */
1953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1954 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1955 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
1956 /* Connect HP out jack to Front */
1957 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1958 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1959 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1960 /* Enable unsolicited event for HP jack and Line-out jack */
1961 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1962 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1966 static void alc_automute_amp(struct hda_codec
*codec
)
1968 alc_automute_speaker(codec
, 0);
1971 static void alc_automute_amp_unsol_event(struct hda_codec
*codec
,
1974 if (codec
->vendor_id
== 0x10ec0880)
1978 if (res
== ALC880_HP_EVENT
)
1979 alc_automute_amp(codec
);
1982 static void alc889_automute_setup(struct hda_codec
*codec
)
1984 struct alc_spec
*spec
= codec
->spec
;
1986 spec
->autocfg
.hp_pins
[0] = 0x15;
1987 spec
->autocfg
.speaker_pins
[0] = 0x14;
1988 spec
->autocfg
.speaker_pins
[1] = 0x16;
1989 spec
->autocfg
.speaker_pins
[2] = 0x17;
1990 spec
->autocfg
.speaker_pins
[3] = 0x19;
1991 spec
->autocfg
.speaker_pins
[4] = 0x1a;
1994 static void alc889_intel_init_hook(struct hda_codec
*codec
)
1996 alc889_coef_init(codec
);
1997 alc_automute_amp(codec
);
2000 static void alc888_fujitsu_xa3530_setup(struct hda_codec
*codec
)
2002 struct alc_spec
*spec
= codec
->spec
;
2004 spec
->autocfg
.hp_pins
[0] = 0x17; /* line-out */
2005 spec
->autocfg
.hp_pins
[1] = 0x1b; /* hp */
2006 spec
->autocfg
.speaker_pins
[0] = 0x14; /* speaker */
2007 spec
->autocfg
.speaker_pins
[1] = 0x15; /* bass */
2011 * ALC888 Acer Aspire 4930G model
2014 static struct hda_verb alc888_acer_aspire_4930g_verbs
[] = {
2015 /* Front Mic: set to PIN_IN (empty by default) */
2016 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2017 /* Unselect Front Mic by default in input mixer 3 */
2018 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2019 /* Enable unsolicited event for HP jack */
2020 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2021 /* Connect Internal HP to front */
2022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2024 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2025 /* Connect HP out to front */
2026 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2028 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2029 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2034 * ALC888 Acer Aspire 6530G model
2037 static struct hda_verb alc888_acer_aspire_6530g_verbs
[] = {
2038 /* Route to built-in subwoofer as well as speakers */
2039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2040 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2041 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2042 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2043 /* Bias voltage on for external mic port */
2044 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
2045 /* Front Mic: set to PIN_IN (empty by default) */
2046 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2047 /* Unselect Front Mic by default in input mixer 3 */
2048 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2049 /* Enable unsolicited event for HP jack */
2050 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2051 /* Enable speaker output */
2052 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2053 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2054 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2055 /* Enable headphone output */
2056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2058 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2059 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2064 *ALC888 Acer Aspire 7730G model
2067 static struct hda_verb alc888_acer_aspire_7730G_verbs
[] = {
2068 /* Bias voltage on for external mic port */
2069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
2070 /* Front Mic: set to PIN_IN (empty by default) */
2071 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2072 /* Unselect Front Mic by default in input mixer 3 */
2073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2074 /* Enable unsolicited event for HP jack */
2075 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2076 /* Enable speaker output */
2077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2078 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2079 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2080 /* Enable headphone output */
2081 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2082 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2083 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2084 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2085 /*Enable internal subwoofer */
2086 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2087 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2088 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
2089 {0x17, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2094 * ALC889 Acer Aspire 8930G model
2097 static struct hda_verb alc889_acer_aspire_8930g_verbs
[] = {
2098 /* Front Mic: set to PIN_IN (empty by default) */
2099 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2100 /* Unselect Front Mic by default in input mixer 3 */
2101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2102 /* Enable unsolicited event for HP jack */
2103 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2104 /* Connect Internal Front to Front */
2105 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2106 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2107 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2108 /* Connect Internal Rear to Rear */
2109 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2110 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2111 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
2112 /* Connect Internal CLFE to CLFE */
2113 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2114 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2115 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
2116 /* Connect HP out to Front */
2117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2118 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2119 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2120 /* Enable all DACs */
2121 /* DAC DISABLE/MUTE 1? */
2122 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2123 {0x20, AC_VERB_SET_COEF_INDEX
, 0x03},
2124 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
2125 /* DAC DISABLE/MUTE 2? */
2126 /* some bit here disables the other DACs. Init=0x4900 */
2127 {0x20, AC_VERB_SET_COEF_INDEX
, 0x08},
2128 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
2130 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2131 * which makes the stereo useless. However, either the mic or the ALC889
2132 * makes the signal become a difference/sum signal instead of standard
2133 * stereo, which is annoying. So instead we flip this bit which makes the
2134 * codec replicate the sum signal to both channels, turning it into a
2137 /* DMIC_CONTROL? Init value = 0x0001 */
2138 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
2139 {0x20, AC_VERB_SET_PROC_COEF
, 0x0003},
2143 static struct hda_input_mux alc888_2_capture_sources
[2] = {
2144 /* Front mic only available on one ADC */
2151 { "Front Mic", 0xb },
2164 static struct hda_input_mux alc888_acer_aspire_6530_sources
[2] = {
2165 /* Interal mic only available on one ADC */
2172 { "Input Mix", 0xa },
2173 { "Internal Mic", 0xb },
2182 { "Input Mix", 0xa },
2187 static struct hda_input_mux alc889_capture_sources
[3] = {
2188 /* Digital mic only available on first "ADC" */
2195 { "Front Mic", 0xb },
2196 { "Input Mix", 0xa },
2205 { "Input Mix", 0xa },
2214 { "Input Mix", 0xa },
2219 static struct snd_kcontrol_new alc888_base_mixer
[] = {
2220 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2221 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2222 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2223 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2224 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2226 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2227 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2228 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2229 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2230 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2236 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2241 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer
[] = {
2242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2244 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2245 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2246 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2248 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2249 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2250 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2252 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2254 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2255 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2260 static void alc888_acer_aspire_4930g_setup(struct hda_codec
*codec
)
2262 struct alc_spec
*spec
= codec
->spec
;
2264 spec
->autocfg
.hp_pins
[0] = 0x15;
2265 spec
->autocfg
.speaker_pins
[0] = 0x14;
2266 spec
->autocfg
.speaker_pins
[1] = 0x16;
2267 spec
->autocfg
.speaker_pins
[2] = 0x17;
2270 static void alc888_acer_aspire_6530g_setup(struct hda_codec
*codec
)
2272 struct alc_spec
*spec
= codec
->spec
;
2274 spec
->autocfg
.hp_pins
[0] = 0x15;
2275 spec
->autocfg
.speaker_pins
[0] = 0x14;
2276 spec
->autocfg
.speaker_pins
[1] = 0x16;
2277 spec
->autocfg
.speaker_pins
[2] = 0x17;
2280 static void alc888_acer_aspire_7730g_setup(struct hda_codec
*codec
)
2282 struct alc_spec
*spec
= codec
->spec
;
2284 spec
->autocfg
.hp_pins
[0] = 0x15;
2285 spec
->autocfg
.speaker_pins
[0] = 0x14;
2286 spec
->autocfg
.speaker_pins
[1] = 0x16;
2287 spec
->autocfg
.speaker_pins
[2] = 0x17;
2290 static void alc889_acer_aspire_8930g_setup(struct hda_codec
*codec
)
2292 struct alc_spec
*spec
= codec
->spec
;
2294 spec
->autocfg
.hp_pins
[0] = 0x15;
2295 spec
->autocfg
.speaker_pins
[0] = 0x14;
2296 spec
->autocfg
.speaker_pins
[1] = 0x16;
2297 spec
->autocfg
.speaker_pins
[2] = 0x1b;
2301 * ALC880 3-stack model
2303 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2304 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2305 * F-Mic = 0x1b, HP = 0x19
2308 static hda_nid_t alc880_dac_nids
[4] = {
2309 /* front, rear, clfe, rear_surr */
2310 0x02, 0x05, 0x04, 0x03
2313 static hda_nid_t alc880_adc_nids
[3] = {
2318 /* The datasheet says the node 0x07 is connected from inputs,
2319 * but it shows zero connection in the real implementation on some devices.
2320 * Note: this is a 915GAV bug, fixed on 915GLV
2322 static hda_nid_t alc880_adc_nids_alt
[2] = {
2327 #define ALC880_DIGOUT_NID 0x06
2328 #define ALC880_DIGIN_NID 0x0a
2330 static struct hda_input_mux alc880_capture_source
= {
2334 { "Front Mic", 0x3 },
2340 /* channel source setting (2/6 channel selection for 3-stack) */
2342 static struct hda_verb alc880_threestack_ch2_init
[] = {
2343 /* set line-in to input, mute it */
2344 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2345 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2346 /* set mic-in to input vref 80%, mute it */
2347 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2348 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2353 static struct hda_verb alc880_threestack_ch6_init
[] = {
2354 /* set line-in to output, unmute it */
2355 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2356 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2357 /* set mic-in to output, unmute it */
2358 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2359 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2363 static struct hda_channel_mode alc880_threestack_modes
[2] = {
2364 { 2, alc880_threestack_ch2_init
},
2365 { 6, alc880_threestack_ch6_init
},
2368 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
2369 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2370 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2371 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2372 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2373 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2374 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2375 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2376 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2377 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2378 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2379 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2380 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2382 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2383 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2384 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
2387 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2388 .name
= "Channel Mode",
2389 .info
= alc_ch_mode_info
,
2390 .get
= alc_ch_mode_get
,
2391 .put
= alc_ch_mode_put
,
2396 /* capture mixer elements */
2397 static int alc_cap_vol_info(struct snd_kcontrol
*kcontrol
,
2398 struct snd_ctl_elem_info
*uinfo
)
2400 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2401 struct alc_spec
*spec
= codec
->spec
;
2404 mutex_lock(&codec
->control_mutex
);
2405 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2407 err
= snd_hda_mixer_amp_volume_info(kcontrol
, uinfo
);
2408 mutex_unlock(&codec
->control_mutex
);
2412 static int alc_cap_vol_tlv(struct snd_kcontrol
*kcontrol
, int op_flag
,
2413 unsigned int size
, unsigned int __user
*tlv
)
2415 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2416 struct alc_spec
*spec
= codec
->spec
;
2419 mutex_lock(&codec
->control_mutex
);
2420 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2422 err
= snd_hda_mixer_amp_tlv(kcontrol
, op_flag
, size
, tlv
);
2423 mutex_unlock(&codec
->control_mutex
);
2427 typedef int (*getput_call_t
)(struct snd_kcontrol
*kcontrol
,
2428 struct snd_ctl_elem_value
*ucontrol
);
2430 static int alc_cap_getput_caller(struct snd_kcontrol
*kcontrol
,
2431 struct snd_ctl_elem_value
*ucontrol
,
2434 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2435 struct alc_spec
*spec
= codec
->spec
;
2436 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
2439 mutex_lock(&codec
->control_mutex
);
2440 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[adc_idx
],
2442 err
= func(kcontrol
, ucontrol
);
2443 mutex_unlock(&codec
->control_mutex
);
2447 static int alc_cap_vol_get(struct snd_kcontrol
*kcontrol
,
2448 struct snd_ctl_elem_value
*ucontrol
)
2450 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2451 snd_hda_mixer_amp_volume_get
);
2454 static int alc_cap_vol_put(struct snd_kcontrol
*kcontrol
,
2455 struct snd_ctl_elem_value
*ucontrol
)
2457 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2458 snd_hda_mixer_amp_volume_put
);
2461 /* capture mixer elements */
2462 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2464 static int alc_cap_sw_get(struct snd_kcontrol
*kcontrol
,
2465 struct snd_ctl_elem_value
*ucontrol
)
2467 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2468 snd_hda_mixer_amp_switch_get
);
2471 static int alc_cap_sw_put(struct snd_kcontrol
*kcontrol
,
2472 struct snd_ctl_elem_value
*ucontrol
)
2474 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2475 snd_hda_mixer_amp_switch_put
);
2478 #define _DEFINE_CAPMIX(num) \
2480 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2481 .name = "Capture Switch", \
2482 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2484 .info = alc_cap_sw_info, \
2485 .get = alc_cap_sw_get, \
2486 .put = alc_cap_sw_put, \
2489 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2490 .name = "Capture Volume", \
2491 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2492 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2493 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2495 .info = alc_cap_vol_info, \
2496 .get = alc_cap_vol_get, \
2497 .put = alc_cap_vol_put, \
2498 .tlv = { .c = alc_cap_vol_tlv }, \
2501 #define _DEFINE_CAPSRC(num) \
2503 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2504 /* .name = "Capture Source", */ \
2505 .name = "Input Source", \
2507 .info = alc_mux_enum_info, \
2508 .get = alc_mux_enum_get, \
2509 .put = alc_mux_enum_put, \
2512 #define DEFINE_CAPMIX(num) \
2513 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2514 _DEFINE_CAPMIX(num), \
2515 _DEFINE_CAPSRC(num), \
2519 #define DEFINE_CAPMIX_NOSRC(num) \
2520 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2521 _DEFINE_CAPMIX(num), \
2525 /* up to three ADCs */
2529 DEFINE_CAPMIX_NOSRC(1);
2530 DEFINE_CAPMIX_NOSRC(2);
2531 DEFINE_CAPMIX_NOSRC(3);
2534 * ALC880 5-stack model
2536 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2538 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2539 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2542 /* additional mixers to alc880_three_stack_mixer */
2543 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
2544 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2545 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
2549 /* channel source setting (6/8 channel selection for 5-stack) */
2551 static struct hda_verb alc880_fivestack_ch6_init
[] = {
2552 /* set line-in to input, mute it */
2553 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2554 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2559 static struct hda_verb alc880_fivestack_ch8_init
[] = {
2560 /* set line-in to output, unmute it */
2561 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2562 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2566 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
2567 { 6, alc880_fivestack_ch6_init
},
2568 { 8, alc880_fivestack_ch8_init
},
2573 * ALC880 6-stack model
2575 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2576 * Side = 0x05 (0x0f)
2577 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2578 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2581 static hda_nid_t alc880_6st_dac_nids
[4] = {
2582 /* front, rear, clfe, rear_surr */
2583 0x02, 0x03, 0x04, 0x05
2586 static struct hda_input_mux alc880_6stack_capture_source
= {
2590 { "Front Mic", 0x1 },
2596 /* fixed 8-channels */
2597 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
2601 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
2602 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2603 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2604 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2605 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2606 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2607 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2608 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2609 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2610 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2611 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2612 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2613 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2614 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2615 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2618 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2619 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2621 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2622 .name
= "Channel Mode",
2623 .info
= alc_ch_mode_info
,
2624 .get
= alc_ch_mode_get
,
2625 .put
= alc_ch_mode_put
,
2634 * W810 has rear IO for:
2637 * Center/LFE (DAC 04)
2640 * The system also has a pair of internal speakers, and a headphone jack.
2641 * These are both connected to Line2 on the codec, hence to DAC 02.
2643 * There is a variable resistor to control the speaker or headphone
2644 * volume. This is a hardware-only device without a software API.
2646 * Plugging headphones in will disable the internal speakers. This is
2647 * implemented in hardware, not via the driver using jack sense. In
2648 * a similar fashion, plugging into the rear socket marked "front" will
2649 * disable both the speakers and headphones.
2651 * For input, there's a microphone jack, and an "audio in" jack.
2652 * These may not do anything useful with this driver yet, because I
2653 * haven't setup any initialization verbs for these yet...
2656 static hda_nid_t alc880_w810_dac_nids
[3] = {
2657 /* front, rear/surround, clfe */
2661 /* fixed 6 channels */
2662 static struct hda_channel_mode alc880_w810_modes
[1] = {
2666 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2667 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
2668 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2669 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2670 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2671 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2672 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2673 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2674 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2675 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2684 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2685 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2689 static hda_nid_t alc880_z71v_dac_nids
[1] = {
2692 #define ALC880_Z71V_HP_DAC 0x03
2694 /* fixed 2 channels */
2695 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
2699 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
2700 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2701 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2702 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2703 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
2704 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2705 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2713 * ALC880 F1734 model
2715 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2716 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2719 static hda_nid_t alc880_f1734_dac_nids
[1] = {
2722 #define ALC880_F1734_HP_DAC 0x02
2724 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
2725 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2726 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2727 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2728 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2729 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2730 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2731 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2732 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2736 static struct hda_input_mux alc880_f1734_capture_source
= {
2748 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2749 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2750 * Mic = 0x18, Line = 0x1a
2753 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2754 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2756 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
2757 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2758 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2759 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2760 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2761 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2762 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2763 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2764 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2765 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2766 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2767 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2768 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2772 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2773 .name
= "Channel Mode",
2774 .info
= alc_ch_mode_info
,
2775 .get
= alc_ch_mode_get
,
2776 .put
= alc_ch_mode_put
,
2782 * ALC880 ASUS W1V model
2784 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2785 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2786 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2789 /* additional mixers to alc880_asus_mixer */
2790 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
2791 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
2792 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
2797 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
2798 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2799 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2800 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
2801 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
2802 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
2803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
2804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
2805 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
2806 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
2811 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
2812 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2813 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2814 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2815 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2816 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2817 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2818 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2819 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2820 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2821 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2822 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2823 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2826 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2827 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2829 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2830 .name
= "Channel Mode",
2831 .info
= alc_ch_mode_info
,
2832 .get
= alc_ch_mode_get
,
2833 .put
= alc_ch_mode_put
,
2838 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
2839 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2840 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2841 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2842 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2843 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2844 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2846 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2847 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2848 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2852 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
2853 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2854 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2855 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2856 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2858 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2863 * virtual master controls
2867 * slave controls for virtual master
2869 static const char *alc_slave_vols
[] = {
2870 "Front Playback Volume",
2871 "Surround Playback Volume",
2872 "Center Playback Volume",
2873 "LFE Playback Volume",
2874 "Side Playback Volume",
2875 "Headphone Playback Volume",
2876 "Speaker Playback Volume",
2877 "Mono Playback Volume",
2878 "Line-Out Playback Volume",
2879 "PCM Playback Volume",
2883 static const char *alc_slave_sws
[] = {
2884 "Front Playback Switch",
2885 "Surround Playback Switch",
2886 "Center Playback Switch",
2887 "LFE Playback Switch",
2888 "Side Playback Switch",
2889 "Headphone Playback Switch",
2890 "Speaker Playback Switch",
2891 "Mono Playback Switch",
2892 "IEC958 Playback Switch",
2893 "Line-Out Playback Switch",
2894 "PCM Playback Switch",
2899 * build control elements
2902 #define NID_MAPPING (-1)
2904 #define SUBDEV_SPEAKER_ (0 << 6)
2905 #define SUBDEV_HP_ (1 << 6)
2906 #define SUBDEV_LINE_ (2 << 6)
2907 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2908 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2909 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2911 static void alc_free_kctls(struct hda_codec
*codec
);
2913 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2914 /* additional beep mixers; the actual parameters are overwritten at build */
2915 static struct snd_kcontrol_new alc_beep_mixer
[] = {
2916 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT
),
2917 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT
),
2922 static int alc_build_controls(struct hda_codec
*codec
)
2924 struct alc_spec
*spec
= codec
->spec
;
2925 struct snd_kcontrol
*kctl
= NULL
;
2926 struct snd_kcontrol_new
*knew
;
2931 for (i
= 0; i
< spec
->num_mixers
; i
++) {
2932 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
2936 if (spec
->cap_mixer
) {
2937 err
= snd_hda_add_new_ctls(codec
, spec
->cap_mixer
);
2941 if (spec
->multiout
.dig_out_nid
) {
2942 err
= snd_hda_create_spdif_out_ctls(codec
,
2943 spec
->multiout
.dig_out_nid
);
2946 if (!spec
->no_analog
) {
2947 err
= snd_hda_create_spdif_share_sw(codec
,
2951 spec
->multiout
.share_spdif
= 1;
2954 if (spec
->dig_in_nid
) {
2955 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
2960 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2961 /* create beep controls if needed */
2962 if (spec
->beep_amp
) {
2963 struct snd_kcontrol_new
*knew
;
2964 for (knew
= alc_beep_mixer
; knew
->name
; knew
++) {
2965 struct snd_kcontrol
*kctl
;
2966 kctl
= snd_ctl_new1(knew
, codec
);
2969 kctl
->private_value
= spec
->beep_amp
;
2970 err
= snd_hda_ctl_add(codec
, 0, kctl
);
2977 /* if we have no master control, let's create it */
2978 if (!spec
->no_analog
&&
2979 !snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
2980 unsigned int vmaster_tlv
[4];
2981 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
2982 HDA_OUTPUT
, vmaster_tlv
);
2983 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
2984 vmaster_tlv
, alc_slave_vols
);
2988 if (!spec
->no_analog
&&
2989 !snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
2990 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
2991 NULL
, alc_slave_sws
);
2996 /* assign Capture Source enums to NID */
2997 if (spec
->capsrc_nids
|| spec
->adc_nids
) {
2998 kctl
= snd_hda_find_mixer_ctl(codec
, "Capture Source");
3000 kctl
= snd_hda_find_mixer_ctl(codec
, "Input Source");
3001 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
3002 hda_nid_t
*nids
= spec
->capsrc_nids
;
3004 nids
= spec
->adc_nids
;
3005 err
= snd_hda_add_nid(codec
, kctl
, i
, nids
[i
]);
3010 if (spec
->cap_mixer
) {
3011 const char *kname
= kctl
? kctl
->id
.name
: NULL
;
3012 for (knew
= spec
->cap_mixer
; knew
->name
; knew
++) {
3013 if (kname
&& strcmp(knew
->name
, kname
) == 0)
3015 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
3016 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
3017 err
= snd_hda_add_nid(codec
, kctl
, i
,
3025 /* other nid->control mapping */
3026 for (i
= 0; i
< spec
->num_mixers
; i
++) {
3027 for (knew
= spec
->mixers
[i
]; knew
->name
; knew
++) {
3028 if (knew
->iface
!= NID_MAPPING
)
3030 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
3033 u
= knew
->subdevice
;
3034 for (j
= 0; j
< 4; j
++, u
>>= 8) {
3039 case SUBDEV_SPEAKER_
:
3040 nid
= spec
->autocfg
.speaker_pins
[nid
];
3043 nid
= spec
->autocfg
.line_out_pins
[nid
];
3046 nid
= spec
->autocfg
.hp_pins
[nid
];
3051 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
3055 u
= knew
->private_value
;
3056 for (j
= 0; j
< 4; j
++, u
>>= 8) {
3060 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
3067 alc_free_kctls(codec
); /* no longer needed */
3074 * initialize the codec volumes, etc
3078 * generic initialization of ADC, input mixers and output mixers
3080 static struct hda_verb alc880_volume_init_verbs
[] = {
3082 * Unmute ADC0-2 and set the default input to mic-in
3084 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
3085 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3086 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
3087 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3088 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
3089 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3091 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3093 * Note: PASD motherboards uses the Line In 2 as the input for front
3096 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3097 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3106 * Set up output mixers (0x0c - 0x0f)
3108 /* set vol=0 to output mixers */
3109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3110 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3111 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3112 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3113 /* set up input amps for analog loopback */
3114 /* Amp Indices: DAC = 0, mixer = 1 */
3115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3117 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3118 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3119 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3120 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3121 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3122 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3128 * 3-stack pin configuration:
3129 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3131 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
3133 * preset connection lists of input pins
3134 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3136 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
3137 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3138 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
3141 * Set pin mode and muting
3143 /* set front pin widgets 0x14 for output */
3144 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3145 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3146 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3147 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3148 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3149 /* Mic2 (as headphone out) for HP output */
3150 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3151 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3152 /* Line In pin widget for input */
3153 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3154 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3155 /* Line2 (as front mic) pin widget for input and vref at 80% */
3156 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3157 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3158 /* CD pin widget for input */
3159 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3165 * 5-stack pin configuration:
3166 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3167 * line-in/side = 0x1a, f-mic = 0x1b
3169 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
3171 * preset connection lists of input pins
3172 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3174 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3175 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
3178 * Set pin mode and muting
3180 /* set pin widgets 0x14-0x17 for output */
3181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3183 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3184 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3185 /* unmute pins for output (no gain on this amp) */
3186 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3187 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3188 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3189 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3191 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3192 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3193 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3194 /* Mic2 (as headphone out) for HP output */
3195 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3196 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3197 /* Line In pin widget for input */
3198 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3199 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3200 /* Line2 (as front mic) pin widget for input and vref at 80% */
3201 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3202 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3203 /* CD pin widget for input */
3204 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3210 * W810 pin configuration:
3211 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3213 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
3214 /* hphone/speaker input selector: front DAC */
3215 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
3217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3221 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3222 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3224 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3225 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3231 * Z71V pin configuration:
3232 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3234 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
3235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3236 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3237 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3238 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3240 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3241 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3242 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3243 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3249 * 6-stack pin configuration:
3250 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3251 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3253 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
3254 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3257 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3260 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3261 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3262 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3263 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3265 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3266 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3269 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3270 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3271 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3272 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3273 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3279 * Uniwill pin configuration:
3280 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3283 static struct hda_verb alc880_uniwill_init_verbs
[] = {
3284 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3287 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3288 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3289 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3290 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3291 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3292 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3293 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3296 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3301 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3302 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3303 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3304 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3305 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3306 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3307 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3308 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3309 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3311 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3312 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
3319 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3321 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
3322 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3325 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3328 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3329 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3333 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3335 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3337 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3338 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3341 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3342 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3344 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3345 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
3350 static struct hda_verb alc880_beep_init_verbs
[] = {
3351 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
3355 /* auto-toggle front mic */
3356 static void alc88x_simple_mic_automute(struct hda_codec
*codec
)
3358 unsigned int present
;
3361 present
= snd_hda_jack_detect(codec
, 0x18);
3362 bits
= present
? HDA_AMP_MUTE
: 0;
3363 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
3366 static void alc880_uniwill_setup(struct hda_codec
*codec
)
3368 struct alc_spec
*spec
= codec
->spec
;
3370 spec
->autocfg
.hp_pins
[0] = 0x14;
3371 spec
->autocfg
.speaker_pins
[0] = 0x15;
3372 spec
->autocfg
.speaker_pins
[0] = 0x16;
3375 static void alc880_uniwill_init_hook(struct hda_codec
*codec
)
3377 alc_automute_amp(codec
);
3378 alc88x_simple_mic_automute(codec
);
3381 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
3384 /* Looks like the unsol event is incompatible with the standard
3385 * definition. 4bit tag is placed at 28 bit!
3387 switch (res
>> 28) {
3388 case ALC880_MIC_EVENT
:
3389 alc88x_simple_mic_automute(codec
);
3392 alc_automute_amp_unsol_event(codec
, res
);
3397 static void alc880_uniwill_p53_setup(struct hda_codec
*codec
)
3399 struct alc_spec
*spec
= codec
->spec
;
3401 spec
->autocfg
.hp_pins
[0] = 0x14;
3402 spec
->autocfg
.speaker_pins
[0] = 0x15;
3405 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
3407 unsigned int present
;
3409 present
= snd_hda_codec_read(codec
, 0x21, 0,
3410 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
3411 present
&= HDA_AMP_VOLMASK
;
3412 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
3413 HDA_AMP_VOLMASK
, present
);
3414 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
3415 HDA_AMP_VOLMASK
, present
);
3418 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
3421 /* Looks like the unsol event is incompatible with the standard
3422 * definition. 4bit tag is placed at 28 bit!
3424 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
3425 alc880_uniwill_p53_dcvol_automute(codec
);
3427 alc_automute_amp_unsol_event(codec
, res
);
3431 * F1734 pin configuration:
3432 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3434 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
3435 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
3436 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3437 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3438 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3439 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3441 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3442 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3444 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3446 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3447 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3448 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
3449 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3450 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3451 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3452 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3453 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3454 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3456 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
3457 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
3463 * ASUS pin configuration:
3464 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3466 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
3467 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3468 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3469 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3470 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3475 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3478 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3479 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3481 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3482 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3484 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3485 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3486 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3487 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3488 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3489 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3494 /* Enable GPIO mask and set output */
3495 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3496 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3497 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3499 /* Clevo m520g init */
3500 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
3501 /* headphone output */
3502 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3507 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3510 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3511 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3512 /* Mic1 (rear panel) */
3513 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3514 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3515 /* Mic2 (front panel) */
3516 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3517 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3519 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3520 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3521 /* change to EAPD mode */
3522 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3523 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3528 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
3529 /* change to EAPD mode */
3530 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3531 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3533 /* Headphone output */
3534 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3536 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3537 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
3539 /* Line In pin widget for input */
3540 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3541 /* CD pin widget for input */
3542 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3543 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3544 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3546 /* change to EAPD mode */
3547 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3548 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
3554 * LG m1 express dual
3557 * Rear Line-In/Out (blue): 0x14
3558 * Build-in Mic-In: 0x15
3560 * HP-Out (green): 0x1b
3561 * Mic-In/Out (red): 0x19
3565 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3566 static hda_nid_t alc880_lg_dac_nids
[3] = {
3570 /* seems analog CD is not working */
3571 static struct hda_input_mux alc880_lg_capture_source
= {
3576 { "Internal Mic", 0x6 },
3580 /* 2,4,6 channel modes */
3581 static struct hda_verb alc880_lg_ch2_init
[] = {
3582 /* set line-in and mic-in to input */
3583 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3584 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3588 static struct hda_verb alc880_lg_ch4_init
[] = {
3589 /* set line-in to out and mic-in to input */
3590 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3591 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3595 static struct hda_verb alc880_lg_ch6_init
[] = {
3596 /* set line-in and mic-in to output */
3597 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3598 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3602 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
3603 { 2, alc880_lg_ch2_init
},
3604 { 4, alc880_lg_ch4_init
},
3605 { 6, alc880_lg_ch6_init
},
3608 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
3609 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3610 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
3611 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3612 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
3613 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
3614 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
3615 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
3616 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
3617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3619 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
3620 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
3621 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
3622 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
3624 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3625 .name
= "Channel Mode",
3626 .info
= alc_ch_mode_info
,
3627 .get
= alc_ch_mode_get
,
3628 .put
= alc_ch_mode_put
,
3633 static struct hda_verb alc880_lg_init_verbs
[] = {
3634 /* set capture source to mic-in */
3635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3636 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3637 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3638 /* mute all amp mixer inputs */
3639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
3640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3642 /* line-in to input */
3643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3646 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3647 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3649 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3650 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3651 /* mic-in to input */
3652 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3653 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3654 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3656 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
3657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3658 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3660 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3664 /* toggle speaker-output according to the hp-jack state */
3665 static void alc880_lg_setup(struct hda_codec
*codec
)
3667 struct alc_spec
*spec
= codec
->spec
;
3669 spec
->autocfg
.hp_pins
[0] = 0x1b;
3670 spec
->autocfg
.speaker_pins
[0] = 0x17;
3679 * Built-in Mic-In: 0x19
3685 static struct hda_input_mux alc880_lg_lw_capture_source
= {
3689 { "Internal Mic", 0x1 },
3694 #define alc880_lg_lw_modes alc880_threestack_modes
3696 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
3697 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3698 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3699 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3700 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
3701 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3702 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3703 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3704 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3706 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3709 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
3710 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
3712 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3713 .name
= "Channel Mode",
3714 .info
= alc_ch_mode_info
,
3715 .get
= alc_ch_mode_get
,
3716 .put
= alc_ch_mode_put
,
3721 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
3722 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3723 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
3724 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
3726 /* set capture source to mic-in */
3727 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3728 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3729 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3733 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3735 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3736 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3737 /* mic-in to input */
3738 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3739 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3744 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3748 /* toggle speaker-output according to the hp-jack state */
3749 static void alc880_lg_lw_setup(struct hda_codec
*codec
)
3751 struct alc_spec
*spec
= codec
->spec
;
3753 spec
->autocfg
.hp_pins
[0] = 0x1b;
3754 spec
->autocfg
.speaker_pins
[0] = 0x14;
3757 static struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
3758 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3759 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
3760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3762 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3763 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3767 static struct hda_input_mux alc880_medion_rim_capture_source
= {
3771 { "Internal Mic", 0x1 },
3775 static struct hda_verb alc880_medion_rim_init_verbs
[] = {
3776 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3778 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3779 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3781 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3782 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3783 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3784 /* Mic2 (as headphone out) for HP output */
3785 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3786 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3787 /* Internal Speaker */
3788 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3789 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3791 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3792 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3794 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3798 /* toggle speaker-output according to the hp-jack state */
3799 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
3801 struct alc_spec
*spec
= codec
->spec
;
3802 alc_automute_amp(codec
);
3804 if (spec
->jack_present
)
3805 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
3807 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
3810 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
3813 /* Looks like the unsol event is incompatible with the standard
3814 * definition. 4bit tag is placed at 28 bit!
3816 if ((res
>> 28) == ALC880_HP_EVENT
)
3817 alc880_medion_rim_automute(codec
);
3820 static void alc880_medion_rim_setup(struct hda_codec
*codec
)
3822 struct alc_spec
*spec
= codec
->spec
;
3824 spec
->autocfg
.hp_pins
[0] = 0x14;
3825 spec
->autocfg
.speaker_pins
[0] = 0x1b;
3828 #ifdef CONFIG_SND_HDA_POWER_SAVE
3829 static struct hda_amp_list alc880_loopbacks
[] = {
3830 { 0x0b, HDA_INPUT
, 0 },
3831 { 0x0b, HDA_INPUT
, 1 },
3832 { 0x0b, HDA_INPUT
, 2 },
3833 { 0x0b, HDA_INPUT
, 3 },
3834 { 0x0b, HDA_INPUT
, 4 },
3838 static struct hda_amp_list alc880_lg_loopbacks
[] = {
3839 { 0x0b, HDA_INPUT
, 1 },
3840 { 0x0b, HDA_INPUT
, 6 },
3841 { 0x0b, HDA_INPUT
, 7 },
3850 static int alc_init(struct hda_codec
*codec
)
3852 struct alc_spec
*spec
= codec
->spec
;
3856 alc_auto_init_amp(codec
, spec
->init_amp
);
3858 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
3859 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
3861 if (spec
->init_hook
)
3862 spec
->init_hook(codec
);
3864 hda_call_check_power_status(codec
, 0x01);
3868 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
3870 struct alc_spec
*spec
= codec
->spec
;
3872 if (spec
->unsol_event
)
3873 spec
->unsol_event(codec
, res
);
3876 #ifdef CONFIG_SND_HDA_POWER_SAVE
3877 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
3879 struct alc_spec
*spec
= codec
->spec
;
3880 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
3885 * Analog playback callbacks
3887 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3888 struct hda_codec
*codec
,
3889 struct snd_pcm_substream
*substream
)
3891 struct alc_spec
*spec
= codec
->spec
;
3892 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
3896 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3897 struct hda_codec
*codec
,
3898 unsigned int stream_tag
,
3899 unsigned int format
,
3900 struct snd_pcm_substream
*substream
)
3902 struct alc_spec
*spec
= codec
->spec
;
3903 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
3904 stream_tag
, format
, substream
);
3907 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3908 struct hda_codec
*codec
,
3909 struct snd_pcm_substream
*substream
)
3911 struct alc_spec
*spec
= codec
->spec
;
3912 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
3918 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3919 struct hda_codec
*codec
,
3920 struct snd_pcm_substream
*substream
)
3922 struct alc_spec
*spec
= codec
->spec
;
3923 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
3926 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3927 struct hda_codec
*codec
,
3928 unsigned int stream_tag
,
3929 unsigned int format
,
3930 struct snd_pcm_substream
*substream
)
3932 struct alc_spec
*spec
= codec
->spec
;
3933 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
3934 stream_tag
, format
, substream
);
3937 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3938 struct hda_codec
*codec
,
3939 struct snd_pcm_substream
*substream
)
3941 struct alc_spec
*spec
= codec
->spec
;
3942 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
3945 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
3946 struct hda_codec
*codec
,
3947 struct snd_pcm_substream
*substream
)
3949 struct alc_spec
*spec
= codec
->spec
;
3950 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
3956 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3957 struct hda_codec
*codec
,
3958 unsigned int stream_tag
,
3959 unsigned int format
,
3960 struct snd_pcm_substream
*substream
)
3962 struct alc_spec
*spec
= codec
->spec
;
3964 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
3965 stream_tag
, 0, format
);
3969 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3970 struct hda_codec
*codec
,
3971 struct snd_pcm_substream
*substream
)
3973 struct alc_spec
*spec
= codec
->spec
;
3975 snd_hda_codec_cleanup_stream(codec
,
3976 spec
->adc_nids
[substream
->number
+ 1]);
3980 /* analog capture with dynamic dual-adc changes */
3981 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3982 struct hda_codec
*codec
,
3983 unsigned int stream_tag
,
3984 unsigned int format
,
3985 struct snd_pcm_substream
*substream
)
3987 struct alc_spec
*spec
= codec
->spec
;
3988 spec
->cur_adc
= spec
->adc_nids
[spec
->cur_adc_idx
];
3989 spec
->cur_adc_stream_tag
= stream_tag
;
3990 spec
->cur_adc_format
= format
;
3991 snd_hda_codec_setup_stream(codec
, spec
->cur_adc
, stream_tag
, 0, format
);
3995 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3996 struct hda_codec
*codec
,
3997 struct snd_pcm_substream
*substream
)
3999 struct alc_spec
*spec
= codec
->spec
;
4000 snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
);
4005 static struct hda_pcm_stream dualmic_pcm_analog_capture
= {
4009 .nid
= 0, /* fill later */
4011 .prepare
= dualmic_capture_pcm_prepare
,
4012 .cleanup
= dualmic_capture_pcm_cleanup
4018 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
4022 /* NID is set in alc_build_pcms */
4024 .open
= alc880_playback_pcm_open
,
4025 .prepare
= alc880_playback_pcm_prepare
,
4026 .cleanup
= alc880_playback_pcm_cleanup
4030 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
4034 /* NID is set in alc_build_pcms */
4037 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
4041 /* NID is set in alc_build_pcms */
4044 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
4045 .substreams
= 2, /* can be overridden */
4048 /* NID is set in alc_build_pcms */
4050 .prepare
= alc880_alt_capture_pcm_prepare
,
4051 .cleanup
= alc880_alt_capture_pcm_cleanup
4055 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
4059 /* NID is set in alc_build_pcms */
4061 .open
= alc880_dig_playback_pcm_open
,
4062 .close
= alc880_dig_playback_pcm_close
,
4063 .prepare
= alc880_dig_playback_pcm_prepare
,
4064 .cleanup
= alc880_dig_playback_pcm_cleanup
4068 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
4072 /* NID is set in alc_build_pcms */
4075 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4076 static struct hda_pcm_stream alc_pcm_null_stream
= {
4082 static int alc_build_pcms(struct hda_codec
*codec
)
4084 struct alc_spec
*spec
= codec
->spec
;
4085 struct hda_pcm
*info
= spec
->pcm_rec
;
4088 codec
->num_pcms
= 1;
4089 codec
->pcm_info
= info
;
4091 if (spec
->no_analog
)
4094 snprintf(spec
->stream_name_analog
, sizeof(spec
->stream_name_analog
),
4095 "%s Analog", codec
->chip_name
);
4096 info
->name
= spec
->stream_name_analog
;
4098 if (spec
->stream_analog_playback
) {
4099 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
4101 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
4102 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
4104 if (spec
->stream_analog_capture
) {
4105 if (snd_BUG_ON(!spec
->adc_nids
))
4107 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
4108 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
4111 if (spec
->channel_mode
) {
4112 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
4113 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
4114 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
4115 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
4121 /* SPDIF for stream index #1 */
4122 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
4123 snprintf(spec
->stream_name_digital
,
4124 sizeof(spec
->stream_name_digital
),
4125 "%s Digital", codec
->chip_name
);
4126 codec
->num_pcms
= 2;
4127 codec
->slave_dig_outs
= spec
->multiout
.slave_dig_outs
;
4128 info
= spec
->pcm_rec
+ 1;
4129 info
->name
= spec
->stream_name_digital
;
4130 if (spec
->dig_out_type
)
4131 info
->pcm_type
= spec
->dig_out_type
;
4133 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
4134 if (spec
->multiout
.dig_out_nid
&&
4135 spec
->stream_digital_playback
) {
4136 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
4137 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
4139 if (spec
->dig_in_nid
&&
4140 spec
->stream_digital_capture
) {
4141 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
4142 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
4144 /* FIXME: do we need this for all Realtek codec models? */
4145 codec
->spdif_status_reset
= 1;
4148 if (spec
->no_analog
)
4151 /* If the use of more than one ADC is requested for the current
4152 * model, configure a second analog capture-only PCM.
4154 /* Additional Analaog capture for index #2 */
4155 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
4156 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
4157 codec
->num_pcms
= 3;
4158 info
= spec
->pcm_rec
+ 2;
4159 info
->name
= spec
->stream_name_analog
;
4160 if (spec
->alt_dac_nid
) {
4161 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
4162 *spec
->stream_analog_alt_playback
;
4163 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
4166 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
4167 alc_pcm_null_stream
;
4168 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
4170 if (spec
->num_adc_nids
> 1) {
4171 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
4172 *spec
->stream_analog_alt_capture
;
4173 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
4175 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
4176 spec
->num_adc_nids
- 1;
4178 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
4179 alc_pcm_null_stream
;
4180 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
4187 static inline void alc_shutup(struct hda_codec
*codec
)
4189 snd_hda_shutup_pins(codec
);
4192 static void alc_free_kctls(struct hda_codec
*codec
)
4194 struct alc_spec
*spec
= codec
->spec
;
4196 if (spec
->kctls
.list
) {
4197 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
4199 for (i
= 0; i
< spec
->kctls
.used
; i
++)
4200 kfree(kctl
[i
].name
);
4202 snd_array_free(&spec
->kctls
);
4205 static void alc_free(struct hda_codec
*codec
)
4207 struct alc_spec
*spec
= codec
->spec
;
4213 alc_free_kctls(codec
);
4215 snd_hda_detach_beep_device(codec
);
4218 #ifdef CONFIG_SND_HDA_POWER_SAVE
4219 static void alc_power_eapd(struct hda_codec
*codec
)
4221 /* We currently only handle front, HP */
4222 switch (codec
->vendor_id
) {
4224 set_eapd(codec
, 0x0f, 0);
4225 set_eapd(codec
, 0x10, 0);
4238 set_eapd(codec
, 0x14, 0);
4239 set_eapd(codec
, 0x15, 0);
4244 static int alc_suspend(struct hda_codec
*codec
, pm_message_t state
)
4246 struct alc_spec
*spec
= codec
->spec
;
4248 if (spec
&& spec
->power_hook
)
4249 spec
->power_hook(codec
);
4254 #ifdef SND_HDA_NEEDS_RESUME
4255 static int alc_resume(struct hda_codec
*codec
)
4257 codec
->patch_ops
.init(codec
);
4258 snd_hda_codec_resume_amp(codec
);
4259 snd_hda_codec_resume_cache(codec
);
4260 hda_call_check_power_status(codec
, 0x01);
4267 static struct hda_codec_ops alc_patch_ops
= {
4268 .build_controls
= alc_build_controls
,
4269 .build_pcms
= alc_build_pcms
,
4272 .unsol_event
= alc_unsol_event
,
4273 #ifdef SND_HDA_NEEDS_RESUME
4274 .resume
= alc_resume
,
4276 #ifdef CONFIG_SND_HDA_POWER_SAVE
4277 .suspend
= alc_suspend
,
4278 .check_power_status
= alc_check_power_status
,
4280 .reboot_notify
= alc_shutup
,
4283 /* replace the codec chip_name with the given string */
4284 static int alc_codec_rename(struct hda_codec
*codec
, const char *name
)
4286 kfree(codec
->chip_name
);
4287 codec
->chip_name
= kstrdup(name
, GFP_KERNEL
);
4288 if (!codec
->chip_name
) {
4296 * Test configuration for debugging
4298 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4301 #ifdef CONFIG_SND_DEBUG
4302 static hda_nid_t alc880_test_dac_nids
[4] = {
4303 0x02, 0x03, 0x04, 0x05
4306 static struct hda_input_mux alc880_test_capture_source
= {
4315 { "Surround", 0x6 },
4319 static struct hda_channel_mode alc880_test_modes
[4] = {
4326 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
4327 struct snd_ctl_elem_info
*uinfo
)
4329 static char *texts
[] = {
4330 "N/A", "Line Out", "HP Out",
4331 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4333 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4335 uinfo
->value
.enumerated
.items
= 8;
4336 if (uinfo
->value
.enumerated
.item
>= 8)
4337 uinfo
->value
.enumerated
.item
= 7;
4338 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4342 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
4343 struct snd_ctl_elem_value
*ucontrol
)
4345 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4346 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4347 unsigned int pin_ctl
, item
= 0;
4349 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
4350 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4351 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
4352 if (pin_ctl
& AC_PINCTL_HP_EN
)
4356 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
4357 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
4358 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
4359 case AC_PINCTL_VREF_50
: item
= 4; break;
4360 case AC_PINCTL_VREF_GRD
: item
= 5; break;
4361 case AC_PINCTL_VREF_80
: item
= 6; break;
4362 case AC_PINCTL_VREF_100
: item
= 7; break;
4365 ucontrol
->value
.enumerated
.item
[0] = item
;
4369 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
4370 struct snd_ctl_elem_value
*ucontrol
)
4372 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4373 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4374 static unsigned int ctls
[] = {
4375 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
4376 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
4377 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
4378 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
4379 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
4380 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
4382 unsigned int old_ctl
, new_ctl
;
4384 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
4385 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4386 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
4387 if (old_ctl
!= new_ctl
) {
4389 snd_hda_codec_write_cache(codec
, nid
, 0,
4390 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4392 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
4394 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
4401 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
4402 struct snd_ctl_elem_info
*uinfo
)
4404 static char *texts
[] = {
4405 "Front", "Surround", "CLFE", "Side"
4407 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4409 uinfo
->value
.enumerated
.items
= 4;
4410 if (uinfo
->value
.enumerated
.item
>= 4)
4411 uinfo
->value
.enumerated
.item
= 3;
4412 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4416 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
4417 struct snd_ctl_elem_value
*ucontrol
)
4419 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4420 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4423 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
4424 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
4428 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
4429 struct snd_ctl_elem_value
*ucontrol
)
4431 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4432 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4435 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
4436 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
4437 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
4438 snd_hda_codec_write_cache(codec
, nid
, 0,
4439 AC_VERB_SET_CONNECT_SEL
, sel
);
4445 #define PIN_CTL_TEST(xname,nid) { \
4446 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4448 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4449 .info = alc_test_pin_ctl_info, \
4450 .get = alc_test_pin_ctl_get, \
4451 .put = alc_test_pin_ctl_put, \
4452 .private_value = nid \
4455 #define PIN_SRC_TEST(xname,nid) { \
4456 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4458 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4459 .info = alc_test_pin_src_info, \
4460 .get = alc_test_pin_src_get, \
4461 .put = alc_test_pin_src_put, \
4462 .private_value = nid \
4465 static struct snd_kcontrol_new alc880_test_mixer
[] = {
4466 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4467 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4468 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
4469 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
4470 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4471 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4472 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
4473 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
4474 PIN_CTL_TEST("Front Pin Mode", 0x14),
4475 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4476 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4477 PIN_CTL_TEST("Side Pin Mode", 0x17),
4478 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4479 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4480 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4481 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4482 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4483 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4484 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4485 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4486 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4487 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4488 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4489 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4490 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
4491 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
4492 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
4493 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
4494 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
4495 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
4497 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4498 .name
= "Channel Mode",
4499 .info
= alc_ch_mode_info
,
4500 .get
= alc_ch_mode_get
,
4501 .put
= alc_ch_mode_put
,
4506 static struct hda_verb alc880_test_init_verbs
[] = {
4507 /* Unmute inputs of 0x0c - 0x0f */
4508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4511 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4512 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4515 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4516 /* Vol output for 0x0c-0x0f */
4517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4518 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4519 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4521 /* Set output pins 0x14-0x17 */
4522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4524 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4525 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4526 /* Unmute output pins 0x14-0x17 */
4527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4528 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4529 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4530 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4531 /* Set input pins 0x18-0x1c */
4532 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4533 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4534 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4535 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4536 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4537 /* Mute input pins 0x18-0x1b */
4538 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4539 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4540 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4541 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4544 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4545 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4546 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4547 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4548 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4549 /* Analog input/passthru */
4550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4551 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4554 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4562 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
4563 [ALC880_3ST
] = "3stack",
4564 [ALC880_TCL_S700
] = "tcl",
4565 [ALC880_3ST_DIG
] = "3stack-digout",
4566 [ALC880_CLEVO
] = "clevo",
4567 [ALC880_5ST
] = "5stack",
4568 [ALC880_5ST_DIG
] = "5stack-digout",
4569 [ALC880_W810
] = "w810",
4570 [ALC880_Z71V
] = "z71v",
4571 [ALC880_6ST
] = "6stack",
4572 [ALC880_6ST_DIG
] = "6stack-digout",
4573 [ALC880_ASUS
] = "asus",
4574 [ALC880_ASUS_W1V
] = "asus-w1v",
4575 [ALC880_ASUS_DIG
] = "asus-dig",
4576 [ALC880_ASUS_DIG2
] = "asus-dig2",
4577 [ALC880_UNIWILL_DIG
] = "uniwill",
4578 [ALC880_UNIWILL_P53
] = "uniwill-p53",
4579 [ALC880_FUJITSU
] = "fujitsu",
4580 [ALC880_F1734
] = "F1734",
4582 [ALC880_LG_LW
] = "lg-lw",
4583 [ALC880_MEDION_RIM
] = "medion",
4584 #ifdef CONFIG_SND_DEBUG
4585 [ALC880_TEST
] = "test",
4587 [ALC880_AUTO
] = "auto",
4590 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
4591 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
4592 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
4593 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
4594 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
4595 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
4596 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
4597 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
4598 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
4599 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
4600 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
4601 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
4602 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
4603 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
4604 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
4605 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
4606 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
4607 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
4608 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
4609 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4610 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
4611 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
4612 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
4613 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
4614 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
4615 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
4616 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS
), /* default ASUS */
4617 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
4618 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
4619 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
4620 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
4621 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
4622 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
4623 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
4624 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
4625 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
4626 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
4627 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
4628 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
4629 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
4630 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
4631 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
4632 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
4633 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
4634 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
4635 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
4636 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
4637 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
4638 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
4639 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
4640 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734
),
4641 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
4642 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
4643 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
4644 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG
),
4645 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
4646 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
4647 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
4648 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
4649 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
4650 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
4651 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
4652 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
4653 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
4654 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
4655 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
4656 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
4657 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
4658 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
4659 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
4661 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST
),
4662 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
4663 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
4668 * ALC880 codec presets
4670 static struct alc_config_preset alc880_presets
[] = {
4672 .mixers
= { alc880_three_stack_mixer
},
4673 .init_verbs
= { alc880_volume_init_verbs
,
4674 alc880_pin_3stack_init_verbs
},
4675 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4676 .dac_nids
= alc880_dac_nids
,
4677 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4678 .channel_mode
= alc880_threestack_modes
,
4680 .input_mux
= &alc880_capture_source
,
4682 [ALC880_3ST_DIG
] = {
4683 .mixers
= { alc880_three_stack_mixer
},
4684 .init_verbs
= { alc880_volume_init_verbs
,
4685 alc880_pin_3stack_init_verbs
},
4686 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4687 .dac_nids
= alc880_dac_nids
,
4688 .dig_out_nid
= ALC880_DIGOUT_NID
,
4689 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4690 .channel_mode
= alc880_threestack_modes
,
4692 .input_mux
= &alc880_capture_source
,
4694 [ALC880_TCL_S700
] = {
4695 .mixers
= { alc880_tcl_s700_mixer
},
4696 .init_verbs
= { alc880_volume_init_verbs
,
4697 alc880_pin_tcl_S700_init_verbs
,
4698 alc880_gpio2_init_verbs
},
4699 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4700 .dac_nids
= alc880_dac_nids
,
4701 .adc_nids
= alc880_adc_nids_alt
, /* FIXME: correct? */
4702 .num_adc_nids
= 1, /* single ADC */
4704 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4705 .channel_mode
= alc880_2_jack_modes
,
4706 .input_mux
= &alc880_capture_source
,
4709 .mixers
= { alc880_three_stack_mixer
,
4710 alc880_five_stack_mixer
},
4711 .init_verbs
= { alc880_volume_init_verbs
,
4712 alc880_pin_5stack_init_verbs
},
4713 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4714 .dac_nids
= alc880_dac_nids
,
4715 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
4716 .channel_mode
= alc880_fivestack_modes
,
4717 .input_mux
= &alc880_capture_source
,
4719 [ALC880_5ST_DIG
] = {
4720 .mixers
= { alc880_three_stack_mixer
,
4721 alc880_five_stack_mixer
},
4722 .init_verbs
= { alc880_volume_init_verbs
,
4723 alc880_pin_5stack_init_verbs
},
4724 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4725 .dac_nids
= alc880_dac_nids
,
4726 .dig_out_nid
= ALC880_DIGOUT_NID
,
4727 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
4728 .channel_mode
= alc880_fivestack_modes
,
4729 .input_mux
= &alc880_capture_source
,
4732 .mixers
= { alc880_six_stack_mixer
},
4733 .init_verbs
= { alc880_volume_init_verbs
,
4734 alc880_pin_6stack_init_verbs
},
4735 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
4736 .dac_nids
= alc880_6st_dac_nids
,
4737 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
4738 .channel_mode
= alc880_sixstack_modes
,
4739 .input_mux
= &alc880_6stack_capture_source
,
4741 [ALC880_6ST_DIG
] = {
4742 .mixers
= { alc880_six_stack_mixer
},
4743 .init_verbs
= { alc880_volume_init_verbs
,
4744 alc880_pin_6stack_init_verbs
},
4745 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
4746 .dac_nids
= alc880_6st_dac_nids
,
4747 .dig_out_nid
= ALC880_DIGOUT_NID
,
4748 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
4749 .channel_mode
= alc880_sixstack_modes
,
4750 .input_mux
= &alc880_6stack_capture_source
,
4753 .mixers
= { alc880_w810_base_mixer
},
4754 .init_verbs
= { alc880_volume_init_verbs
,
4755 alc880_pin_w810_init_verbs
,
4756 alc880_gpio2_init_verbs
},
4757 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
4758 .dac_nids
= alc880_w810_dac_nids
,
4759 .dig_out_nid
= ALC880_DIGOUT_NID
,
4760 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
4761 .channel_mode
= alc880_w810_modes
,
4762 .input_mux
= &alc880_capture_source
,
4765 .mixers
= { alc880_z71v_mixer
},
4766 .init_verbs
= { alc880_volume_init_verbs
,
4767 alc880_pin_z71v_init_verbs
},
4768 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
4769 .dac_nids
= alc880_z71v_dac_nids
,
4770 .dig_out_nid
= ALC880_DIGOUT_NID
,
4772 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4773 .channel_mode
= alc880_2_jack_modes
,
4774 .input_mux
= &alc880_capture_source
,
4777 .mixers
= { alc880_f1734_mixer
},
4778 .init_verbs
= { alc880_volume_init_verbs
,
4779 alc880_pin_f1734_init_verbs
},
4780 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
4781 .dac_nids
= alc880_f1734_dac_nids
,
4783 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4784 .channel_mode
= alc880_2_jack_modes
,
4785 .input_mux
= &alc880_f1734_capture_source
,
4786 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4787 .setup
= alc880_uniwill_p53_setup
,
4788 .init_hook
= alc_automute_amp
,
4791 .mixers
= { alc880_asus_mixer
},
4792 .init_verbs
= { alc880_volume_init_verbs
,
4793 alc880_pin_asus_init_verbs
,
4794 alc880_gpio1_init_verbs
},
4795 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4796 .dac_nids
= alc880_asus_dac_nids
,
4797 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4798 .channel_mode
= alc880_asus_modes
,
4800 .input_mux
= &alc880_capture_source
,
4802 [ALC880_ASUS_DIG
] = {
4803 .mixers
= { alc880_asus_mixer
},
4804 .init_verbs
= { alc880_volume_init_verbs
,
4805 alc880_pin_asus_init_verbs
,
4806 alc880_gpio1_init_verbs
},
4807 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4808 .dac_nids
= alc880_asus_dac_nids
,
4809 .dig_out_nid
= ALC880_DIGOUT_NID
,
4810 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4811 .channel_mode
= alc880_asus_modes
,
4813 .input_mux
= &alc880_capture_source
,
4815 [ALC880_ASUS_DIG2
] = {
4816 .mixers
= { alc880_asus_mixer
},
4817 .init_verbs
= { alc880_volume_init_verbs
,
4818 alc880_pin_asus_init_verbs
,
4819 alc880_gpio2_init_verbs
}, /* use GPIO2 */
4820 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4821 .dac_nids
= alc880_asus_dac_nids
,
4822 .dig_out_nid
= ALC880_DIGOUT_NID
,
4823 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4824 .channel_mode
= alc880_asus_modes
,
4826 .input_mux
= &alc880_capture_source
,
4828 [ALC880_ASUS_W1V
] = {
4829 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
4830 .init_verbs
= { alc880_volume_init_verbs
,
4831 alc880_pin_asus_init_verbs
,
4832 alc880_gpio1_init_verbs
},
4833 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4834 .dac_nids
= alc880_asus_dac_nids
,
4835 .dig_out_nid
= ALC880_DIGOUT_NID
,
4836 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4837 .channel_mode
= alc880_asus_modes
,
4839 .input_mux
= &alc880_capture_source
,
4841 [ALC880_UNIWILL_DIG
] = {
4842 .mixers
= { alc880_asus_mixer
},
4843 .init_verbs
= { alc880_volume_init_verbs
,
4844 alc880_pin_asus_init_verbs
},
4845 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4846 .dac_nids
= alc880_asus_dac_nids
,
4847 .dig_out_nid
= ALC880_DIGOUT_NID
,
4848 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4849 .channel_mode
= alc880_asus_modes
,
4851 .input_mux
= &alc880_capture_source
,
4853 [ALC880_UNIWILL
] = {
4854 .mixers
= { alc880_uniwill_mixer
},
4855 .init_verbs
= { alc880_volume_init_verbs
,
4856 alc880_uniwill_init_verbs
},
4857 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4858 .dac_nids
= alc880_asus_dac_nids
,
4859 .dig_out_nid
= ALC880_DIGOUT_NID
,
4860 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4861 .channel_mode
= alc880_threestack_modes
,
4863 .input_mux
= &alc880_capture_source
,
4864 .unsol_event
= alc880_uniwill_unsol_event
,
4865 .setup
= alc880_uniwill_setup
,
4866 .init_hook
= alc880_uniwill_init_hook
,
4868 [ALC880_UNIWILL_P53
] = {
4869 .mixers
= { alc880_uniwill_p53_mixer
},
4870 .init_verbs
= { alc880_volume_init_verbs
,
4871 alc880_uniwill_p53_init_verbs
},
4872 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4873 .dac_nids
= alc880_asus_dac_nids
,
4874 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
4875 .channel_mode
= alc880_threestack_modes
,
4876 .input_mux
= &alc880_capture_source
,
4877 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4878 .setup
= alc880_uniwill_p53_setup
,
4879 .init_hook
= alc_automute_amp
,
4881 [ALC880_FUJITSU
] = {
4882 .mixers
= { alc880_fujitsu_mixer
},
4883 .init_verbs
= { alc880_volume_init_verbs
,
4884 alc880_uniwill_p53_init_verbs
,
4885 alc880_beep_init_verbs
},
4886 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4887 .dac_nids
= alc880_dac_nids
,
4888 .dig_out_nid
= ALC880_DIGOUT_NID
,
4889 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4890 .channel_mode
= alc880_2_jack_modes
,
4891 .input_mux
= &alc880_capture_source
,
4892 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4893 .setup
= alc880_uniwill_p53_setup
,
4894 .init_hook
= alc_automute_amp
,
4897 .mixers
= { alc880_three_stack_mixer
},
4898 .init_verbs
= { alc880_volume_init_verbs
,
4899 alc880_pin_clevo_init_verbs
},
4900 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4901 .dac_nids
= alc880_dac_nids
,
4903 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4904 .channel_mode
= alc880_threestack_modes
,
4906 .input_mux
= &alc880_capture_source
,
4909 .mixers
= { alc880_lg_mixer
},
4910 .init_verbs
= { alc880_volume_init_verbs
,
4911 alc880_lg_init_verbs
},
4912 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
4913 .dac_nids
= alc880_lg_dac_nids
,
4914 .dig_out_nid
= ALC880_DIGOUT_NID
,
4915 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
4916 .channel_mode
= alc880_lg_ch_modes
,
4918 .input_mux
= &alc880_lg_capture_source
,
4919 .unsol_event
= alc_automute_amp_unsol_event
,
4920 .setup
= alc880_lg_setup
,
4921 .init_hook
= alc_automute_amp
,
4922 #ifdef CONFIG_SND_HDA_POWER_SAVE
4923 .loopbacks
= alc880_lg_loopbacks
,
4927 .mixers
= { alc880_lg_lw_mixer
},
4928 .init_verbs
= { alc880_volume_init_verbs
,
4929 alc880_lg_lw_init_verbs
},
4930 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4931 .dac_nids
= alc880_dac_nids
,
4932 .dig_out_nid
= ALC880_DIGOUT_NID
,
4933 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
4934 .channel_mode
= alc880_lg_lw_modes
,
4935 .input_mux
= &alc880_lg_lw_capture_source
,
4936 .unsol_event
= alc_automute_amp_unsol_event
,
4937 .setup
= alc880_lg_lw_setup
,
4938 .init_hook
= alc_automute_amp
,
4940 [ALC880_MEDION_RIM
] = {
4941 .mixers
= { alc880_medion_rim_mixer
},
4942 .init_verbs
= { alc880_volume_init_verbs
,
4943 alc880_medion_rim_init_verbs
,
4944 alc_gpio2_init_verbs
},
4945 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4946 .dac_nids
= alc880_dac_nids
,
4947 .dig_out_nid
= ALC880_DIGOUT_NID
,
4948 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4949 .channel_mode
= alc880_2_jack_modes
,
4950 .input_mux
= &alc880_medion_rim_capture_source
,
4951 .unsol_event
= alc880_medion_rim_unsol_event
,
4952 .setup
= alc880_medion_rim_setup
,
4953 .init_hook
= alc880_medion_rim_automute
,
4955 #ifdef CONFIG_SND_DEBUG
4957 .mixers
= { alc880_test_mixer
},
4958 .init_verbs
= { alc880_test_init_verbs
},
4959 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
4960 .dac_nids
= alc880_test_dac_nids
,
4961 .dig_out_nid
= ALC880_DIGOUT_NID
,
4962 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
4963 .channel_mode
= alc880_test_modes
,
4964 .input_mux
= &alc880_test_capture_source
,
4970 * Automatic parse of I/O pins from the BIOS configuration
4975 ALC_CTL_WIDGET_MUTE
,
4978 static struct snd_kcontrol_new alc880_control_templates
[] = {
4979 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
4980 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
4981 HDA_BIND_MUTE(NULL
, 0, 0, 0),
4984 /* add dynamic controls */
4985 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
4986 int cidx
, unsigned long val
)
4988 struct snd_kcontrol_new
*knew
;
4990 snd_array_init(&spec
->kctls
, sizeof(*knew
), 32);
4991 knew
= snd_array_new(&spec
->kctls
);
4994 *knew
= alc880_control_templates
[type
];
4995 knew
->name
= kstrdup(name
, GFP_KERNEL
);
4999 if (get_amp_nid_(val
))
5000 knew
->subdevice
= HDA_SUBDEV_AMP_FLAG
;
5001 knew
->private_value
= val
;
5005 static int add_control_with_pfx(struct alc_spec
*spec
, int type
,
5006 const char *pfx
, const char *dir
,
5007 const char *sfx
, int cidx
, unsigned long val
)
5010 snprintf(name
, sizeof(name
), "%s %s %s", pfx
, dir
, sfx
);
5011 return add_control(spec
, type
, name
, cidx
, val
);
5014 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5015 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5016 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5017 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5018 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5019 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5020 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5021 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5023 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5024 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5025 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5026 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5027 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5028 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5029 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5030 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5031 #define ALC880_PIN_CD_NID 0x1c
5033 /* fill in the dac_nids table from the parsed pin configuration */
5034 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
5035 const struct auto_pin_cfg
*cfg
)
5041 memset(assigned
, 0, sizeof(assigned
));
5042 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
5044 /* check the pins hardwired to audio widget */
5045 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5046 nid
= cfg
->line_out_pins
[i
];
5047 if (alc880_is_fixed_pin(nid
)) {
5048 int idx
= alc880_fixed_pin_idx(nid
);
5049 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
5053 /* left pins can be connect to any audio widget */
5054 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5055 nid
= cfg
->line_out_pins
[i
];
5056 if (alc880_is_fixed_pin(nid
))
5058 /* search for an empty channel */
5059 for (j
= 0; j
< cfg
->line_outs
; j
++) {
5061 spec
->multiout
.dac_nids
[i
] =
5062 alc880_idx_to_dac(j
);
5068 spec
->multiout
.num_dacs
= cfg
->line_outs
;
5072 static const char *alc_get_line_out_pfx(const struct auto_pin_cfg
*cfg
,
5075 if (!cfg
->hp_outs
&& !cfg
->speaker_outs
&& can_be_master
)
5078 switch (cfg
->line_out_type
) {
5079 case AUTO_PIN_SPEAKER_OUT
:
5081 case AUTO_PIN_HP_OUT
:
5084 if (cfg
->line_outs
== 1)
5091 /* add playback controls from the parsed DAC table */
5092 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
5093 const struct auto_pin_cfg
*cfg
)
5095 static const char *chname
[4] = {
5096 "Front", "Surround", NULL
/*CLFE*/, "Side"
5098 const char *pfx
= alc_get_line_out_pfx(cfg
, false);
5102 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5103 if (!spec
->multiout
.dac_nids
[i
])
5105 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
5106 if (!pfx
&& i
== 2) {
5108 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5110 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
5114 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5116 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
5120 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5122 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
5126 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5128 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
5133 const char *name
= pfx
;
5136 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5138 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
5142 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5144 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
5153 /* add playback controls for speaker and HP outputs */
5154 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
5163 if (alc880_is_fixed_pin(pin
)) {
5164 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
5165 /* specify the DAC as the extra output */
5166 if (!spec
->multiout
.hp_nid
)
5167 spec
->multiout
.hp_nid
= nid
;
5169 spec
->multiout
.extra_out_nid
[0] = nid
;
5170 /* control HP volume/switch on the output mixer amp */
5171 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
5172 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
5173 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
5176 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
5177 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
5180 } else if (alc880_is_multi_pin(pin
)) {
5181 /* set manual connection */
5182 /* we have only a switch on HP-out PIN */
5183 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
5184 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
5191 /* create input playback/capture controls for the given pin */
5192 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
5193 const char *ctlname
, int ctlidx
,
5194 int idx
, hda_nid_t mix_nid
)
5198 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
, ctlidx
,
5199 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
5202 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
, ctlidx
,
5203 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
5209 static int alc_is_input_pin(struct hda_codec
*codec
, hda_nid_t nid
)
5211 unsigned int pincap
= snd_hda_query_pin_caps(codec
, nid
);
5212 return (pincap
& AC_PINCAP_IN
) != 0;
5215 /* create playback/capture controls for input pins */
5216 static int alc_auto_create_input_ctls(struct hda_codec
*codec
,
5217 const struct auto_pin_cfg
*cfg
,
5219 hda_nid_t cap1
, hda_nid_t cap2
)
5221 struct alc_spec
*spec
= codec
->spec
;
5222 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
5223 int i
, err
, idx
, type_idx
= 0;
5224 const char *prev_label
= NULL
;
5226 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5230 pin
= cfg
->inputs
[i
].pin
;
5231 if (!alc_is_input_pin(codec
, pin
))
5234 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
5235 if (prev_label
&& !strcmp(label
, prev_label
))
5242 idx
= get_connection_index(codec
, mixer
, pin
);
5244 err
= new_analog_input(spec
, pin
,
5254 idx
= get_connection_index(codec
, cap1
, pin
);
5255 if (idx
< 0 && cap2
)
5256 idx
= get_connection_index(codec
, cap2
, pin
);
5258 snd_hda_add_imux_item(imux
, label
, idx
, NULL
);
5263 static int alc880_auto_create_input_ctls(struct hda_codec
*codec
,
5264 const struct auto_pin_cfg
*cfg
)
5266 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x08, 0x09);
5269 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
5270 unsigned int pin_type
)
5272 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5275 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5279 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
5280 hda_nid_t nid
, int pin_type
,
5283 alc_set_pin_output(codec
, nid
, pin_type
);
5284 /* need the manual connection? */
5285 if (alc880_is_multi_pin(nid
)) {
5286 struct alc_spec
*spec
= codec
->spec
;
5287 int idx
= alc880_multi_pin_idx(nid
);
5288 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
5289 AC_VERB_SET_CONNECT_SEL
,
5290 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
5294 static int get_pin_type(int line_out_type
)
5296 if (line_out_type
== AUTO_PIN_HP_OUT
)
5302 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
5304 struct alc_spec
*spec
= codec
->spec
;
5307 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
5308 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
5309 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5310 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
5314 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
5316 struct alc_spec
*spec
= codec
->spec
;
5319 pin
= spec
->autocfg
.speaker_pins
[0];
5320 if (pin
) /* connect to front */
5321 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
5322 pin
= spec
->autocfg
.hp_pins
[0];
5323 if (pin
) /* connect to front */
5324 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
5327 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
5329 struct alc_spec
*spec
= codec
->spec
;
5330 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5333 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5334 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5335 if (alc_is_input_pin(codec
, nid
)) {
5336 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
5337 if (nid
!= ALC880_PIN_CD_NID
&&
5338 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
5339 snd_hda_codec_write(codec
, nid
, 0,
5340 AC_VERB_SET_AMP_GAIN_MUTE
,
5346 static void alc880_auto_init_input_src(struct hda_codec
*codec
)
5348 struct alc_spec
*spec
= codec
->spec
;
5351 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
5352 unsigned int mux_idx
;
5353 const struct hda_input_mux
*imux
;
5354 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
5355 imux
= &spec
->input_mux
[mux_idx
];
5356 if (!imux
->num_items
&& mux_idx
> 0)
5357 imux
= &spec
->input_mux
[0];
5359 snd_hda_codec_write(codec
, spec
->adc_nids
[c
], 0,
5360 AC_VERB_SET_CONNECT_SEL
,
5361 imux
->items
[0].index
);
5365 /* parse the BIOS configuration and set up the alc_spec */
5366 /* return 1 if successful, 0 if the proper config is not found,
5367 * or a negative error code
5369 static int alc880_parse_auto_config(struct hda_codec
*codec
)
5371 struct alc_spec
*spec
= codec
->spec
;
5373 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
5375 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5379 if (!spec
->autocfg
.line_outs
)
5380 return 0; /* can't find valid BIOS pin config */
5382 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
5385 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5388 err
= alc880_auto_create_extra_out(spec
,
5389 spec
->autocfg
.speaker_pins
[0],
5393 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
5397 err
= alc880_auto_create_input_ctls(codec
, &spec
->autocfg
);
5401 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
5403 alc_auto_parse_digital(codec
);
5405 if (spec
->kctls
.list
)
5406 add_mixer(spec
, spec
->kctls
.list
);
5408 add_verb(spec
, alc880_volume_init_verbs
);
5410 spec
->num_mux_defs
= 1;
5411 spec
->input_mux
= &spec
->private_imux
[0];
5413 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
5418 /* additional initialization for auto-configuration model */
5419 static void alc880_auto_init(struct hda_codec
*codec
)
5421 struct alc_spec
*spec
= codec
->spec
;
5422 alc880_auto_init_multi_out(codec
);
5423 alc880_auto_init_extra_out(codec
);
5424 alc880_auto_init_analog_input(codec
);
5425 alc880_auto_init_input_src(codec
);
5426 alc_auto_init_digital(codec
);
5427 if (spec
->unsol_event
)
5428 alc_inithook(codec
);
5431 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5432 * one of two digital mic pins, e.g. on ALC272
5434 static void fixup_automic_adc(struct hda_codec
*codec
)
5436 struct alc_spec
*spec
= codec
->spec
;
5439 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5440 hda_nid_t cap
= spec
->capsrc_nids
?
5441 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5444 iidx
= get_connection_index(codec
, cap
, spec
->int_mic
.pin
);
5447 eidx
= get_connection_index(codec
, cap
, spec
->ext_mic
.pin
);
5450 spec
->int_mic
.mux_idx
= iidx
;
5451 spec
->ext_mic
.mux_idx
= eidx
;
5452 if (spec
->capsrc_nids
)
5453 spec
->capsrc_nids
+= i
;
5454 spec
->adc_nids
+= i
;
5455 spec
->num_adc_nids
= 1;
5458 snd_printd(KERN_INFO
"hda_codec: %s: "
5459 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5460 codec
->chip_name
, spec
->int_mic
.pin
, spec
->ext_mic
.pin
);
5461 spec
->auto_mic
= 0; /* disable auto-mic to be sure */
5464 /* select or unmute the given capsrc route */
5465 static void select_or_unmute_capsrc(struct hda_codec
*codec
, hda_nid_t cap
,
5468 if (get_wcaps_type(get_wcaps(codec
, cap
)) == AC_WID_AUD_MIX
) {
5469 snd_hda_codec_amp_stereo(codec
, cap
, HDA_INPUT
, idx
,
5472 snd_hda_codec_write_cache(codec
, cap
, 0,
5473 AC_VERB_SET_CONNECT_SEL
, idx
);
5477 /* set the default connection to that pin */
5478 static int init_capsrc_for_pin(struct hda_codec
*codec
, hda_nid_t pin
)
5480 struct alc_spec
*spec
= codec
->spec
;
5483 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5484 hda_nid_t cap
= spec
->capsrc_nids
?
5485 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5488 idx
= get_connection_index(codec
, cap
, pin
);
5491 select_or_unmute_capsrc(codec
, cap
, idx
);
5492 return i
; /* return the found index */
5494 return -1; /* not found */
5497 /* choose the ADC/MUX containing the input pin and initialize the setup */
5498 static void fixup_single_adc(struct hda_codec
*codec
)
5500 struct alc_spec
*spec
= codec
->spec
;
5501 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5504 /* search for the input pin; there must be only one */
5505 if (cfg
->num_inputs
!= 1)
5507 i
= init_capsrc_for_pin(codec
, cfg
->inputs
[0].pin
);
5509 /* use only this ADC */
5510 if (spec
->capsrc_nids
)
5511 spec
->capsrc_nids
+= i
;
5512 spec
->adc_nids
+= i
;
5513 spec
->num_adc_nids
= 1;
5517 /* initialize dual adcs */
5518 static void fixup_dual_adc_switch(struct hda_codec
*codec
)
5520 struct alc_spec
*spec
= codec
->spec
;
5521 init_capsrc_for_pin(codec
, spec
->ext_mic
.pin
);
5522 init_capsrc_for_pin(codec
, spec
->int_mic
.pin
);
5525 static void set_capture_mixer(struct hda_codec
*codec
)
5527 struct alc_spec
*spec
= codec
->spec
;
5528 static struct snd_kcontrol_new
*caps
[2][3] = {
5529 { alc_capture_mixer_nosrc1
,
5530 alc_capture_mixer_nosrc2
,
5531 alc_capture_mixer_nosrc3
},
5532 { alc_capture_mixer1
,
5534 alc_capture_mixer3
},
5536 if (spec
->num_adc_nids
> 0 && spec
->num_adc_nids
<= 3) {
5538 int num_adcs
= spec
->num_adc_nids
;
5539 if (spec
->dual_adc_switch
)
5540 fixup_dual_adc_switch(codec
);
5541 else if (spec
->auto_mic
)
5542 fixup_automic_adc(codec
);
5543 else if (spec
->input_mux
) {
5544 if (spec
->input_mux
->num_items
> 1)
5546 else if (spec
->input_mux
->num_items
== 1)
5547 fixup_single_adc(codec
);
5549 if (spec
->dual_adc_switch
)
5551 spec
->cap_mixer
= caps
[mux
][num_adcs
- 1];
5555 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5556 static void fillup_priv_adc_nids(struct hda_codec
*codec
, hda_nid_t
*nids
,
5559 struct alc_spec
*spec
= codec
->spec
;
5560 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5562 hda_nid_t fallback_adc
= 0, fallback_cap
= 0;
5564 for (n
= 0; n
< num_nids
; n
++) {
5566 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
5570 if (get_wcaps_type(get_wcaps(codec
, adc
)) != AC_WID_AUD_IN
)
5573 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5577 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5582 if (!fallback_adc
) {
5586 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5587 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5588 for (j
= 0; j
< nconns
; j
++) {
5595 if (i
>= cfg
->num_inputs
) {
5596 int num_adcs
= spec
->num_adc_nids
;
5597 spec
->private_adc_nids
[num_adcs
] = adc
;
5598 spec
->private_capsrc_nids
[num_adcs
] = cap
;
5599 spec
->num_adc_nids
++;
5600 spec
->adc_nids
= spec
->private_adc_nids
;
5602 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
5605 if (!spec
->num_adc_nids
) {
5606 printk(KERN_WARNING
"hda_codec: %s: no valid ADC found;"
5607 " using fallback 0x%x\n",
5608 codec
->chip_name
, fallback_adc
);
5609 spec
->private_adc_nids
[0] = fallback_adc
;
5610 spec
->adc_nids
= spec
->private_adc_nids
;
5611 if (fallback_adc
!= fallback_cap
) {
5612 spec
->private_capsrc_nids
[0] = fallback_cap
;
5613 spec
->capsrc_nids
= spec
->private_adc_nids
;
5618 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5619 #define set_beep_amp(spec, nid, idx, dir) \
5620 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5622 static struct snd_pci_quirk beep_white_list
[] = {
5623 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5624 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5625 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5629 static inline int has_cdefine_beep(struct hda_codec
*codec
)
5631 struct alc_spec
*spec
= codec
->spec
;
5632 const struct snd_pci_quirk
*q
;
5633 q
= snd_pci_quirk_lookup(codec
->bus
->pci
, beep_white_list
);
5636 return spec
->cdefine
.enable_pcbeep
;
5639 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5640 #define has_cdefine_beep(codec) 0
5644 * OK, here we have finally the patch for ALC880
5647 static int patch_alc880(struct hda_codec
*codec
)
5649 struct alc_spec
*spec
;
5653 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5659 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
5662 if (board_config
< 0) {
5663 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5665 board_config
= ALC880_AUTO
;
5668 if (board_config
== ALC880_AUTO
) {
5669 /* automatic parse from the BIOS config */
5670 err
= alc880_parse_auto_config(codec
);
5676 "hda_codec: Cannot set up configuration "
5677 "from BIOS. Using 3-stack mode...\n");
5678 board_config
= ALC880_3ST
;
5682 err
= snd_hda_attach_beep_device(codec
, 0x1);
5688 if (board_config
!= ALC880_AUTO
)
5689 setup_preset(codec
, &alc880_presets
[board_config
]);
5691 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
5692 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
5693 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
5695 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
5696 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
5698 if (!spec
->adc_nids
&& spec
->input_mux
) {
5699 /* check whether NID 0x07 is valid */
5700 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
5702 wcap
= get_wcaps_type(wcap
);
5703 if (wcap
!= AC_WID_AUD_IN
) {
5704 spec
->adc_nids
= alc880_adc_nids_alt
;
5705 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
5707 spec
->adc_nids
= alc880_adc_nids
;
5708 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
5711 set_capture_mixer(codec
);
5712 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
5714 spec
->vmaster_nid
= 0x0c;
5716 codec
->patch_ops
= alc_patch_ops
;
5717 if (board_config
== ALC880_AUTO
)
5718 spec
->init_hook
= alc880_auto_init
;
5719 #ifdef CONFIG_SND_HDA_POWER_SAVE
5720 if (!spec
->loopback
.amplist
)
5721 spec
->loopback
.amplist
= alc880_loopbacks
;
5732 static hda_nid_t alc260_dac_nids
[1] = {
5737 static hda_nid_t alc260_adc_nids
[1] = {
5742 static hda_nid_t alc260_adc_nids_alt
[1] = {
5747 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5748 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5750 static hda_nid_t alc260_dual_adc_nids
[2] = {
5755 #define ALC260_DIGOUT_NID 0x03
5756 #define ALC260_DIGIN_NID 0x06
5758 static struct hda_input_mux alc260_capture_source
= {
5762 { "Front Mic", 0x1 },
5768 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5769 * headphone jack and the internal CD lines since these are the only pins at
5770 * which audio can appear. For flexibility, also allow the option of
5771 * recording the mixer output on the second ADC (ADC0 doesn't have a
5772 * connection to the mixer output).
5774 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
5778 { "Mic/Line", 0x0 },
5780 { "Headphone", 0x2 },
5786 { "Mic/Line", 0x0 },
5788 { "Headphone", 0x2 },
5795 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5796 * the Fujitsu S702x, but jacks are marked differently.
5798 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
5805 { "Headphone", 0x5 },
5814 { "Headphone", 0x6 },
5820 /* Maxdata Favorit 100XS */
5821 static struct hda_input_mux alc260_favorit100_capture_sources
[2] = {
5825 { "Line/Mic", 0x0 },
5832 { "Line/Mic", 0x0 },
5840 * This is just place-holder, so there's something for alc_build_pcms to look
5841 * at when it calculates the maximum number of channels. ALC260 has no mixer
5842 * element which allows changing the channel mode, so the verb list is
5845 static struct hda_channel_mode alc260_modes
[1] = {
5850 /* Mixer combinations
5852 * basic: base_output + input + pc_beep + capture
5853 * HP: base_output + input + capture_alt
5854 * HP_3013: hp_3013 + input + capture
5855 * fujitsu: fujitsu + capture
5856 * acer: acer + capture
5859 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
5860 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5861 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
5862 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5863 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
5864 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
5865 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
5869 static struct snd_kcontrol_new alc260_input_mixer
[] = {
5870 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5871 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5872 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5873 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5875 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5876 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
5877 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
5881 /* update HP, line and mono out pins according to the master switch */
5882 static void alc260_hp_master_update(struct hda_codec
*codec
,
5883 hda_nid_t hp
, hda_nid_t line
,
5886 struct alc_spec
*spec
= codec
->spec
;
5887 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
5888 /* change HP and line-out pins */
5889 snd_hda_codec_write(codec
, hp
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5891 snd_hda_codec_write(codec
, line
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5893 /* mono (speaker) depending on the HP jack sense */
5894 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
5895 snd_hda_codec_write(codec
, mono
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5899 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
5900 struct snd_ctl_elem_value
*ucontrol
)
5902 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5903 struct alc_spec
*spec
= codec
->spec
;
5904 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
5908 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
5909 struct snd_ctl_elem_value
*ucontrol
)
5911 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5912 struct alc_spec
*spec
= codec
->spec
;
5913 int val
= !!*ucontrol
->value
.integer
.value
;
5914 hda_nid_t hp
, line
, mono
;
5916 if (val
== spec
->master_sw
)
5918 spec
->master_sw
= val
;
5919 hp
= (kcontrol
->private_value
>> 16) & 0xff;
5920 line
= (kcontrol
->private_value
>> 8) & 0xff;
5921 mono
= kcontrol
->private_value
& 0xff;
5922 alc260_hp_master_update(codec
, hp
, line
, mono
);
5926 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
5928 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5929 .name
= "Master Playback Switch",
5930 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
5931 .info
= snd_ctl_boolean_mono_info
,
5932 .get
= alc260_hp_master_sw_get
,
5933 .put
= alc260_hp_master_sw_put
,
5934 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
5936 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5937 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
5938 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5939 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
5940 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5942 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
5946 static struct hda_verb alc260_hp_unsol_verbs
[] = {
5947 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5951 static void alc260_hp_automute(struct hda_codec
*codec
)
5953 struct alc_spec
*spec
= codec
->spec
;
5955 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x10);
5956 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
5959 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5961 if ((res
>> 26) == ALC880_HP_EVENT
)
5962 alc260_hp_automute(codec
);
5965 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
5967 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5968 .name
= "Master Playback Switch",
5969 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
5970 .info
= snd_ctl_boolean_mono_info
,
5971 .get
= alc260_hp_master_sw_get
,
5972 .put
= alc260_hp_master_sw_put
,
5973 .private_value
= (0x15 << 16) | (0x10 << 8) | 0x11
5975 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5976 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
5977 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
5978 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
5979 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5981 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
5982 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
5986 static struct hda_bind_ctls alc260_dc7600_bind_master_vol
= {
5987 .ops
= &snd_hda_bind_vol
,
5989 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT
),
5990 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
5991 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT
),
5996 static struct hda_bind_ctls alc260_dc7600_bind_switch
= {
5997 .ops
= &snd_hda_bind_sw
,
5999 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT
),
6000 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
6005 static struct snd_kcontrol_new alc260_hp_dc7600_mixer
[] = {
6006 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol
),
6007 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch
),
6008 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT
),
6009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
6013 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
6014 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6018 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
6020 struct alc_spec
*spec
= codec
->spec
;
6022 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
6023 alc260_hp_master_update(codec
, 0x15, 0x10, 0x11);
6026 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
6029 if ((res
>> 26) == ALC880_HP_EVENT
)
6030 alc260_hp_3013_automute(codec
);
6033 static void alc260_hp_3012_automute(struct hda_codec
*codec
)
6035 unsigned int bits
= snd_hda_jack_detect(codec
, 0x10) ? 0 : PIN_OUT
;
6037 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
6039 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
6041 snd_hda_codec_write(codec
, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
6045 static void alc260_hp_3012_unsol_event(struct hda_codec
*codec
,
6048 if ((res
>> 26) == ALC880_HP_EVENT
)
6049 alc260_hp_3012_automute(codec
);
6052 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6053 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6055 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
6056 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6057 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
6058 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6059 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6060 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6061 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
6062 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
6063 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6064 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6065 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
6069 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6070 * versions of the ALC260 don't act on requests to enable mic bias from NID
6071 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6072 * datasheet doesn't mention this restriction. At this stage it's not clear
6073 * whether this behaviour is intentional or is a hardware bug in chip
6074 * revisions available in early 2006. Therefore for now allow the
6075 * "Headphone Jack Mode" control to span all choices, but if it turns out
6076 * that the lack of mic bias for this NID is intentional we could change the
6077 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6079 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6080 * don't appear to make the mic bias available from the "line" jack, even
6081 * though the NID used for this jack (0x14) can supply it. The theory is
6082 * that perhaps Acer have included blocking capacitors between the ALC260
6083 * and the output jack. If this turns out to be the case for all such
6084 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6085 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6087 * The C20x Tablet series have a mono internal speaker which is controlled
6088 * via the chip's Mono sum widget and pin complex, so include the necessary
6089 * controls for such models. On models without a "mono speaker" the control
6090 * won't do anything.
6092 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
6093 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6094 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
6095 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
6096 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6098 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6100 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6101 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6103 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6104 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6105 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6106 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6107 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6111 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6113 static struct snd_kcontrol_new alc260_favorit100_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("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
6117 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6118 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6119 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6123 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6124 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6126 static struct snd_kcontrol_new alc260_will_mixer
[] = {
6127 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6128 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
6129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6130 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6131 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6132 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6133 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6134 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6135 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6136 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6140 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6141 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6143 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
6144 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6145 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
6146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6147 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6148 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6149 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
6150 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
6151 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6152 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6153 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6158 * initialization verbs
6160 static struct hda_verb alc260_init_verbs
[] = {
6161 /* Line In pin widget for input */
6162 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6163 /* CD pin widget for input */
6164 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6165 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6166 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6167 /* Mic2 (front panel) pin widget for input and vref at 80% */
6168 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6169 /* LINE-2 is used for line-out in rear */
6170 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6171 /* select line-out */
6172 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
6174 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6176 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6178 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6179 /* mute capture amp left and right */
6180 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6181 /* set connection select to line in (default select for this ADC) */
6182 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6183 /* mute capture amp left and right */
6184 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6185 /* set connection select to line in (default select for this ADC) */
6186 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
6187 /* set vol=0 Line-Out mixer amp left and right */
6188 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6189 /* unmute pin widget amp left and right (no gain on this amp) */
6190 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6191 /* set vol=0 HP mixer amp left and right */
6192 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6193 /* unmute pin widget amp left and right (no gain on this amp) */
6194 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6195 /* set vol=0 Mono mixer amp left and right */
6196 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6197 /* unmute pin widget amp left and right (no gain on this amp) */
6198 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6199 /* unmute LINE-2 out pin */
6200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6201 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6204 /* mute analog inputs */
6205 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6206 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6207 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6208 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6209 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6210 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6211 /* mute Front out path */
6212 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6213 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6214 /* mute Headphone out path */
6215 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6216 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6217 /* mute Mono out path */
6218 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6219 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6223 #if 0 /* should be identical with alc260_init_verbs? */
6224 static struct hda_verb alc260_hp_init_verbs
[] = {
6225 /* Headphone and output */
6226 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6228 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6229 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6230 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6231 /* Mic2 (front panel) pin widget for input and vref at 80% */
6232 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6233 /* Line In pin widget for input */
6234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6235 /* Line-2 pin widget for output */
6236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6237 /* CD pin widget for input */
6238 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6239 /* unmute amp left and right */
6240 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
6241 /* set connection select to line in (default select for this ADC) */
6242 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6243 /* unmute Line-Out mixer amp left and right (volume = 0) */
6244 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6245 /* mute pin widget amp left and right (no gain on this amp) */
6246 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6247 /* unmute HP mixer amp left and right (volume = 0) */
6248 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6249 /* mute pin widget amp left and right (no gain on this amp) */
6250 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6251 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6254 /* mute analog inputs */
6255 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6256 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6257 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6259 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6260 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6261 /* Unmute Front out path */
6262 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6263 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6264 /* Unmute Headphone out path */
6265 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6266 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6267 /* Unmute Mono out path */
6268 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6269 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6274 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
6275 /* Line out and output */
6276 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6278 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6279 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6280 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6281 /* Mic2 (front panel) pin widget for input and vref at 80% */
6282 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6283 /* Line In pin widget for input */
6284 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6285 /* Headphone pin widget for output */
6286 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6287 /* CD pin widget for input */
6288 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6289 /* unmute amp left and right */
6290 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
6291 /* set connection select to line in (default select for this ADC) */
6292 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6293 /* unmute Line-Out mixer amp left and right (volume = 0) */
6294 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6295 /* mute pin widget amp left and right (no gain on this amp) */
6296 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6297 /* unmute HP mixer amp left and right (volume = 0) */
6298 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6299 /* mute pin widget amp left and right (no gain on this amp) */
6300 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6301 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6304 /* mute analog inputs */
6305 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6306 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6307 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6308 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6309 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6310 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6311 /* Unmute Front out path */
6312 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6313 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6314 /* Unmute Headphone out path */
6315 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6316 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6317 /* Unmute Mono out path */
6318 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6319 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6323 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6324 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6325 * audio = 0x16, internal speaker = 0x10.
6327 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
6328 /* Disable all GPIOs */
6329 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
6330 /* Internal speaker is connected to headphone pin */
6331 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6332 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6333 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6334 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6335 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6336 /* Ensure all other unused pins are disabled and muted. */
6337 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6338 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6339 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6340 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6341 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6342 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6343 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6344 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6346 /* Disable digital (SPDIF) pins */
6347 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6348 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6350 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6351 * when acting as an output.
6353 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6355 /* Start with output sum widgets muted and their output gains at min */
6356 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6357 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6358 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6359 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6360 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6361 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6362 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6363 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6364 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6366 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6367 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6368 /* Unmute Line1 pin widget output buffer since it starts as an output.
6369 * If the pin mode is changed by the user the pin mode control will
6370 * take care of enabling the pin's input/output buffers as needed.
6371 * Therefore there's no need to enable the input buffer at this
6374 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6375 /* Unmute input buffer of pin widget used for Line-in (no equiv
6378 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6380 /* Mute capture amp left and right */
6381 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6382 /* Set ADC connection select to match default mixer setting - line
6385 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6387 /* Do the same for the second ADC: mute capture input amp and
6388 * set ADC connection to line in (on mic1 pin)
6390 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6391 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6393 /* Mute all inputs to mixer widget (even unconnected ones) */
6394 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6395 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6396 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6406 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6407 * similar laptops (adapted from Fujitsu init verbs).
6409 static struct hda_verb alc260_acer_init_verbs
[] = {
6410 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6411 * the headphone jack. Turn this on and rely on the standard mute
6412 * methods whenever the user wants to turn these outputs off.
6414 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6415 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6416 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6417 /* Internal speaker/Headphone jack is connected to Line-out pin */
6418 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6419 /* Internal microphone/Mic jack is connected to Mic1 pin */
6420 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6421 /* Line In jack is connected to Line1 pin */
6422 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6423 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6424 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6425 /* Ensure all other unused pins are disabled and muted. */
6426 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6427 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6428 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6429 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6430 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6431 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6432 /* Disable digital (SPDIF) pins */
6433 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6434 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6436 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6437 * bus when acting as outputs.
6439 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6440 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6442 /* Start with output sum widgets muted and their output gains at min */
6443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6444 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6446 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6449 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6450 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6451 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6453 /* Unmute Line-out pin widget amp left and right
6454 * (no equiv mixer ctrl)
6456 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6457 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6458 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6459 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6460 * inputs. If the pin mode is changed by the user the pin mode control
6461 * will take care of enabling the pin's input/output buffers as needed.
6462 * Therefore there's no need to enable the input buffer at this
6465 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6466 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6468 /* Mute capture amp left and right */
6469 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6470 /* Set ADC connection select to match default mixer setting - mic
6473 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6475 /* Do similar with the second ADC: mute capture input amp and
6476 * set ADC connection to mic to match ALSA's default state.
6478 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6479 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6481 /* Mute all inputs to mixer widget (even unconnected ones) */
6482 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6483 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6484 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6494 /* Initialisation sequence for Maxdata Favorit 100XS
6495 * (adapted from Acer init verbs).
6497 static struct hda_verb alc260_favorit100_init_verbs
[] = {
6498 /* GPIO 0 enables the output jack.
6499 * Turn this on and rely on the standard mute
6500 * methods whenever the user wants to turn these outputs off.
6502 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6503 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6504 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6505 /* Line/Mic input jack is connected to Mic1 pin */
6506 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6507 /* Ensure all other unused pins are disabled and muted. */
6508 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6509 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6510 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6511 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6512 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6513 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6515 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6518 /* Disable digital (SPDIF) pins */
6519 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6520 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6522 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6523 * bus when acting as outputs.
6525 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6526 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6528 /* Start with output sum widgets muted and their output gains at min */
6529 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6530 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6531 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6532 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6533 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6534 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6535 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6536 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6537 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6539 /* Unmute Line-out pin widget amp left and right
6540 * (no equiv mixer ctrl)
6542 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6543 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6544 * inputs. If the pin mode is changed by the user the pin mode control
6545 * will take care of enabling the pin's input/output buffers as needed.
6546 * Therefore there's no need to enable the input buffer at this
6549 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6551 /* Mute capture amp left and right */
6552 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6553 /* Set ADC connection select to match default mixer setting - mic
6556 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6558 /* Do similar with the second ADC: mute capture input amp and
6559 * set ADC connection to mic to match ALSA's default state.
6561 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6562 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6564 /* Mute all inputs to mixer widget (even unconnected ones) */
6565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6566 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6569 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6571 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6572 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6577 static struct hda_verb alc260_will_verbs
[] = {
6578 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6579 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6580 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
6581 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6582 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6583 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
6587 static struct hda_verb alc260_replacer_672v_verbs
[] = {
6588 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6589 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6590 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
6592 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6593 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6594 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
6596 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6600 /* toggle speaker-output according to the hp-jack state */
6601 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
6603 unsigned int present
;
6605 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6606 present
= snd_hda_jack_detect(codec
, 0x0f);
6608 snd_hda_codec_write_cache(codec
, 0x01, 0,
6609 AC_VERB_SET_GPIO_DATA
, 1);
6610 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6611 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6614 snd_hda_codec_write_cache(codec
, 0x01, 0,
6615 AC_VERB_SET_GPIO_DATA
, 0);
6616 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6617 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6622 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
6625 if ((res
>> 26) == ALC880_HP_EVENT
)
6626 alc260_replacer_672v_automute(codec
);
6629 static struct hda_verb alc260_hp_dc7600_verbs
[] = {
6630 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x01},
6631 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6632 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6633 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6634 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6636 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6637 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6638 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6639 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6643 /* Test configuration for debugging, modelled after the ALC880 test
6646 #ifdef CONFIG_SND_DEBUG
6647 static hda_nid_t alc260_test_dac_nids
[1] = {
6650 static hda_nid_t alc260_test_adc_nids
[2] = {
6653 /* For testing the ALC260, each input MUX needs its own definition since
6654 * the signal assignments are different. This assumes that the first ADC
6657 static struct hda_input_mux alc260_test_capture_sources
[2] = {
6661 { "MIC1 pin", 0x0 },
6662 { "MIC2 pin", 0x1 },
6663 { "LINE1 pin", 0x2 },
6664 { "LINE2 pin", 0x3 },
6666 { "LINE-OUT pin", 0x5 },
6667 { "HP-OUT pin", 0x6 },
6673 { "MIC1 pin", 0x0 },
6674 { "MIC2 pin", 0x1 },
6675 { "LINE1 pin", 0x2 },
6676 { "LINE2 pin", 0x3 },
6679 { "LINE-OUT pin", 0x6 },
6680 { "HP-OUT pin", 0x7 },
6684 static struct snd_kcontrol_new alc260_test_mixer
[] = {
6685 /* Output driver widgets */
6686 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6687 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6688 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6689 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
6690 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6691 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
6693 /* Modes for retasking pin widgets
6694 * Note: the ALC260 doesn't seem to act on requests to enable mic
6695 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6696 * mention this restriction. At this stage it's not clear whether
6697 * this behaviour is intentional or is a hardware bug in chip
6698 * revisions available at least up until early 2006. Therefore for
6699 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6700 * choices, but if it turns out that the lack of mic bias for these
6701 * NIDs is intentional we could change their modes from
6702 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6704 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
6705 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
6706 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
6707 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
6708 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
6709 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
6711 /* Loopback mixer controls */
6712 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
6713 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
6714 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
6715 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
6716 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
6717 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
6718 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
6719 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
6720 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6721 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6722 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
6723 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
6724 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
6725 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
6727 /* Controls for GPIO pins, assuming they are configured as outputs */
6728 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6729 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6730 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6731 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6733 /* Switches to allow the digital IO pins to be enabled. The datasheet
6734 * is ambigious as to which NID is which; testing on laptops which
6735 * make this output available should provide clarification.
6737 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6738 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6740 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6741 * this output to turn on an external amplifier.
6743 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6744 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6748 static struct hda_verb alc260_test_init_verbs
[] = {
6749 /* Enable all GPIOs as outputs with an initial value of 0 */
6750 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
6751 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
6752 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
6754 /* Enable retasking pins as output, initially without power amp */
6755 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6756 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6757 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6758 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6759 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6760 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6762 /* Disable digital (SPDIF) pins initially, but users can enable
6763 * them via a mixer switch. In the case of SPDIF-out, this initverb
6764 * payload also sets the generation to 0, output to be in "consumer"
6765 * PCM format, copyright asserted, no pre-emphasis and no validity
6768 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6769 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6771 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6772 * OUT1 sum bus when acting as an output.
6774 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6775 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
6776 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6777 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
6779 /* Start with output sum widgets muted and their output gains at min */
6780 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6781 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6782 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6783 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6784 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6785 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6786 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6787 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6788 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6790 /* Unmute retasking pin widget output buffers since the default
6791 * state appears to be output. As the pin mode is changed by the
6792 * user the pin mode control will take care of enabling the pin's
6793 * input/output buffers as needed.
6795 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6796 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6797 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6798 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6799 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6800 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6801 /* Also unmute the mono-out pin widget */
6802 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6804 /* Mute capture amp left and right */
6805 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6806 /* Set ADC connection select to match default mixer setting (mic1
6809 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6811 /* Do the same for the second ADC: mute capture input amp and
6812 * set ADC connection to mic1 pin
6814 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6815 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6817 /* Mute all inputs to mixer widget (even unconnected ones) */
6818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6820 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6822 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6823 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6831 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6832 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6834 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6835 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6838 * for BIOS auto-configuration
6841 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
6842 const char *pfx
, int *vol_bits
)
6845 unsigned long vol_val
, sw_val
;
6848 if (nid
>= 0x0f && nid
< 0x11) {
6849 nid_vol
= nid
- 0x7;
6850 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
6851 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
6852 } else if (nid
== 0x11) {
6853 nid_vol
= nid
- 0x7;
6854 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
6855 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
6856 } else if (nid
>= 0x12 && nid
<= 0x15) {
6858 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
6859 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
6863 if (!(*vol_bits
& (1 << nid_vol
))) {
6864 /* first control for the volume widget */
6865 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, vol_val
);
6868 *vol_bits
|= (1 << nid_vol
);
6870 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, sw_val
);
6876 /* add playback controls from the parsed DAC table */
6877 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
6878 const struct auto_pin_cfg
*cfg
)
6884 spec
->multiout
.num_dacs
= 1;
6885 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
6886 spec
->multiout
.dac_nids
[0] = 0x02;
6888 nid
= cfg
->line_out_pins
[0];
6891 if (!cfg
->speaker_pins
[0] && !cfg
->hp_pins
[0])
6893 else if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
6897 err
= alc260_add_playback_controls(spec
, nid
, pfx
, &vols
);
6902 nid
= cfg
->speaker_pins
[0];
6904 err
= alc260_add_playback_controls(spec
, nid
, "Speaker", &vols
);
6909 nid
= cfg
->hp_pins
[0];
6911 err
= alc260_add_playback_controls(spec
, nid
, "Headphone",
6919 /* create playback/capture controls for input pins */
6920 static int alc260_auto_create_input_ctls(struct hda_codec
*codec
,
6921 const struct auto_pin_cfg
*cfg
)
6923 return alc_auto_create_input_ctls(codec
, cfg
, 0x07, 0x04, 0x05);
6926 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
6927 hda_nid_t nid
, int pin_type
,
6930 alc_set_pin_output(codec
, nid
, pin_type
);
6931 /* need the manual connection? */
6933 int idx
= nid
- 0x12;
6934 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
6935 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
6939 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
6941 struct alc_spec
*spec
= codec
->spec
;
6944 nid
= spec
->autocfg
.line_out_pins
[0];
6946 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
6947 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
6950 nid
= spec
->autocfg
.speaker_pins
[0];
6952 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
6954 nid
= spec
->autocfg
.hp_pins
[0];
6956 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
6959 #define ALC260_PIN_CD_NID 0x16
6960 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
6962 struct alc_spec
*spec
= codec
->spec
;
6963 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
6966 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
6967 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
6969 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
6970 if (nid
!= ALC260_PIN_CD_NID
&&
6971 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
6972 snd_hda_codec_write(codec
, nid
, 0,
6973 AC_VERB_SET_AMP_GAIN_MUTE
,
6979 #define alc260_auto_init_input_src alc880_auto_init_input_src
6982 * generic initialization of ADC, input mixers and output mixers
6984 static struct hda_verb alc260_volume_init_verbs
[] = {
6986 * Unmute ADC0-1 and set the default input to mic-in
6988 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6989 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6990 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6991 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6993 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6995 * Note: PASD motherboards uses the Line In 2 as the input for
6996 * front panel mic (mic 2)
6998 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6999 /* mute analog inputs */
7000 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7001 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7003 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7004 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7007 * Set up output mixers (0x08 - 0x0a)
7009 /* set vol=0 to output mixers */
7010 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7011 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7012 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7013 /* set up input amps for analog loopback */
7014 /* Amp Indices: DAC = 0, mixer = 1 */
7015 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7016 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7017 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7018 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7019 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7020 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7025 static int alc260_parse_auto_config(struct hda_codec
*codec
)
7027 struct alc_spec
*spec
= codec
->spec
;
7029 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
7031 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
7035 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
7038 if (!spec
->kctls
.list
)
7039 return 0; /* can't find valid BIOS pin config */
7040 err
= alc260_auto_create_input_ctls(codec
, &spec
->autocfg
);
7044 spec
->multiout
.max_channels
= 2;
7046 if (spec
->autocfg
.dig_outs
)
7047 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
7048 if (spec
->kctls
.list
)
7049 add_mixer(spec
, spec
->kctls
.list
);
7051 add_verb(spec
, alc260_volume_init_verbs
);
7053 spec
->num_mux_defs
= 1;
7054 spec
->input_mux
= &spec
->private_imux
[0];
7056 alc_ssid_check(codec
, 0x10, 0x15, 0x0f, 0);
7061 /* additional initialization for auto-configuration model */
7062 static void alc260_auto_init(struct hda_codec
*codec
)
7064 struct alc_spec
*spec
= codec
->spec
;
7065 alc260_auto_init_multi_out(codec
);
7066 alc260_auto_init_analog_input(codec
);
7067 alc260_auto_init_input_src(codec
);
7068 alc_auto_init_digital(codec
);
7069 if (spec
->unsol_event
)
7070 alc_inithook(codec
);
7073 #ifdef CONFIG_SND_HDA_POWER_SAVE
7074 static struct hda_amp_list alc260_loopbacks
[] = {
7075 { 0x07, HDA_INPUT
, 0 },
7076 { 0x07, HDA_INPUT
, 1 },
7077 { 0x07, HDA_INPUT
, 2 },
7078 { 0x07, HDA_INPUT
, 3 },
7079 { 0x07, HDA_INPUT
, 4 },
7091 static const struct alc_fixup alc260_fixups
[] = {
7092 [PINFIX_HP_DC5750
] = {
7093 .pins
= (const struct alc_pincfg
[]) {
7094 { 0x11, 0x90130110 }, /* speaker */
7100 static struct snd_pci_quirk alc260_fixup_tbl
[] = {
7101 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750
),
7106 * ALC260 configurations
7108 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
7109 [ALC260_BASIC
] = "basic",
7111 [ALC260_HP_3013
] = "hp-3013",
7112 [ALC260_HP_DC7600
] = "hp-dc7600",
7113 [ALC260_FUJITSU_S702X
] = "fujitsu",
7114 [ALC260_ACER
] = "acer",
7115 [ALC260_WILL
] = "will",
7116 [ALC260_REPLACER_672V
] = "replacer",
7117 [ALC260_FAVORIT100
] = "favorit100",
7118 #ifdef CONFIG_SND_DEBUG
7119 [ALC260_TEST
] = "test",
7121 [ALC260_AUTO
] = "auto",
7124 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
7125 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
7126 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL
),
7127 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
7128 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100
),
7129 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
7130 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO
), /* no quirk */
7131 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
7132 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
7133 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600
),
7134 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
7135 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
7136 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
7137 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
7138 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
7139 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
7140 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
7141 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
7142 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
7143 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
7144 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
7148 static struct alc_config_preset alc260_presets
[] = {
7150 .mixers
= { alc260_base_output_mixer
,
7151 alc260_input_mixer
},
7152 .init_verbs
= { alc260_init_verbs
},
7153 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7154 .dac_nids
= alc260_dac_nids
,
7155 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7156 .adc_nids
= alc260_dual_adc_nids
,
7157 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7158 .channel_mode
= alc260_modes
,
7159 .input_mux
= &alc260_capture_source
,
7162 .mixers
= { alc260_hp_output_mixer
,
7163 alc260_input_mixer
},
7164 .init_verbs
= { alc260_init_verbs
,
7165 alc260_hp_unsol_verbs
},
7166 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7167 .dac_nids
= alc260_dac_nids
,
7168 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7169 .adc_nids
= alc260_adc_nids_alt
,
7170 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7171 .channel_mode
= alc260_modes
,
7172 .input_mux
= &alc260_capture_source
,
7173 .unsol_event
= alc260_hp_unsol_event
,
7174 .init_hook
= alc260_hp_automute
,
7176 [ALC260_HP_DC7600
] = {
7177 .mixers
= { alc260_hp_dc7600_mixer
,
7178 alc260_input_mixer
},
7179 .init_verbs
= { alc260_init_verbs
,
7180 alc260_hp_dc7600_verbs
},
7181 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7182 .dac_nids
= alc260_dac_nids
,
7183 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7184 .adc_nids
= alc260_adc_nids_alt
,
7185 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7186 .channel_mode
= alc260_modes
,
7187 .input_mux
= &alc260_capture_source
,
7188 .unsol_event
= alc260_hp_3012_unsol_event
,
7189 .init_hook
= alc260_hp_3012_automute
,
7191 [ALC260_HP_3013
] = {
7192 .mixers
= { alc260_hp_3013_mixer
,
7193 alc260_input_mixer
},
7194 .init_verbs
= { alc260_hp_3013_init_verbs
,
7195 alc260_hp_3013_unsol_verbs
},
7196 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7197 .dac_nids
= alc260_dac_nids
,
7198 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7199 .adc_nids
= alc260_adc_nids_alt
,
7200 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7201 .channel_mode
= alc260_modes
,
7202 .input_mux
= &alc260_capture_source
,
7203 .unsol_event
= alc260_hp_3013_unsol_event
,
7204 .init_hook
= alc260_hp_3013_automute
,
7206 [ALC260_FUJITSU_S702X
] = {
7207 .mixers
= { alc260_fujitsu_mixer
},
7208 .init_verbs
= { alc260_fujitsu_init_verbs
},
7209 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7210 .dac_nids
= alc260_dac_nids
,
7211 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7212 .adc_nids
= alc260_dual_adc_nids
,
7213 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7214 .channel_mode
= alc260_modes
,
7215 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
7216 .input_mux
= alc260_fujitsu_capture_sources
,
7219 .mixers
= { alc260_acer_mixer
},
7220 .init_verbs
= { alc260_acer_init_verbs
},
7221 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7222 .dac_nids
= alc260_dac_nids
,
7223 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7224 .adc_nids
= alc260_dual_adc_nids
,
7225 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7226 .channel_mode
= alc260_modes
,
7227 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
7228 .input_mux
= alc260_acer_capture_sources
,
7230 [ALC260_FAVORIT100
] = {
7231 .mixers
= { alc260_favorit100_mixer
},
7232 .init_verbs
= { alc260_favorit100_init_verbs
},
7233 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7234 .dac_nids
= alc260_dac_nids
,
7235 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7236 .adc_nids
= alc260_dual_adc_nids
,
7237 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7238 .channel_mode
= alc260_modes
,
7239 .num_mux_defs
= ARRAY_SIZE(alc260_favorit100_capture_sources
),
7240 .input_mux
= alc260_favorit100_capture_sources
,
7243 .mixers
= { alc260_will_mixer
},
7244 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
7245 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7246 .dac_nids
= alc260_dac_nids
,
7247 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
7248 .adc_nids
= alc260_adc_nids
,
7249 .dig_out_nid
= ALC260_DIGOUT_NID
,
7250 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7251 .channel_mode
= alc260_modes
,
7252 .input_mux
= &alc260_capture_source
,
7254 [ALC260_REPLACER_672V
] = {
7255 .mixers
= { alc260_replacer_672v_mixer
},
7256 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
7257 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7258 .dac_nids
= alc260_dac_nids
,
7259 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
7260 .adc_nids
= alc260_adc_nids
,
7261 .dig_out_nid
= ALC260_DIGOUT_NID
,
7262 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7263 .channel_mode
= alc260_modes
,
7264 .input_mux
= &alc260_capture_source
,
7265 .unsol_event
= alc260_replacer_672v_unsol_event
,
7266 .init_hook
= alc260_replacer_672v_automute
,
7268 #ifdef CONFIG_SND_DEBUG
7270 .mixers
= { alc260_test_mixer
},
7271 .init_verbs
= { alc260_test_init_verbs
},
7272 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
7273 .dac_nids
= alc260_test_dac_nids
,
7274 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
7275 .adc_nids
= alc260_test_adc_nids
,
7276 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7277 .channel_mode
= alc260_modes
,
7278 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
7279 .input_mux
= alc260_test_capture_sources
,
7284 static int patch_alc260(struct hda_codec
*codec
)
7286 struct alc_spec
*spec
;
7287 int err
, board_config
;
7289 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
7295 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
7298 if (board_config
< 0) {
7299 snd_printd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
7301 board_config
= ALC260_AUTO
;
7304 if (board_config
== ALC260_AUTO
)
7305 alc_pick_fixup(codec
, alc260_fixup_tbl
, alc260_fixups
, 1);
7307 if (board_config
== ALC260_AUTO
) {
7308 /* automatic parse from the BIOS config */
7309 err
= alc260_parse_auto_config(codec
);
7315 "hda_codec: Cannot set up configuration "
7316 "from BIOS. Using base mode...\n");
7317 board_config
= ALC260_BASIC
;
7321 err
= snd_hda_attach_beep_device(codec
, 0x1);
7327 if (board_config
!= ALC260_AUTO
)
7328 setup_preset(codec
, &alc260_presets
[board_config
]);
7330 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
7331 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
7332 spec
->stream_analog_alt_capture
= &alc260_pcm_analog_capture
;
7334 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
7335 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
7337 if (!spec
->adc_nids
&& spec
->input_mux
) {
7338 /* check whether NID 0x04 is valid */
7339 unsigned int wcap
= get_wcaps(codec
, 0x04);
7340 wcap
= get_wcaps_type(wcap
);
7342 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
7343 spec
->adc_nids
= alc260_adc_nids_alt
;
7344 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
7346 spec
->adc_nids
= alc260_adc_nids
;
7347 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
7350 set_capture_mixer(codec
);
7351 set_beep_amp(spec
, 0x07, 0x05, HDA_INPUT
);
7353 if (board_config
== ALC260_AUTO
)
7354 alc_pick_fixup(codec
, alc260_fixup_tbl
, alc260_fixups
, 0);
7356 spec
->vmaster_nid
= 0x08;
7358 codec
->patch_ops
= alc_patch_ops
;
7359 if (board_config
== ALC260_AUTO
)
7360 spec
->init_hook
= alc260_auto_init
;
7361 #ifdef CONFIG_SND_HDA_POWER_SAVE
7362 if (!spec
->loopback
.amplist
)
7363 spec
->loopback
.amplist
= alc260_loopbacks
;
7371 * ALC882/883/885/888/889 support
7373 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7374 * configuration. Each pin widget can choose any input DACs and a mixer.
7375 * Each ADC is connected from a mixer of all inputs. This makes possible
7376 * 6-channel independent captures.
7378 * In addition, an independent DAC for the multi-playback (not used in this
7381 #define ALC882_DIGOUT_NID 0x06
7382 #define ALC882_DIGIN_NID 0x0a
7383 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7384 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7385 #define ALC1200_DIGOUT_NID 0x10
7388 static struct hda_channel_mode alc882_ch_modes
[1] = {
7393 static hda_nid_t alc882_dac_nids
[4] = {
7394 /* front, rear, clfe, rear_surr */
7395 0x02, 0x03, 0x04, 0x05
7397 #define alc883_dac_nids alc882_dac_nids
7400 #define alc882_adc_nids alc880_adc_nids
7401 #define alc882_adc_nids_alt alc880_adc_nids_alt
7402 #define alc883_adc_nids alc882_adc_nids_alt
7403 static hda_nid_t alc883_adc_nids_alt
[1] = { 0x08 };
7404 static hda_nid_t alc883_adc_nids_rev
[2] = { 0x09, 0x08 };
7405 #define alc889_adc_nids alc880_adc_nids
7407 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
7408 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
7409 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7410 static hda_nid_t alc883_capsrc_nids_rev
[2] = { 0x22, 0x23 };
7411 #define alc889_capsrc_nids alc882_capsrc_nids
7414 /* FIXME: should be a matrix-type input source selection */
7416 static struct hda_input_mux alc882_capture_source
= {
7420 { "Front Mic", 0x1 },
7426 #define alc883_capture_source alc882_capture_source
7428 static struct hda_input_mux alc889_capture_source
= {
7431 { "Front Mic", 0x0 },
7437 static struct hda_input_mux mb5_capture_source
= {
7446 static struct hda_input_mux macmini3_capture_source
= {
7454 static struct hda_input_mux alc883_3stack_6ch_intel
= {
7458 { "Front Mic", 0x0 },
7464 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
7472 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
7476 { "Internal Mic", 0x1 },
7482 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
7486 { "Internal Mic", 0x1 },
7490 static struct hda_input_mux alc883_lenovo_sky_capture_source
= {
7494 { "Front Mic", 0x1 },
7499 static struct hda_input_mux alc883_asus_eee1601_capture_source
= {
7507 static struct hda_input_mux alc889A_mb31_capture_source
= {
7511 /* Front Mic (0x01) unused */
7513 /* Line 2 (0x03) unused */
7514 /* CD (0x04) unused? */
7518 static struct hda_input_mux alc889A_imac91_capture_source
= {
7522 { "Line", 0x2 }, /* Not sure! */
7529 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
7536 static struct hda_verb alc882_3ST_ch2_init
[] = {
7537 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7538 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7539 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7540 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7547 static struct hda_verb alc882_3ST_ch4_init
[] = {
7548 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7549 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7550 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7551 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7552 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7559 static struct hda_verb alc882_3ST_ch6_init
[] = {
7560 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7561 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7562 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7563 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7564 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7565 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7569 static struct hda_channel_mode alc882_3ST_6ch_modes
[3] = {
7570 { 2, alc882_3ST_ch2_init
},
7571 { 4, alc882_3ST_ch4_init
},
7572 { 6, alc882_3ST_ch6_init
},
7575 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7580 static struct hda_verb alc883_3ST_ch2_clevo_init
[] = {
7581 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7582 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7583 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7584 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7585 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7592 static struct hda_verb alc883_3ST_ch4_clevo_init
[] = {
7593 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7594 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7595 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7596 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7597 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7598 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7605 static struct hda_verb alc883_3ST_ch6_clevo_init
[] = {
7606 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7607 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7608 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7609 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7610 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7611 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7612 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7616 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes
[3] = {
7617 { 2, alc883_3ST_ch2_clevo_init
},
7618 { 4, alc883_3ST_ch4_clevo_init
},
7619 { 6, alc883_3ST_ch6_clevo_init
},
7626 static struct hda_verb alc882_sixstack_ch6_init
[] = {
7627 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7628 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7629 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7630 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7637 static struct hda_verb alc882_sixstack_ch8_init
[] = {
7638 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7639 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7640 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7641 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7645 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
7646 { 6, alc882_sixstack_ch6_init
},
7647 { 8, alc882_sixstack_ch8_init
},
7651 /* Macbook Air 2,1 */
7653 static struct hda_channel_mode alc885_mba21_ch_modes
[1] = {
7658 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7664 static struct hda_verb alc885_mbp_ch2_init
[] = {
7665 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7666 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7667 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7674 static struct hda_verb alc885_mbp_ch4_init
[] = {
7675 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7676 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7677 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7678 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7679 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7683 static struct hda_channel_mode alc885_mbp_4ch_modes
[2] = {
7684 { 2, alc885_mbp_ch2_init
},
7685 { 4, alc885_mbp_ch4_init
},
7690 * Speakers/Woofer/HP = Front
7693 static struct hda_verb alc885_mb5_ch2_init
[] = {
7694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7695 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7701 * Speakers/HP = Front
7705 static struct hda_verb alc885_mb5_ch6_init
[] = {
7706 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7707 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7708 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7712 static struct hda_channel_mode alc885_mb5_6ch_modes
[2] = {
7713 { 2, alc885_mb5_ch2_init
},
7714 { 6, alc885_mb5_ch6_init
},
7717 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7722 static struct hda_verb alc883_4ST_ch2_init
[] = {
7723 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7724 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7725 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7726 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7727 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7728 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7735 static struct hda_verb alc883_4ST_ch4_init
[] = {
7736 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7737 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7738 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7739 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7740 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7741 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7742 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7749 static struct hda_verb alc883_4ST_ch6_init
[] = {
7750 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7751 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7752 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7753 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7754 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7755 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7756 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7757 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7764 static struct hda_verb alc883_4ST_ch8_init
[] = {
7765 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7766 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7767 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7768 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7769 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7770 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7771 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7772 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7773 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7777 static struct hda_channel_mode alc883_4ST_8ch_modes
[4] = {
7778 { 2, alc883_4ST_ch2_init
},
7779 { 4, alc883_4ST_ch4_init
},
7780 { 6, alc883_4ST_ch6_init
},
7781 { 8, alc883_4ST_ch8_init
},
7788 static struct hda_verb alc883_3ST_ch2_intel_init
[] = {
7789 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7790 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7791 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7792 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7799 static struct hda_verb alc883_3ST_ch4_intel_init
[] = {
7800 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7801 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7802 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7803 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7804 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7811 static struct hda_verb alc883_3ST_ch6_intel_init
[] = {
7812 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7813 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7814 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7815 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7816 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7817 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7821 static struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
7822 { 2, alc883_3ST_ch2_intel_init
},
7823 { 4, alc883_3ST_ch4_intel_init
},
7824 { 6, alc883_3ST_ch6_intel_init
},
7830 static struct hda_verb alc889_ch2_intel_init
[] = {
7831 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7832 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7833 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7834 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7835 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7836 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7843 static struct hda_verb alc889_ch6_intel_init
[] = {
7844 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7845 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7846 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7847 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7848 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7849 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7856 static struct hda_verb alc889_ch8_intel_init
[] = {
7857 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7858 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7859 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7860 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7861 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7862 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7863 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7867 static struct hda_channel_mode alc889_8ch_intel_modes
[3] = {
7868 { 2, alc889_ch2_intel_init
},
7869 { 6, alc889_ch6_intel_init
},
7870 { 8, alc889_ch8_intel_init
},
7876 static struct hda_verb alc883_sixstack_ch6_init
[] = {
7877 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7878 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7879 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7880 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7887 static struct hda_verb alc883_sixstack_ch8_init
[] = {
7888 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7889 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7890 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7891 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7895 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
7896 { 6, alc883_sixstack_ch6_init
},
7897 { 8, alc883_sixstack_ch8_init
},
7901 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7902 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7904 static struct snd_kcontrol_new alc882_base_mixer
[] = {
7905 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7906 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7907 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7908 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7909 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7910 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7911 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7912 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7913 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
7914 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
7915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7916 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7917 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7918 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7919 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7921 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
7922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7923 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7924 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
7925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7929 /* Macbook Air 2,1 same control for HP and internal Speaker */
7931 static struct snd_kcontrol_new alc885_mba21_mixer
[] = {
7932 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7933 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT
),
7938 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
7939 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7940 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7941 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
7942 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT
),
7943 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
7944 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7945 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7946 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
7947 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
7948 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT
),
7949 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT
),
7953 static struct snd_kcontrol_new alc885_mb5_mixer
[] = {
7954 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7955 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7956 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
7957 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
7958 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
7959 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
7960 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
7961 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
7962 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
7963 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
7964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7965 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7966 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT
),
7967 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT
),
7971 static struct snd_kcontrol_new alc885_macmini3_mixer
[] = {
7972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7973 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7974 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
7975 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
7976 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
7977 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
7978 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
7979 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
7980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
7981 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
7982 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT
),
7986 static struct snd_kcontrol_new alc885_imac91_mixer
[] = {
7987 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7988 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7993 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
7994 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7995 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7996 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7997 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7998 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7999 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8001 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8006 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
8007 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8008 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8010 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8011 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8012 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8013 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8016 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8017 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8018 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8019 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8023 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8024 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8026 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
8027 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8028 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8030 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
8031 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8032 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8033 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8034 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8035 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
8036 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, 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
),
8043 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
8044 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8045 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8047 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8048 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8049 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8050 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8052 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8057 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
8059 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8060 .name
= "Channel Mode",
8061 .info
= alc_ch_mode_info
,
8062 .get
= alc_ch_mode_get
,
8063 .put
= alc_ch_mode_put
,
8068 static struct hda_verb alc882_base_init_verbs
[] = {
8069 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8071 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8073 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8074 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8076 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8077 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8079 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8080 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8082 /* Front Pin: output 0 (0x0c) */
8083 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8084 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8085 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8086 /* Rear Pin: output 1 (0x0d) */
8087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8088 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8089 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8090 /* CLFE Pin: output 2 (0x0e) */
8091 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8092 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8093 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8094 /* Side Pin: output 3 (0x0f) */
8095 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8096 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8097 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8098 /* Mic (rear) pin: input vref at 80% */
8099 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8100 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8101 /* Front Mic pin: input vref at 80% */
8102 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8103 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8104 /* Line In pin: input */
8105 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8106 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8107 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8108 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8109 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8110 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8111 /* CD pin widget for input */
8112 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8114 /* FIXME: use matrix-type input source selection */
8115 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8117 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8120 /* ADC2: mute amp left and right */
8121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8122 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8123 /* ADC3: mute amp left and right */
8124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8125 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8130 static struct hda_verb alc882_adc1_init_verbs
[] = {
8131 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8135 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8136 /* ADC1: mute amp left and right */
8137 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8138 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8142 static struct hda_verb alc882_eapd_verbs
[] = {
8143 /* change to EAPD mode */
8144 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8145 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
8149 static struct hda_verb alc889_eapd_verbs
[] = {
8150 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8151 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8155 static struct hda_verb alc_hp15_unsol_verbs
[] = {
8156 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8161 static struct hda_verb alc885_init_verbs
[] = {
8162 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8166 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8167 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8169 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8170 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8172 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8173 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8175 /* Front HP Pin: output 0 (0x0c) */
8176 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8178 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8179 /* Front Pin: output 0 (0x0c) */
8180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8181 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8182 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8183 /* Rear Pin: output 1 (0x0d) */
8184 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8185 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8186 {0x19, AC_VERB_SET_CONNECT_SEL
, 0x01},
8187 /* CLFE Pin: output 2 (0x0e) */
8188 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8189 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8190 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8191 /* Side Pin: output 3 (0x0f) */
8192 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8193 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8194 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8195 /* Mic (rear) pin: input vref at 80% */
8196 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8197 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8198 /* Front Mic pin: input vref at 80% */
8199 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8200 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8201 /* Line In pin: input */
8202 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8203 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8205 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8209 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8211 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8212 /* ADC2: mute amp left and right */
8213 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8214 /* ADC3: mute amp left and right */
8215 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8220 static struct hda_verb alc885_init_input_verbs
[] = {
8221 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8222 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8223 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
8228 /* Unmute Selector 24h and set the default input to front mic */
8229 static struct hda_verb alc889_init_input_verbs
[] = {
8230 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
8231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8236 #define alc883_init_verbs alc882_base_init_verbs
8239 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
8240 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8241 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8242 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
8243 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8244 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8245 /* FIXME: this looks suspicious...
8246 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8247 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8252 static struct hda_verb alc882_macpro_init_verbs
[] = {
8253 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8257 /* Front Pin: output 0 (0x0c) */
8258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8260 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8261 /* Front Mic pin: input vref at 80% */
8262 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8263 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8264 /* Speaker: output */
8265 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8266 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8267 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
8268 /* Headphone output (output 0 - 0x0c) */
8269 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8270 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8271 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8273 /* FIXME: use matrix-type input source selection */
8274 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8275 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8290 /* ADC1: mute amp left and right */
8291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8292 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8293 /* ADC2: mute amp left and right */
8294 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8295 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8296 /* ADC3: mute amp left and right */
8297 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8298 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8304 static struct hda_verb alc885_mb5_init_verbs
[] = {
8306 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8307 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8308 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8309 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8314 /* Surround mixer */
8315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8316 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8317 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8320 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8321 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8323 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8325 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8326 /* Front Pin (0x0c) */
8327 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8328 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8329 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8330 /* LFE Pin (0x0e) */
8331 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8332 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8333 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
8335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8336 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8337 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
8338 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8339 /* Front Mic pin: input vref at 80% */
8340 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8341 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8343 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8344 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0x1)},
8347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x7)},
8348 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x4)},
8353 static struct hda_verb alc885_macmini3_init_verbs
[] = {
8355 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8356 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8357 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8358 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8361 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8363 /* Surround mixer */
8364 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8365 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8372 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8373 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8374 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8375 /* Front Pin (0x0c) */
8376 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8377 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8378 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8379 /* LFE Pin (0x0e) */
8380 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8381 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8382 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
8384 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8385 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8386 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
8387 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8389 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8390 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8400 static struct hda_verb alc885_mba21_init_verbs
[] = {
8401 /*Internal and HP Speaker Mixer*/
8402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8405 /*Internal Speaker Pin (0x0c)*/
8406 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8407 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8408 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8409 /* HP Pin: output 0 (0x0e) */
8410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
8411 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8412 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8413 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8414 /* Line in (is hp when jack connected)*/
8415 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8416 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8422 /* Macbook Pro rev3 */
8423 static struct hda_verb alc885_mbp3_init_verbs
[] = {
8424 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8429 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8430 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8431 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8433 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8436 /* Front Pin: output 0 (0x0c) */
8437 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8439 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8440 /* HP Pin: output 0 (0x0e) */
8441 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
8442 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8443 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x02},
8444 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8445 /* Mic (rear) pin: input vref at 80% */
8446 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8447 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8448 /* Front Mic pin: input vref at 80% */
8449 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8450 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8451 /* Line In pin: use output 1 when in LineOut mode */
8452 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8453 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8454 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
8456 /* FIXME: use matrix-type input source selection */
8457 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8458 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8462 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8473 /* ADC1: mute amp left and right */
8474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8475 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8476 /* ADC2: mute amp left and right */
8477 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8478 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8479 /* ADC3: mute amp left and right */
8480 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8481 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8487 static struct hda_verb alc885_imac91_init_verbs
[] = {
8488 /* Internal Speaker Pin (0x0c) */
8489 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8490 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8491 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8492 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8493 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8494 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8498 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8499 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8501 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8502 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8503 /* Front Mic pin: input vref at 80% */
8504 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8505 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8507 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8508 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8509 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8510 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8514 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8519 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8520 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8524 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8529 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8531 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8532 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8534 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8535 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8537 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8541 /* iMac 24 mixer. */
8542 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
8543 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8544 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
8548 /* iMac 24 init verbs. */
8549 static struct hda_verb alc885_imac24_init_verbs
[] = {
8550 /* Internal speakers: output 0 (0x0c) */
8551 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8552 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8553 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8554 /* Internal speakers: output 0 (0x0c) */
8555 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8556 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8557 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8558 /* Headphone: output 0 (0x0c) */
8559 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8560 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8561 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8562 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8563 /* Front Mic: input vref at 80% */
8564 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8565 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8569 /* Toggle speaker-output according to the hp-jack state */
8570 static void alc885_imac24_setup(struct hda_codec
*codec
)
8572 struct alc_spec
*spec
= codec
->spec
;
8574 spec
->autocfg
.hp_pins
[0] = 0x14;
8575 spec
->autocfg
.speaker_pins
[0] = 0x18;
8576 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8579 #define alc885_mb5_setup alc885_imac24_setup
8580 #define alc885_macmini3_setup alc885_imac24_setup
8582 /* Macbook Air 2,1 */
8583 static void alc885_mba21_setup(struct hda_codec
*codec
)
8585 struct alc_spec
*spec
= codec
->spec
;
8587 spec
->autocfg
.hp_pins
[0] = 0x14;
8588 spec
->autocfg
.speaker_pins
[0] = 0x18;
8593 static void alc885_mbp3_setup(struct hda_codec
*codec
)
8595 struct alc_spec
*spec
= codec
->spec
;
8597 spec
->autocfg
.hp_pins
[0] = 0x15;
8598 spec
->autocfg
.speaker_pins
[0] = 0x14;
8601 static void alc885_imac91_setup(struct hda_codec
*codec
)
8603 struct alc_spec
*spec
= codec
->spec
;
8605 spec
->autocfg
.hp_pins
[0] = 0x14;
8606 spec
->autocfg
.speaker_pins
[0] = 0x18;
8607 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8610 static struct hda_verb alc882_targa_verbs
[] = {
8611 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8615 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8617 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8618 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8619 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8621 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8625 /* toggle speaker-output according to the hp-jack state */
8626 static void alc882_targa_automute(struct hda_codec
*codec
)
8628 struct alc_spec
*spec
= codec
->spec
;
8629 alc_automute_amp(codec
);
8630 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
8631 spec
->jack_present
? 1 : 3);
8634 static void alc882_targa_setup(struct hda_codec
*codec
)
8636 struct alc_spec
*spec
= codec
->spec
;
8638 spec
->autocfg
.hp_pins
[0] = 0x14;
8639 spec
->autocfg
.speaker_pins
[0] = 0x1b;
8642 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8644 if ((res
>> 26) == ALC880_HP_EVENT
)
8645 alc882_targa_automute(codec
);
8648 static struct hda_verb alc882_asus_a7j_verbs
[] = {
8649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8650 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8654 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8656 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8657 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8658 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8660 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8661 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8662 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8666 static struct hda_verb alc882_asus_a7m_verbs
[] = {
8667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8670 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8671 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8672 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8674 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8675 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8676 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8678 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8679 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8680 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8684 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
8686 unsigned int gpiostate
, gpiomask
, gpiodir
;
8688 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8689 AC_VERB_GET_GPIO_DATA
, 0);
8692 gpiostate
|= (1 << pin
);
8694 gpiostate
&= ~(1 << pin
);
8696 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8697 AC_VERB_GET_GPIO_MASK
, 0);
8698 gpiomask
|= (1 << pin
);
8700 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8701 AC_VERB_GET_GPIO_DIRECTION
, 0);
8702 gpiodir
|= (1 << pin
);
8705 snd_hda_codec_write(codec
, codec
->afg
, 0,
8706 AC_VERB_SET_GPIO_MASK
, gpiomask
);
8707 snd_hda_codec_write(codec
, codec
->afg
, 0,
8708 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
8712 snd_hda_codec_write(codec
, codec
->afg
, 0,
8713 AC_VERB_SET_GPIO_DATA
, gpiostate
);
8716 /* set up GPIO at initialization */
8717 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
8719 alc882_gpio_mute(codec
, 0, 0);
8720 alc882_gpio_mute(codec
, 1, 0);
8723 /* set up GPIO and update auto-muting at initialization */
8724 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
8726 alc885_macpro_init_hook(codec
);
8727 alc_automute_amp(codec
);
8731 * generic initialization of ADC, input mixers and output mixers
8733 static struct hda_verb alc883_auto_init_verbs
[] = {
8735 * Unmute ADC0-2 and set the default input to mic-in
8737 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8738 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8739 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8740 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8743 * Set up output mixers (0x0c - 0x0f)
8745 /* set vol=0 to output mixers */
8746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8749 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8750 /* set up input amps for analog loopback */
8751 /* Amp Indices: DAC = 0, mixer = 1 */
8752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8755 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8758 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8759 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8760 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8761 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8763 /* FIXME: use matrix-type input source selection */
8764 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8768 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8772 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8773 static struct hda_verb alc889A_mb31_ch2_init
[] = {
8774 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
8775 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8776 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
8777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
8781 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8782 static struct hda_verb alc889A_mb31_ch4_init
[] = {
8783 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
8784 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8785 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
8786 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
8790 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8791 static struct hda_verb alc889A_mb31_ch5_init
[] = {
8792 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as rear */
8793 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8794 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
8795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
8799 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8800 static struct hda_verb alc889A_mb31_ch6_init
[] = {
8801 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as front */
8802 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Subwoofer off */
8803 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
8804 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
8808 static struct hda_channel_mode alc889A_mb31_6ch_modes
[4] = {
8809 { 2, alc889A_mb31_ch2_init
},
8810 { 4, alc889A_mb31_ch4_init
},
8811 { 5, alc889A_mb31_ch5_init
},
8812 { 6, alc889A_mb31_ch6_init
},
8815 static struct hda_verb alc883_medion_eapd_verbs
[] = {
8816 /* eanable EAPD on medion laptop */
8817 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8818 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
8822 #define alc883_base_mixer alc882_base_mixer
8824 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
8825 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8826 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8827 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8828 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8829 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8830 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8831 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8832 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8833 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8835 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8836 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8837 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8841 static struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
8842 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8843 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8844 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8845 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8847 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8849 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8850 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8851 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8855 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
8856 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8857 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8858 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8859 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8860 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8861 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8862 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8863 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8864 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8865 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8869 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
8870 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8871 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8872 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8873 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8874 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8875 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8876 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8878 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8880 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8881 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8882 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8886 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
8887 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8888 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8889 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8890 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8891 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8892 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8893 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8894 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 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_intel_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,
8916 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8917 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8918 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8919 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8920 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8921 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8922 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8923 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8925 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8927 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8928 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8929 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8933 static struct snd_kcontrol_new alc885_8ch_intel_mixer
[] = {
8934 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8935 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8936 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8937 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8938 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8940 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8941 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8942 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8943 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8944 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT
),
8945 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8946 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8947 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8948 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
8949 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT
),
8950 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
8951 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8952 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8953 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8957 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
8958 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8959 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8960 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8961 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8962 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
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_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8967 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8968 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
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, 0x0, HDA_INPUT
),
8972 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8974 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8975 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8976 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8980 static struct snd_kcontrol_new alc883_targa_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_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8984 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8985 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8986 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8987 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8988 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8989 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8990 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8996 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9001 static struct snd_kcontrol_new alc883_targa_2ch_mixer
[] = {
9002 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9003 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9005 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9006 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9007 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9008 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9009 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9011 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9012 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9013 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9017 static struct snd_kcontrol_new alc883_targa_8ch_mixer
[] = {
9018 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9019 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
9020 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9021 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9022 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9026 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
9027 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9028 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9029 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9030 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
9031 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9033 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9038 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
9039 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9040 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
9041 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9042 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9043 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9044 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9045 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9046 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9047 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9051 static struct snd_kcontrol_new alc883_medion_wim2160_mixer
[] = {
9052 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9053 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9054 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9055 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT
),
9056 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT
),
9057 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT
),
9061 static struct hda_verb alc883_medion_wim2160_verbs
[] = {
9062 /* Unmute front mixer */
9063 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9064 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9066 /* Set speaker pin to front mixer */
9067 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9069 /* Init headphone pin */
9070 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9072 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
9073 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9078 /* toggle speaker-output according to the hp-jack state */
9079 static void alc883_medion_wim2160_setup(struct hda_codec
*codec
)
9081 struct alc_spec
*spec
= codec
->spec
;
9083 spec
->autocfg
.hp_pins
[0] = 0x1a;
9084 spec
->autocfg
.speaker_pins
[0] = 0x15;
9087 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
9088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9091 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9092 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9094 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9099 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer
[] = {
9100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9101 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9102 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9103 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9104 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9105 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9106 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9107 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9112 static struct snd_kcontrol_new alc888_lenovo_sky_mixer
[] = {
9113 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9114 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9115 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
9116 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
9117 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9118 0x0d, 1, 0x0, HDA_OUTPUT
),
9119 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
9120 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
9121 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
9122 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9123 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
9124 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9125 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9126 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9127 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9129 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9131 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9132 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9133 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9137 static struct snd_kcontrol_new alc889A_mb31_mixer
[] = {
9139 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
9140 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
9141 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
9142 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
9143 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9145 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT
),
9146 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT
),
9147 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT
),
9148 /* Output switches */
9149 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT
),
9150 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT
),
9151 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT
),
9153 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT
),
9154 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT
),
9156 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
9157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
9158 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9159 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9163 static struct snd_kcontrol_new alc883_vaiott_mixer
[] = {
9164 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9165 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9168 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9173 static struct hda_bind_ctls alc883_bind_cap_vol
= {
9174 .ops
= &snd_hda_bind_vol
,
9176 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
9177 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
9182 static struct hda_bind_ctls alc883_bind_cap_switch
= {
9183 .ops
= &snd_hda_bind_sw
,
9185 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
9186 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
9191 static struct snd_kcontrol_new alc883_asus_eee1601_mixer
[] = {
9192 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9193 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9194 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9198 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9203 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer
[] = {
9204 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol
),
9205 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch
),
9207 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9208 /* .name = "Capture Source", */
9209 .name
= "Input Source",
9211 .info
= alc_mux_enum_info
,
9212 .get
= alc_mux_enum_get
,
9213 .put
= alc_mux_enum_put
,
9218 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
9220 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9221 .name
= "Channel Mode",
9222 .info
= alc_ch_mode_info
,
9223 .get
= alc_ch_mode_get
,
9224 .put
= alc_ch_mode_put
,
9229 /* toggle speaker-output according to the hp-jack state */
9230 static void alc883_mitac_setup(struct hda_codec
*codec
)
9232 struct alc_spec
*spec
= codec
->spec
;
9234 spec
->autocfg
.hp_pins
[0] = 0x15;
9235 spec
->autocfg
.speaker_pins
[0] = 0x14;
9236 spec
->autocfg
.speaker_pins
[1] = 0x17;
9239 static struct hda_verb alc883_mitac_verbs
[] = {
9241 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9242 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9244 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
9245 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9247 /* enable unsolicited event */
9248 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9249 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9254 static struct hda_verb alc883_clevo_m540r_verbs
[] = {
9256 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9259 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9261 /* enable unsolicited event */
9263 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9264 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9270 static struct hda_verb alc883_clevo_m720_verbs
[] = {
9272 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9273 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9275 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
9276 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9278 /* enable unsolicited event */
9279 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9280 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9285 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
9287 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9290 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9291 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9293 /* enable unsolicited event */
9294 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9299 static struct hda_verb alc883_targa_verbs
[] = {
9300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9304 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9306 /* Connect Line-Out side jack (SPDIF) to Side */
9307 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9308 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9309 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
9310 /* Connect Mic jack to CLFE */
9311 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9312 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9313 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
9314 /* Connect Line-in jack to Surround */
9315 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9317 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
9318 /* Connect HP out jack to Front */
9319 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9320 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9321 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9323 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9328 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
9329 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9330 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
9331 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
9335 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
9336 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9337 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9338 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9339 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9343 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
9344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9346 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9347 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
9348 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9352 static struct hda_verb alc883_haier_w66_verbs
[] = {
9353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9358 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9359 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9360 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9361 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9365 static struct hda_verb alc888_lenovo_sky_verbs
[] = {
9366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9370 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9371 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9372 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
9373 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9377 static struct hda_verb alc888_6st_dell_verbs
[] = {
9378 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9382 static struct hda_verb alc883_vaiott_verbs
[] = {
9384 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9385 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9387 /* enable unsolicited event */
9388 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9393 static void alc888_3st_hp_setup(struct hda_codec
*codec
)
9395 struct alc_spec
*spec
= codec
->spec
;
9397 spec
->autocfg
.hp_pins
[0] = 0x1b;
9398 spec
->autocfg
.speaker_pins
[0] = 0x14;
9399 spec
->autocfg
.speaker_pins
[1] = 0x16;
9400 spec
->autocfg
.speaker_pins
[2] = 0x18;
9403 static struct hda_verb alc888_3st_hp_verbs
[] = {
9404 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
9405 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
9406 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
9407 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9414 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
9415 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9416 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9417 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
9418 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9425 static struct hda_verb alc888_3st_hp_4ch_init
[] = {
9426 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9427 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9428 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9429 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9430 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9437 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
9438 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9439 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9440 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
9441 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9442 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9443 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9447 static struct hda_channel_mode alc888_3st_hp_modes
[3] = {
9448 { 2, alc888_3st_hp_2ch_init
},
9449 { 4, alc888_3st_hp_4ch_init
},
9450 { 6, alc888_3st_hp_6ch_init
},
9453 /* toggle front-jack and RCA according to the hp-jack state */
9454 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
9456 unsigned int present
= snd_hda_jack_detect(codec
, 0x1b);
9458 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9459 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9460 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9461 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9464 /* toggle RCA according to the front-jack state */
9465 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
9467 unsigned int present
= snd_hda_jack_detect(codec
, 0x14);
9469 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9470 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9473 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
9476 if ((res
>> 26) == ALC880_HP_EVENT
)
9477 alc888_lenovo_ms7195_front_automute(codec
);
9478 if ((res
>> 26) == ALC880_FRONT_EVENT
)
9479 alc888_lenovo_ms7195_rca_automute(codec
);
9482 /* toggle speaker-output according to the hp-jack state */
9483 static void alc883_lenovo_nb0763_setup(struct hda_codec
*codec
)
9485 struct alc_spec
*spec
= codec
->spec
;
9487 spec
->autocfg
.hp_pins
[0] = 0x14;
9488 spec
->autocfg
.speaker_pins
[0] = 0x15;
9491 /* toggle speaker-output according to the hp-jack state */
9492 #define alc883_targa_init_hook alc882_targa_init_hook
9493 #define alc883_targa_unsol_event alc882_targa_unsol_event
9495 static void alc883_clevo_m720_setup(struct hda_codec
*codec
)
9497 struct alc_spec
*spec
= codec
->spec
;
9499 spec
->autocfg
.hp_pins
[0] = 0x15;
9500 spec
->autocfg
.speaker_pins
[0] = 0x14;
9503 static void alc883_clevo_m720_init_hook(struct hda_codec
*codec
)
9505 alc_automute_amp(codec
);
9506 alc88x_simple_mic_automute(codec
);
9509 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
9512 switch (res
>> 26) {
9513 case ALC880_MIC_EVENT
:
9514 alc88x_simple_mic_automute(codec
);
9517 alc_automute_amp_unsol_event(codec
, res
);
9522 /* toggle speaker-output according to the hp-jack state */
9523 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec
*codec
)
9525 struct alc_spec
*spec
= codec
->spec
;
9527 spec
->autocfg
.hp_pins
[0] = 0x14;
9528 spec
->autocfg
.speaker_pins
[0] = 0x15;
9531 static void alc883_haier_w66_setup(struct hda_codec
*codec
)
9533 struct alc_spec
*spec
= codec
->spec
;
9535 spec
->autocfg
.hp_pins
[0] = 0x1b;
9536 spec
->autocfg
.speaker_pins
[0] = 0x14;
9539 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
9541 int bits
= snd_hda_jack_detect(codec
, 0x14) ? HDA_AMP_MUTE
: 0;
9543 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9544 HDA_AMP_MUTE
, bits
);
9547 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
9549 int bits
= snd_hda_jack_detect(codec
, 0x1b) ? HDA_AMP_MUTE
: 0;
9551 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9552 HDA_AMP_MUTE
, bits
);
9553 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9554 HDA_AMP_MUTE
, bits
);
9557 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
9560 if ((res
>> 26) == ALC880_HP_EVENT
)
9561 alc883_lenovo_101e_all_automute(codec
);
9562 if ((res
>> 26) == ALC880_FRONT_EVENT
)
9563 alc883_lenovo_101e_ispeaker_automute(codec
);
9566 /* toggle speaker-output according to the hp-jack state */
9567 static void alc883_acer_aspire_setup(struct hda_codec
*codec
)
9569 struct alc_spec
*spec
= codec
->spec
;
9571 spec
->autocfg
.hp_pins
[0] = 0x14;
9572 spec
->autocfg
.speaker_pins
[0] = 0x15;
9573 spec
->autocfg
.speaker_pins
[1] = 0x16;
9576 static struct hda_verb alc883_acer_eapd_verbs
[] = {
9577 /* HP Pin: output 0 (0x0c) */
9578 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9579 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9580 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9581 /* Front Pin: output 0 (0x0c) */
9582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9583 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9584 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9585 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
9586 /* eanable EAPD on medion laptop */
9587 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9588 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9589 /* enable unsolicited event */
9590 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9594 static void alc888_6st_dell_setup(struct hda_codec
*codec
)
9596 struct alc_spec
*spec
= codec
->spec
;
9598 spec
->autocfg
.hp_pins
[0] = 0x1b;
9599 spec
->autocfg
.speaker_pins
[0] = 0x14;
9600 spec
->autocfg
.speaker_pins
[1] = 0x15;
9601 spec
->autocfg
.speaker_pins
[2] = 0x16;
9602 spec
->autocfg
.speaker_pins
[3] = 0x17;
9605 static void alc888_lenovo_sky_setup(struct hda_codec
*codec
)
9607 struct alc_spec
*spec
= codec
->spec
;
9609 spec
->autocfg
.hp_pins
[0] = 0x1b;
9610 spec
->autocfg
.speaker_pins
[0] = 0x14;
9611 spec
->autocfg
.speaker_pins
[1] = 0x15;
9612 spec
->autocfg
.speaker_pins
[2] = 0x16;
9613 spec
->autocfg
.speaker_pins
[3] = 0x17;
9614 spec
->autocfg
.speaker_pins
[4] = 0x1a;
9617 static void alc883_vaiott_setup(struct hda_codec
*codec
)
9619 struct alc_spec
*spec
= codec
->spec
;
9621 spec
->autocfg
.hp_pins
[0] = 0x15;
9622 spec
->autocfg
.speaker_pins
[0] = 0x14;
9623 spec
->autocfg
.speaker_pins
[1] = 0x17;
9626 static struct hda_verb alc888_asus_m90v_verbs
[] = {
9627 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9628 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9629 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9630 /* enable unsolicited event */
9631 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9632 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9636 static void alc883_mode2_setup(struct hda_codec
*codec
)
9638 struct alc_spec
*spec
= codec
->spec
;
9640 spec
->autocfg
.hp_pins
[0] = 0x1b;
9641 spec
->autocfg
.speaker_pins
[0] = 0x14;
9642 spec
->autocfg
.speaker_pins
[1] = 0x15;
9643 spec
->autocfg
.speaker_pins
[2] = 0x16;
9644 spec
->ext_mic
.pin
= 0x18;
9645 spec
->int_mic
.pin
= 0x19;
9646 spec
->ext_mic
.mux_idx
= 0;
9647 spec
->int_mic
.mux_idx
= 1;
9651 static struct hda_verb alc888_asus_eee1601_verbs
[] = {
9652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9653 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9656 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9657 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
9658 {0x20, AC_VERB_SET_PROC_COEF
, 0x0838},
9659 /* enable unsolicited event */
9660 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9664 static void alc883_eee1601_inithook(struct hda_codec
*codec
)
9666 struct alc_spec
*spec
= codec
->spec
;
9668 spec
->autocfg
.hp_pins
[0] = 0x14;
9669 spec
->autocfg
.speaker_pins
[0] = 0x1b;
9670 alc_automute_pin(codec
);
9673 static struct hda_verb alc889A_mb31_verbs
[] = {
9674 /* Init rear pin (used as headphone output) */
9675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4}, /* Apple Headphones */
9676 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Connect to front */
9677 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9678 /* Init line pin (used as output in 4ch and 6ch mode) */
9679 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Connect to CLFE */
9680 /* Init line 2 pin (used as headphone out by default) */
9681 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Use as input */
9682 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Mute output */
9686 /* Mute speakers according to the headphone jack state */
9687 static void alc889A_mb31_automute(struct hda_codec
*codec
)
9689 unsigned int present
;
9691 /* Mute only in 2ch or 4ch mode */
9692 if (snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_CONNECT_SEL
, 0)
9694 present
= snd_hda_jack_detect(codec
, 0x15);
9695 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9696 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9697 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9698 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9702 static void alc889A_mb31_unsol_event(struct hda_codec
*codec
, unsigned int res
)
9704 if ((res
>> 26) == ALC880_HP_EVENT
)
9705 alc889A_mb31_automute(codec
);
9709 #ifdef CONFIG_SND_HDA_POWER_SAVE
9710 #define alc882_loopbacks alc880_loopbacks
9713 /* pcm configuration: identical with ALC880 */
9714 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9715 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9716 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9717 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9719 static hda_nid_t alc883_slave_dig_outs
[] = {
9720 ALC1200_DIGOUT_NID
, 0,
9723 static hda_nid_t alc1200_slave_dig_outs
[] = {
9724 ALC883_DIGOUT_NID
, 0,
9728 * configuration and preset
9730 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
9731 [ALC882_3ST_DIG
] = "3stack-dig",
9732 [ALC882_6ST_DIG
] = "6stack-dig",
9733 [ALC882_ARIMA
] = "arima",
9734 [ALC882_W2JC
] = "w2jc",
9735 [ALC882_TARGA
] = "targa",
9736 [ALC882_ASUS_A7J
] = "asus-a7j",
9737 [ALC882_ASUS_A7M
] = "asus-a7m",
9738 [ALC885_MACPRO
] = "macpro",
9739 [ALC885_MB5
] = "mb5",
9740 [ALC885_MACMINI3
] = "macmini3",
9741 [ALC885_MBA21
] = "mba21",
9742 [ALC885_MBP3
] = "mbp3",
9743 [ALC885_IMAC24
] = "imac24",
9744 [ALC885_IMAC91
] = "imac91",
9745 [ALC883_3ST_2ch_DIG
] = "3stack-2ch-dig",
9746 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
9747 [ALC883_3ST_6ch
] = "3stack-6ch",
9748 [ALC883_6ST_DIG
] = "alc883-6stack-dig",
9749 [ALC883_TARGA_DIG
] = "targa-dig",
9750 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
9751 [ALC883_TARGA_8ch_DIG
] = "targa-8ch-dig",
9752 [ALC883_ACER
] = "acer",
9753 [ALC883_ACER_ASPIRE
] = "acer-aspire",
9754 [ALC888_ACER_ASPIRE_4930G
] = "acer-aspire-4930g",
9755 [ALC888_ACER_ASPIRE_6530G
] = "acer-aspire-6530g",
9756 [ALC888_ACER_ASPIRE_8930G
] = "acer-aspire-8930g",
9757 [ALC888_ACER_ASPIRE_7730G
] = "acer-aspire-7730g",
9758 [ALC883_MEDION
] = "medion",
9759 [ALC883_MEDION_WIM2160
] = "medion-wim2160",
9760 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
9761 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
9762 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
9763 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
9764 [ALC888_LENOVO_SKY
] = "lenovo-sky",
9765 [ALC883_HAIER_W66
] = "haier-w66",
9766 [ALC888_3ST_HP
] = "3stack-hp",
9767 [ALC888_6ST_DELL
] = "6stack-dell",
9768 [ALC883_MITAC
] = "mitac",
9769 [ALC883_CLEVO_M540R
] = "clevo-m540r",
9770 [ALC883_CLEVO_M720
] = "clevo-m720",
9771 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
9772 [ALC888_FUJITSU_XA3530
] = "fujitsu-xa3530",
9773 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
9774 [ALC889A_INTEL
] = "intel-alc889a",
9775 [ALC889_INTEL
] = "intel-x58",
9776 [ALC1200_ASUS_P5Q
] = "asus-p5q",
9777 [ALC889A_MB31
] = "mb31",
9778 [ALC883_SONY_VAIO_TT
] = "sony-vaio-tt",
9779 [ALC882_AUTO
] = "auto",
9782 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
9783 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
9785 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
9786 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE
),
9787 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE
),
9788 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
9789 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
9790 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
9791 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9792 ALC888_ACER_ASPIRE_4930G
),
9793 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9794 ALC888_ACER_ASPIRE_4930G
),
9795 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9796 ALC888_ACER_ASPIRE_8930G
),
9797 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9798 ALC888_ACER_ASPIRE_8930G
),
9799 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO
),
9800 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO
),
9801 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9802 ALC888_ACER_ASPIRE_6530G
),
9803 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9804 ALC888_ACER_ASPIRE_6530G
),
9805 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9806 ALC888_ACER_ASPIRE_7730G
),
9807 /* default Acer -- disabled as it causes more problems.
9808 * model=auto should work fine now
9810 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9812 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
9814 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
9815 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
9816 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
9817 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
9818 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP
),
9819 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP
),
9821 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
9822 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
9823 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
9824 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V
),
9825 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
9826 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
9827 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
9828 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
9829 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG
),
9830 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q
),
9831 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601
),
9833 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT
),
9834 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
9835 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
9836 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC
),
9837 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
9838 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
9839 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL
),
9840 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
9841 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
9843 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
9844 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
9845 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
9846 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
9847 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO
),
9848 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
9849 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
9850 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
9851 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
9852 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
9853 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
9854 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
9855 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
9856 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
9857 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG
),
9858 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
9859 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
9860 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
9861 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG
),
9862 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG
),
9863 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
9864 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
9865 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
9866 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG
),
9867 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
9868 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
9869 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
9870 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG
),
9871 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG
),
9872 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
9873 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG
),
9875 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
9876 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG
),
9877 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
9878 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
9879 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R
),
9880 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD
),
9881 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
9882 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9883 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
9884 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9885 ALC883_FUJITSU_PI2515
),
9886 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9887 ALC888_FUJITSU_XA3530
),
9888 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
9889 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9890 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9891 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9892 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY
),
9893 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG
),
9894 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
9895 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
9897 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
9898 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
9899 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC
),
9900 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL
),
9901 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL
),
9902 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL
),
9903 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG
),
9908 /* codec SSID table for Intel Mac */
9909 static struct snd_pci_quirk alc882_ssid_cfg_tbl
[] = {
9910 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3
),
9911 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3
),
9912 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3
),
9913 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO
),
9914 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24
),
9915 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24
),
9916 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3
),
9917 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31
),
9918 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M
),
9919 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3
),
9920 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21
),
9921 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31
),
9922 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3
),
9923 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24
),
9924 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91
),
9925 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5
),
9926 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5
),
9927 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9928 * so apparently no perfect solution yet
9930 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5
),
9931 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5
),
9932 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3
),
9936 static struct alc_config_preset alc882_presets
[] = {
9937 [ALC882_3ST_DIG
] = {
9938 .mixers
= { alc882_base_mixer
},
9939 .init_verbs
= { alc882_base_init_verbs
,
9940 alc882_adc1_init_verbs
},
9941 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9942 .dac_nids
= alc882_dac_nids
,
9943 .dig_out_nid
= ALC882_DIGOUT_NID
,
9944 .dig_in_nid
= ALC882_DIGIN_NID
,
9945 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
9946 .channel_mode
= alc882_ch_modes
,
9948 .input_mux
= &alc882_capture_source
,
9950 [ALC882_6ST_DIG
] = {
9951 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
9952 .init_verbs
= { alc882_base_init_verbs
,
9953 alc882_adc1_init_verbs
},
9954 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9955 .dac_nids
= alc882_dac_nids
,
9956 .dig_out_nid
= ALC882_DIGOUT_NID
,
9957 .dig_in_nid
= ALC882_DIGIN_NID
,
9958 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
9959 .channel_mode
= alc882_sixstack_modes
,
9960 .input_mux
= &alc882_capture_source
,
9963 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
9964 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
9965 alc882_eapd_verbs
},
9966 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9967 .dac_nids
= alc882_dac_nids
,
9968 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
9969 .channel_mode
= alc882_sixstack_modes
,
9970 .input_mux
= &alc882_capture_source
,
9973 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
9974 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
9975 alc882_eapd_verbs
, alc880_gpio1_init_verbs
},
9976 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9977 .dac_nids
= alc882_dac_nids
,
9978 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
9979 .channel_mode
= alc880_threestack_modes
,
9981 .input_mux
= &alc882_capture_source
,
9982 .dig_out_nid
= ALC882_DIGOUT_NID
,
9985 .mixers
= { alc885_mba21_mixer
},
9986 .init_verbs
= { alc885_mba21_init_verbs
, alc880_gpio1_init_verbs
},
9988 .dac_nids
= alc882_dac_nids
,
9989 .channel_mode
= alc885_mba21_ch_modes
,
9990 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
9991 .input_mux
= &alc882_capture_source
,
9992 .unsol_event
= alc_automute_amp_unsol_event
,
9993 .setup
= alc885_mba21_setup
,
9994 .init_hook
= alc_automute_amp
,
9997 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
9998 .init_verbs
= { alc885_mbp3_init_verbs
,
9999 alc880_gpio1_init_verbs
},
10001 .dac_nids
= alc882_dac_nids
,
10003 .channel_mode
= alc885_mbp_4ch_modes
,
10004 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_4ch_modes
),
10005 .input_mux
= &alc882_capture_source
,
10006 .dig_out_nid
= ALC882_DIGOUT_NID
,
10007 .dig_in_nid
= ALC882_DIGIN_NID
,
10008 .unsol_event
= alc_automute_amp_unsol_event
,
10009 .setup
= alc885_mbp3_setup
,
10010 .init_hook
= alc_automute_amp
,
10013 .mixers
= { alc885_mb5_mixer
, alc882_chmode_mixer
},
10014 .init_verbs
= { alc885_mb5_init_verbs
,
10015 alc880_gpio1_init_verbs
},
10016 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10017 .dac_nids
= alc882_dac_nids
,
10018 .channel_mode
= alc885_mb5_6ch_modes
,
10019 .num_channel_mode
= ARRAY_SIZE(alc885_mb5_6ch_modes
),
10020 .input_mux
= &mb5_capture_source
,
10021 .dig_out_nid
= ALC882_DIGOUT_NID
,
10022 .dig_in_nid
= ALC882_DIGIN_NID
,
10023 .unsol_event
= alc_automute_amp_unsol_event
,
10024 .setup
= alc885_mb5_setup
,
10025 .init_hook
= alc_automute_amp
,
10027 [ALC885_MACMINI3
] = {
10028 .mixers
= { alc885_macmini3_mixer
, alc882_chmode_mixer
},
10029 .init_verbs
= { alc885_macmini3_init_verbs
,
10030 alc880_gpio1_init_verbs
},
10031 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10032 .dac_nids
= alc882_dac_nids
,
10033 .channel_mode
= alc885_macmini3_6ch_modes
,
10034 .num_channel_mode
= ARRAY_SIZE(alc885_macmini3_6ch_modes
),
10035 .input_mux
= &macmini3_capture_source
,
10036 .dig_out_nid
= ALC882_DIGOUT_NID
,
10037 .dig_in_nid
= ALC882_DIGIN_NID
,
10038 .unsol_event
= alc_automute_amp_unsol_event
,
10039 .setup
= alc885_macmini3_setup
,
10040 .init_hook
= alc_automute_amp
,
10042 [ALC885_MACPRO
] = {
10043 .mixers
= { alc882_macpro_mixer
},
10044 .init_verbs
= { alc882_macpro_init_verbs
},
10045 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10046 .dac_nids
= alc882_dac_nids
,
10047 .dig_out_nid
= ALC882_DIGOUT_NID
,
10048 .dig_in_nid
= ALC882_DIGIN_NID
,
10049 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10050 .channel_mode
= alc882_ch_modes
,
10051 .input_mux
= &alc882_capture_source
,
10052 .init_hook
= alc885_macpro_init_hook
,
10054 [ALC885_IMAC24
] = {
10055 .mixers
= { alc885_imac24_mixer
},
10056 .init_verbs
= { alc885_imac24_init_verbs
},
10057 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10058 .dac_nids
= alc882_dac_nids
,
10059 .dig_out_nid
= ALC882_DIGOUT_NID
,
10060 .dig_in_nid
= ALC882_DIGIN_NID
,
10061 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10062 .channel_mode
= alc882_ch_modes
,
10063 .input_mux
= &alc882_capture_source
,
10064 .unsol_event
= alc_automute_amp_unsol_event
,
10065 .setup
= alc885_imac24_setup
,
10066 .init_hook
= alc885_imac24_init_hook
,
10068 [ALC885_IMAC91
] = {
10069 .mixers
= {alc885_imac91_mixer
},
10070 .init_verbs
= { alc885_imac91_init_verbs
,
10071 alc880_gpio1_init_verbs
},
10072 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10073 .dac_nids
= alc882_dac_nids
,
10074 .channel_mode
= alc885_mba21_ch_modes
,
10075 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
10076 .input_mux
= &alc889A_imac91_capture_source
,
10077 .dig_out_nid
= ALC882_DIGOUT_NID
,
10078 .dig_in_nid
= ALC882_DIGIN_NID
,
10079 .unsol_event
= alc_automute_amp_unsol_event
,
10080 .setup
= alc885_imac91_setup
,
10081 .init_hook
= alc_automute_amp
,
10084 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
},
10085 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10086 alc880_gpio3_init_verbs
, alc882_targa_verbs
},
10087 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10088 .dac_nids
= alc882_dac_nids
,
10089 .dig_out_nid
= ALC882_DIGOUT_NID
,
10090 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
10091 .adc_nids
= alc882_adc_nids
,
10092 .capsrc_nids
= alc882_capsrc_nids
,
10093 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
10094 .channel_mode
= alc882_3ST_6ch_modes
,
10096 .input_mux
= &alc882_capture_source
,
10097 .unsol_event
= alc882_targa_unsol_event
,
10098 .setup
= alc882_targa_setup
,
10099 .init_hook
= alc882_targa_automute
,
10101 [ALC882_ASUS_A7J
] = {
10102 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
},
10103 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10104 alc882_asus_a7j_verbs
},
10105 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10106 .dac_nids
= alc882_dac_nids
,
10107 .dig_out_nid
= ALC882_DIGOUT_NID
,
10108 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
10109 .adc_nids
= alc882_adc_nids
,
10110 .capsrc_nids
= alc882_capsrc_nids
,
10111 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
10112 .channel_mode
= alc882_3ST_6ch_modes
,
10114 .input_mux
= &alc882_capture_source
,
10116 [ALC882_ASUS_A7M
] = {
10117 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
10118 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10119 alc882_eapd_verbs
, alc880_gpio1_init_verbs
,
10120 alc882_asus_a7m_verbs
},
10121 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10122 .dac_nids
= alc882_dac_nids
,
10123 .dig_out_nid
= ALC882_DIGOUT_NID
,
10124 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
10125 .channel_mode
= alc880_threestack_modes
,
10127 .input_mux
= &alc882_capture_source
,
10129 [ALC883_3ST_2ch_DIG
] = {
10130 .mixers
= { alc883_3ST_2ch_mixer
},
10131 .init_verbs
= { alc883_init_verbs
},
10132 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10133 .dac_nids
= alc883_dac_nids
,
10134 .dig_out_nid
= ALC883_DIGOUT_NID
,
10135 .dig_in_nid
= ALC883_DIGIN_NID
,
10136 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10137 .channel_mode
= alc883_3ST_2ch_modes
,
10138 .input_mux
= &alc883_capture_source
,
10140 [ALC883_3ST_6ch_DIG
] = {
10141 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10142 .init_verbs
= { alc883_init_verbs
},
10143 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10144 .dac_nids
= alc883_dac_nids
,
10145 .dig_out_nid
= ALC883_DIGOUT_NID
,
10146 .dig_in_nid
= ALC883_DIGIN_NID
,
10147 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10148 .channel_mode
= alc883_3ST_6ch_modes
,
10150 .input_mux
= &alc883_capture_source
,
10152 [ALC883_3ST_6ch
] = {
10153 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10154 .init_verbs
= { alc883_init_verbs
},
10155 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10156 .dac_nids
= alc883_dac_nids
,
10157 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10158 .channel_mode
= alc883_3ST_6ch_modes
,
10160 .input_mux
= &alc883_capture_source
,
10162 [ALC883_3ST_6ch_INTEL
] = {
10163 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
10164 .init_verbs
= { alc883_init_verbs
},
10165 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10166 .dac_nids
= alc883_dac_nids
,
10167 .dig_out_nid
= ALC883_DIGOUT_NID
,
10168 .dig_in_nid
= ALC883_DIGIN_NID
,
10169 .slave_dig_outs
= alc883_slave_dig_outs
,
10170 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
10171 .channel_mode
= alc883_3ST_6ch_intel_modes
,
10173 .input_mux
= &alc883_3stack_6ch_intel
,
10175 [ALC889A_INTEL
] = {
10176 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
10177 .init_verbs
= { alc885_init_verbs
, alc885_init_input_verbs
,
10178 alc_hp15_unsol_verbs
},
10179 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10180 .dac_nids
= alc883_dac_nids
,
10181 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10182 .adc_nids
= alc889_adc_nids
,
10183 .dig_out_nid
= ALC883_DIGOUT_NID
,
10184 .dig_in_nid
= ALC883_DIGIN_NID
,
10185 .slave_dig_outs
= alc883_slave_dig_outs
,
10186 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
10187 .channel_mode
= alc889_8ch_intel_modes
,
10188 .capsrc_nids
= alc889_capsrc_nids
,
10189 .input_mux
= &alc889_capture_source
,
10190 .setup
= alc889_automute_setup
,
10191 .init_hook
= alc_automute_amp
,
10192 .unsol_event
= alc_automute_amp_unsol_event
,
10196 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
10197 .init_verbs
= { alc885_init_verbs
, alc889_init_input_verbs
,
10198 alc889_eapd_verbs
, alc_hp15_unsol_verbs
},
10199 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10200 .dac_nids
= alc883_dac_nids
,
10201 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10202 .adc_nids
= alc889_adc_nids
,
10203 .dig_out_nid
= ALC883_DIGOUT_NID
,
10204 .dig_in_nid
= ALC883_DIGIN_NID
,
10205 .slave_dig_outs
= alc883_slave_dig_outs
,
10206 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
10207 .channel_mode
= alc889_8ch_intel_modes
,
10208 .capsrc_nids
= alc889_capsrc_nids
,
10209 .input_mux
= &alc889_capture_source
,
10210 .setup
= alc889_automute_setup
,
10211 .init_hook
= alc889_intel_init_hook
,
10212 .unsol_event
= alc_automute_amp_unsol_event
,
10215 [ALC883_6ST_DIG
] = {
10216 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10217 .init_verbs
= { alc883_init_verbs
},
10218 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10219 .dac_nids
= alc883_dac_nids
,
10220 .dig_out_nid
= ALC883_DIGOUT_NID
,
10221 .dig_in_nid
= ALC883_DIGIN_NID
,
10222 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10223 .channel_mode
= alc883_sixstack_modes
,
10224 .input_mux
= &alc883_capture_source
,
10226 [ALC883_TARGA_DIG
] = {
10227 .mixers
= { alc883_targa_mixer
, alc883_chmode_mixer
},
10228 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10229 alc883_targa_verbs
},
10230 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10231 .dac_nids
= alc883_dac_nids
,
10232 .dig_out_nid
= ALC883_DIGOUT_NID
,
10233 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10234 .channel_mode
= alc883_3ST_6ch_modes
,
10236 .input_mux
= &alc883_capture_source
,
10237 .unsol_event
= alc883_targa_unsol_event
,
10238 .setup
= alc882_targa_setup
,
10239 .init_hook
= alc882_targa_automute
,
10241 [ALC883_TARGA_2ch_DIG
] = {
10242 .mixers
= { alc883_targa_2ch_mixer
},
10243 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10244 alc883_targa_verbs
},
10245 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10246 .dac_nids
= alc883_dac_nids
,
10247 .adc_nids
= alc883_adc_nids_alt
,
10248 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10249 .capsrc_nids
= alc883_capsrc_nids
,
10250 .dig_out_nid
= ALC883_DIGOUT_NID
,
10251 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10252 .channel_mode
= alc883_3ST_2ch_modes
,
10253 .input_mux
= &alc883_capture_source
,
10254 .unsol_event
= alc883_targa_unsol_event
,
10255 .setup
= alc882_targa_setup
,
10256 .init_hook
= alc882_targa_automute
,
10258 [ALC883_TARGA_8ch_DIG
] = {
10259 .mixers
= { alc883_targa_mixer
, alc883_targa_8ch_mixer
,
10260 alc883_chmode_mixer
},
10261 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10262 alc883_targa_verbs
},
10263 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10264 .dac_nids
= alc883_dac_nids
,
10265 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10266 .adc_nids
= alc883_adc_nids_rev
,
10267 .capsrc_nids
= alc883_capsrc_nids_rev
,
10268 .dig_out_nid
= ALC883_DIGOUT_NID
,
10269 .dig_in_nid
= ALC883_DIGIN_NID
,
10270 .num_channel_mode
= ARRAY_SIZE(alc883_4ST_8ch_modes
),
10271 .channel_mode
= alc883_4ST_8ch_modes
,
10273 .input_mux
= &alc883_capture_source
,
10274 .unsol_event
= alc883_targa_unsol_event
,
10275 .setup
= alc882_targa_setup
,
10276 .init_hook
= alc882_targa_automute
,
10279 .mixers
= { alc883_base_mixer
},
10280 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10281 * and the headphone jack. Turn this on and rely on the
10282 * standard mute methods whenever the user wants to turn
10283 * these outputs off.
10285 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
10286 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10287 .dac_nids
= alc883_dac_nids
,
10288 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10289 .channel_mode
= alc883_3ST_2ch_modes
,
10290 .input_mux
= &alc883_capture_source
,
10292 [ALC883_ACER_ASPIRE
] = {
10293 .mixers
= { alc883_acer_aspire_mixer
},
10294 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
10295 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10296 .dac_nids
= alc883_dac_nids
,
10297 .dig_out_nid
= ALC883_DIGOUT_NID
,
10298 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10299 .channel_mode
= alc883_3ST_2ch_modes
,
10300 .input_mux
= &alc883_capture_source
,
10301 .unsol_event
= alc_automute_amp_unsol_event
,
10302 .setup
= alc883_acer_aspire_setup
,
10303 .init_hook
= alc_automute_amp
,
10305 [ALC888_ACER_ASPIRE_4930G
] = {
10306 .mixers
= { alc888_base_mixer
,
10307 alc883_chmode_mixer
},
10308 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10309 alc888_acer_aspire_4930g_verbs
},
10310 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10311 .dac_nids
= alc883_dac_nids
,
10312 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10313 .adc_nids
= alc883_adc_nids_rev
,
10314 .capsrc_nids
= alc883_capsrc_nids_rev
,
10315 .dig_out_nid
= ALC883_DIGOUT_NID
,
10316 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10317 .channel_mode
= alc883_3ST_6ch_modes
,
10319 .const_channel_count
= 6,
10321 ARRAY_SIZE(alc888_2_capture_sources
),
10322 .input_mux
= alc888_2_capture_sources
,
10323 .unsol_event
= alc_automute_amp_unsol_event
,
10324 .setup
= alc888_acer_aspire_4930g_setup
,
10325 .init_hook
= alc_automute_amp
,
10327 [ALC888_ACER_ASPIRE_6530G
] = {
10328 .mixers
= { alc888_acer_aspire_6530_mixer
},
10329 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10330 alc888_acer_aspire_6530g_verbs
},
10331 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10332 .dac_nids
= alc883_dac_nids
,
10333 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10334 .adc_nids
= alc883_adc_nids_rev
,
10335 .capsrc_nids
= alc883_capsrc_nids_rev
,
10336 .dig_out_nid
= ALC883_DIGOUT_NID
,
10337 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10338 .channel_mode
= alc883_3ST_2ch_modes
,
10340 ARRAY_SIZE(alc888_2_capture_sources
),
10341 .input_mux
= alc888_acer_aspire_6530_sources
,
10342 .unsol_event
= alc_automute_amp_unsol_event
,
10343 .setup
= alc888_acer_aspire_6530g_setup
,
10344 .init_hook
= alc_automute_amp
,
10346 [ALC888_ACER_ASPIRE_8930G
] = {
10347 .mixers
= { alc889_acer_aspire_8930g_mixer
,
10348 alc883_chmode_mixer
},
10349 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10350 alc889_acer_aspire_8930g_verbs
,
10351 alc889_eapd_verbs
},
10352 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10353 .dac_nids
= alc883_dac_nids
,
10354 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10355 .adc_nids
= alc889_adc_nids
,
10356 .capsrc_nids
= alc889_capsrc_nids
,
10357 .dig_out_nid
= ALC883_DIGOUT_NID
,
10358 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10359 .channel_mode
= alc883_3ST_6ch_modes
,
10361 .const_channel_count
= 6,
10363 ARRAY_SIZE(alc889_capture_sources
),
10364 .input_mux
= alc889_capture_sources
,
10365 .unsol_event
= alc_automute_amp_unsol_event
,
10366 .setup
= alc889_acer_aspire_8930g_setup
,
10367 .init_hook
= alc_automute_amp
,
10368 #ifdef CONFIG_SND_HDA_POWER_SAVE
10369 .power_hook
= alc_power_eapd
,
10372 [ALC888_ACER_ASPIRE_7730G
] = {
10373 .mixers
= { alc883_3ST_6ch_mixer
,
10374 alc883_chmode_mixer
},
10375 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10376 alc888_acer_aspire_7730G_verbs
},
10377 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10378 .dac_nids
= alc883_dac_nids
,
10379 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10380 .adc_nids
= alc883_adc_nids_rev
,
10381 .capsrc_nids
= alc883_capsrc_nids_rev
,
10382 .dig_out_nid
= ALC883_DIGOUT_NID
,
10383 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10384 .channel_mode
= alc883_3ST_6ch_modes
,
10386 .const_channel_count
= 6,
10387 .input_mux
= &alc883_capture_source
,
10388 .unsol_event
= alc_automute_amp_unsol_event
,
10389 .setup
= alc888_acer_aspire_7730g_setup
,
10390 .init_hook
= alc_automute_amp
,
10392 [ALC883_MEDION
] = {
10393 .mixers
= { alc883_fivestack_mixer
,
10394 alc883_chmode_mixer
},
10395 .init_verbs
= { alc883_init_verbs
,
10396 alc883_medion_eapd_verbs
},
10397 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10398 .dac_nids
= alc883_dac_nids
,
10399 .adc_nids
= alc883_adc_nids_alt
,
10400 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10401 .capsrc_nids
= alc883_capsrc_nids
,
10402 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10403 .channel_mode
= alc883_sixstack_modes
,
10404 .input_mux
= &alc883_capture_source
,
10406 [ALC883_MEDION_WIM2160
] = {
10407 .mixers
= { alc883_medion_wim2160_mixer
},
10408 .init_verbs
= { alc883_init_verbs
, alc883_medion_wim2160_verbs
},
10409 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10410 .dac_nids
= alc883_dac_nids
,
10411 .dig_out_nid
= ALC883_DIGOUT_NID
,
10412 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10413 .adc_nids
= alc883_adc_nids
,
10414 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10415 .channel_mode
= alc883_3ST_2ch_modes
,
10416 .input_mux
= &alc883_capture_source
,
10417 .unsol_event
= alc_automute_amp_unsol_event
,
10418 .setup
= alc883_medion_wim2160_setup
,
10419 .init_hook
= alc_automute_amp
,
10421 [ALC883_LAPTOP_EAPD
] = {
10422 .mixers
= { alc883_base_mixer
},
10423 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
10424 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10425 .dac_nids
= alc883_dac_nids
,
10426 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10427 .channel_mode
= alc883_3ST_2ch_modes
,
10428 .input_mux
= &alc883_capture_source
,
10430 [ALC883_CLEVO_M540R
] = {
10431 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10432 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m540r_verbs
},
10433 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10434 .dac_nids
= alc883_dac_nids
,
10435 .dig_out_nid
= ALC883_DIGOUT_NID
,
10436 .dig_in_nid
= ALC883_DIGIN_NID
,
10437 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_clevo_modes
),
10438 .channel_mode
= alc883_3ST_6ch_clevo_modes
,
10440 .input_mux
= &alc883_capture_source
,
10441 /* This machine has the hardware HP auto-muting, thus
10442 * we need no software mute via unsol event
10445 [ALC883_CLEVO_M720
] = {
10446 .mixers
= { alc883_clevo_m720_mixer
},
10447 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
10448 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10449 .dac_nids
= alc883_dac_nids
,
10450 .dig_out_nid
= ALC883_DIGOUT_NID
,
10451 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10452 .channel_mode
= alc883_3ST_2ch_modes
,
10453 .input_mux
= &alc883_capture_source
,
10454 .unsol_event
= alc883_clevo_m720_unsol_event
,
10455 .setup
= alc883_clevo_m720_setup
,
10456 .init_hook
= alc883_clevo_m720_init_hook
,
10458 [ALC883_LENOVO_101E_2ch
] = {
10459 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
10460 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
10461 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10462 .dac_nids
= alc883_dac_nids
,
10463 .adc_nids
= alc883_adc_nids_alt
,
10464 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10465 .capsrc_nids
= alc883_capsrc_nids
,
10466 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10467 .channel_mode
= alc883_3ST_2ch_modes
,
10468 .input_mux
= &alc883_lenovo_101e_capture_source
,
10469 .unsol_event
= alc883_lenovo_101e_unsol_event
,
10470 .init_hook
= alc883_lenovo_101e_all_automute
,
10472 [ALC883_LENOVO_NB0763
] = {
10473 .mixers
= { alc883_lenovo_nb0763_mixer
},
10474 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
10475 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10476 .dac_nids
= alc883_dac_nids
,
10477 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10478 .channel_mode
= alc883_3ST_2ch_modes
,
10480 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
10481 .unsol_event
= alc_automute_amp_unsol_event
,
10482 .setup
= alc883_lenovo_nb0763_setup
,
10483 .init_hook
= alc_automute_amp
,
10485 [ALC888_LENOVO_MS7195_DIG
] = {
10486 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10487 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
10488 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10489 .dac_nids
= alc883_dac_nids
,
10490 .dig_out_nid
= ALC883_DIGOUT_NID
,
10491 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10492 .channel_mode
= alc883_3ST_6ch_modes
,
10494 .input_mux
= &alc883_capture_source
,
10495 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
10496 .init_hook
= alc888_lenovo_ms7195_front_automute
,
10498 [ALC883_HAIER_W66
] = {
10499 .mixers
= { alc883_targa_2ch_mixer
},
10500 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
10501 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10502 .dac_nids
= alc883_dac_nids
,
10503 .dig_out_nid
= ALC883_DIGOUT_NID
,
10504 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10505 .channel_mode
= alc883_3ST_2ch_modes
,
10506 .input_mux
= &alc883_capture_source
,
10507 .unsol_event
= alc_automute_amp_unsol_event
,
10508 .setup
= alc883_haier_w66_setup
,
10509 .init_hook
= alc_automute_amp
,
10511 [ALC888_3ST_HP
] = {
10512 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10513 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
10514 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10515 .dac_nids
= alc883_dac_nids
,
10516 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
10517 .channel_mode
= alc888_3st_hp_modes
,
10519 .input_mux
= &alc883_capture_source
,
10520 .unsol_event
= alc_automute_amp_unsol_event
,
10521 .setup
= alc888_3st_hp_setup
,
10522 .init_hook
= alc_automute_amp
,
10524 [ALC888_6ST_DELL
] = {
10525 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10526 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
10527 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10528 .dac_nids
= alc883_dac_nids
,
10529 .dig_out_nid
= ALC883_DIGOUT_NID
,
10530 .dig_in_nid
= ALC883_DIGIN_NID
,
10531 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10532 .channel_mode
= alc883_sixstack_modes
,
10533 .input_mux
= &alc883_capture_source
,
10534 .unsol_event
= alc_automute_amp_unsol_event
,
10535 .setup
= alc888_6st_dell_setup
,
10536 .init_hook
= alc_automute_amp
,
10539 .mixers
= { alc883_mitac_mixer
},
10540 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
10541 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10542 .dac_nids
= alc883_dac_nids
,
10543 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10544 .channel_mode
= alc883_3ST_2ch_modes
,
10545 .input_mux
= &alc883_capture_source
,
10546 .unsol_event
= alc_automute_amp_unsol_event
,
10547 .setup
= alc883_mitac_setup
,
10548 .init_hook
= alc_automute_amp
,
10550 [ALC883_FUJITSU_PI2515
] = {
10551 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
10552 .init_verbs
= { alc883_init_verbs
,
10553 alc883_2ch_fujitsu_pi2515_verbs
},
10554 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10555 .dac_nids
= alc883_dac_nids
,
10556 .dig_out_nid
= ALC883_DIGOUT_NID
,
10557 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10558 .channel_mode
= alc883_3ST_2ch_modes
,
10559 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10560 .unsol_event
= alc_automute_amp_unsol_event
,
10561 .setup
= alc883_2ch_fujitsu_pi2515_setup
,
10562 .init_hook
= alc_automute_amp
,
10564 [ALC888_FUJITSU_XA3530
] = {
10565 .mixers
= { alc888_base_mixer
, alc883_chmode_mixer
},
10566 .init_verbs
= { alc883_init_verbs
,
10567 alc888_fujitsu_xa3530_verbs
},
10568 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10569 .dac_nids
= alc883_dac_nids
,
10570 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10571 .adc_nids
= alc883_adc_nids_rev
,
10572 .capsrc_nids
= alc883_capsrc_nids_rev
,
10573 .dig_out_nid
= ALC883_DIGOUT_NID
,
10574 .num_channel_mode
= ARRAY_SIZE(alc888_4ST_8ch_intel_modes
),
10575 .channel_mode
= alc888_4ST_8ch_intel_modes
,
10577 ARRAY_SIZE(alc888_2_capture_sources
),
10578 .input_mux
= alc888_2_capture_sources
,
10579 .unsol_event
= alc_automute_amp_unsol_event
,
10580 .setup
= alc888_fujitsu_xa3530_setup
,
10581 .init_hook
= alc_automute_amp
,
10583 [ALC888_LENOVO_SKY
] = {
10584 .mixers
= { alc888_lenovo_sky_mixer
, alc883_chmode_mixer
},
10585 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_sky_verbs
},
10586 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10587 .dac_nids
= alc883_dac_nids
,
10588 .dig_out_nid
= ALC883_DIGOUT_NID
,
10589 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10590 .channel_mode
= alc883_sixstack_modes
,
10592 .input_mux
= &alc883_lenovo_sky_capture_source
,
10593 .unsol_event
= alc_automute_amp_unsol_event
,
10594 .setup
= alc888_lenovo_sky_setup
,
10595 .init_hook
= alc_automute_amp
,
10597 [ALC888_ASUS_M90V
] = {
10598 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10599 .init_verbs
= { alc883_init_verbs
, alc888_asus_m90v_verbs
},
10600 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10601 .dac_nids
= alc883_dac_nids
,
10602 .dig_out_nid
= ALC883_DIGOUT_NID
,
10603 .dig_in_nid
= ALC883_DIGIN_NID
,
10604 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10605 .channel_mode
= alc883_3ST_6ch_modes
,
10607 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10608 .unsol_event
= alc_sku_unsol_event
,
10609 .setup
= alc883_mode2_setup
,
10610 .init_hook
= alc_inithook
,
10612 [ALC888_ASUS_EEE1601
] = {
10613 .mixers
= { alc883_asus_eee1601_mixer
},
10614 .cap_mixer
= alc883_asus_eee1601_cap_mixer
,
10615 .init_verbs
= { alc883_init_verbs
, alc888_asus_eee1601_verbs
},
10616 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10617 .dac_nids
= alc883_dac_nids
,
10618 .dig_out_nid
= ALC883_DIGOUT_NID
,
10619 .dig_in_nid
= ALC883_DIGIN_NID
,
10620 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10621 .channel_mode
= alc883_3ST_2ch_modes
,
10623 .input_mux
= &alc883_asus_eee1601_capture_source
,
10624 .unsol_event
= alc_sku_unsol_event
,
10625 .init_hook
= alc883_eee1601_inithook
,
10627 [ALC1200_ASUS_P5Q
] = {
10628 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10629 .init_verbs
= { alc883_init_verbs
},
10630 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10631 .dac_nids
= alc883_dac_nids
,
10632 .dig_out_nid
= ALC1200_DIGOUT_NID
,
10633 .dig_in_nid
= ALC883_DIGIN_NID
,
10634 .slave_dig_outs
= alc1200_slave_dig_outs
,
10635 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10636 .channel_mode
= alc883_sixstack_modes
,
10637 .input_mux
= &alc883_capture_source
,
10640 .mixers
= { alc889A_mb31_mixer
, alc883_chmode_mixer
},
10641 .init_verbs
= { alc883_init_verbs
, alc889A_mb31_verbs
,
10642 alc880_gpio1_init_verbs
},
10643 .adc_nids
= alc883_adc_nids
,
10644 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10645 .capsrc_nids
= alc883_capsrc_nids
,
10646 .dac_nids
= alc883_dac_nids
,
10647 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10648 .channel_mode
= alc889A_mb31_6ch_modes
,
10649 .num_channel_mode
= ARRAY_SIZE(alc889A_mb31_6ch_modes
),
10650 .input_mux
= &alc889A_mb31_capture_source
,
10651 .dig_out_nid
= ALC883_DIGOUT_NID
,
10652 .unsol_event
= alc889A_mb31_unsol_event
,
10653 .init_hook
= alc889A_mb31_automute
,
10655 [ALC883_SONY_VAIO_TT
] = {
10656 .mixers
= { alc883_vaiott_mixer
},
10657 .init_verbs
= { alc883_init_verbs
, alc883_vaiott_verbs
},
10658 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10659 .dac_nids
= alc883_dac_nids
,
10660 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10661 .channel_mode
= alc883_3ST_2ch_modes
,
10662 .input_mux
= &alc883_capture_source
,
10663 .unsol_event
= alc_automute_amp_unsol_event
,
10664 .setup
= alc883_vaiott_setup
,
10665 .init_hook
= alc_automute_amp
,
10674 PINFIX_ABIT_AW9D_MAX
,
10676 PINFIX_ACER_ASPIRE_7736
,
10679 static const struct alc_fixup alc882_fixups
[] = {
10680 [PINFIX_ABIT_AW9D_MAX
] = {
10681 .pins
= (const struct alc_pincfg
[]) {
10682 { 0x15, 0x01080104 }, /* side */
10683 { 0x16, 0x01011012 }, /* rear */
10684 { 0x17, 0x01016011 }, /* clfe */
10688 [PINFIX_PB_M5210
] = {
10689 .verbs
= (const struct hda_verb
[]) {
10690 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
10694 [PINFIX_ACER_ASPIRE_7736
] = {
10695 .sku
= ALC_FIXUP_SKU_IGNORE
,
10699 static struct snd_pci_quirk alc882_fixup_tbl
[] = {
10700 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210
),
10701 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
10702 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736
),
10707 * BIOS auto configuration
10709 static int alc882_auto_create_input_ctls(struct hda_codec
*codec
,
10710 const struct auto_pin_cfg
*cfg
)
10712 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x23, 0x22);
10715 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
10716 hda_nid_t nid
, int pin_type
,
10721 /* set as output */
10722 alc_set_pin_output(codec
, nid
, pin_type
);
10726 else if (dac
>= 0x02 && dac
<= 0x05)
10730 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
10733 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
10735 struct alc_spec
*spec
= codec
->spec
;
10738 for (i
= 0; i
<= HDA_SIDE
; i
++) {
10739 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
10740 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
10742 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
10743 spec
->multiout
.dac_nids
[i
]);
10747 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
10749 struct alc_spec
*spec
= codec
->spec
;
10750 hda_nid_t pin
, dac
;
10753 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.hp_pins
); i
++) {
10754 pin
= spec
->autocfg
.hp_pins
[i
];
10757 dac
= spec
->multiout
.hp_nid
;
10759 dac
= spec
->multiout
.dac_nids
[0]; /* to front */
10760 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, dac
);
10762 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
10763 pin
= spec
->autocfg
.speaker_pins
[i
];
10766 dac
= spec
->multiout
.extra_out_nid
[0];
10768 dac
= spec
->multiout
.dac_nids
[0]; /* to front */
10769 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, dac
);
10773 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
10775 struct alc_spec
*spec
= codec
->spec
;
10776 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
10779 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
10780 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
10781 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
10782 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
10783 snd_hda_codec_write(codec
, nid
, 0,
10784 AC_VERB_SET_AMP_GAIN_MUTE
,
10789 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
10791 struct alc_spec
*spec
= codec
->spec
;
10794 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
10795 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
10796 hda_nid_t nid
= spec
->capsrc_nids
[c
];
10797 unsigned int mux_idx
;
10798 const struct hda_input_mux
*imux
;
10799 int conns
, mute
, idx
, item
;
10801 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
10802 ARRAY_SIZE(conn_list
));
10805 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
10806 imux
= &spec
->input_mux
[mux_idx
];
10807 if (!imux
->num_items
&& mux_idx
> 0)
10808 imux
= &spec
->input_mux
[0];
10809 for (idx
= 0; idx
< conns
; idx
++) {
10810 /* if the current connection is the selected one,
10811 * unmute it as default - otherwise mute it
10813 mute
= AMP_IN_MUTE(idx
);
10814 for (item
= 0; item
< imux
->num_items
; item
++) {
10815 if (imux
->items
[item
].index
== idx
) {
10816 if (spec
->cur_mux
[c
] == item
)
10817 mute
= AMP_IN_UNMUTE(idx
);
10821 /* check if we have a selector or mixer
10822 * we could check for the widget type instead, but
10823 * just check for Amp-In presence (in case of mixer
10824 * without amp-in there is something wrong, this
10825 * function shouldn't be used or capsrc nid is wrong)
10827 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)
10828 snd_hda_codec_write(codec
, nid
, 0,
10829 AC_VERB_SET_AMP_GAIN_MUTE
,
10831 else if (mute
!= AMP_IN_MUTE(idx
))
10832 snd_hda_codec_write(codec
, nid
, 0,
10833 AC_VERB_SET_CONNECT_SEL
,
10839 /* add mic boosts if needed */
10840 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
10842 struct alc_spec
*spec
= codec
->spec
;
10843 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
10847 const char *prev_label
= NULL
;
10849 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
10850 if (cfg
->inputs
[i
].type
> AUTO_PIN_MIC
)
10852 nid
= cfg
->inputs
[i
].pin
;
10853 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
) {
10855 char boost_label
[32];
10857 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
10858 if (prev_label
&& !strcmp(label
, prev_label
))
10862 prev_label
= label
;
10864 snprintf(boost_label
, sizeof(boost_label
),
10865 "%s Boost Volume", label
);
10866 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10867 boost_label
, type_idx
,
10868 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
10876 /* almost identical with ALC880 parser... */
10877 static int alc882_parse_auto_config(struct hda_codec
*codec
)
10879 struct alc_spec
*spec
= codec
->spec
;
10880 static hda_nid_t alc882_ignore
[] = { 0x1d, 0 };
10883 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10887 if (!spec
->autocfg
.line_outs
)
10888 return 0; /* can't find valid BIOS pin config */
10890 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
10893 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10896 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
10900 err
= alc880_auto_create_extra_out(spec
,
10901 spec
->autocfg
.speaker_pins
[0],
10905 err
= alc882_auto_create_input_ctls(codec
, &spec
->autocfg
);
10909 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
10911 alc_auto_parse_digital(codec
);
10913 if (spec
->kctls
.list
)
10914 add_mixer(spec
, spec
->kctls
.list
);
10916 add_verb(spec
, alc883_auto_init_verbs
);
10917 /* if ADC 0x07 is available, initialize it, too */
10918 if (get_wcaps_type(get_wcaps(codec
, 0x07)) == AC_WID_AUD_IN
)
10919 add_verb(spec
, alc882_adc1_init_verbs
);
10921 spec
->num_mux_defs
= 1;
10922 spec
->input_mux
= &spec
->private_imux
[0];
10924 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
10926 err
= alc_auto_add_mic_boost(codec
);
10930 return 1; /* config found */
10933 /* additional initialization for auto-configuration model */
10934 static void alc882_auto_init(struct hda_codec
*codec
)
10936 struct alc_spec
*spec
= codec
->spec
;
10937 alc882_auto_init_multi_out(codec
);
10938 alc882_auto_init_hp_out(codec
);
10939 alc882_auto_init_analog_input(codec
);
10940 alc882_auto_init_input_src(codec
);
10941 alc_auto_init_digital(codec
);
10942 if (spec
->unsol_event
)
10943 alc_inithook(codec
);
10946 static int patch_alc882(struct hda_codec
*codec
)
10948 struct alc_spec
*spec
;
10949 int err
, board_config
;
10951 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10955 codec
->spec
= spec
;
10957 switch (codec
->vendor_id
) {
10962 /* ALC883 and variants */
10963 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
10967 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
10971 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
)
10972 board_config
= snd_hda_check_board_codec_sid_config(codec
,
10973 ALC882_MODEL_LAST
, alc882_models
, alc882_ssid_cfg_tbl
);
10975 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
10976 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
10978 board_config
= ALC882_AUTO
;
10981 if (board_config
== ALC882_AUTO
)
10982 alc_pick_fixup(codec
, alc882_fixup_tbl
, alc882_fixups
, 1);
10984 alc_auto_parse_customize_define(codec
);
10986 if (board_config
== ALC882_AUTO
) {
10987 /* automatic parse from the BIOS config */
10988 err
= alc882_parse_auto_config(codec
);
10994 "hda_codec: Cannot set up configuration "
10995 "from BIOS. Using base mode...\n");
10996 board_config
= ALC882_3ST_DIG
;
11000 if (has_cdefine_beep(codec
)) {
11001 err
= snd_hda_attach_beep_device(codec
, 0x1);
11008 if (board_config
!= ALC882_AUTO
)
11009 setup_preset(codec
, &alc882_presets
[board_config
]);
11011 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
11012 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
11013 /* FIXME: setup DAC5 */
11014 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11015 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
11017 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
11018 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
11020 if (!spec
->adc_nids
&& spec
->input_mux
) {
11022 spec
->num_adc_nids
= 0;
11023 for (i
= 0; i
< ARRAY_SIZE(alc882_adc_nids
); i
++) {
11024 const struct hda_input_mux
*imux
= spec
->input_mux
;
11026 hda_nid_t items
[16];
11027 hda_nid_t nid
= alc882_adc_nids
[i
];
11028 unsigned int wcap
= get_wcaps(codec
, nid
);
11030 wcap
= get_wcaps_type(wcap
);
11031 if (wcap
!= AC_WID_AUD_IN
)
11033 spec
->private_adc_nids
[spec
->num_adc_nids
] = nid
;
11034 err
= snd_hda_get_connections(codec
, nid
, &cap
, 1);
11037 err
= snd_hda_get_connections(codec
, cap
, items
,
11038 ARRAY_SIZE(items
));
11041 for (j
= 0; j
< imux
->num_items
; j
++)
11042 if (imux
->items
[j
].index
>= err
)
11044 if (j
< imux
->num_items
)
11046 spec
->private_capsrc_nids
[spec
->num_adc_nids
] = cap
;
11047 spec
->num_adc_nids
++;
11049 spec
->adc_nids
= spec
->private_adc_nids
;
11050 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
11053 set_capture_mixer(codec
);
11055 if (has_cdefine_beep(codec
))
11056 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
11058 if (board_config
== ALC882_AUTO
)
11059 alc_pick_fixup(codec
, alc882_fixup_tbl
, alc882_fixups
, 0);
11061 spec
->vmaster_nid
= 0x0c;
11063 codec
->patch_ops
= alc_patch_ops
;
11064 if (board_config
== ALC882_AUTO
)
11065 spec
->init_hook
= alc882_auto_init
;
11067 alc_init_jacks(codec
);
11068 #ifdef CONFIG_SND_HDA_POWER_SAVE
11069 if (!spec
->loopback
.amplist
)
11070 spec
->loopback
.amplist
= alc882_loopbacks
;
11081 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11082 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11084 #define alc262_dac_nids alc260_dac_nids
11085 #define alc262_adc_nids alc882_adc_nids
11086 #define alc262_adc_nids_alt alc882_adc_nids_alt
11087 #define alc262_capsrc_nids alc882_capsrc_nids
11088 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11090 #define alc262_modes alc260_modes
11091 #define alc262_capture_source alc882_capture_source
11093 static hda_nid_t alc262_dmic_adc_nids
[1] = {
11098 static hda_nid_t alc262_dmic_capsrc_nids
[1] = { 0x22 };
11100 static struct snd_kcontrol_new alc262_base_mixer
[] = {
11101 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11102 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11103 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11104 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11105 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11106 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11109 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11112 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11113 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
11114 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11115 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
11116 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
11120 /* update HP, line and mono-out pins according to the master switch */
11121 static void alc262_hp_master_update(struct hda_codec
*codec
)
11123 struct alc_spec
*spec
= codec
->spec
;
11124 int val
= spec
->master_sw
;
11126 /* HP & line-out */
11127 snd_hda_codec_write_cache(codec
, 0x1b, 0,
11128 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11130 snd_hda_codec_write_cache(codec
, 0x15, 0,
11131 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11133 /* mono (speaker) depending on the HP jack sense */
11134 val
= val
&& !spec
->jack_present
;
11135 snd_hda_codec_write_cache(codec
, 0x16, 0,
11136 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11137 val
? PIN_OUT
: 0);
11140 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
11142 struct alc_spec
*spec
= codec
->spec
;
11144 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x1b);
11145 alc262_hp_master_update(codec
);
11148 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
11150 if ((res
>> 26) != ALC880_HP_EVENT
)
11152 alc262_hp_bpc_automute(codec
);
11155 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
11157 struct alc_spec
*spec
= codec
->spec
;
11159 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
11160 alc262_hp_master_update(codec
);
11163 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
11166 if ((res
>> 26) != ALC880_HP_EVENT
)
11168 alc262_hp_wildwest_automute(codec
);
11171 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11173 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
11174 struct snd_ctl_elem_value
*ucontrol
)
11176 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11177 struct alc_spec
*spec
= codec
->spec
;
11178 int val
= !!*ucontrol
->value
.integer
.value
;
11180 if (val
== spec
->master_sw
)
11182 spec
->master_sw
= val
;
11183 alc262_hp_master_update(codec
);
11187 #define ALC262_HP_MASTER_SWITCH \
11189 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11190 .name = "Master Playback Switch", \
11191 .info = snd_ctl_boolean_mono_info, \
11192 .get = alc262_hp_master_sw_get, \
11193 .put = alc262_hp_master_sw_put, \
11196 .iface = NID_MAPPING, \
11197 .name = "Master Playback Switch", \
11198 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11202 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
11203 ALC262_HP_MASTER_SWITCH
,
11204 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11205 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11207 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11209 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11213 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11214 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11215 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11216 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11221 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11222 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11226 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
11227 ALC262_HP_MASTER_SWITCH
,
11228 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11229 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11230 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11231 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11232 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11234 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11237 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11238 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT
),
11239 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11240 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11241 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11242 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11246 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
11247 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11248 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11249 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11253 /* mute/unmute internal speaker according to the hp jack and mute state */
11254 static void alc262_hp_t5735_setup(struct hda_codec
*codec
)
11256 struct alc_spec
*spec
= codec
->spec
;
11258 spec
->autocfg
.hp_pins
[0] = 0x15;
11259 spec
->autocfg
.speaker_pins
[0] = 0x14;
11262 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
11263 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11264 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11265 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11269 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11273 static struct hda_verb alc262_hp_t5735_verbs
[] = {
11274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11277 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11281 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
11282 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11283 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11284 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
11285 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
11286 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11287 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11291 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
11292 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11293 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11295 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11296 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11297 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
11301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
11305 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
11312 /* bind hp and internal speaker mute (with plug check) as master switch */
11313 static void alc262_hippo_master_update(struct hda_codec
*codec
)
11315 struct alc_spec
*spec
= codec
->spec
;
11316 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
11317 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
11318 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
11322 mute
= spec
->master_sw
? 0 : HDA_AMP_MUTE
;
11323 snd_hda_codec_amp_stereo(codec
, hp_nid
, HDA_OUTPUT
, 0,
11324 HDA_AMP_MUTE
, mute
);
11325 /* mute internal speaker per jack sense */
11326 if (spec
->jack_present
)
11327 mute
= HDA_AMP_MUTE
;
11329 snd_hda_codec_amp_stereo(codec
, line_nid
, HDA_OUTPUT
, 0,
11330 HDA_AMP_MUTE
, mute
);
11331 if (speaker_nid
&& speaker_nid
!= line_nid
)
11332 snd_hda_codec_amp_stereo(codec
, speaker_nid
, HDA_OUTPUT
, 0,
11333 HDA_AMP_MUTE
, mute
);
11336 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11338 static int alc262_hippo_master_sw_put(struct snd_kcontrol
*kcontrol
,
11339 struct snd_ctl_elem_value
*ucontrol
)
11341 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11342 struct alc_spec
*spec
= codec
->spec
;
11343 int val
= !!*ucontrol
->value
.integer
.value
;
11345 if (val
== spec
->master_sw
)
11347 spec
->master_sw
= val
;
11348 alc262_hippo_master_update(codec
);
11352 #define ALC262_HIPPO_MASTER_SWITCH \
11354 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11355 .name = "Master Playback Switch", \
11356 .info = snd_ctl_boolean_mono_info, \
11357 .get = alc262_hippo_master_sw_get, \
11358 .put = alc262_hippo_master_sw_put, \
11361 .iface = NID_MAPPING, \
11362 .name = "Master Playback Switch", \
11363 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11364 (SUBDEV_SPEAKER(0) << 16), \
11367 static struct snd_kcontrol_new alc262_hippo_mixer
[] = {
11368 ALC262_HIPPO_MASTER_SWITCH
,
11369 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11370 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11371 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11372 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11373 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11376 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11377 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11378 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11379 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11380 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11384 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
11385 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11386 ALC262_HIPPO_MASTER_SWITCH
,
11387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11389 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11390 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11391 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11392 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11393 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11394 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11395 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11396 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11400 /* mute/unmute internal speaker according to the hp jack and mute state */
11401 static void alc262_hippo_automute(struct hda_codec
*codec
)
11403 struct alc_spec
*spec
= codec
->spec
;
11404 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
11406 spec
->jack_present
= snd_hda_jack_detect(codec
, hp_nid
);
11407 alc262_hippo_master_update(codec
);
11410 static void alc262_hippo_unsol_event(struct hda_codec
*codec
, unsigned int res
)
11412 if ((res
>> 26) != ALC880_HP_EVENT
)
11414 alc262_hippo_automute(codec
);
11417 static void alc262_hippo_setup(struct hda_codec
*codec
)
11419 struct alc_spec
*spec
= codec
->spec
;
11421 spec
->autocfg
.hp_pins
[0] = 0x15;
11422 spec
->autocfg
.speaker_pins
[0] = 0x14;
11425 static void alc262_hippo1_setup(struct hda_codec
*codec
)
11427 struct alc_spec
*spec
= codec
->spec
;
11429 spec
->autocfg
.hp_pins
[0] = 0x1b;
11430 spec
->autocfg
.speaker_pins
[0] = 0x14;
11434 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
11435 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11436 ALC262_HIPPO_MASTER_SWITCH
,
11437 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11438 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11439 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11440 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11444 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
11445 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11446 ALC262_HIPPO_MASTER_SWITCH
,
11447 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11448 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11449 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11450 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11451 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11455 static struct snd_kcontrol_new alc262_tyan_mixer
[] = {
11456 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11457 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
11458 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11459 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11460 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11461 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11464 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11465 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11466 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11467 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11471 static struct hda_verb alc262_tyan_verbs
[] = {
11472 /* Headphone automute */
11473 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11474 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11475 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11477 /* P11 AUX_IN, white 4-pin connector */
11478 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11479 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
, 0xe1},
11480 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
, 0x93},
11481 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
, 0x19},
11486 /* unsolicited event for HP jack sensing */
11487 static void alc262_tyan_setup(struct hda_codec
*codec
)
11489 struct alc_spec
*spec
= codec
->spec
;
11491 spec
->autocfg
.hp_pins
[0] = 0x1b;
11492 spec
->autocfg
.speaker_pins
[0] = 0x15;
11496 #define alc262_capture_mixer alc882_capture_mixer
11497 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11500 * generic initialization of ADC, input mixers and output mixers
11502 static struct hda_verb alc262_init_verbs
[] = {
11504 * Unmute ADC0-2 and set the default input to mic-in
11506 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11508 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11509 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11510 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11513 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11515 * Note: PASD motherboards uses the Line In 2 as the input for
11516 * front panel mic (mic 2)
11518 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11526 * Set up output mixers (0x0c - 0x0e)
11528 /* set vol=0 to output mixers */
11529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11530 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11531 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11532 /* set up input amps for analog loopback */
11533 /* Amp Indices: DAC = 0, mixer = 1 */
11534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11536 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11541 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11542 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11543 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11544 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11545 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11546 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11550 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11551 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11552 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11554 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11555 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11557 /* FIXME: use matrix-type input source selection */
11558 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11559 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11560 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11562 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11563 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11568 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11578 static struct hda_verb alc262_eapd_verbs
[] = {
11579 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11580 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11584 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
11585 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11586 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11587 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11589 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11590 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11594 static struct hda_verb alc262_sony_unsol_verbs
[] = {
11595 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11596 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11597 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
11599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11604 static struct snd_kcontrol_new alc262_toshiba_s06_mixer
[] = {
11605 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11606 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11607 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11608 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11609 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11613 static struct hda_verb alc262_toshiba_s06_verbs
[] = {
11614 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11615 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11616 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11617 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11618 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x09},
11619 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11620 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11621 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11625 static void alc262_toshiba_s06_setup(struct hda_codec
*codec
)
11627 struct alc_spec
*spec
= codec
->spec
;
11629 spec
->autocfg
.hp_pins
[0] = 0x15;
11630 spec
->autocfg
.speaker_pins
[0] = 0x14;
11631 spec
->ext_mic
.pin
= 0x18;
11632 spec
->ext_mic
.mux_idx
= 0;
11633 spec
->int_mic
.pin
= 0x12;
11634 spec
->int_mic
.mux_idx
= 9;
11635 spec
->auto_mic
= 1;
11641 * 0x16 = internal speaker
11642 * 0x18 = external mic
11645 static struct snd_kcontrol_new alc262_nec_mixer
[] = {
11646 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
11647 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
11649 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11650 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11651 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11653 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11658 static struct hda_verb alc262_nec_verbs
[] = {
11659 /* Unmute Speaker */
11660 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11663 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11666 /* External mic to headphone */
11667 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11668 /* External mic to speaker */
11669 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11675 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11676 * 0x1b = port replicator headphone out
11679 #define ALC_HP_EVENT 0x37
11681 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
11682 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11683 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11684 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11685 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11689 static struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
11690 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11691 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11695 static struct hda_verb alc262_lenovo_3000_init_verbs
[] = {
11696 /* Front Mic pin: input vref at 50% */
11697 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11698 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11702 static struct hda_input_mux alc262_fujitsu_capture_source
= {
11706 { "Internal Mic", 0x1 },
11711 static struct hda_input_mux alc262_HP_capture_source
= {
11715 { "Front Mic", 0x1 },
11722 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
11726 { "Front Mic", 0x2 },
11732 /* mute/unmute internal speaker according to the hp jacks and mute state */
11733 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
11735 struct alc_spec
*spec
= codec
->spec
;
11738 if (force
|| !spec
->sense_updated
) {
11739 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x14) ||
11740 snd_hda_jack_detect(codec
, 0x1b);
11741 spec
->sense_updated
= 1;
11743 /* unmute internal speaker only if both HPs are unplugged and
11744 * master switch is on
11746 if (spec
->jack_present
)
11747 mute
= HDA_AMP_MUTE
;
11749 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
11750 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
11751 HDA_AMP_MUTE
, mute
);
11754 /* unsolicited event for HP jack sensing */
11755 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
11758 if ((res
>> 26) != ALC_HP_EVENT
)
11760 alc262_fujitsu_automute(codec
, 1);
11763 static void alc262_fujitsu_init_hook(struct hda_codec
*codec
)
11765 alc262_fujitsu_automute(codec
, 1);
11768 /* bind volumes of both NID 0x0c and 0x0d */
11769 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
11770 .ops
= &snd_hda_bind_vol
,
11772 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
11773 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
11778 /* mute/unmute internal speaker according to the hp jack and mute state */
11779 static void alc262_lenovo_3000_automute(struct hda_codec
*codec
, int force
)
11781 struct alc_spec
*spec
= codec
->spec
;
11784 if (force
|| !spec
->sense_updated
) {
11785 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x1b);
11786 spec
->sense_updated
= 1;
11788 if (spec
->jack_present
) {
11789 /* mute internal speaker */
11790 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11791 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
11792 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
11793 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
11795 /* unmute internal speaker if necessary */
11796 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
11797 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11798 HDA_AMP_MUTE
, mute
);
11799 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
11800 HDA_AMP_MUTE
, mute
);
11804 /* unsolicited event for HP jack sensing */
11805 static void alc262_lenovo_3000_unsol_event(struct hda_codec
*codec
,
11808 if ((res
>> 26) != ALC_HP_EVENT
)
11810 alc262_lenovo_3000_automute(codec
, 1);
11813 static int amp_stereo_mute_update(struct hda_codec
*codec
, hda_nid_t nid
,
11814 int dir
, int idx
, long *valp
)
11818 for (i
= 0; i
< 2; i
++, valp
++)
11819 change
|= snd_hda_codec_amp_update(codec
, nid
, i
, dir
, idx
,
11821 *valp
? 0 : HDA_AMP_MUTE
);
11825 /* bind hp and internal speaker mute (with plug check) */
11826 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
11827 struct snd_ctl_elem_value
*ucontrol
)
11829 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11830 long *valp
= ucontrol
->value
.integer
.value
;
11833 change
= amp_stereo_mute_update(codec
, 0x14, HDA_OUTPUT
, 0, valp
);
11834 change
|= amp_stereo_mute_update(codec
, 0x1b, HDA_OUTPUT
, 0, valp
);
11836 alc262_fujitsu_automute(codec
, 0);
11840 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
11841 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11843 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11844 .name
= "Master Playback Switch",
11845 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
11846 .info
= snd_hda_mixer_amp_switch_info
,
11847 .get
= snd_hda_mixer_amp_switch_get
,
11848 .put
= alc262_fujitsu_master_sw_put
,
11849 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11852 .iface
= NID_MAPPING
,
11853 .name
= "Master Playback Switch",
11854 .private_value
= 0x1b,
11856 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11857 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11858 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11861 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11862 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11863 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11867 /* bind hp and internal speaker mute (with plug check) */
11868 static int alc262_lenovo_3000_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
, 0x1b, HDA_OUTPUT
, 0, valp
);
11877 alc262_lenovo_3000_automute(codec
, 0);
11881 static struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
11882 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11884 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11885 .name
= "Master Playback Switch",
11886 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
11887 .info
= snd_hda_mixer_amp_switch_info
,
11888 .get
= snd_hda_mixer_amp_switch_get
,
11889 .put
= alc262_lenovo_3000_master_sw_put
,
11890 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
11892 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11893 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11894 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11897 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11898 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11899 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11903 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer
[] = {
11904 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11905 ALC262_HIPPO_MASTER_SWITCH
,
11906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11908 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11909 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11910 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11911 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11915 /* additional init verbs for Benq laptops */
11916 static struct hda_verb alc262_EAPD_verbs
[] = {
11917 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
11918 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
11922 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
11923 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11924 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11926 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
11927 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
11931 /* Samsung Q1 Ultra Vista model setup */
11932 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
11933 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11934 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
11935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11937 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11938 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT
),
11942 static struct hda_verb alc262_ultra_verbs
[] = {
11944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11948 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11949 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11950 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11951 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11956 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11957 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11959 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11960 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11961 /* ADC, choose mic */
11962 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11963 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11964 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11965 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11966 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11967 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11968 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
11969 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
11970 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
11971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
11975 /* mute/unmute internal speaker according to the hp jack and mute state */
11976 static void alc262_ultra_automute(struct hda_codec
*codec
)
11978 struct alc_spec
*spec
= codec
->spec
;
11982 /* auto-mute only when HP is used as HP */
11983 if (!spec
->cur_mux
[0]) {
11984 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
11985 if (spec
->jack_present
)
11986 mute
= HDA_AMP_MUTE
;
11988 /* mute/unmute internal speaker */
11989 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11990 HDA_AMP_MUTE
, mute
);
11991 /* mute/unmute HP */
11992 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
11993 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
11996 /* unsolicited event for HP jack sensing */
11997 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
12000 if ((res
>> 26) != ALC880_HP_EVENT
)
12002 alc262_ultra_automute(codec
);
12005 static struct hda_input_mux alc262_ultra_capture_source
= {
12009 { "Headphone", 0x7 },
12013 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
12014 struct snd_ctl_elem_value
*ucontrol
)
12016 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
12017 struct alc_spec
*spec
= codec
->spec
;
12020 ret
= alc_mux_enum_put(kcontrol
, ucontrol
);
12023 /* reprogram the HP pin as mic or HP according to the input source */
12024 snd_hda_codec_write_cache(codec
, 0x15, 0,
12025 AC_VERB_SET_PIN_WIDGET_CONTROL
,
12026 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
12027 alc262_ultra_automute(codec
); /* mute/unmute HP */
12031 static struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
12032 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
12033 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
12035 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12036 .name
= "Capture Source",
12037 .info
= alc_mux_enum_info
,
12038 .get
= alc_mux_enum_get
,
12039 .put
= alc262_ultra_mux_enum_put
,
12042 .iface
= NID_MAPPING
,
12043 .name
= "Capture Source",
12044 .private_value
= 0x15,
12049 /* We use two mixers depending on the output pin; 0x16 is a mono output
12050 * and thus it's bound with a different mixer.
12051 * This function returns which mixer amp should be used.
12053 static int alc262_check_volbit(hda_nid_t nid
)
12057 else if (nid
== 0x16)
12063 static int alc262_add_out_vol_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
12064 const char *pfx
, int *vbits
, int idx
)
12069 vbit
= alc262_check_volbit(nid
);
12072 if (*vbits
& vbit
) /* a volume control for this mixer already there */
12076 val
= HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
);
12078 val
= HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
);
12079 return __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, idx
, val
);
12082 static int alc262_add_out_sw_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
12083 const char *pfx
, int idx
)
12090 val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
12092 val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
12093 return __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
, val
);
12096 /* add playback controls from the parsed DAC table */
12097 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12098 const struct auto_pin_cfg
*cfg
)
12104 spec
->multiout
.num_dacs
= 1; /* only use one dac */
12105 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
12106 spec
->multiout
.dac_nids
[0] = 2;
12108 pfx
= alc_get_line_out_pfx(cfg
, true);
12111 for (i
= 0; i
< 2; i
++) {
12112 err
= alc262_add_out_sw_ctl(spec
, cfg
->line_out_pins
[i
], pfx
, i
);
12115 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
12116 err
= alc262_add_out_sw_ctl(spec
, cfg
->speaker_pins
[i
],
12121 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
) {
12122 err
= alc262_add_out_sw_ctl(spec
, cfg
->hp_pins
[i
],
12129 vbits
= alc262_check_volbit(cfg
->line_out_pins
[0]) |
12130 alc262_check_volbit(cfg
->speaker_pins
[0]) |
12131 alc262_check_volbit(cfg
->hp_pins
[0]);
12132 if (vbits
== 1 || vbits
== 2)
12133 pfx
= "Master"; /* only one mixer is used */
12135 for (i
= 0; i
< 2; i
++) {
12136 err
= alc262_add_out_vol_ctl(spec
, cfg
->line_out_pins
[i
], pfx
,
12140 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
12141 err
= alc262_add_out_vol_ctl(spec
, cfg
->speaker_pins
[i
],
12142 "Speaker", &vbits
, i
);
12146 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
) {
12147 err
= alc262_add_out_vol_ctl(spec
, cfg
->hp_pins
[i
],
12148 "Headphone", &vbits
, i
);
12156 #define alc262_auto_create_input_ctls \
12157 alc882_auto_create_input_ctls
12160 * generic initialization of ADC, input mixers and output mixers
12162 static struct hda_verb alc262_volume_init_verbs
[] = {
12164 * Unmute ADC0-2 and set the default input to mic-in
12166 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12168 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12169 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12170 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12171 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12173 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12175 * Note: PASD motherboards uses the Line In 2 as the input for
12176 * front panel mic (mic 2)
12178 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12186 * Set up output mixers (0x0c - 0x0f)
12188 /* set vol=0 to output mixers */
12189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12191 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12193 /* set up input amps for analog loopback */
12194 /* Amp Indices: DAC = 0, mixer = 1 */
12195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12197 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12198 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12200 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12202 /* FIXME: use matrix-type input source selection */
12203 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12204 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12205 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12212 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12213 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12223 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
12225 * Unmute ADC0-2 and set the default input to mic-in
12227 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12229 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12230 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12231 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12232 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12234 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12236 * Note: PASD motherboards uses the Line In 2 as the input for
12237 * front panel mic (mic 2)
12239 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12240 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12241 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12242 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12243 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12244 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12249 * Set up output mixers (0x0c - 0x0e)
12251 /* set vol=0 to output mixers */
12252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12253 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12254 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12256 /* set up input amps for analog loopback */
12257 /* Amp Indices: DAC = 0, mixer = 1 */
12258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12260 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12262 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12265 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12266 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12267 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12269 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12270 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12272 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12273 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12276 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12277 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12278 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12279 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12281 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12282 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12283 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12284 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12285 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12286 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12289 /* FIXME: use matrix-type input source selection */
12290 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12291 /* Input mixer1: only unmute Mic */
12292 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12293 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12294 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12295 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12296 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12302 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12319 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12320 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12322 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12327 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
12329 * Unmute ADC0-2 and set the default input to mic-in
12331 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12333 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12335 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12336 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12338 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12340 * Note: PASD motherboards uses the Line In 2 as the input for front
12341 * panel mic (mic 2)
12343 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12345 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12346 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12347 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12348 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12349 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12350 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12351 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
12353 * Set up output mixers (0x0c - 0x0e)
12355 /* set vol=0 to output mixers */
12356 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12357 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12358 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12360 /* set up input amps for analog loopback */
12361 /* Amp Indices: DAC = 0, mixer = 1 */
12362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12364 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12365 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12366 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12367 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12370 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
12371 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
12372 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
12373 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
12374 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
12375 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
12376 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
12378 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12379 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12381 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12382 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12384 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12385 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12386 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12387 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
12388 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12389 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12391 /* FIXME: use matrix-type input source selection */
12392 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12393 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
12396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
12397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
12398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
12399 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
12402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
12404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
12405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
12406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
12407 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12408 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
12410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
12412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
12413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
12414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
12415 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
12418 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12423 static struct hda_verb alc262_toshiba_rx1_unsol_verbs
[] = {
12425 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Front Speaker */
12426 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12427 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
12429 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* MIC jack */
12430 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
12431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
12432 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
12434 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP jack */
12435 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12436 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12447 static const struct alc_fixup alc262_fixups
[] = {
12448 [PINFIX_FSC_H270
] = {
12449 .pins
= (const struct alc_pincfg
[]) {
12450 { 0x14, 0x99130110 }, /* speaker */
12451 { 0x15, 0x0221142f }, /* front HP */
12452 { 0x1b, 0x0121141f }, /* rear HP */
12456 [PINFIX_PB_M5210
] = {
12457 .verbs
= (const struct hda_verb
[]) {
12458 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
12464 static struct snd_pci_quirk alc262_fixup_tbl
[] = {
12465 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270
),
12470 #ifdef CONFIG_SND_HDA_POWER_SAVE
12471 #define alc262_loopbacks alc880_loopbacks
12474 /* pcm configuration: identical with ALC880 */
12475 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12476 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12477 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12478 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12481 * BIOS auto configuration
12483 static int alc262_parse_auto_config(struct hda_codec
*codec
)
12485 struct alc_spec
*spec
= codec
->spec
;
12487 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
12489 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12493 if (!spec
->autocfg
.line_outs
) {
12494 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
12495 spec
->multiout
.max_channels
= 2;
12496 spec
->no_analog
= 1;
12499 return 0; /* can't find valid BIOS pin config */
12501 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12504 err
= alc262_auto_create_input_ctls(codec
, &spec
->autocfg
);
12508 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12511 alc_auto_parse_digital(codec
);
12513 if (spec
->kctls
.list
)
12514 add_mixer(spec
, spec
->kctls
.list
);
12516 add_verb(spec
, alc262_volume_init_verbs
);
12517 spec
->num_mux_defs
= 1;
12518 spec
->input_mux
= &spec
->private_imux
[0];
12520 err
= alc_auto_add_mic_boost(codec
);
12524 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
12529 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12530 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12531 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12532 #define alc262_auto_init_input_src alc882_auto_init_input_src
12535 /* init callback for auto-configuration model -- overriding the default init */
12536 static void alc262_auto_init(struct hda_codec
*codec
)
12538 struct alc_spec
*spec
= codec
->spec
;
12539 alc262_auto_init_multi_out(codec
);
12540 alc262_auto_init_hp_out(codec
);
12541 alc262_auto_init_analog_input(codec
);
12542 alc262_auto_init_input_src(codec
);
12543 alc_auto_init_digital(codec
);
12544 if (spec
->unsol_event
)
12545 alc_inithook(codec
);
12549 * configuration and preset
12551 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
12552 [ALC262_BASIC
] = "basic",
12553 [ALC262_HIPPO
] = "hippo",
12554 [ALC262_HIPPO_1
] = "hippo_1",
12555 [ALC262_FUJITSU
] = "fujitsu",
12556 [ALC262_HP_BPC
] = "hp-bpc",
12557 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
12558 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
12559 [ALC262_HP_RP5700
] = "hp-rp5700",
12560 [ALC262_BENQ_ED8
] = "benq",
12561 [ALC262_BENQ_T31
] = "benq-t31",
12562 [ALC262_SONY_ASSAMD
] = "sony-assamd",
12563 [ALC262_TOSHIBA_S06
] = "toshiba-s06",
12564 [ALC262_TOSHIBA_RX1
] = "toshiba-rx1",
12565 [ALC262_ULTRA
] = "ultra",
12566 [ALC262_LENOVO_3000
] = "lenovo-3000",
12567 [ALC262_NEC
] = "nec",
12568 [ALC262_TYAN
] = "tyan",
12569 [ALC262_AUTO
] = "auto",
12572 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
12573 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
12574 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
12575 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12577 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12579 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12581 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12582 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12583 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12584 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12585 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12586 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12587 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12588 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12589 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
12590 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
12591 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
12592 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12593 ALC262_HP_TC_T5735
),
12594 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
12595 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12596 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
12597 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12598 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO
), /* dig-only */
12599 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06
),
12600 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO
),
12601 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO
),
12602 #if 0 /* disable the quirk since model=auto works better in recent versions */
12603 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12604 ALC262_SONY_ASSAMD
),
12606 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12607 ALC262_TOSHIBA_RX1
),
12608 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06
),
12609 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
12610 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
12611 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN
),
12612 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12614 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO
),
12615 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
12616 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
12617 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
12618 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
12622 static struct alc_config_preset alc262_presets
[] = {
12624 .mixers
= { alc262_base_mixer
},
12625 .init_verbs
= { alc262_init_verbs
},
12626 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12627 .dac_nids
= alc262_dac_nids
,
12629 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12630 .channel_mode
= alc262_modes
,
12631 .input_mux
= &alc262_capture_source
,
12634 .mixers
= { alc262_hippo_mixer
},
12635 .init_verbs
= { alc262_init_verbs
, alc_hp15_unsol_verbs
},
12636 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12637 .dac_nids
= alc262_dac_nids
,
12639 .dig_out_nid
= ALC262_DIGOUT_NID
,
12640 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12641 .channel_mode
= alc262_modes
,
12642 .input_mux
= &alc262_capture_source
,
12643 .unsol_event
= alc262_hippo_unsol_event
,
12644 .setup
= alc262_hippo_setup
,
12645 .init_hook
= alc262_hippo_automute
,
12647 [ALC262_HIPPO_1
] = {
12648 .mixers
= { alc262_hippo1_mixer
},
12649 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
12650 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12651 .dac_nids
= alc262_dac_nids
,
12653 .dig_out_nid
= ALC262_DIGOUT_NID
,
12654 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12655 .channel_mode
= alc262_modes
,
12656 .input_mux
= &alc262_capture_source
,
12657 .unsol_event
= alc262_hippo_unsol_event
,
12658 .setup
= alc262_hippo1_setup
,
12659 .init_hook
= alc262_hippo_automute
,
12661 [ALC262_FUJITSU
] = {
12662 .mixers
= { alc262_fujitsu_mixer
},
12663 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12664 alc262_fujitsu_unsol_verbs
},
12665 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12666 .dac_nids
= alc262_dac_nids
,
12668 .dig_out_nid
= ALC262_DIGOUT_NID
,
12669 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12670 .channel_mode
= alc262_modes
,
12671 .input_mux
= &alc262_fujitsu_capture_source
,
12672 .unsol_event
= alc262_fujitsu_unsol_event
,
12673 .init_hook
= alc262_fujitsu_init_hook
,
12675 [ALC262_HP_BPC
] = {
12676 .mixers
= { alc262_HP_BPC_mixer
},
12677 .init_verbs
= { alc262_HP_BPC_init_verbs
},
12678 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12679 .dac_nids
= alc262_dac_nids
,
12681 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12682 .channel_mode
= alc262_modes
,
12683 .input_mux
= &alc262_HP_capture_source
,
12684 .unsol_event
= alc262_hp_bpc_unsol_event
,
12685 .init_hook
= alc262_hp_bpc_automute
,
12687 [ALC262_HP_BPC_D7000_WF
] = {
12688 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
12689 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12690 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12691 .dac_nids
= alc262_dac_nids
,
12693 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12694 .channel_mode
= alc262_modes
,
12695 .input_mux
= &alc262_HP_D7000_capture_source
,
12696 .unsol_event
= alc262_hp_wildwest_unsol_event
,
12697 .init_hook
= alc262_hp_wildwest_automute
,
12699 [ALC262_HP_BPC_D7000_WL
] = {
12700 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
12701 alc262_HP_BPC_WildWest_option_mixer
},
12702 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12703 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12704 .dac_nids
= alc262_dac_nids
,
12706 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12707 .channel_mode
= alc262_modes
,
12708 .input_mux
= &alc262_HP_D7000_capture_source
,
12709 .unsol_event
= alc262_hp_wildwest_unsol_event
,
12710 .init_hook
= alc262_hp_wildwest_automute
,
12712 [ALC262_HP_TC_T5735
] = {
12713 .mixers
= { alc262_hp_t5735_mixer
},
12714 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
12715 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12716 .dac_nids
= alc262_dac_nids
,
12718 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12719 .channel_mode
= alc262_modes
,
12720 .input_mux
= &alc262_capture_source
,
12721 .unsol_event
= alc_sku_unsol_event
,
12722 .setup
= alc262_hp_t5735_setup
,
12723 .init_hook
= alc_inithook
,
12725 [ALC262_HP_RP5700
] = {
12726 .mixers
= { alc262_hp_rp5700_mixer
},
12727 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
12728 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12729 .dac_nids
= alc262_dac_nids
,
12730 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12731 .channel_mode
= alc262_modes
,
12732 .input_mux
= &alc262_hp_rp5700_capture_source
,
12734 [ALC262_BENQ_ED8
] = {
12735 .mixers
= { alc262_base_mixer
},
12736 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
12737 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12738 .dac_nids
= alc262_dac_nids
,
12740 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12741 .channel_mode
= alc262_modes
,
12742 .input_mux
= &alc262_capture_source
,
12744 [ALC262_SONY_ASSAMD
] = {
12745 .mixers
= { alc262_sony_mixer
},
12746 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
12747 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12748 .dac_nids
= alc262_dac_nids
,
12750 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12751 .channel_mode
= alc262_modes
,
12752 .input_mux
= &alc262_capture_source
,
12753 .unsol_event
= alc262_hippo_unsol_event
,
12754 .setup
= alc262_hippo_setup
,
12755 .init_hook
= alc262_hippo_automute
,
12757 [ALC262_BENQ_T31
] = {
12758 .mixers
= { alc262_benq_t31_mixer
},
12759 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
,
12760 alc_hp15_unsol_verbs
},
12761 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12762 .dac_nids
= alc262_dac_nids
,
12764 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12765 .channel_mode
= alc262_modes
,
12766 .input_mux
= &alc262_capture_source
,
12767 .unsol_event
= alc262_hippo_unsol_event
,
12768 .setup
= alc262_hippo_setup
,
12769 .init_hook
= alc262_hippo_automute
,
12772 .mixers
= { alc262_ultra_mixer
},
12773 .cap_mixer
= alc262_ultra_capture_mixer
,
12774 .init_verbs
= { alc262_ultra_verbs
},
12775 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12776 .dac_nids
= alc262_dac_nids
,
12777 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12778 .channel_mode
= alc262_modes
,
12779 .input_mux
= &alc262_ultra_capture_source
,
12780 .adc_nids
= alc262_adc_nids
, /* ADC0 */
12781 .capsrc_nids
= alc262_capsrc_nids
,
12782 .num_adc_nids
= 1, /* single ADC */
12783 .unsol_event
= alc262_ultra_unsol_event
,
12784 .init_hook
= alc262_ultra_automute
,
12786 [ALC262_LENOVO_3000
] = {
12787 .mixers
= { alc262_lenovo_3000_mixer
},
12788 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12789 alc262_lenovo_3000_unsol_verbs
,
12790 alc262_lenovo_3000_init_verbs
},
12791 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12792 .dac_nids
= alc262_dac_nids
,
12794 .dig_out_nid
= ALC262_DIGOUT_NID
,
12795 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12796 .channel_mode
= alc262_modes
,
12797 .input_mux
= &alc262_fujitsu_capture_source
,
12798 .unsol_event
= alc262_lenovo_3000_unsol_event
,
12801 .mixers
= { alc262_nec_mixer
},
12802 .init_verbs
= { alc262_nec_verbs
},
12803 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12804 .dac_nids
= alc262_dac_nids
,
12806 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12807 .channel_mode
= alc262_modes
,
12808 .input_mux
= &alc262_capture_source
,
12810 [ALC262_TOSHIBA_S06
] = {
12811 .mixers
= { alc262_toshiba_s06_mixer
},
12812 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_s06_verbs
,
12813 alc262_eapd_verbs
},
12814 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12815 .capsrc_nids
= alc262_dmic_capsrc_nids
,
12816 .dac_nids
= alc262_dac_nids
,
12817 .adc_nids
= alc262_dmic_adc_nids
, /* ADC0 */
12818 .num_adc_nids
= 1, /* single ADC */
12819 .dig_out_nid
= ALC262_DIGOUT_NID
,
12820 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12821 .channel_mode
= alc262_modes
,
12822 .unsol_event
= alc_sku_unsol_event
,
12823 .setup
= alc262_toshiba_s06_setup
,
12824 .init_hook
= alc_inithook
,
12826 [ALC262_TOSHIBA_RX1
] = {
12827 .mixers
= { alc262_toshiba_rx1_mixer
},
12828 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_rx1_unsol_verbs
},
12829 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12830 .dac_nids
= alc262_dac_nids
,
12832 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12833 .channel_mode
= alc262_modes
,
12834 .input_mux
= &alc262_capture_source
,
12835 .unsol_event
= alc262_hippo_unsol_event
,
12836 .setup
= alc262_hippo_setup
,
12837 .init_hook
= alc262_hippo_automute
,
12840 .mixers
= { alc262_tyan_mixer
},
12841 .init_verbs
= { alc262_init_verbs
, alc262_tyan_verbs
},
12842 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12843 .dac_nids
= alc262_dac_nids
,
12845 .dig_out_nid
= ALC262_DIGOUT_NID
,
12846 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12847 .channel_mode
= alc262_modes
,
12848 .input_mux
= &alc262_capture_source
,
12849 .unsol_event
= alc_automute_amp_unsol_event
,
12850 .setup
= alc262_tyan_setup
,
12851 .init_hook
= alc_automute_amp
,
12855 static int patch_alc262(struct hda_codec
*codec
)
12857 struct alc_spec
*spec
;
12861 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12865 codec
->spec
= spec
;
12867 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12872 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
12873 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
12874 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
12875 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
12878 alc_auto_parse_customize_define(codec
);
12880 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
12882 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
12886 if (board_config
< 0) {
12887 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
12889 board_config
= ALC262_AUTO
;
12892 if (board_config
== ALC262_AUTO
)
12893 alc_pick_fixup(codec
, alc262_fixup_tbl
, alc262_fixups
, 1);
12895 if (board_config
== ALC262_AUTO
) {
12896 /* automatic parse from the BIOS config */
12897 err
= alc262_parse_auto_config(codec
);
12903 "hda_codec: Cannot set up configuration "
12904 "from BIOS. Using base mode...\n");
12905 board_config
= ALC262_BASIC
;
12909 if (!spec
->no_analog
&& has_cdefine_beep(codec
)) {
12910 err
= snd_hda_attach_beep_device(codec
, 0x1);
12917 if (board_config
!= ALC262_AUTO
)
12918 setup_preset(codec
, &alc262_presets
[board_config
]);
12920 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
12921 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
12923 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
12924 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
12926 if (!spec
->adc_nids
&& spec
->input_mux
) {
12928 /* check whether the digital-mic has to be supported */
12929 for (i
= 0; i
< spec
->input_mux
->num_items
; i
++) {
12930 if (spec
->input_mux
->items
[i
].index
>= 9)
12933 if (i
< spec
->input_mux
->num_items
) {
12934 /* use only ADC0 */
12935 spec
->adc_nids
= alc262_dmic_adc_nids
;
12936 spec
->num_adc_nids
= 1;
12937 spec
->capsrc_nids
= alc262_dmic_capsrc_nids
;
12939 /* all analog inputs */
12940 /* check whether NID 0x07 is valid */
12941 unsigned int wcap
= get_wcaps(codec
, 0x07);
12944 wcap
= get_wcaps_type(wcap
);
12945 if (wcap
!= AC_WID_AUD_IN
) {
12946 spec
->adc_nids
= alc262_adc_nids_alt
;
12947 spec
->num_adc_nids
=
12948 ARRAY_SIZE(alc262_adc_nids_alt
);
12949 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
12951 spec
->adc_nids
= alc262_adc_nids
;
12952 spec
->num_adc_nids
=
12953 ARRAY_SIZE(alc262_adc_nids
);
12954 spec
->capsrc_nids
= alc262_capsrc_nids
;
12958 if (!spec
->cap_mixer
&& !spec
->no_analog
)
12959 set_capture_mixer(codec
);
12960 if (!spec
->no_analog
&& has_cdefine_beep(codec
))
12961 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
12963 if (board_config
== ALC262_AUTO
)
12964 alc_pick_fixup(codec
, alc262_fixup_tbl
, alc262_fixups
, 0);
12966 spec
->vmaster_nid
= 0x0c;
12968 codec
->patch_ops
= alc_patch_ops
;
12969 if (board_config
== ALC262_AUTO
)
12970 spec
->init_hook
= alc262_auto_init
;
12972 alc_init_jacks(codec
);
12973 #ifdef CONFIG_SND_HDA_POWER_SAVE
12974 if (!spec
->loopback
.amplist
)
12975 spec
->loopback
.amplist
= alc262_loopbacks
;
12982 * ALC268 channel source setting (2 channel)
12984 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12985 #define alc268_modes alc260_modes
12987 static hda_nid_t alc268_dac_nids
[2] = {
12992 static hda_nid_t alc268_adc_nids
[2] = {
12997 static hda_nid_t alc268_adc_nids_alt
[1] = {
13002 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
13004 static struct snd_kcontrol_new alc268_base_mixer
[] = {
13005 /* output mixer control */
13006 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13007 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13008 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13010 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13011 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13012 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13016 static struct snd_kcontrol_new alc268_toshiba_mixer
[] = {
13017 /* output mixer control */
13018 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13019 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13020 ALC262_HIPPO_MASTER_SWITCH
,
13021 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13022 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13023 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13027 /* bind Beep switches of both NID 0x0f and 0x10 */
13028 static struct hda_bind_ctls alc268_bind_beep_sw
= {
13029 .ops
= &snd_hda_bind_sw
,
13031 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
13032 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
13037 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
13038 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
13039 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
13043 static struct hda_verb alc268_eapd_verbs
[] = {
13044 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13045 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13049 /* Toshiba specific */
13050 static struct hda_verb alc268_toshiba_verbs
[] = {
13051 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13055 /* Acer specific */
13056 /* bind volumes of both NID 0x02 and 0x03 */
13057 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
13058 .ops
= &snd_hda_bind_vol
,
13060 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
13061 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
13066 /* mute/unmute internal speaker according to the hp jack and mute state */
13067 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
13069 struct alc_spec
*spec
= codec
->spec
;
13072 if (force
|| !spec
->sense_updated
) {
13073 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x14);
13074 spec
->sense_updated
= 1;
13076 if (spec
->jack_present
)
13077 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
13078 else /* unmute internal speaker if necessary */
13079 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
13080 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
13081 HDA_AMP_MUTE
, mute
);
13085 /* bind hp and internal speaker mute (with plug check) */
13086 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
13087 struct snd_ctl_elem_value
*ucontrol
)
13089 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
13090 long *valp
= ucontrol
->value
.integer
.value
;
13093 change
= amp_stereo_mute_update(codec
, 0x14, HDA_OUTPUT
, 0, valp
);
13095 alc268_acer_automute(codec
, 0);
13099 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer
[] = {
13100 /* output mixer control */
13101 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13103 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13104 .name
= "Master Playback Switch",
13105 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
13106 .info
= snd_hda_mixer_amp_switch_info
,
13107 .get
= snd_hda_mixer_amp_switch_get
,
13108 .put
= alc268_acer_master_sw_put
,
13109 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
13111 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT
),
13115 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
13116 /* output mixer control */
13117 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13119 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13120 .name
= "Master Playback Switch",
13121 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
13122 .info
= snd_hda_mixer_amp_switch_info
,
13123 .get
= snd_hda_mixer_amp_switch_get
,
13124 .put
= alc268_acer_master_sw_put
,
13125 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
13127 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13128 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13129 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13133 static struct snd_kcontrol_new alc268_acer_dmic_mixer
[] = {
13134 /* output mixer control */
13135 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13137 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13138 .name
= "Master Playback Switch",
13139 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
13140 .info
= snd_hda_mixer_amp_switch_info
,
13141 .get
= snd_hda_mixer_amp_switch_get
,
13142 .put
= alc268_acer_master_sw_put
,
13143 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
13145 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13146 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13150 static struct hda_verb alc268_acer_aspire_one_verbs
[] = {
13151 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13153 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13154 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13155 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x06},
13156 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, 0xa017},
13160 static struct hda_verb alc268_acer_verbs
[] = {
13161 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
13162 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13165 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13166 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13167 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13171 /* unsolicited event for HP jack sensing */
13172 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13173 #define alc268_toshiba_setup alc262_hippo_setup
13174 #define alc268_toshiba_automute alc262_hippo_automute
13176 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
13179 if ((res
>> 26) != ALC880_HP_EVENT
)
13181 alc268_acer_automute(codec
, 1);
13184 static void alc268_acer_init_hook(struct hda_codec
*codec
)
13186 alc268_acer_automute(codec
, 1);
13189 /* toggle speaker-output according to the hp-jack state */
13190 static void alc268_aspire_one_speaker_automute(struct hda_codec
*codec
)
13192 unsigned int present
;
13193 unsigned char bits
;
13195 present
= snd_hda_jack_detect(codec
, 0x15);
13196 bits
= present
? HDA_AMP_MUTE
: 0;
13197 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 0,
13198 HDA_AMP_MUTE
, bits
);
13199 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 1,
13200 HDA_AMP_MUTE
, bits
);
13203 static void alc268_acer_lc_unsol_event(struct hda_codec
*codec
,
13206 switch (res
>> 26) {
13207 case ALC880_HP_EVENT
:
13208 alc268_aspire_one_speaker_automute(codec
);
13210 case ALC880_MIC_EVENT
:
13211 alc_mic_automute(codec
);
13216 static void alc268_acer_lc_setup(struct hda_codec
*codec
)
13218 struct alc_spec
*spec
= codec
->spec
;
13219 spec
->ext_mic
.pin
= 0x18;
13220 spec
->ext_mic
.mux_idx
= 0;
13221 spec
->int_mic
.pin
= 0x12;
13222 spec
->int_mic
.mux_idx
= 6;
13223 spec
->auto_mic
= 1;
13226 static void alc268_acer_lc_init_hook(struct hda_codec
*codec
)
13228 alc268_aspire_one_speaker_automute(codec
);
13229 alc_mic_automute(codec
);
13232 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
13233 /* output mixer control */
13234 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13235 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13236 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13237 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13238 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13239 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13243 static struct hda_verb alc268_dell_verbs
[] = {
13244 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13245 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13246 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13247 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
13251 /* mute/unmute internal speaker according to the hp jack and mute state */
13252 static void alc268_dell_setup(struct hda_codec
*codec
)
13254 struct alc_spec
*spec
= codec
->spec
;
13256 spec
->autocfg
.hp_pins
[0] = 0x15;
13257 spec
->autocfg
.speaker_pins
[0] = 0x14;
13258 spec
->ext_mic
.pin
= 0x18;
13259 spec
->ext_mic
.mux_idx
= 0;
13260 spec
->int_mic
.pin
= 0x19;
13261 spec
->int_mic
.mux_idx
= 1;
13262 spec
->auto_mic
= 1;
13265 static struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
13266 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13267 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13268 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13269 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13270 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13271 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
13272 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13273 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13277 static struct hda_verb alc267_quanta_il1_verbs
[] = {
13278 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13279 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
13283 static void alc267_quanta_il1_setup(struct hda_codec
*codec
)
13285 struct alc_spec
*spec
= codec
->spec
;
13286 spec
->autocfg
.hp_pins
[0] = 0x15;
13287 spec
->autocfg
.speaker_pins
[0] = 0x14;
13288 spec
->ext_mic
.pin
= 0x18;
13289 spec
->ext_mic
.mux_idx
= 0;
13290 spec
->int_mic
.pin
= 0x19;
13291 spec
->int_mic
.mux_idx
= 1;
13292 spec
->auto_mic
= 1;
13296 * generic initialization of ADC, input mixers and output mixers
13298 static struct hda_verb alc268_base_init_verbs
[] = {
13299 /* Unmute DAC0-1 and set vol = 0 */
13300 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13301 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13304 * Set up output mixers (0x0c - 0x0e)
13306 /* set vol=0 to output mixers */
13307 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13308 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
13310 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13311 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
13314 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
13315 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
13316 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13317 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13318 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13319 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13320 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13322 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13323 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13324 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13325 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13326 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13328 /* set PCBEEP vol = 0, mute connections */
13329 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13330 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13331 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13333 /* Unmute Selector 23h,24h and set the default input to mic-in */
13335 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
13336 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13337 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
13338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13344 * generic initialization of ADC, input mixers and output mixers
13346 static struct hda_verb alc268_volume_init_verbs
[] = {
13347 /* set output DAC */
13348 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13349 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13351 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13352 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13353 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13354 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13355 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13358 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13359 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13361 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13362 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13364 /* set PCBEEP vol = 0, mute connections */
13365 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13366 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13367 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13372 static struct snd_kcontrol_new alc268_capture_nosrc_mixer
[] = {
13373 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13374 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13378 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
13379 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13380 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13385 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
13386 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13387 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13388 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
13389 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
13394 static struct hda_input_mux alc268_capture_source
= {
13398 { "Front Mic", 0x1 },
13404 static struct hda_input_mux alc268_acer_capture_source
= {
13408 { "Internal Mic", 0x1 },
13413 static struct hda_input_mux alc268_acer_dmic_capture_source
= {
13417 { "Internal Mic", 0x6 },
13422 #ifdef CONFIG_SND_DEBUG
13423 static struct snd_kcontrol_new alc268_test_mixer
[] = {
13424 /* Volume widgets */
13425 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13426 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13427 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
13428 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
13429 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
13430 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
13431 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
13432 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
13433 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
13434 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
13435 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
13436 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
13437 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
13438 /* The below appears problematic on some hardwares */
13439 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13440 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13441 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
13442 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
13443 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
13445 /* Modes for retasking pin widgets */
13446 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
13447 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
13448 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
13449 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
13451 /* Controls for GPIO pins, assuming they are configured as outputs */
13452 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13453 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13454 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13455 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13457 /* Switches to allow the digital SPDIF output pin to be enabled.
13458 * The ALC268 does not have an SPDIF input.
13460 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13462 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13463 * this output to turn on an external amplifier.
13465 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13466 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13472 /* create input playback/capture controls for the given pin */
13473 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
13474 const char *ctlname
, int idx
)
13485 case 0x1a: /* ALC259/269 only */
13486 case 0x1b: /* ALC259/269 only */
13487 case 0x21: /* ALC269vb has this pin, too */
13491 snd_printd(KERN_WARNING
"hda_codec: "
13492 "ignoring pin 0x%x as unknown\n", nid
);
13495 if (spec
->multiout
.dac_nids
[0] != dac
&&
13496 spec
->multiout
.dac_nids
[1] != dac
) {
13497 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
13498 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
13502 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
13506 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13507 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
13509 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13510 HDA_COMPOSE_AMP_VAL(nid
, 2, idx
, HDA_OUTPUT
));
13516 /* add playback controls from the parsed DAC table */
13517 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13518 const struct auto_pin_cfg
*cfg
)
13523 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
13525 nid
= cfg
->line_out_pins
[0];
13528 if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
13532 err
= alc268_new_analog_output(spec
, nid
, name
, 0);
13537 nid
= cfg
->speaker_pins
[0];
13539 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, "Speaker",
13540 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
13544 err
= alc268_new_analog_output(spec
, nid
, "Speaker", 0);
13548 nid
= cfg
->hp_pins
[0];
13550 err
= alc268_new_analog_output(spec
, nid
, "Headphone", 0);
13555 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
13557 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, "Mono",
13558 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
));
13565 /* create playback/capture controls for input pins */
13566 static int alc268_auto_create_input_ctls(struct hda_codec
*codec
,
13567 const struct auto_pin_cfg
*cfg
)
13569 return alc_auto_create_input_ctls(codec
, cfg
, 0, 0x23, 0x24);
13572 static void alc268_auto_set_output_and_unmute(struct hda_codec
*codec
,
13573 hda_nid_t nid
, int pin_type
)
13577 alc_set_pin_output(codec
, nid
, pin_type
);
13578 if (nid
== 0x14 || nid
== 0x16)
13582 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
13585 static void alc268_auto_init_multi_out(struct hda_codec
*codec
)
13587 struct alc_spec
*spec
= codec
->spec
;
13590 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
13591 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13592 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13593 alc268_auto_set_output_and_unmute(codec
, nid
, pin_type
);
13597 static void alc268_auto_init_hp_out(struct hda_codec
*codec
)
13599 struct alc_spec
*spec
= codec
->spec
;
13603 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
13604 pin
= spec
->autocfg
.hp_pins
[i
];
13605 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
13607 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
13608 pin
= spec
->autocfg
.speaker_pins
[i
];
13609 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
13611 if (spec
->autocfg
.mono_out_pin
)
13612 snd_hda_codec_write(codec
, spec
->autocfg
.mono_out_pin
, 0,
13613 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13616 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
13618 struct alc_spec
*spec
= codec
->spec
;
13619 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
13620 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
13621 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
13622 unsigned int dac_vol1
, dac_vol2
;
13624 if (line_nid
== 0x1d || speaker_nid
== 0x1d) {
13625 snd_hda_codec_write(codec
, speaker_nid
, 0,
13626 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13627 /* mute mixer inputs from 0x1d */
13628 snd_hda_codec_write(codec
, 0x0f, 0,
13629 AC_VERB_SET_AMP_GAIN_MUTE
,
13631 snd_hda_codec_write(codec
, 0x10, 0,
13632 AC_VERB_SET_AMP_GAIN_MUTE
,
13635 /* unmute mixer inputs from 0x1d */
13636 snd_hda_codec_write(codec
, 0x0f, 0,
13637 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13638 snd_hda_codec_write(codec
, 0x10, 0,
13639 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13642 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
13643 if (line_nid
== 0x14)
13644 dac_vol2
= AMP_OUT_ZERO
;
13645 else if (line_nid
== 0x15)
13646 dac_vol1
= AMP_OUT_ZERO
;
13647 if (hp_nid
== 0x14)
13648 dac_vol2
= AMP_OUT_ZERO
;
13649 else if (hp_nid
== 0x15)
13650 dac_vol1
= AMP_OUT_ZERO
;
13651 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
13652 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
13653 spec
->autocfg
.line_out_pins
[2] != 0x16)
13654 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
13656 snd_hda_codec_write(codec
, 0x02, 0,
13657 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
13658 snd_hda_codec_write(codec
, 0x03, 0,
13659 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
13662 /* pcm configuration: identical with ALC880 */
13663 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13664 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13665 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13666 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13669 * BIOS auto configuration
13671 static int alc268_parse_auto_config(struct hda_codec
*codec
)
13673 struct alc_spec
*spec
= codec
->spec
;
13675 static hda_nid_t alc268_ignore
[] = { 0 };
13677 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13681 if (!spec
->autocfg
.line_outs
) {
13682 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
13683 spec
->multiout
.max_channels
= 2;
13684 spec
->no_analog
= 1;
13687 return 0; /* can't find valid BIOS pin config */
13689 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13692 err
= alc268_auto_create_input_ctls(codec
, &spec
->autocfg
);
13696 spec
->multiout
.max_channels
= 2;
13699 /* digital only support output */
13700 alc_auto_parse_digital(codec
);
13701 if (spec
->kctls
.list
)
13702 add_mixer(spec
, spec
->kctls
.list
);
13704 if (!spec
->no_analog
&& spec
->autocfg
.speaker_pins
[0] != 0x1d)
13705 add_mixer(spec
, alc268_beep_mixer
);
13707 add_verb(spec
, alc268_volume_init_verbs
);
13708 spec
->num_mux_defs
= 2;
13709 spec
->input_mux
= &spec
->private_imux
[0];
13711 err
= alc_auto_add_mic_boost(codec
);
13715 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
13720 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13722 /* init callback for auto-configuration model -- overriding the default init */
13723 static void alc268_auto_init(struct hda_codec
*codec
)
13725 struct alc_spec
*spec
= codec
->spec
;
13726 alc268_auto_init_multi_out(codec
);
13727 alc268_auto_init_hp_out(codec
);
13728 alc268_auto_init_mono_speaker_out(codec
);
13729 alc268_auto_init_analog_input(codec
);
13730 alc_auto_init_digital(codec
);
13731 if (spec
->unsol_event
)
13732 alc_inithook(codec
);
13736 * configuration and preset
13738 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
13739 [ALC267_QUANTA_IL1
] = "quanta-il1",
13740 [ALC268_3ST
] = "3stack",
13741 [ALC268_TOSHIBA
] = "toshiba",
13742 [ALC268_ACER
] = "acer",
13743 [ALC268_ACER_DMIC
] = "acer-dmic",
13744 [ALC268_ACER_ASPIRE_ONE
] = "acer-aspire",
13745 [ALC268_DELL
] = "dell",
13746 [ALC268_ZEPTO
] = "zepto",
13747 #ifdef CONFIG_SND_DEBUG
13748 [ALC268_TEST
] = "test",
13750 [ALC268_AUTO
] = "auto",
13753 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
13754 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
13755 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
13756 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
13757 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
13758 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
13759 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13760 ALC268_ACER_ASPIRE_ONE
),
13761 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
13762 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13763 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL
),
13764 /* almost compatible with toshiba but with optional digital outs;
13765 * auto-probing seems working fine
13767 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13769 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
13770 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
13771 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
13772 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
13773 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
13777 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13778 static struct snd_pci_quirk alc268_ssid_cfg_tbl
[] = {
13779 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO
),
13780 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO
),
13781 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13786 static struct alc_config_preset alc268_presets
[] = {
13787 [ALC267_QUANTA_IL1
] = {
13788 .mixers
= { alc267_quanta_il1_mixer
, alc268_beep_mixer
,
13789 alc268_capture_nosrc_mixer
},
13790 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13791 alc267_quanta_il1_verbs
},
13792 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13793 .dac_nids
= alc268_dac_nids
,
13794 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13795 .adc_nids
= alc268_adc_nids_alt
,
13797 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13798 .channel_mode
= alc268_modes
,
13799 .unsol_event
= alc_sku_unsol_event
,
13800 .setup
= alc267_quanta_il1_setup
,
13801 .init_hook
= alc_inithook
,
13804 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
13805 alc268_beep_mixer
},
13806 .init_verbs
= { alc268_base_init_verbs
},
13807 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13808 .dac_nids
= alc268_dac_nids
,
13809 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13810 .adc_nids
= alc268_adc_nids_alt
,
13811 .capsrc_nids
= alc268_capsrc_nids
,
13813 .dig_out_nid
= ALC268_DIGOUT_NID
,
13814 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13815 .channel_mode
= alc268_modes
,
13816 .input_mux
= &alc268_capture_source
,
13818 [ALC268_TOSHIBA
] = {
13819 .mixers
= { alc268_toshiba_mixer
, alc268_capture_alt_mixer
,
13820 alc268_beep_mixer
},
13821 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13822 alc268_toshiba_verbs
},
13823 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13824 .dac_nids
= alc268_dac_nids
,
13825 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13826 .adc_nids
= alc268_adc_nids_alt
,
13827 .capsrc_nids
= alc268_capsrc_nids
,
13829 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13830 .channel_mode
= alc268_modes
,
13831 .input_mux
= &alc268_capture_source
,
13832 .unsol_event
= alc268_toshiba_unsol_event
,
13833 .setup
= alc268_toshiba_setup
,
13834 .init_hook
= alc268_toshiba_automute
,
13837 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
13838 alc268_beep_mixer
},
13839 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13840 alc268_acer_verbs
},
13841 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13842 .dac_nids
= alc268_dac_nids
,
13843 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13844 .adc_nids
= alc268_adc_nids_alt
,
13845 .capsrc_nids
= alc268_capsrc_nids
,
13847 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13848 .channel_mode
= alc268_modes
,
13849 .input_mux
= &alc268_acer_capture_source
,
13850 .unsol_event
= alc268_acer_unsol_event
,
13851 .init_hook
= alc268_acer_init_hook
,
13853 [ALC268_ACER_DMIC
] = {
13854 .mixers
= { alc268_acer_dmic_mixer
, alc268_capture_alt_mixer
,
13855 alc268_beep_mixer
},
13856 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13857 alc268_acer_verbs
},
13858 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13859 .dac_nids
= alc268_dac_nids
,
13860 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13861 .adc_nids
= alc268_adc_nids_alt
,
13862 .capsrc_nids
= alc268_capsrc_nids
,
13864 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13865 .channel_mode
= alc268_modes
,
13866 .input_mux
= &alc268_acer_dmic_capture_source
,
13867 .unsol_event
= alc268_acer_unsol_event
,
13868 .init_hook
= alc268_acer_init_hook
,
13870 [ALC268_ACER_ASPIRE_ONE
] = {
13871 .mixers
= { alc268_acer_aspire_one_mixer
,
13873 alc268_capture_nosrc_mixer
},
13874 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13875 alc268_acer_aspire_one_verbs
},
13876 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13877 .dac_nids
= alc268_dac_nids
,
13878 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13879 .adc_nids
= alc268_adc_nids_alt
,
13880 .capsrc_nids
= alc268_capsrc_nids
,
13882 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13883 .channel_mode
= alc268_modes
,
13884 .unsol_event
= alc268_acer_lc_unsol_event
,
13885 .setup
= alc268_acer_lc_setup
,
13886 .init_hook
= alc268_acer_lc_init_hook
,
13889 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
,
13890 alc268_capture_nosrc_mixer
},
13891 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13892 alc268_dell_verbs
},
13893 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13894 .dac_nids
= alc268_dac_nids
,
13895 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13896 .adc_nids
= alc268_adc_nids_alt
,
13897 .capsrc_nids
= alc268_capsrc_nids
,
13899 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13900 .channel_mode
= alc268_modes
,
13901 .unsol_event
= alc_sku_unsol_event
,
13902 .setup
= alc268_dell_setup
,
13903 .init_hook
= alc_inithook
,
13906 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
13907 alc268_beep_mixer
},
13908 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13909 alc268_toshiba_verbs
},
13910 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13911 .dac_nids
= alc268_dac_nids
,
13912 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13913 .adc_nids
= alc268_adc_nids_alt
,
13914 .capsrc_nids
= alc268_capsrc_nids
,
13916 .dig_out_nid
= ALC268_DIGOUT_NID
,
13917 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13918 .channel_mode
= alc268_modes
,
13919 .input_mux
= &alc268_capture_source
,
13920 .setup
= alc268_toshiba_setup
,
13921 .init_hook
= alc268_toshiba_automute
,
13923 #ifdef CONFIG_SND_DEBUG
13925 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
13926 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13927 alc268_volume_init_verbs
},
13928 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13929 .dac_nids
= alc268_dac_nids
,
13930 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13931 .adc_nids
= alc268_adc_nids_alt
,
13932 .capsrc_nids
= alc268_capsrc_nids
,
13934 .dig_out_nid
= ALC268_DIGOUT_NID
,
13935 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13936 .channel_mode
= alc268_modes
,
13937 .input_mux
= &alc268_capture_source
,
13942 static int patch_alc268(struct hda_codec
*codec
)
13944 struct alc_spec
*spec
;
13946 int i
, has_beep
, err
;
13948 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13952 codec
->spec
= spec
;
13954 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
13958 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
)
13959 board_config
= snd_hda_check_board_codec_sid_config(codec
,
13960 ALC268_MODEL_LAST
, alc268_models
, alc268_ssid_cfg_tbl
);
13962 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
13963 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
13965 board_config
= ALC268_AUTO
;
13968 if (board_config
== ALC268_AUTO
) {
13969 /* automatic parse from the BIOS config */
13970 err
= alc268_parse_auto_config(codec
);
13976 "hda_codec: Cannot set up configuration "
13977 "from BIOS. Using base mode...\n");
13978 board_config
= ALC268_3ST
;
13982 if (board_config
!= ALC268_AUTO
)
13983 setup_preset(codec
, &alc268_presets
[board_config
]);
13985 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
13986 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
13987 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
13989 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
13992 for (i
= 0; i
< spec
->num_mixers
; i
++) {
13993 if (spec
->mixers
[i
] == alc268_beep_mixer
) {
14000 err
= snd_hda_attach_beep_device(codec
, 0x1);
14005 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
14006 /* override the amp caps for beep generator */
14007 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
14008 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
14009 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
14010 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
14011 (0 << AC_AMPCAP_MUTE_SHIFT
));
14014 if (!spec
->no_analog
&& !spec
->adc_nids
&& spec
->input_mux
) {
14015 /* check whether NID 0x07 is valid */
14016 unsigned int wcap
= get_wcaps(codec
, 0x07);
14019 spec
->capsrc_nids
= alc268_capsrc_nids
;
14021 wcap
= get_wcaps_type(wcap
);
14022 if (spec
->auto_mic
||
14023 wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
14024 spec
->adc_nids
= alc268_adc_nids_alt
;
14025 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
14026 if (spec
->auto_mic
)
14027 fixup_automic_adc(codec
);
14028 if (spec
->auto_mic
|| spec
->input_mux
->num_items
== 1)
14029 add_mixer(spec
, alc268_capture_nosrc_mixer
);
14031 add_mixer(spec
, alc268_capture_alt_mixer
);
14033 spec
->adc_nids
= alc268_adc_nids
;
14034 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
14035 add_mixer(spec
, alc268_capture_mixer
);
14037 /* set default input source */
14038 for (i
= 0; i
< spec
->num_adc_nids
; i
++)
14039 snd_hda_codec_write_cache(codec
, alc268_capsrc_nids
[i
],
14040 0, AC_VERB_SET_CONNECT_SEL
,
14041 i
< spec
->num_mux_defs
?
14042 spec
->input_mux
[i
].items
[0].index
:
14043 spec
->input_mux
->items
[0].index
);
14046 spec
->vmaster_nid
= 0x02;
14048 codec
->patch_ops
= alc_patch_ops
;
14049 if (board_config
== ALC268_AUTO
)
14050 spec
->init_hook
= alc268_auto_init
;
14052 alc_init_jacks(codec
);
14058 * ALC269 channel source setting (2 channel)
14060 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14062 #define alc269_dac_nids alc260_dac_nids
14064 static hda_nid_t alc269_adc_nids
[1] = {
14069 static hda_nid_t alc269_capsrc_nids
[1] = {
14073 static hda_nid_t alc269vb_adc_nids
[1] = {
14078 static hda_nid_t alc269vb_capsrc_nids
[1] = {
14082 static hda_nid_t alc269_adc_candidates
[] = {
14086 #define alc269_modes alc260_modes
14087 #define alc269_capture_source alc880_lg_lw_capture_source
14089 static struct snd_kcontrol_new alc269_base_mixer
[] = {
14090 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14091 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14092 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14093 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14096 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14097 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14098 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14099 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14100 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14101 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
14105 static struct snd_kcontrol_new alc269_quanta_fl1_mixer
[] = {
14106 /* output mixer control */
14107 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
14109 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14110 .name
= "Master Playback Switch",
14111 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
14112 .info
= snd_hda_mixer_amp_switch_info
,
14113 .get
= snd_hda_mixer_amp_switch_get
,
14114 .put
= alc268_acer_master_sw_put
,
14115 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14118 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14119 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14120 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14121 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14122 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14126 static struct snd_kcontrol_new alc269_lifebook_mixer
[] = {
14127 /* output mixer control */
14128 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
14130 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14131 .name
= "Master Playback Switch",
14132 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
14133 .info
= snd_hda_mixer_amp_switch_info
,
14134 .get
= snd_hda_mixer_amp_switch_get
,
14135 .put
= alc268_acer_master_sw_put
,
14136 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14139 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14140 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14141 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14142 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14143 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14144 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT
),
14145 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT
),
14146 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT
),
14150 static struct snd_kcontrol_new alc269_laptop_mixer
[] = {
14151 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14152 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14153 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14154 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14158 static struct snd_kcontrol_new alc269vb_laptop_mixer
[] = {
14159 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14160 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14161 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
14162 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14166 static struct snd_kcontrol_new alc269_asus_mixer
[] = {
14167 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14168 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT
),
14172 /* capture mixer elements */
14173 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer
[] = {
14174 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
14175 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
14176 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14177 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14181 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer
[] = {
14182 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
14183 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
14184 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14188 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer
[] = {
14189 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
14190 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
14191 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14192 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14196 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer
[] = {
14197 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
14198 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
14199 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14204 #define alc269_fujitsu_mixer alc269_laptop_mixer
14206 static struct hda_verb alc269_quanta_fl1_verbs
[] = {
14207 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14208 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14210 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14211 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14212 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14216 static struct hda_verb alc269_lifebook_verbs
[] = {
14217 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14218 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
14219 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14221 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14222 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14223 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14224 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14225 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14226 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14230 /* toggle speaker-output according to the hp-jack state */
14231 static void alc269_quanta_fl1_speaker_automute(struct hda_codec
*codec
)
14233 unsigned int present
;
14234 unsigned char bits
;
14236 present
= snd_hda_jack_detect(codec
, 0x15);
14237 bits
= present
? HDA_AMP_MUTE
: 0;
14238 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
14239 HDA_AMP_MUTE
, bits
);
14240 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
14241 HDA_AMP_MUTE
, bits
);
14243 snd_hda_codec_write(codec
, 0x20, 0,
14244 AC_VERB_SET_COEF_INDEX
, 0x0c);
14245 snd_hda_codec_write(codec
, 0x20, 0,
14246 AC_VERB_SET_PROC_COEF
, 0x680);
14248 snd_hda_codec_write(codec
, 0x20, 0,
14249 AC_VERB_SET_COEF_INDEX
, 0x0c);
14250 snd_hda_codec_write(codec
, 0x20, 0,
14251 AC_VERB_SET_PROC_COEF
, 0x480);
14254 /* toggle speaker-output according to the hp-jacks state */
14255 static void alc269_lifebook_speaker_automute(struct hda_codec
*codec
)
14257 unsigned int present
;
14258 unsigned char bits
;
14260 /* Check laptop headphone socket */
14261 present
= snd_hda_jack_detect(codec
, 0x15);
14263 /* Check port replicator headphone socket */
14264 present
|= snd_hda_jack_detect(codec
, 0x1a);
14266 bits
= present
? HDA_AMP_MUTE
: 0;
14267 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
14268 HDA_AMP_MUTE
, bits
);
14269 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
14270 HDA_AMP_MUTE
, bits
);
14272 snd_hda_codec_write(codec
, 0x20, 0,
14273 AC_VERB_SET_COEF_INDEX
, 0x0c);
14274 snd_hda_codec_write(codec
, 0x20, 0,
14275 AC_VERB_SET_PROC_COEF
, 0x680);
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
, 0x480);
14283 static void alc269_lifebook_mic_autoswitch(struct hda_codec
*codec
)
14285 unsigned int present_laptop
;
14286 unsigned int present_dock
;
14288 present_laptop
= snd_hda_jack_detect(codec
, 0x18);
14289 present_dock
= snd_hda_jack_detect(codec
, 0x1b);
14291 /* Laptop mic port overrides dock mic port, design decision */
14293 snd_hda_codec_write(codec
, 0x23, 0,
14294 AC_VERB_SET_CONNECT_SEL
, 0x3);
14295 if (present_laptop
)
14296 snd_hda_codec_write(codec
, 0x23, 0,
14297 AC_VERB_SET_CONNECT_SEL
, 0x0);
14298 if (!present_dock
&& !present_laptop
)
14299 snd_hda_codec_write(codec
, 0x23, 0,
14300 AC_VERB_SET_CONNECT_SEL
, 0x1);
14303 static void alc269_quanta_fl1_unsol_event(struct hda_codec
*codec
,
14306 switch (res
>> 26) {
14307 case ALC880_HP_EVENT
:
14308 alc269_quanta_fl1_speaker_automute(codec
);
14310 case ALC880_MIC_EVENT
:
14311 alc_mic_automute(codec
);
14316 static void alc269_lifebook_unsol_event(struct hda_codec
*codec
,
14319 if ((res
>> 26) == ALC880_HP_EVENT
)
14320 alc269_lifebook_speaker_automute(codec
);
14321 if ((res
>> 26) == ALC880_MIC_EVENT
)
14322 alc269_lifebook_mic_autoswitch(codec
);
14325 static void alc269_quanta_fl1_setup(struct hda_codec
*codec
)
14327 struct alc_spec
*spec
= codec
->spec
;
14328 spec
->autocfg
.hp_pins
[0] = 0x15;
14329 spec
->autocfg
.speaker_pins
[0] = 0x14;
14330 spec
->ext_mic
.pin
= 0x18;
14331 spec
->ext_mic
.mux_idx
= 0;
14332 spec
->int_mic
.pin
= 0x19;
14333 spec
->int_mic
.mux_idx
= 1;
14334 spec
->auto_mic
= 1;
14337 static void alc269_quanta_fl1_init_hook(struct hda_codec
*codec
)
14339 alc269_quanta_fl1_speaker_automute(codec
);
14340 alc_mic_automute(codec
);
14343 static void alc269_lifebook_init_hook(struct hda_codec
*codec
)
14345 alc269_lifebook_speaker_automute(codec
);
14346 alc269_lifebook_mic_autoswitch(codec
);
14349 static struct hda_verb alc269_laptop_dmic_init_verbs
[] = {
14350 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14351 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
14352 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14353 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14354 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14355 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14356 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14360 static struct hda_verb alc269_laptop_amic_init_verbs
[] = {
14361 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14362 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
14363 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14364 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
14365 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14366 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14370 static struct hda_verb alc269vb_laptop_dmic_init_verbs
[] = {
14371 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
14372 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x06},
14373 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14375 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14376 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14377 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14381 static struct hda_verb alc269vb_laptop_amic_init_verbs
[] = {
14382 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
14383 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x01},
14384 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14385 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14386 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14387 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14388 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14392 static struct hda_verb alc271_acer_dmic_verbs
[] = {
14393 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0d},
14394 {0x20, AC_VERB_SET_PROC_COEF
, 0x4000},
14395 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14396 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14397 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14398 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14399 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00},
14400 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14401 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14402 {0x22, AC_VERB_SET_CONNECT_SEL
, 6},
14406 /* toggle speaker-output according to the hp-jack state */
14407 static void alc269_speaker_automute(struct hda_codec
*codec
)
14409 struct alc_spec
*spec
= codec
->spec
;
14410 unsigned int nid
= spec
->autocfg
.hp_pins
[0];
14411 unsigned int present
;
14412 unsigned char bits
;
14414 present
= snd_hda_jack_detect(codec
, nid
);
14415 bits
= present
? HDA_AMP_MUTE
: 0;
14416 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
14417 HDA_AMP_MUTE
, bits
);
14418 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
14419 HDA_AMP_MUTE
, bits
);
14420 alc_report_jack(codec
, nid
);
14423 /* unsolicited event for HP jack sensing */
14424 static void alc269_laptop_unsol_event(struct hda_codec
*codec
,
14427 switch (res
>> 26) {
14428 case ALC880_HP_EVENT
:
14429 alc269_speaker_automute(codec
);
14431 case ALC880_MIC_EVENT
:
14432 alc_mic_automute(codec
);
14437 static void alc269_laptop_amic_setup(struct hda_codec
*codec
)
14439 struct alc_spec
*spec
= codec
->spec
;
14440 spec
->autocfg
.hp_pins
[0] = 0x15;
14441 spec
->autocfg
.speaker_pins
[0] = 0x14;
14442 spec
->ext_mic
.pin
= 0x18;
14443 spec
->ext_mic
.mux_idx
= 0;
14444 spec
->int_mic
.pin
= 0x19;
14445 spec
->int_mic
.mux_idx
= 1;
14446 spec
->auto_mic
= 1;
14449 static void alc269_laptop_dmic_setup(struct hda_codec
*codec
)
14451 struct alc_spec
*spec
= codec
->spec
;
14452 spec
->autocfg
.hp_pins
[0] = 0x15;
14453 spec
->autocfg
.speaker_pins
[0] = 0x14;
14454 spec
->ext_mic
.pin
= 0x18;
14455 spec
->ext_mic
.mux_idx
= 0;
14456 spec
->int_mic
.pin
= 0x12;
14457 spec
->int_mic
.mux_idx
= 5;
14458 spec
->auto_mic
= 1;
14461 static void alc269vb_laptop_amic_setup(struct hda_codec
*codec
)
14463 struct alc_spec
*spec
= codec
->spec
;
14464 spec
->autocfg
.hp_pins
[0] = 0x21;
14465 spec
->autocfg
.speaker_pins
[0] = 0x14;
14466 spec
->ext_mic
.pin
= 0x18;
14467 spec
->ext_mic
.mux_idx
= 0;
14468 spec
->int_mic
.pin
= 0x19;
14469 spec
->int_mic
.mux_idx
= 1;
14470 spec
->auto_mic
= 1;
14473 static void alc269vb_laptop_dmic_setup(struct hda_codec
*codec
)
14475 struct alc_spec
*spec
= codec
->spec
;
14476 spec
->autocfg
.hp_pins
[0] = 0x21;
14477 spec
->autocfg
.speaker_pins
[0] = 0x14;
14478 spec
->ext_mic
.pin
= 0x18;
14479 spec
->ext_mic
.mux_idx
= 0;
14480 spec
->int_mic
.pin
= 0x12;
14481 spec
->int_mic
.mux_idx
= 6;
14482 spec
->auto_mic
= 1;
14485 static void alc269_laptop_inithook(struct hda_codec
*codec
)
14487 alc269_speaker_automute(codec
);
14488 alc_mic_automute(codec
);
14492 * generic initialization of ADC, input mixers and output mixers
14494 static struct hda_verb alc269_init_verbs
[] = {
14496 * Unmute ADC0 and set the default input to mic-in
14498 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14501 * Set up output mixers (0x02 - 0x03)
14503 /* set vol=0 to output mixers */
14504 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14505 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14507 /* set up input amps for analog loopback */
14508 /* Amp Indices: DAC = 0, mixer = 1 */
14509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14511 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14514 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14516 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14518 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14519 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14520 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14521 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14522 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14524 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14525 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14527 /* FIXME: use Mux-type input source selection */
14528 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14529 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14530 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
14533 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14537 static struct hda_verb alc269vb_init_verbs
[] = {
14539 * Unmute ADC0 and set the default input to mic-in
14541 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14544 * Set up output mixers (0x02 - 0x03)
14546 /* set vol=0 to output mixers */
14547 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14548 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14550 /* set up input amps for analog loopback */
14551 /* Amp Indices: DAC = 0, mixer = 1 */
14552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14554 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14555 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14556 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14557 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14559 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14560 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14561 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14562 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14563 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14564 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14565 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14567 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14568 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14570 /* FIXME: use Mux-type input source selection */
14571 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14572 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14573 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x00},
14576 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14580 #define alc269_auto_create_multi_out_ctls \
14581 alc268_auto_create_multi_out_ctls
14582 #define alc269_auto_create_input_ctls \
14583 alc268_auto_create_input_ctls
14585 #ifdef CONFIG_SND_HDA_POWER_SAVE
14586 #define alc269_loopbacks alc880_loopbacks
14589 /* pcm configuration: identical with ALC880 */
14590 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14591 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14592 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14593 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14595 static struct hda_pcm_stream alc269_44k_pcm_analog_playback
= {
14599 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14600 /* NID is set in alc_build_pcms */
14602 .open
= alc880_playback_pcm_open
,
14603 .prepare
= alc880_playback_pcm_prepare
,
14604 .cleanup
= alc880_playback_pcm_cleanup
14608 static struct hda_pcm_stream alc269_44k_pcm_analog_capture
= {
14612 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14613 /* NID is set in alc_build_pcms */
14616 #ifdef CONFIG_SND_HDA_POWER_SAVE
14617 static int alc269_mic2_for_mute_led(struct hda_codec
*codec
)
14619 switch (codec
->subsystem_id
) {
14626 static int alc269_mic2_mute_check_ps(struct hda_codec
*codec
, hda_nid_t nid
)
14628 /* update mute-LED according to the speaker mute state */
14629 if (nid
== 0x01 || nid
== 0x14) {
14631 if (snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0) &
14636 /* mic2 vref pin is used for mute LED control */
14637 snd_hda_codec_update_cache(codec
, 0x19, 0,
14638 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14641 return alc_check_power_status(codec
, nid
);
14643 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14645 static int alc275_setup_dual_adc(struct hda_codec
*codec
)
14647 struct alc_spec
*spec
= codec
->spec
;
14649 if (codec
->vendor_id
!= 0x10ec0275 || !spec
->auto_mic
)
14651 if ((spec
->ext_mic
.pin
>= 0x18 && spec
->int_mic
.pin
<= 0x13) ||
14652 (spec
->ext_mic
.pin
<= 0x12 && spec
->int_mic
.pin
>= 0x18)) {
14653 if (spec
->ext_mic
.pin
<= 0x12) {
14654 spec
->private_adc_nids
[0] = 0x08;
14655 spec
->private_adc_nids
[1] = 0x11;
14656 spec
->private_capsrc_nids
[0] = 0x23;
14657 spec
->private_capsrc_nids
[1] = 0x22;
14659 spec
->private_adc_nids
[0] = 0x11;
14660 spec
->private_adc_nids
[1] = 0x08;
14661 spec
->private_capsrc_nids
[0] = 0x22;
14662 spec
->private_capsrc_nids
[1] = 0x23;
14664 spec
->adc_nids
= spec
->private_adc_nids
;
14665 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
14666 spec
->num_adc_nids
= 2;
14667 spec
->dual_adc_switch
= 1;
14668 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14669 spec
->adc_nids
[0], spec
->adc_nids
[1]);
14675 /* different alc269-variants */
14677 ALC269_TYPE_NORMAL
,
14678 ALC269_TYPE_ALC258
,
14679 ALC269_TYPE_ALC259
,
14680 ALC269_TYPE_ALC269VB
,
14681 ALC269_TYPE_ALC270
,
14682 ALC269_TYPE_ALC271X
,
14686 * BIOS auto configuration
14688 static int alc269_parse_auto_config(struct hda_codec
*codec
)
14690 struct alc_spec
*spec
= codec
->spec
;
14692 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
14694 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14699 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14702 if (spec
->codec_variant
== ALC269_TYPE_NORMAL
)
14703 err
= alc269_auto_create_input_ctls(codec
, &spec
->autocfg
);
14705 err
= alc_auto_create_input_ctls(codec
, &spec
->autocfg
, 0,
14710 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14712 alc_auto_parse_digital(codec
);
14714 if (spec
->kctls
.list
)
14715 add_mixer(spec
, spec
->kctls
.list
);
14717 if (spec
->codec_variant
!= ALC269_TYPE_NORMAL
) {
14718 add_verb(spec
, alc269vb_init_verbs
);
14719 alc_ssid_check(codec
, 0, 0x1b, 0x14, 0x21);
14721 add_verb(spec
, alc269_init_verbs
);
14722 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
14725 spec
->num_mux_defs
= 1;
14726 spec
->input_mux
= &spec
->private_imux
[0];
14728 if (!alc275_setup_dual_adc(codec
))
14729 fillup_priv_adc_nids(codec
, alc269_adc_candidates
,
14730 sizeof(alc269_adc_candidates
));
14732 /* set default input source */
14733 if (!spec
->dual_adc_switch
)
14734 select_or_unmute_capsrc(codec
, spec
->capsrc_nids
[0],
14735 spec
->input_mux
->items
[0].index
);
14737 err
= alc_auto_add_mic_boost(codec
);
14741 if (!spec
->cap_mixer
&& !spec
->no_analog
)
14742 set_capture_mixer(codec
);
14747 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14748 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14749 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14752 /* init callback for auto-configuration model -- overriding the default init */
14753 static void alc269_auto_init(struct hda_codec
*codec
)
14755 struct alc_spec
*spec
= codec
->spec
;
14756 alc269_auto_init_multi_out(codec
);
14757 alc269_auto_init_hp_out(codec
);
14758 alc269_auto_init_analog_input(codec
);
14759 alc_auto_init_digital(codec
);
14760 if (spec
->unsol_event
)
14761 alc_inithook(codec
);
14764 #ifdef SND_HDA_NEEDS_RESUME
14765 static void alc269_toggle_power_output(struct hda_codec
*codec
, int power_up
)
14767 int val
= alc_read_coef_idx(codec
, 0x04);
14772 alc_write_coef_idx(codec
, 0x04, val
);
14775 #ifdef CONFIG_SND_HDA_POWER_SAVE
14776 static int alc269_suspend(struct hda_codec
*codec
, pm_message_t state
)
14778 struct alc_spec
*spec
= codec
->spec
;
14780 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017)
14781 alc269_toggle_power_output(codec
, 0);
14782 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14783 alc269_toggle_power_output(codec
, 0);
14788 if (spec
&& spec
->power_hook
)
14789 spec
->power_hook(codec
);
14792 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14794 static int alc269_resume(struct hda_codec
*codec
)
14796 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14797 alc269_toggle_power_output(codec
, 0);
14801 codec
->patch_ops
.init(codec
);
14803 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017) {
14804 alc269_toggle_power_output(codec
, 1);
14808 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018)
14809 alc269_toggle_power_output(codec
, 1);
14811 snd_hda_codec_resume_amp(codec
);
14812 snd_hda_codec_resume_cache(codec
);
14813 hda_call_check_power_status(codec
, 0x01);
14816 #endif /* SND_HDA_NEEDS_RESUME */
14819 ALC269_FIXUP_SONY_VAIO
,
14820 ALC275_FIX_SONY_VAIO_GPIO2
,
14821 ALC269_FIXUP_DELL_M101Z
,
14822 ALC269_FIXUP_SKU_IGNORE
,
14823 ALC269_FIXUP_ASUS_G73JW
,
14824 ALC269_FIXUP_LENOVO_EAPD
,
14827 static const struct alc_fixup alc269_fixups
[] = {
14828 [ALC269_FIXUP_SONY_VAIO
] = {
14829 .verbs
= (const struct hda_verb
[]) {
14830 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREFGRD
},
14834 [ALC275_FIX_SONY_VAIO_GPIO2
] = {
14835 .verbs
= (const struct hda_verb
[]) {
14836 {0x01, AC_VERB_SET_GPIO_MASK
, 0x04},
14837 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x04},
14838 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
14842 [ALC269_FIXUP_DELL_M101Z
] = {
14843 .verbs
= (const struct hda_verb
[]) {
14844 /* Enables internal speaker */
14845 {0x20, AC_VERB_SET_COEF_INDEX
, 13},
14846 {0x20, AC_VERB_SET_PROC_COEF
, 0x4040},
14850 [ALC269_FIXUP_SKU_IGNORE
] = {
14851 .sku
= ALC_FIXUP_SKU_IGNORE
,
14853 [ALC269_FIXUP_ASUS_G73JW
] = {
14854 .pins
= (const struct alc_pincfg
[]) {
14855 { 0x17, 0x99130111 }, /* subwoofer */
14859 [ALC269_FIXUP_LENOVO_EAPD
] = {
14860 .verbs
= (const struct hda_verb
[]) {
14861 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
14867 static struct snd_pci_quirk alc269_fixup_tbl
[] = {
14868 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2
),
14869 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2
),
14870 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2
),
14871 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO
),
14872 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z
),
14873 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE
),
14874 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE
),
14875 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW
),
14876 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD
),
14882 * configuration and preset
14884 static const char *alc269_models
[ALC269_MODEL_LAST
] = {
14885 [ALC269_BASIC
] = "basic",
14886 [ALC269_QUANTA_FL1
] = "quanta",
14887 [ALC269_AMIC
] = "laptop-amic",
14888 [ALC269_DMIC
] = "laptop-dmic",
14889 [ALC269_FUJITSU
] = "fujitsu",
14890 [ALC269_LIFEBOOK
] = "lifebook",
14891 [ALC269_AUTO
] = "auto",
14894 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
14895 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1
),
14896 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER
),
14897 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14899 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC
),
14900 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC
),
14901 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC
),
14902 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC
),
14903 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC
),
14904 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC
),
14905 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC
),
14906 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC
),
14907 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC
),
14908 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC
),
14909 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC
),
14910 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC
),
14911 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC
),
14912 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC
),
14913 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC
),
14914 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC
),
14915 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC
),
14916 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC
),
14917 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC
),
14918 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC
),
14919 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC
),
14920 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC
),
14921 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC
),
14922 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC
),
14923 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC
),
14924 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC
),
14925 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC
),
14926 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC
),
14927 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC
),
14928 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC
),
14929 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC
),
14930 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC
),
14931 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC
),
14932 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC
),
14933 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC
),
14934 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC
),
14935 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14937 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14939 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC
),
14940 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC
),
14941 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO
),
14942 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK
),
14943 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC
),
14944 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU
),
14945 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC
),
14946 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC
),
14947 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC
),
14948 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC
),
14952 static struct alc_config_preset alc269_presets
[] = {
14954 .mixers
= { alc269_base_mixer
},
14955 .init_verbs
= { alc269_init_verbs
},
14956 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14957 .dac_nids
= alc269_dac_nids
,
14959 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14960 .channel_mode
= alc269_modes
,
14961 .input_mux
= &alc269_capture_source
,
14963 [ALC269_QUANTA_FL1
] = {
14964 .mixers
= { alc269_quanta_fl1_mixer
},
14965 .init_verbs
= { alc269_init_verbs
, alc269_quanta_fl1_verbs
},
14966 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14967 .dac_nids
= alc269_dac_nids
,
14969 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14970 .channel_mode
= alc269_modes
,
14971 .input_mux
= &alc269_capture_source
,
14972 .unsol_event
= alc269_quanta_fl1_unsol_event
,
14973 .setup
= alc269_quanta_fl1_setup
,
14974 .init_hook
= alc269_quanta_fl1_init_hook
,
14977 .mixers
= { alc269_laptop_mixer
},
14978 .cap_mixer
= alc269_laptop_analog_capture_mixer
,
14979 .init_verbs
= { alc269_init_verbs
,
14980 alc269_laptop_amic_init_verbs
},
14981 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14982 .dac_nids
= alc269_dac_nids
,
14984 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14985 .channel_mode
= alc269_modes
,
14986 .unsol_event
= alc269_laptop_unsol_event
,
14987 .setup
= alc269_laptop_amic_setup
,
14988 .init_hook
= alc269_laptop_inithook
,
14991 .mixers
= { alc269_laptop_mixer
},
14992 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
14993 .init_verbs
= { alc269_init_verbs
,
14994 alc269_laptop_dmic_init_verbs
},
14995 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14996 .dac_nids
= alc269_dac_nids
,
14998 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14999 .channel_mode
= alc269_modes
,
15000 .unsol_event
= alc269_laptop_unsol_event
,
15001 .setup
= alc269_laptop_dmic_setup
,
15002 .init_hook
= alc269_laptop_inithook
,
15004 [ALC269VB_AMIC
] = {
15005 .mixers
= { alc269vb_laptop_mixer
},
15006 .cap_mixer
= alc269vb_laptop_analog_capture_mixer
,
15007 .init_verbs
= { alc269vb_init_verbs
,
15008 alc269vb_laptop_amic_init_verbs
},
15009 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15010 .dac_nids
= alc269_dac_nids
,
15012 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15013 .channel_mode
= alc269_modes
,
15014 .unsol_event
= alc269_laptop_unsol_event
,
15015 .setup
= alc269vb_laptop_amic_setup
,
15016 .init_hook
= alc269_laptop_inithook
,
15018 [ALC269VB_DMIC
] = {
15019 .mixers
= { alc269vb_laptop_mixer
},
15020 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
15021 .init_verbs
= { alc269vb_init_verbs
,
15022 alc269vb_laptop_dmic_init_verbs
},
15023 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15024 .dac_nids
= alc269_dac_nids
,
15026 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15027 .channel_mode
= alc269_modes
,
15028 .unsol_event
= alc269_laptop_unsol_event
,
15029 .setup
= alc269vb_laptop_dmic_setup
,
15030 .init_hook
= alc269_laptop_inithook
,
15032 [ALC269_FUJITSU
] = {
15033 .mixers
= { alc269_fujitsu_mixer
},
15034 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
15035 .init_verbs
= { alc269_init_verbs
,
15036 alc269_laptop_dmic_init_verbs
},
15037 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15038 .dac_nids
= alc269_dac_nids
,
15040 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15041 .channel_mode
= alc269_modes
,
15042 .unsol_event
= alc269_laptop_unsol_event
,
15043 .setup
= alc269_laptop_dmic_setup
,
15044 .init_hook
= alc269_laptop_inithook
,
15046 [ALC269_LIFEBOOK
] = {
15047 .mixers
= { alc269_lifebook_mixer
},
15048 .init_verbs
= { alc269_init_verbs
, alc269_lifebook_verbs
},
15049 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15050 .dac_nids
= alc269_dac_nids
,
15052 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15053 .channel_mode
= alc269_modes
,
15054 .input_mux
= &alc269_capture_source
,
15055 .unsol_event
= alc269_lifebook_unsol_event
,
15056 .init_hook
= alc269_lifebook_init_hook
,
15059 .mixers
= { alc269_asus_mixer
},
15060 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
15061 .init_verbs
= { alc269_init_verbs
, alc271_acer_dmic_verbs
},
15062 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15063 .dac_nids
= alc269_dac_nids
,
15064 .adc_nids
= alc262_dmic_adc_nids
,
15065 .num_adc_nids
= ARRAY_SIZE(alc262_dmic_adc_nids
),
15066 .capsrc_nids
= alc262_dmic_capsrc_nids
,
15067 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15068 .channel_mode
= alc269_modes
,
15069 .input_mux
= &alc269_capture_source
,
15070 .dig_out_nid
= ALC880_DIGOUT_NID
,
15071 .unsol_event
= alc_sku_unsol_event
,
15072 .setup
= alc269vb_laptop_dmic_setup
,
15073 .init_hook
= alc_inithook
,
15077 static int alc269_fill_coef(struct hda_codec
*codec
)
15081 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) < 0x015) {
15082 alc_write_coef_idx(codec
, 0xf, 0x960b);
15083 alc_write_coef_idx(codec
, 0xe, 0x8817);
15086 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x016) {
15087 alc_write_coef_idx(codec
, 0xf, 0x960b);
15088 alc_write_coef_idx(codec
, 0xe, 0x8814);
15091 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017) {
15092 val
= alc_read_coef_idx(codec
, 0x04);
15093 /* Power up output pin */
15094 alc_write_coef_idx(codec
, 0x04, val
| (1<<11));
15097 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
15098 val
= alc_read_coef_idx(codec
, 0xd);
15099 if ((val
& 0x0c00) >> 10 != 0x1) {
15100 /* Capless ramp up clock control */
15101 alc_write_coef_idx(codec
, 0xd, val
| 1<<10);
15103 val
= alc_read_coef_idx(codec
, 0x17);
15104 if ((val
& 0x01c0) >> 6 != 0x4) {
15105 /* Class D power on reset */
15106 alc_write_coef_idx(codec
, 0x17, val
| 1<<7);
15112 static int patch_alc269(struct hda_codec
*codec
)
15114 struct alc_spec
*spec
;
15115 int board_config
, coef
;
15118 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
15122 codec
->spec
= spec
;
15124 alc_auto_parse_customize_define(codec
);
15126 if (codec
->vendor_id
== 0x10ec0269) {
15127 coef
= alc_read_coef_idx(codec
, 0);
15128 if ((coef
& 0x00f0) == 0x0010) {
15129 if (codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
15130 spec
->cdefine
.platform_type
== 1) {
15131 alc_codec_rename(codec
, "ALC271X");
15132 spec
->codec_variant
= ALC269_TYPE_ALC271X
;
15133 } else if ((coef
& 0xf000) == 0x1000) {
15134 spec
->codec_variant
= ALC269_TYPE_ALC270
;
15135 } else if ((coef
& 0xf000) == 0x2000) {
15136 alc_codec_rename(codec
, "ALC259");
15137 spec
->codec_variant
= ALC269_TYPE_ALC259
;
15138 } else if ((coef
& 0xf000) == 0x3000) {
15139 alc_codec_rename(codec
, "ALC258");
15140 spec
->codec_variant
= ALC269_TYPE_ALC258
;
15142 alc_codec_rename(codec
, "ALC269VB");
15143 spec
->codec_variant
= ALC269_TYPE_ALC269VB
;
15146 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
15147 alc269_fill_coef(codec
);
15150 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
15154 if (board_config
< 0) {
15155 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
15157 board_config
= ALC269_AUTO
;
15160 if (board_config
== ALC269_AUTO
)
15161 alc_pick_fixup(codec
, alc269_fixup_tbl
, alc269_fixups
, 1);
15163 if (board_config
== ALC269_AUTO
) {
15164 /* automatic parse from the BIOS config */
15165 err
= alc269_parse_auto_config(codec
);
15171 "hda_codec: Cannot set up configuration "
15172 "from BIOS. Using base mode...\n");
15173 board_config
= ALC269_BASIC
;
15177 if (has_cdefine_beep(codec
)) {
15178 err
= snd_hda_attach_beep_device(codec
, 0x1);
15185 if (board_config
!= ALC269_AUTO
)
15186 setup_preset(codec
, &alc269_presets
[board_config
]);
15188 if (board_config
== ALC269_QUANTA_FL1
) {
15189 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15190 * fix the sample rate of analog I/O to 44.1kHz
15192 spec
->stream_analog_playback
= &alc269_44k_pcm_analog_playback
;
15193 spec
->stream_analog_capture
= &alc269_44k_pcm_analog_capture
;
15194 } else if (spec
->dual_adc_switch
) {
15195 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
15196 /* switch ADC dynamically */
15197 spec
->stream_analog_capture
= &dualmic_pcm_analog_capture
;
15199 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
15200 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
15202 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
15203 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
15205 if (!spec
->adc_nids
) { /* wasn't filled automatically? use default */
15206 if (spec
->codec_variant
== ALC269_TYPE_NORMAL
) {
15207 spec
->adc_nids
= alc269_adc_nids
;
15208 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
15209 spec
->capsrc_nids
= alc269_capsrc_nids
;
15211 spec
->adc_nids
= alc269vb_adc_nids
;
15212 spec
->num_adc_nids
= ARRAY_SIZE(alc269vb_adc_nids
);
15213 spec
->capsrc_nids
= alc269vb_capsrc_nids
;
15217 if (!spec
->cap_mixer
)
15218 set_capture_mixer(codec
);
15219 if (has_cdefine_beep(codec
))
15220 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
15222 if (board_config
== ALC269_AUTO
)
15223 alc_pick_fixup(codec
, alc269_fixup_tbl
, alc269_fixups
, 0);
15225 spec
->vmaster_nid
= 0x02;
15227 codec
->patch_ops
= alc_patch_ops
;
15228 #ifdef CONFIG_SND_HDA_POWER_SAVE
15229 codec
->patch_ops
.suspend
= alc269_suspend
;
15231 #ifdef SND_HDA_NEEDS_RESUME
15232 codec
->patch_ops
.resume
= alc269_resume
;
15234 if (board_config
== ALC269_AUTO
)
15235 spec
->init_hook
= alc269_auto_init
;
15237 alc_init_jacks(codec
);
15238 #ifdef CONFIG_SND_HDA_POWER_SAVE
15239 if (!spec
->loopback
.amplist
)
15240 spec
->loopback
.amplist
= alc269_loopbacks
;
15241 if (alc269_mic2_for_mute_led(codec
))
15242 codec
->patch_ops
.check_power_status
= alc269_mic2_mute_check_ps
;
15249 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15253 * set the path ways for 2 channel output
15254 * need to set the codec line out and mic 1 pin widgets to inputs
15256 static struct hda_verb alc861_threestack_ch2_init
[] = {
15257 /* set pin widget 1Ah (line in) for input */
15258 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15259 /* set pin widget 18h (mic1/2) for input, for mic also enable
15262 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15264 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
15266 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15267 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
15273 * need to set the codec line out and mic 1 pin widgets to outputs
15275 static struct hda_verb alc861_threestack_ch6_init
[] = {
15276 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15277 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15278 /* set pin widget 18h (mic1) for output (CLFE)*/
15279 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15281 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15282 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15284 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
15286 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15287 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
15292 static struct hda_channel_mode alc861_threestack_modes
[2] = {
15293 { 2, alc861_threestack_ch2_init
},
15294 { 6, alc861_threestack_ch6_init
},
15296 /* Set mic1 as input and unmute the mixer */
15297 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
15298 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15299 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15302 /* Set mic1 as output and mute mixer */
15303 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
15304 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15305 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15309 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
15310 { 2, alc861_uniwill_m31_ch2_init
},
15311 { 4, alc861_uniwill_m31_ch4_init
},
15314 /* Set mic1 and line-in as input and unmute the mixer */
15315 static struct hda_verb alc861_asus_ch2_init
[] = {
15316 /* set pin widget 1Ah (line in) for input */
15317 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15318 /* set pin widget 18h (mic1/2) for input, for mic also enable
15321 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15323 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
15325 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15326 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
15330 /* Set mic1 nad line-in as output and mute mixer */
15331 static struct hda_verb alc861_asus_ch6_init
[] = {
15332 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15333 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15334 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15335 /* set pin widget 18h (mic1) for output (CLFE)*/
15336 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15337 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15338 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15339 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15341 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
15343 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15344 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
15349 static struct hda_channel_mode alc861_asus_modes
[2] = {
15350 { 2, alc861_asus_ch2_init
},
15351 { 6, alc861_asus_ch6_init
},
15356 static struct snd_kcontrol_new alc861_base_mixer
[] = {
15357 /* output mixer control */
15358 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15359 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15360 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15361 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15362 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
15364 /*Input mixer control */
15365 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15366 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15367 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15368 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15369 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15370 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15371 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15372 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15373 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15374 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15379 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
15380 /* output mixer control */
15381 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15382 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15383 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15384 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15385 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15387 /* Input mixer control */
15388 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15389 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15390 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15391 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15392 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15393 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15394 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15395 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15396 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15397 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15400 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15401 .name
= "Channel Mode",
15402 .info
= alc_ch_mode_info
,
15403 .get
= alc_ch_mode_get
,
15404 .put
= alc_ch_mode_put
,
15405 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
15410 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
15411 /* output mixer control */
15412 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15414 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15419 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
15420 /* output mixer control */
15421 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15422 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15423 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15424 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15425 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15427 /* Input mixer control */
15428 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15429 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15430 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15431 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15432 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15433 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15435 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15436 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15437 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15440 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15441 .name
= "Channel Mode",
15442 .info
= alc_ch_mode_info
,
15443 .get
= alc_ch_mode_get
,
15444 .put
= alc_ch_mode_put
,
15445 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
15450 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
15451 /* output mixer control */
15452 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15453 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15454 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15455 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15456 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
15458 /* Input mixer control */
15459 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
15460 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15461 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15462 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15463 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15464 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15466 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15467 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15468 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
15471 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15472 .name
= "Channel Mode",
15473 .info
= alc_ch_mode_info
,
15474 .get
= alc_ch_mode_get
,
15475 .put
= alc_ch_mode_put
,
15476 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
15481 /* additional mixer */
15482 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
15483 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15484 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15489 * generic initialization of ADC, input mixers and output mixers
15491 static struct hda_verb alc861_base_init_verbs
[] = {
15493 * Unmute ADC0 and set the default input to mic-in
15495 /* port-A for surround (rear panel) */
15496 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15497 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15498 /* port-B for mic-in (rear panel) with vref */
15499 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15500 /* port-C for line-in (rear panel) */
15501 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15502 /* port-D for Front */
15503 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15504 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15505 /* port-E for HP out (front panel) */
15506 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
15507 /* route front PCM to HP */
15508 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15509 /* port-F for mic-in (front panel) with vref */
15510 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15511 /* port-G for CLFE (rear panel) */
15512 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15513 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15514 /* port-H for side (rear panel) */
15515 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15516 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15518 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15519 /* route front mic to ADC1*/
15520 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15521 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15523 /* Unmute DAC0~3 & spdif out*/
15524 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15525 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15526 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15527 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15530 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15531 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15532 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15533 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15534 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15536 /* Unmute Stereo Mixer 15 */
15537 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15538 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15539 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15540 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15542 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15543 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15544 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15545 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15546 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15547 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15548 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15549 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15550 /* hp used DAC 3 (Front) */
15551 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15552 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15557 static struct hda_verb alc861_threestack_init_verbs
[] = {
15559 * Unmute ADC0 and set the default input to mic-in
15561 /* port-A for surround (rear panel) */
15562 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15563 /* port-B for mic-in (rear panel) with vref */
15564 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15565 /* port-C for line-in (rear panel) */
15566 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15567 /* port-D for Front */
15568 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15569 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15570 /* port-E for HP out (front panel) */
15571 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
15572 /* route front PCM to HP */
15573 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15574 /* port-F for mic-in (front panel) with vref */
15575 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15576 /* port-G for CLFE (rear panel) */
15577 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15578 /* port-H for side (rear panel) */
15579 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15581 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15582 /* route front mic to ADC1*/
15583 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15584 {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)},
15618 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
15620 * Unmute ADC0 and set the default input to mic-in
15622 /* port-A for surround (rear panel) */
15623 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15624 /* port-B for mic-in (rear panel) with vref */
15625 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15626 /* port-C for line-in (rear panel) */
15627 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15628 /* port-D for Front */
15629 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15630 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15631 /* port-E for HP out (front panel) */
15632 /* this has to be set to VREF80 */
15633 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
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_asus_init_verbs
[] = {
15682 * Unmute ADC0 and set the default input to mic-in
15684 /* port-A for surround (rear panel)
15685 * according to codec#0 this is the HP jack
15687 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
15688 /* route front PCM to HP */
15689 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
15690 /* port-B for mic-in (rear panel) with vref */
15691 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15692 /* port-C for line-in (rear panel) */
15693 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15694 /* port-D for Front */
15695 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15696 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15697 /* port-E for HP out (front panel) */
15698 /* this has to be set to VREF80 */
15699 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15700 /* route front PCM to HP */
15701 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15702 /* port-F for mic-in (front panel) with vref */
15703 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15704 /* port-G for CLFE (rear panel) */
15705 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15706 /* port-H for side (rear panel) */
15707 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15709 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15710 /* route front mic to ADC1*/
15711 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15712 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15713 /* Unmute DAC0~3 & spdif out*/
15714 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15715 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15716 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15717 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15719 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15720 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15721 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15722 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15723 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15725 /* Unmute Stereo Mixer 15 */
15726 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15727 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15728 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15731 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15732 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15733 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15734 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15735 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15736 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15737 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15738 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15739 /* hp used DAC 3 (Front) */
15740 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15741 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15745 /* additional init verbs for ASUS laptops */
15746 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
15747 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
15748 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
15753 * generic initialization of ADC, input mixers and output mixers
15755 static struct hda_verb alc861_auto_init_verbs
[] = {
15757 * Unmute ADC0 and set the default input to mic-in
15759 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15760 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15762 /* Unmute DAC0~3 & spdif out*/
15763 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15764 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15765 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15766 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15767 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15769 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15770 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15771 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15772 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15773 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15775 /* Unmute Stereo Mixer 15 */
15776 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15777 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15778 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15779 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
15781 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15782 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15783 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15784 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15785 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15786 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15787 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15788 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15790 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15791 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15792 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15793 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15794 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15795 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15796 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15797 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15799 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
15804 static struct hda_verb alc861_toshiba_init_verbs
[] = {
15805 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15810 /* toggle speaker-output according to the hp-jack state */
15811 static void alc861_toshiba_automute(struct hda_codec
*codec
)
15813 unsigned int present
= snd_hda_jack_detect(codec
, 0x0f);
15815 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
15816 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
15817 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
15818 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
15821 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
15824 if ((res
>> 26) == ALC880_HP_EVENT
)
15825 alc861_toshiba_automute(codec
);
15828 /* pcm configuration: identical with ALC880 */
15829 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15830 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15831 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15832 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15835 #define ALC861_DIGOUT_NID 0x07
15837 static struct hda_channel_mode alc861_8ch_modes
[1] = {
15841 static hda_nid_t alc861_dac_nids
[4] = {
15842 /* front, surround, clfe, side */
15843 0x03, 0x06, 0x05, 0x04
15846 static hda_nid_t alc660_dac_nids
[3] = {
15847 /* front, clfe, surround */
15851 static hda_nid_t alc861_adc_nids
[1] = {
15856 static struct hda_input_mux alc861_capture_source
= {
15860 { "Front Mic", 0x3 },
15867 static hda_nid_t
alc861_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
15869 struct alc_spec
*spec
= codec
->spec
;
15870 hda_nid_t mix
, srcs
[5];
15873 if (snd_hda_get_connections(codec
, pin
, &mix
, 1) != 1)
15875 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
15878 for (i
= 0; i
< num
; i
++) {
15880 type
= get_wcaps_type(get_wcaps(codec
, srcs
[i
]));
15881 if (type
!= AC_WID_AUD_OUT
)
15883 for (j
= 0; j
< spec
->multiout
.num_dacs
; j
++)
15884 if (spec
->multiout
.dac_nids
[j
] == srcs
[i
])
15886 if (j
>= spec
->multiout
.num_dacs
)
15892 /* fill in the dac_nids table from the parsed pin configuration */
15893 static int alc861_auto_fill_dac_nids(struct hda_codec
*codec
,
15894 const struct auto_pin_cfg
*cfg
)
15896 struct alc_spec
*spec
= codec
->spec
;
15898 hda_nid_t nid
, dac
;
15900 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
15901 for (i
= 0; i
< cfg
->line_outs
; i
++) {
15902 nid
= cfg
->line_out_pins
[i
];
15903 dac
= alc861_look_for_dac(codec
, nid
);
15906 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
15911 static int __alc861_create_out_sw(struct hda_codec
*codec
, const char *pfx
,
15912 hda_nid_t nid
, int idx
, unsigned int chs
)
15914 return __add_pb_sw_ctrl(codec
->spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
,
15915 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
15918 #define alc861_create_out_sw(codec, pfx, nid, chs) \
15919 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
15921 /* add playback controls from the parsed DAC table */
15922 static int alc861_auto_create_multi_out_ctls(struct hda_codec
*codec
,
15923 const struct auto_pin_cfg
*cfg
)
15925 struct alc_spec
*spec
= codec
->spec
;
15926 static const char *chname
[4] = {
15927 "Front", "Surround", NULL
/*CLFE*/, "Side"
15929 const char *pfx
= alc_get_line_out_pfx(cfg
, true);
15933 for (i
= 0; i
< cfg
->line_outs
; i
++) {
15934 nid
= spec
->multiout
.dac_nids
[i
];
15937 if (!pfx
&& i
== 2) {
15939 err
= alc861_create_out_sw(codec
, "Center", nid
, 1);
15942 err
= alc861_create_out_sw(codec
, "LFE", nid
, 2);
15946 const char *name
= pfx
;
15949 err
= __alc861_create_out_sw(codec
, name
, nid
, i
, 3);
15957 static int alc861_auto_create_hp_ctls(struct hda_codec
*codec
, hda_nid_t pin
)
15959 struct alc_spec
*spec
= codec
->spec
;
15966 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
15967 nid
= alc861_look_for_dac(codec
, pin
);
15969 err
= alc861_create_out_sw(codec
, "Headphone", nid
, 3);
15972 spec
->multiout
.hp_nid
= nid
;
15978 /* create playback/capture controls for input pins */
15979 static int alc861_auto_create_input_ctls(struct hda_codec
*codec
,
15980 const struct auto_pin_cfg
*cfg
)
15982 return alc_auto_create_input_ctls(codec
, cfg
, 0x15, 0x08, 0);
15985 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
15987 int pin_type
, hda_nid_t dac
)
15989 hda_nid_t mix
, srcs
[5];
15992 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
15994 snd_hda_codec_write(codec
, dac
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15996 if (snd_hda_get_connections(codec
, nid
, &mix
, 1) != 1)
15998 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
16001 for (i
= 0; i
< num
; i
++) {
16003 if (srcs
[i
] == dac
|| srcs
[i
] == 0x15)
16004 mute
= AMP_IN_UNMUTE(i
);
16006 mute
= AMP_IN_MUTE(i
);
16007 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16012 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
16014 struct alc_spec
*spec
= codec
->spec
;
16017 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
16018 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
16019 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
16021 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
16022 spec
->multiout
.dac_nids
[i
]);
16026 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
16028 struct alc_spec
*spec
= codec
->spec
;
16030 if (spec
->autocfg
.hp_outs
)
16031 alc861_auto_set_output_and_unmute(codec
,
16032 spec
->autocfg
.hp_pins
[0],
16034 spec
->multiout
.hp_nid
);
16035 if (spec
->autocfg
.speaker_outs
)
16036 alc861_auto_set_output_and_unmute(codec
,
16037 spec
->autocfg
.speaker_pins
[0],
16039 spec
->multiout
.dac_nids
[0]);
16042 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
16044 struct alc_spec
*spec
= codec
->spec
;
16045 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
16048 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
16049 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
16050 if (nid
>= 0x0c && nid
<= 0x11)
16051 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
16055 /* parse the BIOS configuration and set up the alc_spec */
16056 /* return 1 if successful, 0 if the proper config is not found,
16057 * or a negative error code
16059 static int alc861_parse_auto_config(struct hda_codec
*codec
)
16061 struct alc_spec
*spec
= codec
->spec
;
16063 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
16065 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
16069 if (!spec
->autocfg
.line_outs
)
16070 return 0; /* can't find valid BIOS pin config */
16072 err
= alc861_auto_fill_dac_nids(codec
, &spec
->autocfg
);
16075 err
= alc861_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
16078 err
= alc861_auto_create_hp_ctls(codec
, spec
->autocfg
.hp_pins
[0]);
16081 err
= alc861_auto_create_input_ctls(codec
, &spec
->autocfg
);
16085 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
16087 alc_auto_parse_digital(codec
);
16089 if (spec
->kctls
.list
)
16090 add_mixer(spec
, spec
->kctls
.list
);
16092 add_verb(spec
, alc861_auto_init_verbs
);
16094 spec
->num_mux_defs
= 1;
16095 spec
->input_mux
= &spec
->private_imux
[0];
16097 spec
->adc_nids
= alc861_adc_nids
;
16098 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
16099 set_capture_mixer(codec
);
16101 alc_ssid_check(codec
, 0x0e, 0x0f, 0x0b, 0);
16106 /* additional initialization for auto-configuration model */
16107 static void alc861_auto_init(struct hda_codec
*codec
)
16109 struct alc_spec
*spec
= codec
->spec
;
16110 alc861_auto_init_multi_out(codec
);
16111 alc861_auto_init_hp_out(codec
);
16112 alc861_auto_init_analog_input(codec
);
16113 alc_auto_init_digital(codec
);
16114 if (spec
->unsol_event
)
16115 alc_inithook(codec
);
16118 #ifdef CONFIG_SND_HDA_POWER_SAVE
16119 static struct hda_amp_list alc861_loopbacks
[] = {
16120 { 0x15, HDA_INPUT
, 0 },
16121 { 0x15, HDA_INPUT
, 1 },
16122 { 0x15, HDA_INPUT
, 2 },
16123 { 0x15, HDA_INPUT
, 3 },
16130 * configuration and preset
16132 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
16133 [ALC861_3ST
] = "3stack",
16134 [ALC660_3ST
] = "3stack-660",
16135 [ALC861_3ST_DIG
] = "3stack-dig",
16136 [ALC861_6ST_DIG
] = "6stack-dig",
16137 [ALC861_UNIWILL_M31
] = "uniwill-m31",
16138 [ALC861_TOSHIBA
] = "toshiba",
16139 [ALC861_ASUS
] = "asus",
16140 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
16141 [ALC861_AUTO
] = "auto",
16144 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
16145 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
16146 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
16147 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
16148 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
16149 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
16150 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
16151 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
16152 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16153 * Any other models that need this preset?
16155 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16156 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
16157 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
16158 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
16159 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
16160 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
16161 /* FIXME: the below seems conflict */
16162 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16163 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
16164 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
16168 static struct alc_config_preset alc861_presets
[] = {
16170 .mixers
= { alc861_3ST_mixer
},
16171 .init_verbs
= { alc861_threestack_init_verbs
},
16172 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16173 .dac_nids
= alc861_dac_nids
,
16174 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16175 .channel_mode
= alc861_threestack_modes
,
16177 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16178 .adc_nids
= alc861_adc_nids
,
16179 .input_mux
= &alc861_capture_source
,
16181 [ALC861_3ST_DIG
] = {
16182 .mixers
= { alc861_base_mixer
},
16183 .init_verbs
= { alc861_threestack_init_verbs
},
16184 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16185 .dac_nids
= alc861_dac_nids
,
16186 .dig_out_nid
= ALC861_DIGOUT_NID
,
16187 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16188 .channel_mode
= alc861_threestack_modes
,
16190 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16191 .adc_nids
= alc861_adc_nids
,
16192 .input_mux
= &alc861_capture_source
,
16194 [ALC861_6ST_DIG
] = {
16195 .mixers
= { alc861_base_mixer
},
16196 .init_verbs
= { alc861_base_init_verbs
},
16197 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16198 .dac_nids
= alc861_dac_nids
,
16199 .dig_out_nid
= ALC861_DIGOUT_NID
,
16200 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
16201 .channel_mode
= alc861_8ch_modes
,
16202 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16203 .adc_nids
= alc861_adc_nids
,
16204 .input_mux
= &alc861_capture_source
,
16207 .mixers
= { alc861_3ST_mixer
},
16208 .init_verbs
= { alc861_threestack_init_verbs
},
16209 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
16210 .dac_nids
= alc660_dac_nids
,
16211 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16212 .channel_mode
= alc861_threestack_modes
,
16214 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16215 .adc_nids
= alc861_adc_nids
,
16216 .input_mux
= &alc861_capture_source
,
16218 [ALC861_UNIWILL_M31
] = {
16219 .mixers
= { alc861_uniwill_m31_mixer
},
16220 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
16221 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16222 .dac_nids
= alc861_dac_nids
,
16223 .dig_out_nid
= ALC861_DIGOUT_NID
,
16224 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
16225 .channel_mode
= alc861_uniwill_m31_modes
,
16227 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16228 .adc_nids
= alc861_adc_nids
,
16229 .input_mux
= &alc861_capture_source
,
16231 [ALC861_TOSHIBA
] = {
16232 .mixers
= { alc861_toshiba_mixer
},
16233 .init_verbs
= { alc861_base_init_verbs
,
16234 alc861_toshiba_init_verbs
},
16235 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16236 .dac_nids
= alc861_dac_nids
,
16237 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
16238 .channel_mode
= alc883_3ST_2ch_modes
,
16239 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16240 .adc_nids
= alc861_adc_nids
,
16241 .input_mux
= &alc861_capture_source
,
16242 .unsol_event
= alc861_toshiba_unsol_event
,
16243 .init_hook
= alc861_toshiba_automute
,
16246 .mixers
= { alc861_asus_mixer
},
16247 .init_verbs
= { alc861_asus_init_verbs
},
16248 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16249 .dac_nids
= alc861_dac_nids
,
16250 .dig_out_nid
= ALC861_DIGOUT_NID
,
16251 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
16252 .channel_mode
= alc861_asus_modes
,
16255 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16256 .adc_nids
= alc861_adc_nids
,
16257 .input_mux
= &alc861_capture_source
,
16259 [ALC861_ASUS_LAPTOP
] = {
16260 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
16261 .init_verbs
= { alc861_asus_init_verbs
,
16262 alc861_asus_laptop_init_verbs
},
16263 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16264 .dac_nids
= alc861_dac_nids
,
16265 .dig_out_nid
= ALC861_DIGOUT_NID
,
16266 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
16267 .channel_mode
= alc883_3ST_2ch_modes
,
16269 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16270 .adc_nids
= alc861_adc_nids
,
16271 .input_mux
= &alc861_capture_source
,
16275 /* Pin config fixes */
16277 PINFIX_FSC_AMILO_PI1505
,
16280 static const struct alc_fixup alc861_fixups
[] = {
16281 [PINFIX_FSC_AMILO_PI1505
] = {
16282 .pins
= (const struct alc_pincfg
[]) {
16283 { 0x0b, 0x0221101f }, /* HP */
16284 { 0x0f, 0x90170310 }, /* speaker */
16290 static struct snd_pci_quirk alc861_fixup_tbl
[] = {
16291 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505
),
16295 static int patch_alc861(struct hda_codec
*codec
)
16297 struct alc_spec
*spec
;
16301 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
16305 codec
->spec
= spec
;
16307 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
16311 if (board_config
< 0) {
16312 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
16314 board_config
= ALC861_AUTO
;
16317 if (board_config
== ALC861_AUTO
)
16318 alc_pick_fixup(codec
, alc861_fixup_tbl
, alc861_fixups
, 1);
16320 if (board_config
== ALC861_AUTO
) {
16321 /* automatic parse from the BIOS config */
16322 err
= alc861_parse_auto_config(codec
);
16328 "hda_codec: Cannot set up configuration "
16329 "from BIOS. Using base mode...\n");
16330 board_config
= ALC861_3ST_DIG
;
16334 err
= snd_hda_attach_beep_device(codec
, 0x23);
16340 if (board_config
!= ALC861_AUTO
)
16341 setup_preset(codec
, &alc861_presets
[board_config
]);
16343 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
16344 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
16346 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
16347 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
16349 if (!spec
->cap_mixer
)
16350 set_capture_mixer(codec
);
16351 set_beep_amp(spec
, 0x23, 0, HDA_OUTPUT
);
16353 spec
->vmaster_nid
= 0x03;
16355 if (board_config
== ALC861_AUTO
)
16356 alc_pick_fixup(codec
, alc861_fixup_tbl
, alc861_fixups
, 0);
16358 codec
->patch_ops
= alc_patch_ops
;
16359 if (board_config
== ALC861_AUTO
) {
16360 spec
->init_hook
= alc861_auto_init
;
16361 #ifdef CONFIG_SND_HDA_POWER_SAVE
16362 spec
->power_hook
= alc_power_eapd
;
16365 #ifdef CONFIG_SND_HDA_POWER_SAVE
16366 if (!spec
->loopback
.amplist
)
16367 spec
->loopback
.amplist
= alc861_loopbacks
;
16374 * ALC861-VD support
16378 * In addition, an independent DAC
16380 #define ALC861VD_DIGOUT_NID 0x06
16382 static hda_nid_t alc861vd_dac_nids
[4] = {
16383 /* front, surr, clfe, side surr */
16384 0x02, 0x03, 0x04, 0x05
16387 /* dac_nids for ALC660vd are in a different order - according to
16388 * Realtek's driver.
16389 * This should probably result in a different mixer for 6stack models
16390 * of ALC660vd codecs, but for now there is only 3stack mixer
16391 * - and it is the same as in 861vd.
16392 * adc_nids in ALC660vd are (is) the same as in 861vd
16394 static hda_nid_t alc660vd_dac_nids
[3] = {
16395 /* front, rear, clfe, rear_surr */
16399 static hda_nid_t alc861vd_adc_nids
[1] = {
16404 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
16407 /* FIXME: should be a matrix-type input source selection */
16408 static struct hda_input_mux alc861vd_capture_source
= {
16412 { "Front Mic", 0x1 },
16418 static struct hda_input_mux alc861vd_dallas_capture_source
= {
16422 { "Internal Mic", 0x1 },
16426 static struct hda_input_mux alc861vd_hp_capture_source
= {
16429 { "Front Mic", 0x0 },
16430 { "ATAPI Mic", 0x1 },
16437 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
16444 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
16445 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
16446 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16447 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16448 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16455 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
16456 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16457 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16458 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16459 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16463 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
16464 { 6, alc861vd_6stack_ch6_init
},
16465 { 8, alc861vd_6stack_ch8_init
},
16468 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
16470 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
16471 .name
= "Channel Mode",
16472 .info
= alc_ch_mode_info
,
16473 .get
= alc_ch_mode_get
,
16474 .put
= alc_ch_mode_put
,
16479 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16480 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16482 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
16483 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16484 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16486 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16487 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
16489 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16491 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16493 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
16494 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
16496 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
16497 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
16499 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16501 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16502 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16503 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16505 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16506 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16507 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16509 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16510 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16512 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16513 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16518 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
16519 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16520 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16524 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16525 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16526 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16528 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16529 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16530 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16532 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16533 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16535 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16536 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16541 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
16542 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16543 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16544 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
16546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16548 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16549 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16550 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16552 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16553 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16554 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16556 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16557 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16562 /* Pin assignment: Speaker=0x14, HP = 0x15,
16563 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16565 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
16566 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16567 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
16568 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16569 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
16570 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16571 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16572 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16573 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16574 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16575 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16579 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16580 * Front Mic=0x18, ATAPI Mic = 0x19,
16582 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
16583 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16584 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16585 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16586 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
16587 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16588 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16589 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16590 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16596 * generic initialization of ADC, input mixers and output mixers
16598 static struct hda_verb alc861vd_volume_init_verbs
[] = {
16600 * Unmute ADC0 and set the default input to mic-in
16602 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16603 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16605 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16606 * the analog-loopback mixer widget
16608 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16615 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16616 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
16619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
16622 * Set up output mixers (0x02 - 0x05)
16624 /* set vol=0 to output mixers */
16625 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16626 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16627 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16628 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16630 /* set up input amps for analog loopback */
16631 /* Amp Indices: DAC = 0, mixer = 1 */
16632 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16633 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16634 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16636 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16637 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16638 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16639 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16645 * 3-stack pin configuration:
16646 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16648 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
16650 * Set pin mode and muting
16652 /* set front pin widgets 0x14 for output */
16653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16654 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16655 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
16657 /* Mic (rear) pin: input vref at 80% */
16658 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16659 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16660 /* Front Mic pin: input vref at 80% */
16661 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16662 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16663 /* Line In pin: input */
16664 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16665 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16666 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16667 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16668 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16669 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16670 /* CD pin widget for input */
16671 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16677 * 6-stack pin configuration:
16679 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
16681 * Set pin mode and muting
16683 /* set front pin widgets 0x14 for output */
16684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16685 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16686 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
16688 /* Rear Pin: output 1 (0x0d) */
16689 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16691 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
16692 /* CLFE Pin: output 2 (0x0e) */
16693 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16694 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16695 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
16696 /* Side Pin: output 3 (0x0f) */
16697 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16698 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16699 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
16701 /* Mic (rear) pin: input vref at 80% */
16702 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16703 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16704 /* Front Mic pin: input vref at 80% */
16705 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16706 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16707 /* Line In pin: input */
16708 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16709 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16710 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16711 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16712 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16713 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16714 /* CD pin widget for input */
16715 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16720 static struct hda_verb alc861vd_eapd_verbs
[] = {
16721 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16725 static struct hda_verb alc660vd_eapd_verbs
[] = {
16726 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16727 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16731 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
16732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
16735 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16736 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16740 static void alc861vd_lenovo_setup(struct hda_codec
*codec
)
16742 struct alc_spec
*spec
= codec
->spec
;
16743 spec
->autocfg
.hp_pins
[0] = 0x1b;
16744 spec
->autocfg
.speaker_pins
[0] = 0x14;
16747 static void alc861vd_lenovo_init_hook(struct hda_codec
*codec
)
16749 alc_automute_amp(codec
);
16750 alc88x_simple_mic_automute(codec
);
16753 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
16756 switch (res
>> 26) {
16757 case ALC880_MIC_EVENT
:
16758 alc88x_simple_mic_automute(codec
);
16761 alc_automute_amp_unsol_event(codec
, res
);
16766 static struct hda_verb alc861vd_dallas_verbs
[] = {
16767 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16768 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16769 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16770 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16773 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16774 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16775 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16776 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16777 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16778 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16779 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16783 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16784 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16785 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16786 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16787 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16788 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16790 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16791 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16792 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16793 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16794 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16795 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16796 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16797 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16799 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16800 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16802 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16804 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16805 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16806 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16811 /* toggle speaker-output according to the hp-jack state */
16812 static void alc861vd_dallas_setup(struct hda_codec
*codec
)
16814 struct alc_spec
*spec
= codec
->spec
;
16816 spec
->autocfg
.hp_pins
[0] = 0x15;
16817 spec
->autocfg
.speaker_pins
[0] = 0x14;
16820 #ifdef CONFIG_SND_HDA_POWER_SAVE
16821 #define alc861vd_loopbacks alc880_loopbacks
16824 /* pcm configuration: identical with ALC880 */
16825 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16826 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16827 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16828 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16831 * configuration and preset
16833 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
16834 [ALC660VD_3ST
] = "3stack-660",
16835 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
16836 [ALC660VD_ASUS_V1S
] = "asus-v1s",
16837 [ALC861VD_3ST
] = "3stack",
16838 [ALC861VD_3ST_DIG
] = "3stack-digout",
16839 [ALC861VD_6ST_DIG
] = "6stack-digout",
16840 [ALC861VD_LENOVO
] = "lenovo",
16841 [ALC861VD_DALLAS
] = "dallas",
16842 [ALC861VD_HP
] = "hp",
16843 [ALC861VD_AUTO
] = "auto",
16846 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
16847 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
16848 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
16849 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
16850 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16851 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S
),
16852 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
16853 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
16854 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
16855 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16856 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO
),
16857 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
16858 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
16859 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
16860 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO
),
16861 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
16865 static struct alc_config_preset alc861vd_presets
[] = {
16867 .mixers
= { alc861vd_3st_mixer
},
16868 .init_verbs
= { alc861vd_volume_init_verbs
,
16869 alc861vd_3stack_init_verbs
},
16870 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16871 .dac_nids
= alc660vd_dac_nids
,
16872 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16873 .channel_mode
= alc861vd_3stack_2ch_modes
,
16874 .input_mux
= &alc861vd_capture_source
,
16876 [ALC660VD_3ST_DIG
] = {
16877 .mixers
= { alc861vd_3st_mixer
},
16878 .init_verbs
= { alc861vd_volume_init_verbs
,
16879 alc861vd_3stack_init_verbs
},
16880 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16881 .dac_nids
= alc660vd_dac_nids
,
16882 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16883 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16884 .channel_mode
= alc861vd_3stack_2ch_modes
,
16885 .input_mux
= &alc861vd_capture_source
,
16888 .mixers
= { alc861vd_3st_mixer
},
16889 .init_verbs
= { alc861vd_volume_init_verbs
,
16890 alc861vd_3stack_init_verbs
},
16891 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16892 .dac_nids
= alc861vd_dac_nids
,
16893 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16894 .channel_mode
= alc861vd_3stack_2ch_modes
,
16895 .input_mux
= &alc861vd_capture_source
,
16897 [ALC861VD_3ST_DIG
] = {
16898 .mixers
= { alc861vd_3st_mixer
},
16899 .init_verbs
= { alc861vd_volume_init_verbs
,
16900 alc861vd_3stack_init_verbs
},
16901 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16902 .dac_nids
= alc861vd_dac_nids
,
16903 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16904 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16905 .channel_mode
= alc861vd_3stack_2ch_modes
,
16906 .input_mux
= &alc861vd_capture_source
,
16908 [ALC861VD_6ST_DIG
] = {
16909 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
16910 .init_verbs
= { alc861vd_volume_init_verbs
,
16911 alc861vd_6stack_init_verbs
},
16912 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16913 .dac_nids
= alc861vd_dac_nids
,
16914 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16915 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
16916 .channel_mode
= alc861vd_6stack_modes
,
16917 .input_mux
= &alc861vd_capture_source
,
16919 [ALC861VD_LENOVO
] = {
16920 .mixers
= { alc861vd_lenovo_mixer
},
16921 .init_verbs
= { alc861vd_volume_init_verbs
,
16922 alc861vd_3stack_init_verbs
,
16923 alc861vd_eapd_verbs
,
16924 alc861vd_lenovo_unsol_verbs
},
16925 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16926 .dac_nids
= alc660vd_dac_nids
,
16927 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16928 .channel_mode
= alc861vd_3stack_2ch_modes
,
16929 .input_mux
= &alc861vd_capture_source
,
16930 .unsol_event
= alc861vd_lenovo_unsol_event
,
16931 .setup
= alc861vd_lenovo_setup
,
16932 .init_hook
= alc861vd_lenovo_init_hook
,
16934 [ALC861VD_DALLAS
] = {
16935 .mixers
= { alc861vd_dallas_mixer
},
16936 .init_verbs
= { alc861vd_dallas_verbs
},
16937 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16938 .dac_nids
= alc861vd_dac_nids
,
16939 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16940 .channel_mode
= alc861vd_3stack_2ch_modes
,
16941 .input_mux
= &alc861vd_dallas_capture_source
,
16942 .unsol_event
= alc_automute_amp_unsol_event
,
16943 .setup
= alc861vd_dallas_setup
,
16944 .init_hook
= alc_automute_amp
,
16947 .mixers
= { alc861vd_hp_mixer
},
16948 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
16949 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16950 .dac_nids
= alc861vd_dac_nids
,
16951 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16952 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16953 .channel_mode
= alc861vd_3stack_2ch_modes
,
16954 .input_mux
= &alc861vd_hp_capture_source
,
16955 .unsol_event
= alc_automute_amp_unsol_event
,
16956 .setup
= alc861vd_dallas_setup
,
16957 .init_hook
= alc_automute_amp
,
16959 [ALC660VD_ASUS_V1S
] = {
16960 .mixers
= { alc861vd_lenovo_mixer
},
16961 .init_verbs
= { alc861vd_volume_init_verbs
,
16962 alc861vd_3stack_init_verbs
,
16963 alc861vd_eapd_verbs
,
16964 alc861vd_lenovo_unsol_verbs
},
16965 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16966 .dac_nids
= alc660vd_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
,
16971 .unsol_event
= alc861vd_lenovo_unsol_event
,
16972 .setup
= alc861vd_lenovo_setup
,
16973 .init_hook
= alc861vd_lenovo_init_hook
,
16978 * BIOS auto configuration
16980 static int alc861vd_auto_create_input_ctls(struct hda_codec
*codec
,
16981 const struct auto_pin_cfg
*cfg
)
16983 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x22, 0);
16987 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
16988 hda_nid_t nid
, int pin_type
, int dac_idx
)
16990 alc_set_pin_output(codec
, nid
, pin_type
);
16993 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
16995 struct alc_spec
*spec
= codec
->spec
;
16998 for (i
= 0; i
<= HDA_SIDE
; i
++) {
16999 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
17000 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
17002 alc861vd_auto_set_output_and_unmute(codec
, nid
,
17008 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
17010 struct alc_spec
*spec
= codec
->spec
;
17013 pin
= spec
->autocfg
.hp_pins
[0];
17014 if (pin
) /* connect to front and use dac 0 */
17015 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
17016 pin
= spec
->autocfg
.speaker_pins
[0];
17018 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
17021 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17023 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
17025 struct alc_spec
*spec
= codec
->spec
;
17026 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
17029 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
17030 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
17031 if (alc_is_input_pin(codec
, nid
)) {
17032 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
17033 if (nid
!= ALC861VD_PIN_CD_NID
&&
17034 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
17035 snd_hda_codec_write(codec
, nid
, 0,
17036 AC_VERB_SET_AMP_GAIN_MUTE
,
17042 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17044 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17045 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17047 /* add playback controls from the parsed DAC table */
17048 /* Based on ALC880 version. But ALC861VD has separate,
17049 * different NIDs for mute/unmute switch and volume control */
17050 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
17051 const struct auto_pin_cfg
*cfg
)
17053 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
17054 const char *pfx
= alc_get_line_out_pfx(cfg
, true);
17055 hda_nid_t nid_v
, nid_s
;
17058 for (i
= 0; i
< cfg
->line_outs
; i
++) {
17059 if (!spec
->multiout
.dac_nids
[i
])
17061 nid_v
= alc861vd_idx_to_mixer_vol(
17063 spec
->multiout
.dac_nids
[i
]));
17064 nid_s
= alc861vd_idx_to_mixer_switch(
17066 spec
->multiout
.dac_nids
[i
]));
17068 if (!pfx
&& i
== 2) {
17070 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17072 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
17076 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17078 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
17082 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17084 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
17088 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17090 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
17095 const char *name
= pfx
;
17098 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17100 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
17104 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17106 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
17115 /* add playback controls for speaker and HP outputs */
17116 /* Based on ALC880 version. But ALC861VD has separate,
17117 * different NIDs for mute/unmute switch and volume control */
17118 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
17119 hda_nid_t pin
, const char *pfx
)
17121 hda_nid_t nid_v
, nid_s
;
17127 if (alc880_is_fixed_pin(pin
)) {
17128 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
17129 /* specify the DAC as the extra output */
17130 if (!spec
->multiout
.hp_nid
)
17131 spec
->multiout
.hp_nid
= nid_v
;
17133 spec
->multiout
.extra_out_nid
[0] = nid_v
;
17134 /* control HP volume/switch on the output mixer amp */
17135 nid_v
= alc861vd_idx_to_mixer_vol(
17136 alc880_fixed_pin_idx(pin
));
17137 nid_s
= alc861vd_idx_to_mixer_switch(
17138 alc880_fixed_pin_idx(pin
));
17140 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
17141 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
17144 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
17145 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
17148 } else if (alc880_is_multi_pin(pin
)) {
17149 /* set manual connection */
17150 /* we have only a switch on HP-out PIN */
17151 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
17152 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
17159 /* parse the BIOS configuration and set up the alc_spec
17160 * return 1 if successful, 0 if the proper config is not found,
17161 * or a negative error code
17162 * Based on ALC880 version - had to change it to override
17163 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17164 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
17166 struct alc_spec
*spec
= codec
->spec
;
17168 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
17170 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
17174 if (!spec
->autocfg
.line_outs
)
17175 return 0; /* can't find valid BIOS pin config */
17177 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
17180 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
17183 err
= alc861vd_auto_create_extra_out(spec
,
17184 spec
->autocfg
.speaker_pins
[0],
17188 err
= alc861vd_auto_create_extra_out(spec
,
17189 spec
->autocfg
.hp_pins
[0],
17193 err
= alc861vd_auto_create_input_ctls(codec
, &spec
->autocfg
);
17197 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
17199 alc_auto_parse_digital(codec
);
17201 if (spec
->kctls
.list
)
17202 add_mixer(spec
, spec
->kctls
.list
);
17204 add_verb(spec
, alc861vd_volume_init_verbs
);
17206 spec
->num_mux_defs
= 1;
17207 spec
->input_mux
= &spec
->private_imux
[0];
17209 err
= alc_auto_add_mic_boost(codec
);
17213 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
17218 /* additional initialization for auto-configuration model */
17219 static void alc861vd_auto_init(struct hda_codec
*codec
)
17221 struct alc_spec
*spec
= codec
->spec
;
17222 alc861vd_auto_init_multi_out(codec
);
17223 alc861vd_auto_init_hp_out(codec
);
17224 alc861vd_auto_init_analog_input(codec
);
17225 alc861vd_auto_init_input_src(codec
);
17226 alc_auto_init_digital(codec
);
17227 if (spec
->unsol_event
)
17228 alc_inithook(codec
);
17232 ALC660VD_FIX_ASUS_GPIO1
17236 static const struct alc_fixup alc861vd_fixups
[] = {
17237 [ALC660VD_FIX_ASUS_GPIO1
] = {
17238 .verbs
= (const struct hda_verb
[]) {
17239 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
17240 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
17241 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
17247 static struct snd_pci_quirk alc861vd_fixup_tbl
[] = {
17248 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1
),
17252 static int patch_alc861vd(struct hda_codec
*codec
)
17254 struct alc_spec
*spec
;
17255 int err
, board_config
;
17257 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
17261 codec
->spec
= spec
;
17263 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
17267 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
17268 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
17270 board_config
= ALC861VD_AUTO
;
17273 if (board_config
== ALC861VD_AUTO
)
17274 alc_pick_fixup(codec
, alc861vd_fixup_tbl
, alc861vd_fixups
, 1);
17276 if (board_config
== ALC861VD_AUTO
) {
17277 /* automatic parse from the BIOS config */
17278 err
= alc861vd_parse_auto_config(codec
);
17284 "hda_codec: Cannot set up configuration "
17285 "from BIOS. Using base mode...\n");
17286 board_config
= ALC861VD_3ST
;
17290 err
= snd_hda_attach_beep_device(codec
, 0x23);
17296 if (board_config
!= ALC861VD_AUTO
)
17297 setup_preset(codec
, &alc861vd_presets
[board_config
]);
17299 if (codec
->vendor_id
== 0x10ec0660) {
17300 /* always turn on EAPD */
17301 add_verb(spec
, alc660vd_eapd_verbs
);
17304 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
17305 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
17307 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
17308 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
17310 if (!spec
->adc_nids
) {
17311 spec
->adc_nids
= alc861vd_adc_nids
;
17312 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
17314 if (!spec
->capsrc_nids
)
17315 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
17317 set_capture_mixer(codec
);
17318 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
17320 spec
->vmaster_nid
= 0x02;
17322 if (board_config
== ALC861VD_AUTO
)
17323 alc_pick_fixup(codec
, alc861vd_fixup_tbl
, alc861vd_fixups
, 0);
17325 codec
->patch_ops
= alc_patch_ops
;
17327 if (board_config
== ALC861VD_AUTO
)
17328 spec
->init_hook
= alc861vd_auto_init
;
17329 #ifdef CONFIG_SND_HDA_POWER_SAVE
17330 if (!spec
->loopback
.amplist
)
17331 spec
->loopback
.amplist
= alc861vd_loopbacks
;
17340 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17341 * configuration. Each pin widget can choose any input DACs and a mixer.
17342 * Each ADC is connected from a mixer of all inputs. This makes possible
17343 * 6-channel independent captures.
17345 * In addition, an independent DAC for the multi-playback (not used in this
17348 #define ALC662_DIGOUT_NID 0x06
17349 #define ALC662_DIGIN_NID 0x0a
17351 static hda_nid_t alc662_dac_nids
[4] = {
17352 /* front, rear, clfe, rear_surr */
17356 static hda_nid_t alc272_dac_nids
[2] = {
17360 static hda_nid_t alc662_adc_nids
[2] = {
17365 static hda_nid_t alc272_adc_nids
[1] = {
17370 static hda_nid_t alc662_capsrc_nids
[2] = { 0x22, 0x23 };
17371 static hda_nid_t alc272_capsrc_nids
[1] = { 0x23 };
17375 /* FIXME: should be a matrix-type input source selection */
17376 static struct hda_input_mux alc662_capture_source
= {
17380 { "Front Mic", 0x1 },
17386 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
17394 static struct hda_input_mux alc663_capture_source
= {
17398 { "Front Mic", 0x1 },
17403 #if 0 /* set to 1 for testing other input sources below */
17404 static struct hda_input_mux alc272_nc10_capture_source
= {
17407 { "Autoselect Mic", 0x0 },
17408 { "Internal Mic", 0x1 },
17409 { "In-0x02", 0x2 },
17410 { "In-0x03", 0x3 },
17411 { "In-0x04", 0x4 },
17412 { "In-0x05", 0x5 },
17413 { "In-0x06", 0x6 },
17414 { "In-0x07", 0x7 },
17415 { "In-0x08", 0x8 },
17416 { "In-0x09", 0x9 },
17417 { "In-0x0a", 0x0a },
17418 { "In-0x0b", 0x0b },
17419 { "In-0x0c", 0x0c },
17420 { "In-0x0d", 0x0d },
17421 { "In-0x0e", 0x0e },
17422 { "In-0x0f", 0x0f },
17430 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
17437 static struct hda_verb alc662_3ST_ch2_init
[] = {
17438 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17439 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17440 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17441 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17448 static struct hda_verb alc662_3ST_ch6_init
[] = {
17449 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17450 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17451 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
17452 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17453 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17454 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
17458 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
17459 { 2, alc662_3ST_ch2_init
},
17460 { 6, alc662_3ST_ch6_init
},
17466 static struct hda_verb alc662_sixstack_ch6_init
[] = {
17467 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
17468 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
17469 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17476 static struct hda_verb alc662_sixstack_ch8_init
[] = {
17477 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17478 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17479 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17483 static struct hda_channel_mode alc662_5stack_modes
[2] = {
17484 { 2, alc662_sixstack_ch6_init
},
17485 { 6, alc662_sixstack_ch8_init
},
17488 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17489 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17492 static struct snd_kcontrol_new alc662_base_mixer
[] = {
17493 /* output mixer control */
17494 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
17495 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17496 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
17497 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
17498 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17499 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17500 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
17501 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
17502 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17504 /*Input mixer control */
17505 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
17506 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
17507 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
17508 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
17509 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
17510 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
17511 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
17512 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
17516 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
17517 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17518 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17519 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17520 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
17521 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
17522 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17523 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17526 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17527 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17531 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
17532 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17533 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17534 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17535 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
17536 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17537 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17538 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
17539 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
17540 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17541 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
17542 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
17543 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17544 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17545 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17546 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17547 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17548 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17552 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
17553 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17554 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
17555 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17556 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
17557 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17558 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17559 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17561 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17565 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
17566 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17567 ALC262_HIPPO_MASTER_SWITCH
,
17569 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
17570 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17571 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17573 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
17574 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17575 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17579 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
17580 ALC262_HIPPO_MASTER_SWITCH
,
17581 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17582 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17583 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17584 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17585 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
17586 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17587 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17593 static struct hda_bind_ctls alc663_asus_bind_master_vol
= {
17594 .ops
= &snd_hda_bind_vol
,
17596 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
17597 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
17602 static struct hda_bind_ctls alc663_asus_one_bind_switch
= {
17603 .ops
= &snd_hda_bind_sw
,
17605 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17606 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17611 static struct snd_kcontrol_new alc663_m51va_mixer
[] = {
17612 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17613 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch
),
17614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17615 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17619 static struct hda_bind_ctls alc663_asus_tree_bind_switch
= {
17620 .ops
= &snd_hda_bind_sw
,
17622 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17623 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17624 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17629 static struct snd_kcontrol_new alc663_two_hp_m1_mixer
[] = {
17630 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17631 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch
),
17632 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17633 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17634 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17635 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17640 static struct hda_bind_ctls alc663_asus_four_bind_switch
= {
17641 .ops
= &snd_hda_bind_sw
,
17643 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17644 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17645 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17650 static struct snd_kcontrol_new alc663_two_hp_m2_mixer
[] = {
17651 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17652 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch
),
17653 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17654 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17655 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17656 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17660 static struct snd_kcontrol_new alc662_1bjd_mixer
[] = {
17661 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17662 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17664 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17665 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17666 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17667 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17671 static struct hda_bind_ctls alc663_asus_two_bind_master_vol
= {
17672 .ops
= &snd_hda_bind_vol
,
17674 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
17675 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT
),
17680 static struct hda_bind_ctls alc663_asus_two_bind_switch
= {
17681 .ops
= &snd_hda_bind_sw
,
17683 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17684 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT
),
17689 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer
[] = {
17690 HDA_BIND_VOL("Master Playback Volume",
17691 &alc663_asus_two_bind_master_vol
),
17692 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
17693 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17694 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17700 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer
[] = {
17701 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17702 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
17703 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17704 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17705 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17706 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17710 static struct snd_kcontrol_new alc663_g71v_mixer
[] = {
17711 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17712 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17713 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17714 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17715 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17717 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17718 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17719 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17720 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17724 static struct snd_kcontrol_new alc663_g50v_mixer
[] = {
17725 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17726 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17727 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17730 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17731 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17732 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17733 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17734 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17738 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch
= {
17739 .ops
= &snd_hda_bind_sw
,
17741 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17742 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17743 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17744 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17745 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17750 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch
= {
17751 .ops
= &snd_hda_bind_sw
,
17753 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17754 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17759 static struct snd_kcontrol_new alc663_mode7_mixer
[] = {
17760 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17761 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17762 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17763 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17764 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17765 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17766 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17772 static struct snd_kcontrol_new alc663_mode8_mixer
[] = {
17773 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17774 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17775 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17776 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17777 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17784 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
17786 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
17787 .name
= "Channel Mode",
17788 .info
= alc_ch_mode_info
,
17789 .get
= alc_ch_mode_get
,
17790 .put
= alc_ch_mode_put
,
17795 static struct hda_verb alc662_init_verbs
[] = {
17796 /* ADC: mute amp left and right */
17797 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17798 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
17800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17801 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17802 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17804 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17805 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17807 /* Front Pin: output 0 (0x0c) */
17808 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17811 /* Rear Pin: output 1 (0x0d) */
17812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17815 /* CLFE Pin: output 2 (0x0e) */
17816 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17817 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17819 /* Mic (rear) pin: input vref at 80% */
17820 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17822 /* Front Mic pin: input vref at 80% */
17823 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17824 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17825 /* Line In pin: input */
17826 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17827 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17828 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17829 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17830 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17831 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
17832 /* CD pin widget for input */
17833 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17835 /* FIXME: use matrix-type input source selection */
17836 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17838 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17839 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17841 /* always trun on EAPD */
17842 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17843 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17848 static struct hda_verb alc663_init_verbs
[] = {
17849 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17850 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17851 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17852 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17853 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17854 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17858 static struct hda_verb alc272_init_verbs
[] = {
17859 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17860 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17861 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17862 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17863 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17864 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17865 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17866 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17870 static struct hda_verb alc662_sue_init_verbs
[] = {
17871 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
17872 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
17876 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
17877 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17878 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17882 /* Set Unsolicited Event*/
17883 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
17884 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17885 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17889 static struct hda_verb alc663_m51va_init_verbs
[] = {
17890 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17891 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17892 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17893 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17894 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17895 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17896 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17897 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17898 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17902 static struct hda_verb alc663_21jd_amic_init_verbs
[] = {
17903 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17904 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17905 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17908 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17909 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17913 static struct hda_verb alc662_1bjd_amic_init_verbs
[] = {
17914 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17915 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17916 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17917 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
17918 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17919 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17920 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17921 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17925 static struct hda_verb alc663_15jd_amic_init_verbs
[] = {
17926 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17928 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17929 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17930 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17931 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17932 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17936 static struct hda_verb alc663_two_hp_amic_m1_init_verbs
[] = {
17937 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17938 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17939 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17940 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
17941 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17942 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17943 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
17944 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17945 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17946 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17947 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17948 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17952 static struct hda_verb alc663_two_hp_amic_m2_init_verbs
[] = {
17953 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17954 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17955 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17956 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17958 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17959 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17960 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17961 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17962 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17963 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17964 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17968 static struct hda_verb alc663_g71v_init_verbs
[] = {
17969 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17970 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17971 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17973 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17974 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17975 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
17977 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
17978 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
17979 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
17983 static struct hda_verb alc663_g50v_init_verbs
[] = {
17984 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17985 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17986 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
17988 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17989 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17993 static struct hda_verb alc662_ecs_init_verbs
[] = {
17994 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
17995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17996 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17997 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18001 static struct hda_verb alc272_dell_zm1_init_verbs
[] = {
18002 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18003 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
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
, 0x01}, /* Headphone */
18009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18011 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18012 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18016 static struct hda_verb alc272_dell_init_verbs
[] = {
18017 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18018 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18019 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18020 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18021 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18022 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18023 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18024 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18025 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18026 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18027 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18031 static struct hda_verb alc663_mode7_init_verbs
[] = {
18032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18033 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18034 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
18035 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18036 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18037 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18038 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
18039 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18040 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18041 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18042 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18043 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18044 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18045 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18046 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18050 static struct hda_verb alc663_mode8_init_verbs
[] = {
18051 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18054 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
18055 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18056 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
18057 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18058 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18059 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18060 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18061 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18064 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18065 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18066 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18070 static struct snd_kcontrol_new alc662_auto_capture_mixer
[] = {
18071 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
18072 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
18076 static struct snd_kcontrol_new alc272_auto_capture_mixer
[] = {
18077 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
18078 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
18082 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
18084 unsigned int present
;
18085 unsigned char bits
;
18087 present
= snd_hda_jack_detect(codec
, 0x14);
18088 bits
= present
? HDA_AMP_MUTE
: 0;
18090 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
18091 HDA_AMP_MUTE
, bits
);
18094 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
18096 unsigned int present
;
18097 unsigned char bits
;
18099 present
= snd_hda_jack_detect(codec
, 0x1b);
18100 bits
= present
? HDA_AMP_MUTE
: 0;
18102 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
18103 HDA_AMP_MUTE
, bits
);
18104 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
18105 HDA_AMP_MUTE
, bits
);
18108 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
18111 if ((res
>> 26) == ALC880_HP_EVENT
)
18112 alc662_lenovo_101e_all_automute(codec
);
18113 if ((res
>> 26) == ALC880_FRONT_EVENT
)
18114 alc662_lenovo_101e_ispeaker_automute(codec
);
18117 /* unsolicited event for HP jack sensing */
18118 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
18121 if ((res
>> 26) == ALC880_MIC_EVENT
)
18122 alc_mic_automute(codec
);
18124 alc262_hippo_unsol_event(codec
, res
);
18127 static void alc662_eeepc_setup(struct hda_codec
*codec
)
18129 struct alc_spec
*spec
= codec
->spec
;
18131 alc262_hippo1_setup(codec
);
18132 spec
->ext_mic
.pin
= 0x18;
18133 spec
->ext_mic
.mux_idx
= 0;
18134 spec
->int_mic
.pin
= 0x19;
18135 spec
->int_mic
.mux_idx
= 1;
18136 spec
->auto_mic
= 1;
18139 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
18141 alc262_hippo_automute(codec
);
18142 alc_mic_automute(codec
);
18145 static void alc662_eeepc_ep20_setup(struct hda_codec
*codec
)
18147 struct alc_spec
*spec
= codec
->spec
;
18149 spec
->autocfg
.hp_pins
[0] = 0x14;
18150 spec
->autocfg
.speaker_pins
[0] = 0x1b;
18153 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18155 static void alc663_m51va_speaker_automute(struct hda_codec
*codec
)
18157 unsigned int present
;
18158 unsigned char bits
;
18160 present
= snd_hda_jack_detect(codec
, 0x21);
18161 bits
= present
? HDA_AMP_MUTE
: 0;
18162 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
18163 HDA_AMP_MUTE
, bits
);
18164 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
18165 HDA_AMP_MUTE
, bits
);
18168 static void alc663_21jd_two_speaker_automute(struct hda_codec
*codec
)
18170 unsigned int present
;
18171 unsigned char bits
;
18173 present
= snd_hda_jack_detect(codec
, 0x21);
18174 bits
= present
? HDA_AMP_MUTE
: 0;
18175 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
18176 HDA_AMP_MUTE
, bits
);
18177 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
18178 HDA_AMP_MUTE
, bits
);
18179 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
18180 HDA_AMP_MUTE
, bits
);
18181 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
18182 HDA_AMP_MUTE
, bits
);
18185 static void alc663_15jd_two_speaker_automute(struct hda_codec
*codec
)
18187 unsigned int present
;
18188 unsigned char bits
;
18190 present
= snd_hda_jack_detect(codec
, 0x15);
18191 bits
= present
? HDA_AMP_MUTE
: 0;
18192 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
18193 HDA_AMP_MUTE
, bits
);
18194 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
18195 HDA_AMP_MUTE
, bits
);
18196 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
18197 HDA_AMP_MUTE
, bits
);
18198 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
18199 HDA_AMP_MUTE
, bits
);
18202 static void alc662_f5z_speaker_automute(struct hda_codec
*codec
)
18204 unsigned int present
;
18205 unsigned char bits
;
18207 present
= snd_hda_jack_detect(codec
, 0x1b);
18208 bits
= present
? 0 : PIN_OUT
;
18209 snd_hda_codec_write(codec
, 0x14, 0,
18210 AC_VERB_SET_PIN_WIDGET_CONTROL
, bits
);
18213 static void alc663_two_hp_m1_speaker_automute(struct hda_codec
*codec
)
18215 unsigned int present1
, present2
;
18217 present1
= snd_hda_jack_detect(codec
, 0x21);
18218 present2
= snd_hda_jack_detect(codec
, 0x15);
18220 if (present1
|| present2
) {
18221 snd_hda_codec_write_cache(codec
, 0x14, 0,
18222 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
18224 snd_hda_codec_write_cache(codec
, 0x14, 0,
18225 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
18229 static void alc663_two_hp_m2_speaker_automute(struct hda_codec
*codec
)
18231 unsigned int present1
, present2
;
18233 present1
= snd_hda_jack_detect(codec
, 0x1b);
18234 present2
= snd_hda_jack_detect(codec
, 0x15);
18236 if (present1
|| present2
) {
18237 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
18238 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
18239 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
18240 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
18242 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
18244 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
18249 static void alc663_two_hp_m7_speaker_automute(struct hda_codec
*codec
)
18251 unsigned int present1
, present2
;
18253 present1
= snd_hda_codec_read(codec
, 0x1b, 0,
18254 AC_VERB_GET_PIN_SENSE
, 0)
18255 & AC_PINSENSE_PRESENCE
;
18256 present2
= snd_hda_codec_read(codec
, 0x21, 0,
18257 AC_VERB_GET_PIN_SENSE
, 0)
18258 & AC_PINSENSE_PRESENCE
;
18260 if (present1
|| present2
) {
18261 snd_hda_codec_write_cache(codec
, 0x14, 0,
18262 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
18263 snd_hda_codec_write_cache(codec
, 0x17, 0,
18264 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
18266 snd_hda_codec_write_cache(codec
, 0x14, 0,
18267 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
18268 snd_hda_codec_write_cache(codec
, 0x17, 0,
18269 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
18273 static void alc663_two_hp_m8_speaker_automute(struct hda_codec
*codec
)
18275 unsigned int present1
, present2
;
18277 present1
= snd_hda_codec_read(codec
, 0x21, 0,
18278 AC_VERB_GET_PIN_SENSE
, 0)
18279 & AC_PINSENSE_PRESENCE
;
18280 present2
= snd_hda_codec_read(codec
, 0x15, 0,
18281 AC_VERB_GET_PIN_SENSE
, 0)
18282 & AC_PINSENSE_PRESENCE
;
18284 if (present1
|| present2
) {
18285 snd_hda_codec_write_cache(codec
, 0x14, 0,
18286 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
18287 snd_hda_codec_write_cache(codec
, 0x17, 0,
18288 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
18290 snd_hda_codec_write_cache(codec
, 0x14, 0,
18291 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
18292 snd_hda_codec_write_cache(codec
, 0x17, 0,
18293 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
18297 static void alc663_m51va_unsol_event(struct hda_codec
*codec
,
18300 switch (res
>> 26) {
18301 case ALC880_HP_EVENT
:
18302 alc663_m51va_speaker_automute(codec
);
18304 case ALC880_MIC_EVENT
:
18305 alc_mic_automute(codec
);
18310 static void alc663_m51va_setup(struct hda_codec
*codec
)
18312 struct alc_spec
*spec
= codec
->spec
;
18313 spec
->ext_mic
.pin
= 0x18;
18314 spec
->ext_mic
.mux_idx
= 0;
18315 spec
->int_mic
.pin
= 0x12;
18316 spec
->int_mic
.mux_idx
= 9;
18317 spec
->auto_mic
= 1;
18320 static void alc663_m51va_inithook(struct hda_codec
*codec
)
18322 alc663_m51va_speaker_automute(codec
);
18323 alc_mic_automute(codec
);
18326 /* ***************** Mode1 ******************************/
18327 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18329 static void alc663_mode1_setup(struct hda_codec
*codec
)
18331 struct alc_spec
*spec
= codec
->spec
;
18332 spec
->ext_mic
.pin
= 0x18;
18333 spec
->ext_mic
.mux_idx
= 0;
18334 spec
->int_mic
.pin
= 0x19;
18335 spec
->int_mic
.mux_idx
= 1;
18336 spec
->auto_mic
= 1;
18339 #define alc663_mode1_inithook alc663_m51va_inithook
18341 /* ***************** Mode2 ******************************/
18342 static void alc662_mode2_unsol_event(struct hda_codec
*codec
,
18345 switch (res
>> 26) {
18346 case ALC880_HP_EVENT
:
18347 alc662_f5z_speaker_automute(codec
);
18349 case ALC880_MIC_EVENT
:
18350 alc_mic_automute(codec
);
18355 #define alc662_mode2_setup alc663_mode1_setup
18357 static void alc662_mode2_inithook(struct hda_codec
*codec
)
18359 alc662_f5z_speaker_automute(codec
);
18360 alc_mic_automute(codec
);
18362 /* ***************** Mode3 ******************************/
18363 static void alc663_mode3_unsol_event(struct hda_codec
*codec
,
18366 switch (res
>> 26) {
18367 case ALC880_HP_EVENT
:
18368 alc663_two_hp_m1_speaker_automute(codec
);
18370 case ALC880_MIC_EVENT
:
18371 alc_mic_automute(codec
);
18376 #define alc663_mode3_setup alc663_mode1_setup
18378 static void alc663_mode3_inithook(struct hda_codec
*codec
)
18380 alc663_two_hp_m1_speaker_automute(codec
);
18381 alc_mic_automute(codec
);
18383 /* ***************** Mode4 ******************************/
18384 static void alc663_mode4_unsol_event(struct hda_codec
*codec
,
18387 switch (res
>> 26) {
18388 case ALC880_HP_EVENT
:
18389 alc663_21jd_two_speaker_automute(codec
);
18391 case ALC880_MIC_EVENT
:
18392 alc_mic_automute(codec
);
18397 #define alc663_mode4_setup alc663_mode1_setup
18399 static void alc663_mode4_inithook(struct hda_codec
*codec
)
18401 alc663_21jd_two_speaker_automute(codec
);
18402 alc_mic_automute(codec
);
18404 /* ***************** Mode5 ******************************/
18405 static void alc663_mode5_unsol_event(struct hda_codec
*codec
,
18408 switch (res
>> 26) {
18409 case ALC880_HP_EVENT
:
18410 alc663_15jd_two_speaker_automute(codec
);
18412 case ALC880_MIC_EVENT
:
18413 alc_mic_automute(codec
);
18418 #define alc663_mode5_setup alc663_mode1_setup
18420 static void alc663_mode5_inithook(struct hda_codec
*codec
)
18422 alc663_15jd_two_speaker_automute(codec
);
18423 alc_mic_automute(codec
);
18425 /* ***************** Mode6 ******************************/
18426 static void alc663_mode6_unsol_event(struct hda_codec
*codec
,
18429 switch (res
>> 26) {
18430 case ALC880_HP_EVENT
:
18431 alc663_two_hp_m2_speaker_automute(codec
);
18433 case ALC880_MIC_EVENT
:
18434 alc_mic_automute(codec
);
18439 #define alc663_mode6_setup alc663_mode1_setup
18441 static void alc663_mode6_inithook(struct hda_codec
*codec
)
18443 alc663_two_hp_m2_speaker_automute(codec
);
18444 alc_mic_automute(codec
);
18447 /* ***************** Mode7 ******************************/
18448 static void alc663_mode7_unsol_event(struct hda_codec
*codec
,
18451 switch (res
>> 26) {
18452 case ALC880_HP_EVENT
:
18453 alc663_two_hp_m7_speaker_automute(codec
);
18455 case ALC880_MIC_EVENT
:
18456 alc_mic_automute(codec
);
18461 #define alc663_mode7_setup alc663_mode1_setup
18463 static void alc663_mode7_inithook(struct hda_codec
*codec
)
18465 alc663_two_hp_m7_speaker_automute(codec
);
18466 alc_mic_automute(codec
);
18469 /* ***************** Mode8 ******************************/
18470 static void alc663_mode8_unsol_event(struct hda_codec
*codec
,
18473 switch (res
>> 26) {
18474 case ALC880_HP_EVENT
:
18475 alc663_two_hp_m8_speaker_automute(codec
);
18477 case ALC880_MIC_EVENT
:
18478 alc_mic_automute(codec
);
18483 #define alc663_mode8_setup alc663_m51va_setup
18485 static void alc663_mode8_inithook(struct hda_codec
*codec
)
18487 alc663_two_hp_m8_speaker_automute(codec
);
18488 alc_mic_automute(codec
);
18491 static void alc663_g71v_hp_automute(struct hda_codec
*codec
)
18493 unsigned int present
;
18494 unsigned char bits
;
18496 present
= snd_hda_jack_detect(codec
, 0x21);
18497 bits
= present
? HDA_AMP_MUTE
: 0;
18498 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
18499 HDA_AMP_MUTE
, bits
);
18500 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
18501 HDA_AMP_MUTE
, bits
);
18504 static void alc663_g71v_front_automute(struct hda_codec
*codec
)
18506 unsigned int present
;
18507 unsigned char bits
;
18509 present
= snd_hda_jack_detect(codec
, 0x15);
18510 bits
= present
? HDA_AMP_MUTE
: 0;
18511 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
18512 HDA_AMP_MUTE
, bits
);
18515 static void alc663_g71v_unsol_event(struct hda_codec
*codec
,
18518 switch (res
>> 26) {
18519 case ALC880_HP_EVENT
:
18520 alc663_g71v_hp_automute(codec
);
18522 case ALC880_FRONT_EVENT
:
18523 alc663_g71v_front_automute(codec
);
18525 case ALC880_MIC_EVENT
:
18526 alc_mic_automute(codec
);
18531 #define alc663_g71v_setup alc663_m51va_setup
18533 static void alc663_g71v_inithook(struct hda_codec
*codec
)
18535 alc663_g71v_front_automute(codec
);
18536 alc663_g71v_hp_automute(codec
);
18537 alc_mic_automute(codec
);
18540 static void alc663_g50v_unsol_event(struct hda_codec
*codec
,
18543 switch (res
>> 26) {
18544 case ALC880_HP_EVENT
:
18545 alc663_m51va_speaker_automute(codec
);
18547 case ALC880_MIC_EVENT
:
18548 alc_mic_automute(codec
);
18553 #define alc663_g50v_setup alc663_m51va_setup
18555 static void alc663_g50v_inithook(struct hda_codec
*codec
)
18557 alc663_m51va_speaker_automute(codec
);
18558 alc_mic_automute(codec
);
18561 static struct snd_kcontrol_new alc662_ecs_mixer
[] = {
18562 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
18563 ALC262_HIPPO_MASTER_SWITCH
,
18565 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT
),
18566 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT
),
18567 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT
),
18569 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
18570 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
18571 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
18575 static struct snd_kcontrol_new alc272_nc10_mixer
[] = {
18576 /* Master Playback automatically created from Speaker and Headphone */
18577 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
18578 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
18579 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
18580 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
18582 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
18583 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
18584 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
18586 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
18587 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
18588 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
18592 #ifdef CONFIG_SND_HDA_POWER_SAVE
18593 #define alc662_loopbacks alc880_loopbacks
18597 /* pcm configuration: identical with ALC880 */
18598 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18599 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18600 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18601 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18604 * configuration and preset
18606 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
18607 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
18608 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
18609 [ALC662_3ST_6ch
] = "3stack-6ch",
18610 [ALC662_5ST_DIG
] = "6stack-dig",
18611 [ALC662_LENOVO_101E
] = "lenovo-101e",
18612 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
18613 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
18614 [ALC662_ECS
] = "ecs",
18615 [ALC663_ASUS_M51VA
] = "m51va",
18616 [ALC663_ASUS_G71V
] = "g71v",
18617 [ALC663_ASUS_H13
] = "h13",
18618 [ALC663_ASUS_G50V
] = "g50v",
18619 [ALC663_ASUS_MODE1
] = "asus-mode1",
18620 [ALC662_ASUS_MODE2
] = "asus-mode2",
18621 [ALC663_ASUS_MODE3
] = "asus-mode3",
18622 [ALC663_ASUS_MODE4
] = "asus-mode4",
18623 [ALC663_ASUS_MODE5
] = "asus-mode5",
18624 [ALC663_ASUS_MODE6
] = "asus-mode6",
18625 [ALC663_ASUS_MODE7
] = "asus-mode7",
18626 [ALC663_ASUS_MODE8
] = "asus-mode8",
18627 [ALC272_DELL
] = "dell",
18628 [ALC272_DELL_ZM1
] = "dell-zm1",
18629 [ALC272_SAMSUNG_NC10
] = "samsung-nc10",
18630 [ALC662_AUTO
] = "auto",
18633 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
18634 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS
),
18635 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL
),
18636 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1
),
18637 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1
),
18638 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3
),
18639 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1
),
18640 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3
),
18641 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1
),
18642 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2
),
18643 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1
),
18644 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1
),
18645 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1
),
18646 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2
),
18647 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7
),
18648 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7
),
18649 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8
),
18650 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3
),
18651 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1
),
18652 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2
),
18653 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2
),
18654 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1
),
18655 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2
),
18656 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6
),
18657 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6
),
18658 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2
),
18659 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1
),
18660 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3
),
18661 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA
),
18662 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2
),
18663 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2
),
18664 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5
),
18665 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6
),
18666 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2
),
18667 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1
),
18668 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2
),
18669 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2
),
18670 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
18671 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18672 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3
),
18673 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3
),
18674 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1
),
18675 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1
),
18676 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1
),
18677 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1
),
18678 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1
),
18679 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2
),
18680 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2
),
18681 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1
),
18682 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1
),
18683 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3
),
18684 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1
),
18685 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1
),
18686 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V
),
18687 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18688 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1
),
18689 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2
),
18690 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA
),
18691 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1
),
18692 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4
),
18693 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
18694 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
18695 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
18696 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS
),
18697 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18698 ALC662_3ST_6ch_DIG
),
18699 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO
),
18700 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10
),
18701 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18702 ALC662_3ST_6ch_DIG
),
18703 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13
),
18704 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG
),
18705 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA
),
18706 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
18707 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18708 ALC662_3ST_6ch_DIG
),
18709 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18714 static struct alc_config_preset alc662_presets
[] = {
18715 [ALC662_3ST_2ch_DIG
] = {
18716 .mixers
= { alc662_3ST_2ch_mixer
},
18717 .init_verbs
= { alc662_init_verbs
},
18718 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18719 .dac_nids
= alc662_dac_nids
,
18720 .dig_out_nid
= ALC662_DIGOUT_NID
,
18721 .dig_in_nid
= ALC662_DIGIN_NID
,
18722 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18723 .channel_mode
= alc662_3ST_2ch_modes
,
18724 .input_mux
= &alc662_capture_source
,
18726 [ALC662_3ST_6ch_DIG
] = {
18727 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18728 .init_verbs
= { alc662_init_verbs
},
18729 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18730 .dac_nids
= alc662_dac_nids
,
18731 .dig_out_nid
= ALC662_DIGOUT_NID
,
18732 .dig_in_nid
= ALC662_DIGIN_NID
,
18733 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18734 .channel_mode
= alc662_3ST_6ch_modes
,
18736 .input_mux
= &alc662_capture_source
,
18738 [ALC662_3ST_6ch
] = {
18739 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18740 .init_verbs
= { alc662_init_verbs
},
18741 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18742 .dac_nids
= alc662_dac_nids
,
18743 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18744 .channel_mode
= alc662_3ST_6ch_modes
,
18746 .input_mux
= &alc662_capture_source
,
18748 [ALC662_5ST_DIG
] = {
18749 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
},
18750 .init_verbs
= { alc662_init_verbs
},
18751 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18752 .dac_nids
= alc662_dac_nids
,
18753 .dig_out_nid
= ALC662_DIGOUT_NID
,
18754 .dig_in_nid
= ALC662_DIGIN_NID
,
18755 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
18756 .channel_mode
= alc662_5stack_modes
,
18757 .input_mux
= &alc662_capture_source
,
18759 [ALC662_LENOVO_101E
] = {
18760 .mixers
= { alc662_lenovo_101e_mixer
},
18761 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
18762 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18763 .dac_nids
= alc662_dac_nids
,
18764 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18765 .channel_mode
= alc662_3ST_2ch_modes
,
18766 .input_mux
= &alc662_lenovo_101e_capture_source
,
18767 .unsol_event
= alc662_lenovo_101e_unsol_event
,
18768 .init_hook
= alc662_lenovo_101e_all_automute
,
18770 [ALC662_ASUS_EEEPC_P701
] = {
18771 .mixers
= { alc662_eeepc_p701_mixer
},
18772 .init_verbs
= { alc662_init_verbs
,
18773 alc662_eeepc_sue_init_verbs
},
18774 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18775 .dac_nids
= alc662_dac_nids
,
18776 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18777 .channel_mode
= alc662_3ST_2ch_modes
,
18778 .unsol_event
= alc662_eeepc_unsol_event
,
18779 .setup
= alc662_eeepc_setup
,
18780 .init_hook
= alc662_eeepc_inithook
,
18782 [ALC662_ASUS_EEEPC_EP20
] = {
18783 .mixers
= { alc662_eeepc_ep20_mixer
,
18784 alc662_chmode_mixer
},
18785 .init_verbs
= { alc662_init_verbs
,
18786 alc662_eeepc_ep20_sue_init_verbs
},
18787 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18788 .dac_nids
= alc662_dac_nids
,
18789 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18790 .channel_mode
= alc662_3ST_6ch_modes
,
18791 .input_mux
= &alc662_lenovo_101e_capture_source
,
18792 .unsol_event
= alc662_eeepc_unsol_event
,
18793 .setup
= alc662_eeepc_ep20_setup
,
18794 .init_hook
= alc662_eeepc_ep20_inithook
,
18797 .mixers
= { alc662_ecs_mixer
},
18798 .init_verbs
= { alc662_init_verbs
,
18799 alc662_ecs_init_verbs
},
18800 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18801 .dac_nids
= alc662_dac_nids
,
18802 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18803 .channel_mode
= alc662_3ST_2ch_modes
,
18804 .unsol_event
= alc662_eeepc_unsol_event
,
18805 .setup
= alc662_eeepc_setup
,
18806 .init_hook
= alc662_eeepc_inithook
,
18808 [ALC663_ASUS_M51VA
] = {
18809 .mixers
= { alc663_m51va_mixer
},
18810 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
18811 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18812 .dac_nids
= alc662_dac_nids
,
18813 .dig_out_nid
= ALC662_DIGOUT_NID
,
18814 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18815 .channel_mode
= alc662_3ST_2ch_modes
,
18816 .unsol_event
= alc663_m51va_unsol_event
,
18817 .setup
= alc663_m51va_setup
,
18818 .init_hook
= alc663_m51va_inithook
,
18820 [ALC663_ASUS_G71V
] = {
18821 .mixers
= { alc663_g71v_mixer
},
18822 .init_verbs
= { alc662_init_verbs
, alc663_g71v_init_verbs
},
18823 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18824 .dac_nids
= alc662_dac_nids
,
18825 .dig_out_nid
= ALC662_DIGOUT_NID
,
18826 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18827 .channel_mode
= alc662_3ST_2ch_modes
,
18828 .unsol_event
= alc663_g71v_unsol_event
,
18829 .setup
= alc663_g71v_setup
,
18830 .init_hook
= alc663_g71v_inithook
,
18832 [ALC663_ASUS_H13
] = {
18833 .mixers
= { alc663_m51va_mixer
},
18834 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
18835 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18836 .dac_nids
= alc662_dac_nids
,
18837 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18838 .channel_mode
= alc662_3ST_2ch_modes
,
18839 .unsol_event
= alc663_m51va_unsol_event
,
18840 .init_hook
= alc663_m51va_inithook
,
18842 [ALC663_ASUS_G50V
] = {
18843 .mixers
= { alc663_g50v_mixer
},
18844 .init_verbs
= { alc662_init_verbs
, alc663_g50v_init_verbs
},
18845 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18846 .dac_nids
= alc662_dac_nids
,
18847 .dig_out_nid
= ALC662_DIGOUT_NID
,
18848 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18849 .channel_mode
= alc662_3ST_6ch_modes
,
18850 .input_mux
= &alc663_capture_source
,
18851 .unsol_event
= alc663_g50v_unsol_event
,
18852 .setup
= alc663_g50v_setup
,
18853 .init_hook
= alc663_g50v_inithook
,
18855 [ALC663_ASUS_MODE1
] = {
18856 .mixers
= { alc663_m51va_mixer
},
18857 .cap_mixer
= alc662_auto_capture_mixer
,
18858 .init_verbs
= { alc662_init_verbs
,
18859 alc663_21jd_amic_init_verbs
},
18860 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18862 .dac_nids
= alc662_dac_nids
,
18863 .dig_out_nid
= ALC662_DIGOUT_NID
,
18864 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18865 .channel_mode
= alc662_3ST_2ch_modes
,
18866 .unsol_event
= alc663_mode1_unsol_event
,
18867 .setup
= alc663_mode1_setup
,
18868 .init_hook
= alc663_mode1_inithook
,
18870 [ALC662_ASUS_MODE2
] = {
18871 .mixers
= { alc662_1bjd_mixer
},
18872 .cap_mixer
= alc662_auto_capture_mixer
,
18873 .init_verbs
= { alc662_init_verbs
,
18874 alc662_1bjd_amic_init_verbs
},
18875 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18876 .dac_nids
= alc662_dac_nids
,
18877 .dig_out_nid
= ALC662_DIGOUT_NID
,
18878 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18879 .channel_mode
= alc662_3ST_2ch_modes
,
18880 .unsol_event
= alc662_mode2_unsol_event
,
18881 .setup
= alc662_mode2_setup
,
18882 .init_hook
= alc662_mode2_inithook
,
18884 [ALC663_ASUS_MODE3
] = {
18885 .mixers
= { alc663_two_hp_m1_mixer
},
18886 .cap_mixer
= alc662_auto_capture_mixer
,
18887 .init_verbs
= { alc662_init_verbs
,
18888 alc663_two_hp_amic_m1_init_verbs
},
18889 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18891 .dac_nids
= alc662_dac_nids
,
18892 .dig_out_nid
= ALC662_DIGOUT_NID
,
18893 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18894 .channel_mode
= alc662_3ST_2ch_modes
,
18895 .unsol_event
= alc663_mode3_unsol_event
,
18896 .setup
= alc663_mode3_setup
,
18897 .init_hook
= alc663_mode3_inithook
,
18899 [ALC663_ASUS_MODE4
] = {
18900 .mixers
= { alc663_asus_21jd_clfe_mixer
},
18901 .cap_mixer
= alc662_auto_capture_mixer
,
18902 .init_verbs
= { alc662_init_verbs
,
18903 alc663_21jd_amic_init_verbs
},
18904 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18906 .dac_nids
= alc662_dac_nids
,
18907 .dig_out_nid
= ALC662_DIGOUT_NID
,
18908 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18909 .channel_mode
= alc662_3ST_2ch_modes
,
18910 .unsol_event
= alc663_mode4_unsol_event
,
18911 .setup
= alc663_mode4_setup
,
18912 .init_hook
= alc663_mode4_inithook
,
18914 [ALC663_ASUS_MODE5
] = {
18915 .mixers
= { alc663_asus_15jd_clfe_mixer
},
18916 .cap_mixer
= alc662_auto_capture_mixer
,
18917 .init_verbs
= { alc662_init_verbs
,
18918 alc663_15jd_amic_init_verbs
},
18919 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18921 .dac_nids
= alc662_dac_nids
,
18922 .dig_out_nid
= ALC662_DIGOUT_NID
,
18923 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18924 .channel_mode
= alc662_3ST_2ch_modes
,
18925 .unsol_event
= alc663_mode5_unsol_event
,
18926 .setup
= alc663_mode5_setup
,
18927 .init_hook
= alc663_mode5_inithook
,
18929 [ALC663_ASUS_MODE6
] = {
18930 .mixers
= { alc663_two_hp_m2_mixer
},
18931 .cap_mixer
= alc662_auto_capture_mixer
,
18932 .init_verbs
= { alc662_init_verbs
,
18933 alc663_two_hp_amic_m2_init_verbs
},
18934 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18936 .dac_nids
= alc662_dac_nids
,
18937 .dig_out_nid
= ALC662_DIGOUT_NID
,
18938 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18939 .channel_mode
= alc662_3ST_2ch_modes
,
18940 .unsol_event
= alc663_mode6_unsol_event
,
18941 .setup
= alc663_mode6_setup
,
18942 .init_hook
= alc663_mode6_inithook
,
18944 [ALC663_ASUS_MODE7
] = {
18945 .mixers
= { alc663_mode7_mixer
},
18946 .cap_mixer
= alc662_auto_capture_mixer
,
18947 .init_verbs
= { alc662_init_verbs
,
18948 alc663_mode7_init_verbs
},
18949 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18951 .dac_nids
= alc662_dac_nids
,
18952 .dig_out_nid
= ALC662_DIGOUT_NID
,
18953 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18954 .channel_mode
= alc662_3ST_2ch_modes
,
18955 .unsol_event
= alc663_mode7_unsol_event
,
18956 .setup
= alc663_mode7_setup
,
18957 .init_hook
= alc663_mode7_inithook
,
18959 [ALC663_ASUS_MODE8
] = {
18960 .mixers
= { alc663_mode8_mixer
},
18961 .cap_mixer
= alc662_auto_capture_mixer
,
18962 .init_verbs
= { alc662_init_verbs
,
18963 alc663_mode8_init_verbs
},
18964 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18966 .dac_nids
= alc662_dac_nids
,
18967 .dig_out_nid
= ALC662_DIGOUT_NID
,
18968 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18969 .channel_mode
= alc662_3ST_2ch_modes
,
18970 .unsol_event
= alc663_mode8_unsol_event
,
18971 .setup
= alc663_mode8_setup
,
18972 .init_hook
= alc663_mode8_inithook
,
18975 .mixers
= { alc663_m51va_mixer
},
18976 .cap_mixer
= alc272_auto_capture_mixer
,
18977 .init_verbs
= { alc662_init_verbs
, alc272_dell_init_verbs
},
18978 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18979 .dac_nids
= alc662_dac_nids
,
18980 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18981 .adc_nids
= alc272_adc_nids
,
18982 .num_adc_nids
= ARRAY_SIZE(alc272_adc_nids
),
18983 .capsrc_nids
= alc272_capsrc_nids
,
18984 .channel_mode
= alc662_3ST_2ch_modes
,
18985 .unsol_event
= alc663_m51va_unsol_event
,
18986 .setup
= alc663_m51va_setup
,
18987 .init_hook
= alc663_m51va_inithook
,
18989 [ALC272_DELL_ZM1
] = {
18990 .mixers
= { alc663_m51va_mixer
},
18991 .cap_mixer
= alc662_auto_capture_mixer
,
18992 .init_verbs
= { alc662_init_verbs
, alc272_dell_zm1_init_verbs
},
18993 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18994 .dac_nids
= alc662_dac_nids
,
18995 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18996 .adc_nids
= alc662_adc_nids
,
18998 .capsrc_nids
= alc662_capsrc_nids
,
18999 .channel_mode
= alc662_3ST_2ch_modes
,
19000 .unsol_event
= alc663_m51va_unsol_event
,
19001 .setup
= alc663_m51va_setup
,
19002 .init_hook
= alc663_m51va_inithook
,
19004 [ALC272_SAMSUNG_NC10
] = {
19005 .mixers
= { alc272_nc10_mixer
},
19006 .init_verbs
= { alc662_init_verbs
,
19007 alc663_21jd_amic_init_verbs
},
19008 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
19009 .dac_nids
= alc272_dac_nids
,
19010 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
19011 .channel_mode
= alc662_3ST_2ch_modes
,
19012 /*.input_mux = &alc272_nc10_capture_source,*/
19013 .unsol_event
= alc663_mode4_unsol_event
,
19014 .setup
= alc663_mode4_setup
,
19015 .init_hook
= alc663_mode4_inithook
,
19021 * BIOS auto configuration
19024 /* convert from MIX nid to DAC */
19025 static inline hda_nid_t
alc662_mix_to_dac(hda_nid_t nid
)
19029 else if (nid
>= 0x0c && nid
<= 0x0e)
19030 return nid
- 0x0c + 0x02;
19031 else if (nid
== 0x26) /* ALC887-VD has this DAC too */
19037 /* get MIX nid connected to the given pin targeted to DAC */
19038 static hda_nid_t
alc662_dac_to_mix(struct hda_codec
*codec
, hda_nid_t pin
,
19044 num
= snd_hda_get_connections(codec
, pin
, mix
, ARRAY_SIZE(mix
));
19045 for (i
= 0; i
< num
; i
++) {
19046 if (alc662_mix_to_dac(mix
[i
]) == dac
)
19052 /* look for an empty DAC slot */
19053 static hda_nid_t
alc662_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
19055 struct alc_spec
*spec
= codec
->spec
;
19059 num
= snd_hda_get_connections(codec
, pin
, srcs
, ARRAY_SIZE(srcs
));
19062 for (i
= 0; i
< num
; i
++) {
19063 hda_nid_t nid
= alc662_mix_to_dac(srcs
[i
]);
19066 for (j
= 0; j
< spec
->multiout
.num_dacs
; j
++)
19067 if (spec
->multiout
.dac_nids
[j
] == nid
)
19069 if (j
>= spec
->multiout
.num_dacs
)
19075 /* fill in the dac_nids table from the parsed pin configuration */
19076 static int alc662_auto_fill_dac_nids(struct hda_codec
*codec
,
19077 const struct auto_pin_cfg
*cfg
)
19079 struct alc_spec
*spec
= codec
->spec
;
19083 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
19084 for (i
= 0; i
< cfg
->line_outs
; i
++) {
19085 dac
= alc662_look_for_dac(codec
, cfg
->line_out_pins
[i
]);
19088 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
19093 static inline int __alc662_add_vol_ctl(struct alc_spec
*spec
, const char *pfx
,
19094 hda_nid_t nid
, int idx
, unsigned int chs
)
19096 return __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, idx
,
19097 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
19100 static inline int __alc662_add_sw_ctl(struct alc_spec
*spec
, const char *pfx
,
19101 hda_nid_t nid
, int idx
, unsigned int chs
)
19103 return __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
,
19104 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_INPUT
));
19107 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19108 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19109 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19110 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19111 #define alc662_add_stereo_vol(spec, pfx, nid) \
19112 alc662_add_vol_ctl(spec, pfx, nid, 3)
19113 #define alc662_add_stereo_sw(spec, pfx, nid) \
19114 alc662_add_sw_ctl(spec, pfx, nid, 3)
19116 /* add playback controls from the parsed DAC table */
19117 static int alc662_auto_create_multi_out_ctls(struct hda_codec
*codec
,
19118 const struct auto_pin_cfg
*cfg
)
19120 struct alc_spec
*spec
= codec
->spec
;
19121 static const char *chname
[4] = {
19122 "Front", "Surround", NULL
/*CLFE*/, "Side"
19124 const char *pfx
= alc_get_line_out_pfx(cfg
, true);
19125 hda_nid_t nid
, mix
;
19128 for (i
= 0; i
< cfg
->line_outs
; i
++) {
19129 nid
= spec
->multiout
.dac_nids
[i
];
19132 mix
= alc662_dac_to_mix(codec
, cfg
->line_out_pins
[i
], nid
);
19135 if (!pfx
&& i
== 2) {
19137 err
= alc662_add_vol_ctl(spec
, "Center", nid
, 1);
19140 err
= alc662_add_vol_ctl(spec
, "LFE", nid
, 2);
19143 err
= alc662_add_sw_ctl(spec
, "Center", mix
, 1);
19146 err
= alc662_add_sw_ctl(spec
, "LFE", mix
, 2);
19150 const char *name
= pfx
;
19153 err
= __alc662_add_vol_ctl(spec
, name
, nid
, i
, 3);
19156 err
= __alc662_add_sw_ctl(spec
, name
, mix
, i
, 3);
19164 /* add playback controls for speaker and HP outputs */
19165 /* return DAC nid if any new DAC is assigned */
19166 static int alc662_auto_create_extra_out(struct hda_codec
*codec
, hda_nid_t pin
,
19169 struct alc_spec
*spec
= codec
->spec
;
19170 hda_nid_t nid
, mix
;
19175 nid
= alc662_look_for_dac(codec
, pin
);
19177 /* the corresponding DAC is already occupied */
19178 if (!(get_wcaps(codec
, pin
) & AC_WCAP_OUT_AMP
))
19179 return 0; /* no way */
19180 /* create a switch only */
19181 return add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
19182 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
19185 mix
= alc662_dac_to_mix(codec
, pin
, nid
);
19188 err
= alc662_add_vol_ctl(spec
, pfx
, nid
, 3);
19191 err
= alc662_add_sw_ctl(spec
, pfx
, mix
, 3);
19197 /* create playback/capture controls for input pins */
19198 #define alc662_auto_create_input_ctls \
19199 alc882_auto_create_input_ctls
19201 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
19202 hda_nid_t nid
, int pin_type
,
19206 hda_nid_t srcs
[HDA_MAX_CONNECTIONS
];
19208 alc_set_pin_output(codec
, nid
, pin_type
);
19209 /* need the manual connection? */
19210 num
= snd_hda_get_connections(codec
, nid
, srcs
, ARRAY_SIZE(srcs
));
19213 for (i
= 0; i
< num
; i
++) {
19214 if (alc662_mix_to_dac(srcs
[i
]) != dac
)
19216 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, i
);
19221 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
19223 struct alc_spec
*spec
= codec
->spec
;
19224 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
19227 for (i
= 0; i
<= HDA_SIDE
; i
++) {
19228 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
19230 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
19231 spec
->multiout
.dac_nids
[i
]);
19235 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
19237 struct alc_spec
*spec
= codec
->spec
;
19240 pin
= spec
->autocfg
.hp_pins
[0];
19242 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
19243 spec
->multiout
.hp_nid
);
19244 pin
= spec
->autocfg
.speaker_pins
[0];
19246 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
,
19247 spec
->multiout
.extra_out_nid
[0]);
19250 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19252 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
19254 struct alc_spec
*spec
= codec
->spec
;
19255 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19258 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19259 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
19260 if (alc_is_input_pin(codec
, nid
)) {
19261 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
19262 if (nid
!= ALC662_PIN_CD_NID
&&
19263 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
19264 snd_hda_codec_write(codec
, nid
, 0,
19265 AC_VERB_SET_AMP_GAIN_MUTE
,
19271 #define alc662_auto_init_input_src alc882_auto_init_input_src
19273 static int alc662_parse_auto_config(struct hda_codec
*codec
)
19275 struct alc_spec
*spec
= codec
->spec
;
19277 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
19279 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
19283 if (!spec
->autocfg
.line_outs
)
19284 return 0; /* can't find valid BIOS pin config */
19286 err
= alc662_auto_fill_dac_nids(codec
, &spec
->autocfg
);
19289 err
= alc662_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
19292 err
= alc662_auto_create_extra_out(codec
,
19293 spec
->autocfg
.speaker_pins
[0],
19298 spec
->multiout
.extra_out_nid
[0] = err
;
19299 err
= alc662_auto_create_extra_out(codec
, spec
->autocfg
.hp_pins
[0],
19304 spec
->multiout
.hp_nid
= err
;
19305 err
= alc662_auto_create_input_ctls(codec
, &spec
->autocfg
);
19309 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
19311 alc_auto_parse_digital(codec
);
19313 if (spec
->kctls
.list
)
19314 add_mixer(spec
, spec
->kctls
.list
);
19316 spec
->num_mux_defs
= 1;
19317 spec
->input_mux
= &spec
->private_imux
[0];
19319 add_verb(spec
, alc662_init_verbs
);
19320 if (codec
->vendor_id
== 0x10ec0272 || codec
->vendor_id
== 0x10ec0663 ||
19321 codec
->vendor_id
== 0x10ec0665 || codec
->vendor_id
== 0x10ec0670)
19322 add_verb(spec
, alc663_init_verbs
);
19324 if (codec
->vendor_id
== 0x10ec0272)
19325 add_verb(spec
, alc272_init_verbs
);
19327 err
= alc_auto_add_mic_boost(codec
);
19331 if (codec
->vendor_id
== 0x10ec0272 || codec
->vendor_id
== 0x10ec0663 ||
19332 codec
->vendor_id
== 0x10ec0665 || codec
->vendor_id
== 0x10ec0670)
19333 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0x21);
19335 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
19340 /* additional initialization for auto-configuration model */
19341 static void alc662_auto_init(struct hda_codec
*codec
)
19343 struct alc_spec
*spec
= codec
->spec
;
19344 alc662_auto_init_multi_out(codec
);
19345 alc662_auto_init_hp_out(codec
);
19346 alc662_auto_init_analog_input(codec
);
19347 alc662_auto_init_input_src(codec
);
19348 alc_auto_init_digital(codec
);
19349 if (spec
->unsol_event
)
19350 alc_inithook(codec
);
19353 static void alc272_fixup_mario(struct hda_codec
*codec
,
19354 const struct alc_fixup
*fix
, int pre_init
) {
19355 if (snd_hda_override_amp_caps(codec
, 0x2, HDA_OUTPUT
,
19356 (0x3b << AC_AMPCAP_OFFSET_SHIFT
) |
19357 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT
) |
19358 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
19359 (0 << AC_AMPCAP_MUTE_SHIFT
)))
19360 printk(KERN_WARNING
19361 "hda_codec: failed to override amp caps for NID 0x2\n");
19365 ALC662_FIXUP_ASPIRE
,
19366 ALC662_FIXUP_IDEAPAD
,
19367 ALC272_FIXUP_MARIO
,
19370 static const struct alc_fixup alc662_fixups
[] = {
19371 [ALC662_FIXUP_ASPIRE
] = {
19372 .pins
= (const struct alc_pincfg
[]) {
19373 { 0x15, 0x99130112 }, /* subwoofer */
19377 [ALC662_FIXUP_IDEAPAD
] = {
19378 .pins
= (const struct alc_pincfg
[]) {
19379 { 0x17, 0x99130112 }, /* subwoofer */
19383 [ALC272_FIXUP_MARIO
] = {
19384 .func
= alc272_fixup_mario
,
19388 static struct snd_pci_quirk alc662_fixup_tbl
[] = {
19389 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE
),
19390 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD
),
19391 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD
),
19392 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD
),
19396 static const struct alc_model_fixup alc662_fixup_models
[] = {
19397 {.id
= ALC272_FIXUP_MARIO
, .name
= "mario"},
19402 static int patch_alc662(struct hda_codec
*codec
)
19404 struct alc_spec
*spec
;
19405 int err
, board_config
;
19408 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
19412 codec
->spec
= spec
;
19414 alc_auto_parse_customize_define(codec
);
19416 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
19418 coef
= alc_read_coef_idx(codec
, 0);
19419 if (coef
== 0x8020 || coef
== 0x8011)
19420 alc_codec_rename(codec
, "ALC661");
19421 else if (coef
& (1 << 14) &&
19422 codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
19423 spec
->cdefine
.platform_type
== 1)
19424 alc_codec_rename(codec
, "ALC272X");
19425 else if (coef
== 0x4011)
19426 alc_codec_rename(codec
, "ALC656");
19428 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
19431 if (board_config
< 0) {
19432 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
19434 board_config
= ALC662_AUTO
;
19437 if (board_config
== ALC662_AUTO
) {
19438 alc_pick_fixup(codec
, alc662_fixup_tbl
, alc662_fixups
, 1);
19439 /* automatic parse from the BIOS config */
19440 err
= alc662_parse_auto_config(codec
);
19446 "hda_codec: Cannot set up configuration "
19447 "from BIOS. Using base mode...\n");
19448 board_config
= ALC662_3ST_2ch_DIG
;
19452 if (has_cdefine_beep(codec
)) {
19453 err
= snd_hda_attach_beep_device(codec
, 0x1);
19460 if (board_config
!= ALC662_AUTO
)
19461 setup_preset(codec
, &alc662_presets
[board_config
]);
19463 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
19464 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
19466 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
19467 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
19469 if (!spec
->adc_nids
) {
19470 spec
->adc_nids
= alc662_adc_nids
;
19471 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
19473 if (!spec
->capsrc_nids
)
19474 spec
->capsrc_nids
= alc662_capsrc_nids
;
19476 if (!spec
->cap_mixer
)
19477 set_capture_mixer(codec
);
19479 if (has_cdefine_beep(codec
)) {
19480 switch (codec
->vendor_id
) {
19482 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
19487 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
19490 set_beep_amp(spec
, 0x0b, 0x03, HDA_INPUT
);
19494 spec
->vmaster_nid
= 0x02;
19496 codec
->patch_ops
= alc_patch_ops
;
19497 if (board_config
== ALC662_AUTO
) {
19498 spec
->init_hook
= alc662_auto_init
;
19499 alc_pick_fixup_model(codec
, alc662_fixup_models
,
19500 alc662_fixup_tbl
, alc662_fixups
, 0);
19503 alc_init_jacks(codec
);
19505 #ifdef CONFIG_SND_HDA_POWER_SAVE
19506 if (!spec
->loopback
.amplist
)
19507 spec
->loopback
.amplist
= alc662_loopbacks
;
19513 static int patch_alc888(struct hda_codec
*codec
)
19515 if ((alc_read_coef_idx(codec
, 0) & 0x00f0)==0x0030){
19516 kfree(codec
->chip_name
);
19517 if (codec
->vendor_id
== 0x10ec0887)
19518 codec
->chip_name
= kstrdup("ALC887-VD", GFP_KERNEL
);
19520 codec
->chip_name
= kstrdup("ALC888-VD", GFP_KERNEL
);
19521 if (!codec
->chip_name
) {
19525 return patch_alc662(codec
);
19527 return patch_alc882(codec
);
19533 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19534 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19535 #define alc680_modes alc260_modes
19537 static hda_nid_t alc680_dac_nids
[3] = {
19538 /* Lout1, Lout2, hp */
19542 static hda_nid_t alc680_adc_nids
[3] = {
19544 /* DMIC, MIC, Line-in*/
19549 * Analog capture ADC cgange
19551 static void alc680_rec_autoswitch(struct hda_codec
*codec
)
19553 struct alc_spec
*spec
= codec
->spec
;
19554 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19556 int type_found
= AUTO_PIN_LAST
;
19560 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19561 nid
= cfg
->inputs
[i
].pin
;
19562 if (!(snd_hda_query_pin_caps(codec
, nid
) &
19563 AC_PINCAP_PRES_DETECT
))
19565 if (snd_hda_jack_detect(codec
, nid
)) {
19566 if (cfg
->inputs
[i
].type
< type_found
) {
19567 type_found
= cfg
->inputs
[i
].type
;
19575 snd_hda_get_connections(codec
, pin_found
, &nid
, 1);
19577 if (nid
!= spec
->cur_adc
)
19578 __snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
, 1);
19579 spec
->cur_adc
= nid
;
19580 snd_hda_codec_setup_stream(codec
, nid
, spec
->cur_adc_stream_tag
, 0,
19581 spec
->cur_adc_format
);
19584 static int alc680_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
19585 struct hda_codec
*codec
,
19586 unsigned int stream_tag
,
19587 unsigned int format
,
19588 struct snd_pcm_substream
*substream
)
19590 struct alc_spec
*spec
= codec
->spec
;
19592 spec
->cur_adc
= 0x07;
19593 spec
->cur_adc_stream_tag
= stream_tag
;
19594 spec
->cur_adc_format
= format
;
19596 alc680_rec_autoswitch(codec
);
19600 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
19601 struct hda_codec
*codec
,
19602 struct snd_pcm_substream
*substream
)
19604 snd_hda_codec_cleanup_stream(codec
, 0x07);
19605 snd_hda_codec_cleanup_stream(codec
, 0x08);
19606 snd_hda_codec_cleanup_stream(codec
, 0x09);
19610 static struct hda_pcm_stream alc680_pcm_analog_auto_capture
= {
19611 .substreams
= 1, /* can be overridden */
19614 /* NID is set in alc_build_pcms */
19616 .prepare
= alc680_capture_pcm_prepare
,
19617 .cleanup
= alc680_capture_pcm_cleanup
19621 static struct snd_kcontrol_new alc680_base_mixer
[] = {
19622 /* output mixer control */
19623 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
19624 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
19625 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT
),
19626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
19627 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT
),
19628 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
19629 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT
),
19633 static struct hda_bind_ctls alc680_bind_cap_vol
= {
19634 .ops
= &snd_hda_bind_vol
,
19636 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT
),
19637 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
19638 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
19643 static struct hda_bind_ctls alc680_bind_cap_switch
= {
19644 .ops
= &snd_hda_bind_sw
,
19646 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT
),
19647 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
19648 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
19653 static struct snd_kcontrol_new alc680_master_capture_mixer
[] = {
19654 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol
),
19655 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch
),
19660 * generic initialization of ADC, input mixers and output mixers
19662 static struct hda_verb alc680_init_verbs
[] = {
19663 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19664 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19665 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19667 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
19668 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
19669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
19670 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
19671 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
19672 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
19674 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19675 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19676 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19677 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19678 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19680 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
19681 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
19682 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
19687 /* toggle speaker-output according to the hp-jack state */
19688 static void alc680_base_setup(struct hda_codec
*codec
)
19690 struct alc_spec
*spec
= codec
->spec
;
19692 spec
->autocfg
.hp_pins
[0] = 0x16;
19693 spec
->autocfg
.speaker_pins
[0] = 0x14;
19694 spec
->autocfg
.speaker_pins
[1] = 0x15;
19695 spec
->autocfg
.num_inputs
= 2;
19696 spec
->autocfg
.inputs
[0].pin
= 0x18;
19697 spec
->autocfg
.inputs
[0].type
= AUTO_PIN_MIC
;
19698 spec
->autocfg
.inputs
[1].pin
= 0x19;
19699 spec
->autocfg
.inputs
[1].type
= AUTO_PIN_LINE_IN
;
19702 static void alc680_unsol_event(struct hda_codec
*codec
,
19705 if ((res
>> 26) == ALC880_HP_EVENT
)
19706 alc_automute_amp(codec
);
19707 if ((res
>> 26) == ALC880_MIC_EVENT
)
19708 alc680_rec_autoswitch(codec
);
19711 static void alc680_inithook(struct hda_codec
*codec
)
19713 alc_automute_amp(codec
);
19714 alc680_rec_autoswitch(codec
);
19717 /* create input playback/capture controls for the given pin */
19718 static int alc680_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
19719 const char *ctlname
, int idx
)
19737 if (spec
->multiout
.dac_nids
[0] != dac
&&
19738 spec
->multiout
.dac_nids
[1] != dac
) {
19739 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
19740 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
19745 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
19746 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
19750 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
19756 /* add playback controls from the parsed DAC table */
19757 static int alc680_auto_create_multi_out_ctls(struct alc_spec
*spec
,
19758 const struct auto_pin_cfg
*cfg
)
19763 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
19765 nid
= cfg
->line_out_pins
[0];
19768 if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
19772 err
= alc680_new_analog_output(spec
, nid
, name
, 0);
19777 nid
= cfg
->speaker_pins
[0];
19779 err
= alc680_new_analog_output(spec
, nid
, "Speaker", 0);
19783 nid
= cfg
->hp_pins
[0];
19785 err
= alc680_new_analog_output(spec
, nid
, "Headphone", 0);
19793 static void alc680_auto_set_output_and_unmute(struct hda_codec
*codec
,
19794 hda_nid_t nid
, int pin_type
)
19796 alc_set_pin_output(codec
, nid
, pin_type
);
19799 static void alc680_auto_init_multi_out(struct hda_codec
*codec
)
19801 struct alc_spec
*spec
= codec
->spec
;
19802 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[0];
19804 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
19805 alc680_auto_set_output_and_unmute(codec
, nid
, pin_type
);
19809 static void alc680_auto_init_hp_out(struct hda_codec
*codec
)
19811 struct alc_spec
*spec
= codec
->spec
;
19814 pin
= spec
->autocfg
.hp_pins
[0];
19816 alc680_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
19817 pin
= spec
->autocfg
.speaker_pins
[0];
19819 alc680_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
19822 /* pcm configuration: identical with ALC880 */
19823 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19824 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19825 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19826 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19827 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19830 * BIOS auto configuration
19832 static int alc680_parse_auto_config(struct hda_codec
*codec
)
19834 struct alc_spec
*spec
= codec
->spec
;
19836 static hda_nid_t alc680_ignore
[] = { 0 };
19838 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
19843 if (!spec
->autocfg
.line_outs
) {
19844 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
19845 spec
->multiout
.max_channels
= 2;
19846 spec
->no_analog
= 1;
19849 return 0; /* can't find valid BIOS pin config */
19851 err
= alc680_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
19855 spec
->multiout
.max_channels
= 2;
19858 /* digital only support output */
19859 alc_auto_parse_digital(codec
);
19860 if (spec
->kctls
.list
)
19861 add_mixer(spec
, spec
->kctls
.list
);
19863 add_verb(spec
, alc680_init_verbs
);
19865 err
= alc_auto_add_mic_boost(codec
);
19872 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19874 /* init callback for auto-configuration model -- overriding the default init */
19875 static void alc680_auto_init(struct hda_codec
*codec
)
19877 struct alc_spec
*spec
= codec
->spec
;
19878 alc680_auto_init_multi_out(codec
);
19879 alc680_auto_init_hp_out(codec
);
19880 alc680_auto_init_analog_input(codec
);
19881 alc_auto_init_digital(codec
);
19882 if (spec
->unsol_event
)
19883 alc_inithook(codec
);
19887 * configuration and preset
19889 static const char *alc680_models
[ALC680_MODEL_LAST
] = {
19890 [ALC680_BASE
] = "base",
19891 [ALC680_AUTO
] = "auto",
19894 static struct snd_pci_quirk alc680_cfg_tbl
[] = {
19895 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE
),
19899 static struct alc_config_preset alc680_presets
[] = {
19901 .mixers
= { alc680_base_mixer
},
19902 .cap_mixer
= alc680_master_capture_mixer
,
19903 .init_verbs
= { alc680_init_verbs
},
19904 .num_dacs
= ARRAY_SIZE(alc680_dac_nids
),
19905 .dac_nids
= alc680_dac_nids
,
19906 .dig_out_nid
= ALC680_DIGOUT_NID
,
19907 .num_channel_mode
= ARRAY_SIZE(alc680_modes
),
19908 .channel_mode
= alc680_modes
,
19909 .unsol_event
= alc680_unsol_event
,
19910 .setup
= alc680_base_setup
,
19911 .init_hook
= alc680_inithook
,
19916 static int patch_alc680(struct hda_codec
*codec
)
19918 struct alc_spec
*spec
;
19922 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
19926 codec
->spec
= spec
;
19928 board_config
= snd_hda_check_board_config(codec
, ALC680_MODEL_LAST
,
19932 if (board_config
< 0 || board_config
>= ALC680_MODEL_LAST
) {
19933 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
19935 board_config
= ALC680_AUTO
;
19938 if (board_config
== ALC680_AUTO
) {
19939 /* automatic parse from the BIOS config */
19940 err
= alc680_parse_auto_config(codec
);
19946 "hda_codec: Cannot set up configuration "
19947 "from BIOS. Using base mode...\n");
19948 board_config
= ALC680_BASE
;
19952 if (board_config
!= ALC680_AUTO
)
19953 setup_preset(codec
, &alc680_presets
[board_config
]);
19955 spec
->stream_analog_playback
= &alc680_pcm_analog_playback
;
19956 spec
->stream_analog_capture
= &alc680_pcm_analog_auto_capture
;
19957 spec
->stream_digital_playback
= &alc680_pcm_digital_playback
;
19958 spec
->stream_digital_capture
= &alc680_pcm_digital_capture
;
19960 if (!spec
->adc_nids
) {
19961 spec
->adc_nids
= alc680_adc_nids
;
19962 spec
->num_adc_nids
= ARRAY_SIZE(alc680_adc_nids
);
19965 if (!spec
->cap_mixer
)
19966 set_capture_mixer(codec
);
19968 spec
->vmaster_nid
= 0x02;
19970 codec
->patch_ops
= alc_patch_ops
;
19971 if (board_config
== ALC680_AUTO
)
19972 spec
->init_hook
= alc680_auto_init
;
19980 static struct hda_codec_preset snd_hda_preset_realtek
[] = {
19981 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
19982 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
19983 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
19984 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
19985 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
19986 { .id
= 0x10ec0270, .name
= "ALC270", .patch
= patch_alc269
},
19987 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
19988 { .id
= 0x10ec0275, .name
= "ALC275", .patch
= patch_alc269
},
19989 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
19990 .patch
= patch_alc861
},
19991 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
19992 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
19993 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
19994 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
19995 .patch
= patch_alc882
},
19996 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
19997 .patch
= patch_alc662
},
19998 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
19999 { .id
= 0x10ec0665, .name
= "ALC665", .patch
= patch_alc662
},
20000 { .id
= 0x10ec0670, .name
= "ALC670", .patch
= patch_alc662
},
20001 { .id
= 0x10ec0680, .name
= "ALC680", .patch
= patch_alc680
},
20002 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
20003 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
20004 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc882
},
20005 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
20006 .patch
= patch_alc882
},
20007 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
20008 .patch
= patch_alc882
},
20009 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
20010 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc888
},
20011 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
20012 .patch
= patch_alc882
},
20013 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc888
},
20014 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc882
},
20015 { .id
= 0x10ec0892, .name
= "ALC892", .patch
= patch_alc662
},
20016 {} /* terminator */
20019 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20021 MODULE_LICENSE("GPL");
20022 MODULE_DESCRIPTION("Realtek HD-audio codec");
20024 static struct hda_codec_preset_list realtek_list
= {
20025 .preset
= snd_hda_preset_realtek
,
20026 .owner
= THIS_MODULE
,
20029 static int __init
patch_realtek_init(void)
20031 return snd_hda_add_codec_preset(&realtek_list
);
20034 static void __exit
patch_realtek_exit(void)
20036 snd_hda_delete_codec_preset(&realtek_list
);
20039 module_init(patch_realtek_init
)
20040 module_exit(patch_realtek_exit
)