2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST
/* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST
/* last tag */
97 ALC262_HP_BPC_D7000_WL
,
98 ALC262_HP_BPC_D7000_WF
,
111 ALC262_MODEL_LAST
/* last tag */
121 ALC268_ACER_ASPIRE_ONE
,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST
/* last tag */
143 ALC269_MODEL_LAST
/* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701
,
183 ALC662_ASUS_EEEPC_EP20
,
225 ALC883_TARGA_2ch_DIG
,
226 ALC883_TARGA_8ch_DIG
,
229 ALC888_ACER_ASPIRE_4930G
,
230 ALC888_ACER_ASPIRE_6530G
,
231 ALC888_ACER_ASPIRE_8930G
,
232 ALC888_ACER_ASPIRE_7730G
,
234 ALC883_MEDION_WIM2160
,
236 ALC883_LENOVO_101E_2ch
,
237 ALC883_LENOVO_NB0763
,
238 ALC888_LENOVO_MS7195_DIG
,
246 ALC883_FUJITSU_PI2515
,
247 ALC888_FUJITSU_XA3530
,
248 ALC883_3ST_6ch_INTEL
,
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
279 struct alc_mic_route
{
281 unsigned char mux_idx
;
282 unsigned char amix_idx
;
285 #define MUX_IDX_UNDEF ((unsigned char)-1)
287 struct alc_customize_define
{
288 unsigned int sku_cfg
;
289 unsigned char port_connectivity
;
290 unsigned char check_sum
;
291 unsigned char customization
;
292 unsigned char external_amp
;
293 unsigned int enable_pcbeep
:1;
294 unsigned int platform_type
:1;
296 unsigned int override
:1;
297 unsigned int fixup
:1; /* Means that this sku is set by driver, not read from hw */
302 struct alc_multi_io
{
303 hda_nid_t pin
; /* multi-io widget pin NID */
304 hda_nid_t dac
; /* DAC to be connected */
305 unsigned int ctl_in
; /* cached input-pin control value */
309 ALC_AUTOMUTE_PIN
, /* change the pin control */
310 ALC_AUTOMUTE_AMP
, /* mute/unmute the pin AMP */
311 ALC_AUTOMUTE_MIXER
, /* mute/unmute mixer widget AMP */
315 /* codec parameterization */
316 const struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
317 unsigned int num_mixers
;
318 const struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
319 unsigned int beep_amp
; /* beep amp value, set via set_beep_amp() */
321 const struct hda_verb
*init_verbs
[10]; /* initialization verbs
325 unsigned int num_init_verbs
;
327 char stream_name_analog
[32]; /* analog PCM stream */
328 const struct hda_pcm_stream
*stream_analog_playback
;
329 const struct hda_pcm_stream
*stream_analog_capture
;
330 const struct hda_pcm_stream
*stream_analog_alt_playback
;
331 const struct hda_pcm_stream
*stream_analog_alt_capture
;
333 char stream_name_digital
[32]; /* digital PCM stream */
334 const struct hda_pcm_stream
*stream_digital_playback
;
335 const struct hda_pcm_stream
*stream_digital_capture
;
338 struct hda_multi_out multiout
; /* playback set-up
339 * max_channels, dacs must be set
340 * dig_out_nid and hp_nid are optional
342 hda_nid_t alt_dac_nid
;
343 hda_nid_t slave_dig_outs
[3]; /* optional - for auto-parsing */
347 unsigned int num_adc_nids
;
348 const hda_nid_t
*adc_nids
;
349 const hda_nid_t
*capsrc_nids
;
350 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
352 /* capture setup for dynamic dual-adc switch */
353 unsigned int cur_adc_idx
;
355 unsigned int cur_adc_stream_tag
;
356 unsigned int cur_adc_format
;
359 unsigned int num_mux_defs
;
360 const struct hda_input_mux
*input_mux
;
361 unsigned int cur_mux
[3];
362 struct alc_mic_route ext_mic
;
363 struct alc_mic_route dock_mic
;
364 struct alc_mic_route int_mic
;
367 const struct hda_channel_mode
*channel_mode
;
368 int num_channel_mode
;
370 int const_channel_count
;
371 int ext_channel_count
;
373 /* PCM information */
374 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
376 /* dynamic controls, init_verbs and input_mux */
377 struct auto_pin_cfg autocfg
;
378 struct alc_customize_define cdefine
;
379 struct snd_array kctls
;
380 struct hda_input_mux private_imux
[3];
381 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
382 hda_nid_t private_adc_nids
[AUTO_CFG_MAX_OUTS
];
383 hda_nid_t private_capsrc_nids
[AUTO_CFG_MAX_OUTS
];
386 void (*init_hook
)(struct hda_codec
*codec
);
387 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
388 #ifdef CONFIG_SND_HDA_POWER_SAVE
389 void (*power_hook
)(struct hda_codec
*codec
);
391 void (*shutup
)(struct hda_codec
*codec
);
393 /* for pin sensing */
394 unsigned int jack_present
: 1;
395 unsigned int line_jack_present
:1;
396 unsigned int master_mute
:1;
397 unsigned int auto_mic
:1;
398 unsigned int automute
:1; /* HP automute enabled */
399 unsigned int detect_line
:1; /* Line-out detection enabled */
400 unsigned int automute_lines
:1; /* automute line-out as well */
401 unsigned int automute_hp_lo
:1; /* both HP and LO available */
404 unsigned int no_analog
:1; /* digital I/O only */
405 unsigned int dual_adc_switch
:1; /* switch ADCs (for ALC275) */
406 unsigned int single_input_src
:1;
408 /* auto-mute control */
410 hda_nid_t automute_mixer_nid
[AUTO_CFG_MAX_OUTS
];
413 int codec_variant
; /* flag for other variants */
415 /* for virtual master */
416 hda_nid_t vmaster_nid
;
417 #ifdef CONFIG_SND_HDA_POWER_SAVE
418 struct hda_loopback_check loopback
;
423 unsigned int pll_coef_idx
, pll_coef_bit
;
427 const struct alc_fixup
*fixup_list
;
428 const char *fixup_name
;
432 struct alc_multi_io multi_io
[4];
436 * configuration template - to be copied to the spec instance
438 struct alc_config_preset
{
439 const struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
442 const struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
443 const struct hda_verb
*init_verbs
[5];
444 unsigned int num_dacs
;
445 const hda_nid_t
*dac_nids
;
446 hda_nid_t dig_out_nid
; /* optional */
447 hda_nid_t hp_nid
; /* optional */
448 const hda_nid_t
*slave_dig_outs
;
449 unsigned int num_adc_nids
;
450 const hda_nid_t
*adc_nids
;
451 const hda_nid_t
*capsrc_nids
;
452 hda_nid_t dig_in_nid
;
453 unsigned int num_channel_mode
;
454 const struct hda_channel_mode
*channel_mode
;
456 int const_channel_count
;
457 unsigned int num_mux_defs
;
458 const struct hda_input_mux
*input_mux
;
459 void (*unsol_event
)(struct hda_codec
*, unsigned int);
460 void (*setup
)(struct hda_codec
*);
461 void (*init_hook
)(struct hda_codec
*);
462 #ifdef CONFIG_SND_HDA_POWER_SAVE
463 const struct hda_amp_list
*loopbacks
;
464 void (*power_hook
)(struct hda_codec
*codec
);
472 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
473 struct snd_ctl_elem_info
*uinfo
)
475 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
476 struct alc_spec
*spec
= codec
->spec
;
477 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
478 if (mux_idx
>= spec
->num_mux_defs
)
480 if (!spec
->input_mux
[mux_idx
].num_items
&& mux_idx
> 0)
482 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
485 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
486 struct snd_ctl_elem_value
*ucontrol
)
488 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
489 struct alc_spec
*spec
= codec
->spec
;
490 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
492 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
496 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
497 struct snd_ctl_elem_value
*ucontrol
)
499 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
500 struct alc_spec
*spec
= codec
->spec
;
501 const struct hda_input_mux
*imux
;
502 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
503 unsigned int mux_idx
;
504 hda_nid_t nid
= spec
->capsrc_nids
?
505 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
508 mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
509 imux
= &spec
->input_mux
[mux_idx
];
510 if (!imux
->num_items
&& mux_idx
> 0)
511 imux
= &spec
->input_mux
[0];
513 type
= get_wcaps_type(get_wcaps(codec
, nid
));
514 if (type
== AC_WID_AUD_MIX
) {
515 /* Matrix-mixer style (e.g. ALC882) */
516 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
519 idx
= ucontrol
->value
.enumerated
.item
[0];
520 if (idx
>= imux
->num_items
)
521 idx
= imux
->num_items
- 1;
524 for (i
= 0; i
< imux
->num_items
; i
++) {
525 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
526 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
527 imux
->items
[i
].index
,
533 /* MUX style (e.g. ALC880) */
534 return snd_hda_input_mux_put(codec
, imux
, ucontrol
, nid
,
535 &spec
->cur_mux
[adc_idx
]);
540 * channel mode setting
542 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
543 struct snd_ctl_elem_info
*uinfo
)
545 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
546 struct alc_spec
*spec
= codec
->spec
;
547 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
548 spec
->num_channel_mode
);
551 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
552 struct snd_ctl_elem_value
*ucontrol
)
554 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
555 struct alc_spec
*spec
= codec
->spec
;
556 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
557 spec
->num_channel_mode
,
558 spec
->ext_channel_count
);
561 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
562 struct snd_ctl_elem_value
*ucontrol
)
564 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
565 struct alc_spec
*spec
= codec
->spec
;
566 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
567 spec
->num_channel_mode
,
568 &spec
->ext_channel_count
);
569 if (err
>= 0 && !spec
->const_channel_count
) {
570 spec
->multiout
.max_channels
= spec
->ext_channel_count
;
571 if (spec
->need_dac_fix
)
572 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
578 * Control the mode of pin widget settings via the mixer. "pc" is used
579 * instead of "%" to avoid consequences of accidentally treating the % as
580 * being part of a format specifier. Maximum allowed length of a value is
581 * 63 characters plus NULL terminator.
583 * Note: some retasking pin complexes seem to ignore requests for input
584 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
585 * are requested. Therefore order this list so that this behaviour will not
586 * cause problems when mixer clients move through the enum sequentially.
587 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
590 static const char * const alc_pin_mode_names
[] = {
591 "Mic 50pc bias", "Mic 80pc bias",
592 "Line in", "Line out", "Headphone out",
594 static const unsigned char alc_pin_mode_values
[] = {
595 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
597 /* The control can present all 5 options, or it can limit the options based
598 * in the pin being assumed to be exclusively an input or an output pin. In
599 * addition, "input" pins may or may not process the mic bias option
600 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
601 * accept requests for bias as of chip versions up to March 2006) and/or
602 * wiring in the computer.
604 #define ALC_PIN_DIR_IN 0x00
605 #define ALC_PIN_DIR_OUT 0x01
606 #define ALC_PIN_DIR_INOUT 0x02
607 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
608 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
610 /* Info about the pin modes supported by the different pin direction modes.
611 * For each direction the minimum and maximum values are given.
613 static const signed char alc_pin_mode_dir_info
[5][2] = {
614 { 0, 2 }, /* ALC_PIN_DIR_IN */
615 { 3, 4 }, /* ALC_PIN_DIR_OUT */
616 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
617 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
618 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
620 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
621 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
622 #define alc_pin_mode_n_items(_dir) \
623 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
625 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
626 struct snd_ctl_elem_info
*uinfo
)
628 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
629 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
631 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
633 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
635 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
636 item_num
= alc_pin_mode_min(dir
);
637 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
641 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
642 struct snd_ctl_elem_value
*ucontrol
)
645 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
646 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
647 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
648 long *valp
= ucontrol
->value
.integer
.value
;
649 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
650 AC_VERB_GET_PIN_WIDGET_CONTROL
,
653 /* Find enumerated value for current pinctl setting */
654 i
= alc_pin_mode_min(dir
);
655 while (i
<= alc_pin_mode_max(dir
) && alc_pin_mode_values
[i
] != pinctl
)
657 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
661 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
662 struct snd_ctl_elem_value
*ucontrol
)
665 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
666 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
667 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
668 long val
= *ucontrol
->value
.integer
.value
;
669 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
670 AC_VERB_GET_PIN_WIDGET_CONTROL
,
673 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
674 val
= alc_pin_mode_min(dir
);
676 change
= pinctl
!= alc_pin_mode_values
[val
];
678 /* Set pin mode to that requested */
679 snd_hda_codec_write_cache(codec
, nid
, 0,
680 AC_VERB_SET_PIN_WIDGET_CONTROL
,
681 alc_pin_mode_values
[val
]);
683 /* Also enable the retasking pin's input/output as required
684 * for the requested pin mode. Enum values of 2 or less are
687 * Dynamically switching the input/output buffers probably
688 * reduces noise slightly (particularly on input) so we'll
689 * do it. However, having both input and output buffers
690 * enabled simultaneously doesn't seem to be problematic if
691 * this turns out to be necessary in the future.
694 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
695 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
696 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
699 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
700 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
701 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
708 #define ALC_PIN_MODE(xname, nid, dir) \
709 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
710 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
711 .info = alc_pin_mode_info, \
712 .get = alc_pin_mode_get, \
713 .put = alc_pin_mode_put, \
714 .private_value = nid | (dir<<16) }
716 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
717 * together using a mask with more than one bit set. This control is
718 * currently used only by the ALC260 test model. At this stage they are not
719 * needed for any "production" models.
721 #ifdef CONFIG_SND_DEBUG
722 #define alc_gpio_data_info snd_ctl_boolean_mono_info
724 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
725 struct snd_ctl_elem_value
*ucontrol
)
727 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
728 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
729 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
730 long *valp
= ucontrol
->value
.integer
.value
;
731 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
732 AC_VERB_GET_GPIO_DATA
, 0x00);
734 *valp
= (val
& mask
) != 0;
737 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
738 struct snd_ctl_elem_value
*ucontrol
)
741 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
742 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
743 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
744 long val
= *ucontrol
->value
.integer
.value
;
745 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
746 AC_VERB_GET_GPIO_DATA
,
749 /* Set/unset the masked GPIO bit(s) as needed */
750 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
755 snd_hda_codec_write_cache(codec
, nid
, 0,
756 AC_VERB_SET_GPIO_DATA
, gpio_data
);
760 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
761 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
762 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
763 .info = alc_gpio_data_info, \
764 .get = alc_gpio_data_get, \
765 .put = alc_gpio_data_put, \
766 .private_value = nid | (mask<<16) }
767 #endif /* CONFIG_SND_DEBUG */
769 /* A switch control to allow the enabling of the digital IO pins on the
770 * ALC260. This is incredibly simplistic; the intention of this control is
771 * to provide something in the test model allowing digital outputs to be
772 * identified if present. If models are found which can utilise these
773 * outputs a more complete mixer control can be devised for those models if
776 #ifdef CONFIG_SND_DEBUG
777 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
779 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
780 struct snd_ctl_elem_value
*ucontrol
)
782 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
783 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
784 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
785 long *valp
= ucontrol
->value
.integer
.value
;
786 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
787 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
789 *valp
= (val
& mask
) != 0;
792 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
793 struct snd_ctl_elem_value
*ucontrol
)
796 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
797 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
798 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
799 long val
= *ucontrol
->value
.integer
.value
;
800 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
801 AC_VERB_GET_DIGI_CONVERT_1
,
804 /* Set/unset the masked control bit(s) as needed */
805 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
810 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
815 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
816 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
817 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
818 .info = alc_spdif_ctrl_info, \
819 .get = alc_spdif_ctrl_get, \
820 .put = alc_spdif_ctrl_put, \
821 .private_value = nid | (mask<<16) }
822 #endif /* CONFIG_SND_DEBUG */
824 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
825 * Again, this is only used in the ALC26x test models to help identify when
826 * the EAPD line must be asserted for features to work.
828 #ifdef CONFIG_SND_DEBUG
829 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
831 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
832 struct snd_ctl_elem_value
*ucontrol
)
834 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
835 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
836 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
837 long *valp
= ucontrol
->value
.integer
.value
;
838 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
839 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
841 *valp
= (val
& mask
) != 0;
845 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
846 struct snd_ctl_elem_value
*ucontrol
)
849 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
850 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
851 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
852 long val
= *ucontrol
->value
.integer
.value
;
853 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
854 AC_VERB_GET_EAPD_BTLENABLE
,
857 /* Set/unset the masked control bit(s) as needed */
858 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
863 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
869 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
870 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
871 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
872 .info = alc_eapd_ctrl_info, \
873 .get = alc_eapd_ctrl_get, \
874 .put = alc_eapd_ctrl_put, \
875 .private_value = nid | (mask<<16) }
876 #endif /* CONFIG_SND_DEBUG */
879 * set up the input pin config (depending on the given auto-pin type)
881 static void alc_set_input_pin(struct hda_codec
*codec
, hda_nid_t nid
,
884 unsigned int val
= PIN_IN
;
886 if (auto_pin_type
== AUTO_PIN_MIC
) {
889 oldval
= snd_hda_codec_read(codec
, nid
, 0,
890 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
891 pincap
= snd_hda_query_pin_caps(codec
, nid
);
892 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
893 /* if the default pin setup is vref50, we give it priority */
894 if ((pincap
& AC_PINCAP_VREF_80
) && oldval
!= PIN_VREF50
)
896 else if (pincap
& AC_PINCAP_VREF_50
)
898 else if (pincap
& AC_PINCAP_VREF_100
)
900 else if (pincap
& AC_PINCAP_VREF_GRD
)
903 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, val
);
906 static void alc_fixup_autocfg_pin_nums(struct hda_codec
*codec
)
908 struct alc_spec
*spec
= codec
->spec
;
909 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
911 if (!cfg
->line_outs
) {
912 while (cfg
->line_outs
< AUTO_CFG_MAX_OUTS
&&
913 cfg
->line_out_pins
[cfg
->line_outs
])
916 if (!cfg
->speaker_outs
) {
917 while (cfg
->speaker_outs
< AUTO_CFG_MAX_OUTS
&&
918 cfg
->speaker_pins
[cfg
->speaker_outs
])
922 while (cfg
->hp_outs
< AUTO_CFG_MAX_OUTS
&&
923 cfg
->hp_pins
[cfg
->hp_outs
])
930 static void add_mixer(struct alc_spec
*spec
, const struct snd_kcontrol_new
*mix
)
932 if (snd_BUG_ON(spec
->num_mixers
>= ARRAY_SIZE(spec
->mixers
)))
934 spec
->mixers
[spec
->num_mixers
++] = mix
;
937 static void add_verb(struct alc_spec
*spec
, const struct hda_verb
*verb
)
939 if (snd_BUG_ON(spec
->num_init_verbs
>= ARRAY_SIZE(spec
->init_verbs
)))
941 spec
->init_verbs
[spec
->num_init_verbs
++] = verb
;
945 * set up from the preset table
947 static void setup_preset(struct hda_codec
*codec
,
948 const struct alc_config_preset
*preset
)
950 struct alc_spec
*spec
= codec
->spec
;
953 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
954 add_mixer(spec
, preset
->mixers
[i
]);
955 spec
->cap_mixer
= preset
->cap_mixer
;
956 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
958 add_verb(spec
, preset
->init_verbs
[i
]);
960 spec
->channel_mode
= preset
->channel_mode
;
961 spec
->num_channel_mode
= preset
->num_channel_mode
;
962 spec
->need_dac_fix
= preset
->need_dac_fix
;
963 spec
->const_channel_count
= preset
->const_channel_count
;
965 if (preset
->const_channel_count
)
966 spec
->multiout
.max_channels
= preset
->const_channel_count
;
968 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
969 spec
->ext_channel_count
= spec
->channel_mode
[0].channels
;
971 spec
->multiout
.num_dacs
= preset
->num_dacs
;
972 spec
->multiout
.dac_nids
= preset
->dac_nids
;
973 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
974 spec
->multiout
.slave_dig_outs
= preset
->slave_dig_outs
;
975 spec
->multiout
.hp_nid
= preset
->hp_nid
;
977 spec
->num_mux_defs
= preset
->num_mux_defs
;
978 if (!spec
->num_mux_defs
)
979 spec
->num_mux_defs
= 1;
980 spec
->input_mux
= preset
->input_mux
;
982 spec
->num_adc_nids
= preset
->num_adc_nids
;
983 spec
->adc_nids
= preset
->adc_nids
;
984 spec
->capsrc_nids
= preset
->capsrc_nids
;
985 spec
->dig_in_nid
= preset
->dig_in_nid
;
987 spec
->unsol_event
= preset
->unsol_event
;
988 spec
->init_hook
= preset
->init_hook
;
989 #ifdef CONFIG_SND_HDA_POWER_SAVE
990 spec
->power_hook
= preset
->power_hook
;
991 spec
->loopback
.amplist
= preset
->loopbacks
;
995 preset
->setup(codec
);
997 alc_fixup_autocfg_pin_nums(codec
);
1000 /* Enable GPIO mask and set output */
1001 static const struct hda_verb alc_gpio1_init_verbs
[] = {
1002 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
1003 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
1004 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
1008 static const struct hda_verb alc_gpio2_init_verbs
[] = {
1009 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
1010 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
1011 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
1015 static const struct hda_verb alc_gpio3_init_verbs
[] = {
1016 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
1017 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
1018 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
1023 * Fix hardware PLL issue
1024 * On some codecs, the analog PLL gating control must be off while
1025 * the default value is 1.
1027 static void alc_fix_pll(struct hda_codec
*codec
)
1029 struct alc_spec
*spec
= codec
->spec
;
1034 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
1035 spec
->pll_coef_idx
);
1036 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
1037 AC_VERB_GET_PROC_COEF
, 0);
1038 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
1039 spec
->pll_coef_idx
);
1040 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
1041 val
& ~(1 << spec
->pll_coef_bit
));
1044 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
1045 unsigned int coef_idx
, unsigned int coef_bit
)
1047 struct alc_spec
*spec
= codec
->spec
;
1048 spec
->pll_nid
= nid
;
1049 spec
->pll_coef_idx
= coef_idx
;
1050 spec
->pll_coef_bit
= coef_bit
;
1054 static int alc_init_jacks(struct hda_codec
*codec
)
1056 #ifdef CONFIG_SND_HDA_INPUT_JACK
1057 struct alc_spec
*spec
= codec
->spec
;
1059 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
1060 unsigned int mic_nid
= spec
->ext_mic
.pin
;
1061 unsigned int dock_nid
= spec
->dock_mic
.pin
;
1064 err
= snd_hda_input_jack_add(codec
, hp_nid
,
1065 SND_JACK_HEADPHONE
, NULL
);
1068 snd_hda_input_jack_report(codec
, hp_nid
);
1072 err
= snd_hda_input_jack_add(codec
, mic_nid
,
1073 SND_JACK_MICROPHONE
, NULL
);
1076 snd_hda_input_jack_report(codec
, mic_nid
);
1079 err
= snd_hda_input_jack_add(codec
, dock_nid
,
1080 SND_JACK_MICROPHONE
, NULL
);
1083 snd_hda_input_jack_report(codec
, dock_nid
);
1085 #endif /* CONFIG_SND_HDA_INPUT_JACK */
1089 static int detect_jacks(struct hda_codec
*codec
, int num_pins
, hda_nid_t
*pins
)
1093 for (i
= 0; i
< num_pins
; i
++) {
1094 hda_nid_t nid
= pins
[i
];
1097 snd_hda_input_jack_report(codec
, nid
);
1098 present
|= snd_hda_jack_detect(codec
, nid
);
1103 static void do_automute(struct hda_codec
*codec
, int num_pins
, hda_nid_t
*pins
,
1104 bool mute
, bool hp_out
)
1106 struct alc_spec
*spec
= codec
->spec
;
1107 unsigned int mute_bits
= mute
? HDA_AMP_MUTE
: 0;
1108 unsigned int pin_bits
= mute
? 0 : (hp_out
? PIN_HP
: PIN_OUT
);
1111 for (i
= 0; i
< num_pins
; i
++) {
1112 hda_nid_t nid
= pins
[i
];
1115 switch (spec
->automute_mode
) {
1116 case ALC_AUTOMUTE_PIN
:
1117 snd_hda_codec_write(codec
, nid
, 0,
1118 AC_VERB_SET_PIN_WIDGET_CONTROL
,
1121 case ALC_AUTOMUTE_AMP
:
1122 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
1123 HDA_AMP_MUTE
, mute_bits
);
1125 case ALC_AUTOMUTE_MIXER
:
1126 nid
= spec
->automute_mixer_nid
[i
];
1129 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
1130 HDA_AMP_MUTE
, mute_bits
);
1131 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 1,
1132 HDA_AMP_MUTE
, mute_bits
);
1138 /* Toggle internal speakers muting */
1139 static void update_speakers(struct hda_codec
*codec
)
1141 struct alc_spec
*spec
= codec
->spec
;
1144 if (!spec
->automute
)
1147 on
= spec
->jack_present
| spec
->line_jack_present
;
1148 on
|= spec
->master_mute
;
1149 do_automute(codec
, ARRAY_SIZE(spec
->autocfg
.speaker_pins
),
1150 spec
->autocfg
.speaker_pins
, on
, false);
1152 /* toggle line-out mutes if needed, too */
1153 /* if LO is a copy of either HP or Speaker, don't need to handle it */
1154 if (spec
->autocfg
.line_out_pins
[0] == spec
->autocfg
.hp_pins
[0] ||
1155 spec
->autocfg
.line_out_pins
[0] == spec
->autocfg
.speaker_pins
[0])
1157 if (!spec
->automute_lines
|| !spec
->automute
)
1160 on
= spec
->jack_present
;
1161 on
|= spec
->master_mute
;
1162 do_automute(codec
, ARRAY_SIZE(spec
->autocfg
.line_out_pins
),
1163 spec
->autocfg
.line_out_pins
, on
, false);
1166 static void alc_hp_automute(struct hda_codec
*codec
)
1168 struct alc_spec
*spec
= codec
->spec
;
1170 if (!spec
->automute
)
1172 spec
->jack_present
=
1173 detect_jacks(codec
, ARRAY_SIZE(spec
->autocfg
.hp_pins
),
1174 spec
->autocfg
.hp_pins
);
1175 update_speakers(codec
);
1178 static void alc_line_automute(struct hda_codec
*codec
)
1180 struct alc_spec
*spec
= codec
->spec
;
1182 if (!spec
->automute
|| !spec
->detect_line
)
1184 spec
->line_jack_present
=
1185 detect_jacks(codec
, ARRAY_SIZE(spec
->autocfg
.line_out_pins
),
1186 spec
->autocfg
.line_out_pins
);
1187 update_speakers(codec
);
1190 static int get_connection_index(struct hda_codec
*codec
, hda_nid_t mux
,
1193 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
1196 nums
= snd_hda_get_connections(codec
, mux
, conn
, ARRAY_SIZE(conn
));
1197 for (i
= 0; i
< nums
; i
++)
1203 /* switch the current ADC according to the jack state */
1204 static void alc_dual_mic_adc_auto_switch(struct hda_codec
*codec
)
1206 struct alc_spec
*spec
= codec
->spec
;
1207 unsigned int present
;
1210 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1212 spec
->cur_adc_idx
= 1;
1214 spec
->cur_adc_idx
= 0;
1215 new_adc
= spec
->adc_nids
[spec
->cur_adc_idx
];
1216 if (spec
->cur_adc
&& spec
->cur_adc
!= new_adc
) {
1217 /* stream is running, let's swap the current ADC */
1218 __snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
, 1);
1219 spec
->cur_adc
= new_adc
;
1220 snd_hda_codec_setup_stream(codec
, new_adc
,
1221 spec
->cur_adc_stream_tag
, 0,
1222 spec
->cur_adc_format
);
1226 static void alc_mic_automute(struct hda_codec
*codec
)
1228 struct alc_spec
*spec
= codec
->spec
;
1229 struct alc_mic_route
*dead1
, *dead2
, *alive
;
1230 unsigned int present
, type
;
1233 if (!spec
->auto_mic
)
1235 if (!spec
->int_mic
.pin
|| !spec
->ext_mic
.pin
)
1237 if (snd_BUG_ON(!spec
->adc_nids
))
1240 if (spec
->dual_adc_switch
) {
1241 alc_dual_mic_adc_auto_switch(codec
);
1245 cap_nid
= spec
->capsrc_nids
? spec
->capsrc_nids
[0] : spec
->adc_nids
[0];
1247 alive
= &spec
->int_mic
;
1248 dead1
= &spec
->ext_mic
;
1249 dead2
= &spec
->dock_mic
;
1251 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1253 alive
= &spec
->ext_mic
;
1254 dead1
= &spec
->int_mic
;
1255 dead2
= &spec
->dock_mic
;
1257 if (!present
&& spec
->dock_mic
.pin
> 0) {
1258 present
= snd_hda_jack_detect(codec
, spec
->dock_mic
.pin
);
1260 alive
= &spec
->dock_mic
;
1261 dead1
= &spec
->int_mic
;
1262 dead2
= &spec
->ext_mic
;
1264 snd_hda_input_jack_report(codec
, spec
->dock_mic
.pin
);
1267 type
= get_wcaps_type(get_wcaps(codec
, cap_nid
));
1268 if (type
== AC_WID_AUD_MIX
) {
1269 /* Matrix-mixer style (e.g. ALC882) */
1270 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1274 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1276 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
1278 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1280 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
1282 /* MUX style (e.g. ALC880) */
1283 snd_hda_codec_write_cache(codec
, cap_nid
, 0,
1284 AC_VERB_SET_CONNECT_SEL
,
1287 snd_hda_input_jack_report(codec
, spec
->ext_mic
.pin
);
1289 /* FIXME: analog mixer */
1292 /* unsolicited event for HP jack sensing */
1293 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1295 if (codec
->vendor_id
== 0x10ec0880)
1300 case ALC880_HP_EVENT
:
1301 alc_hp_automute(codec
);
1303 case ALC880_FRONT_EVENT
:
1304 alc_line_automute(codec
);
1306 case ALC880_MIC_EVENT
:
1307 alc_mic_automute(codec
);
1312 static void alc_inithook(struct hda_codec
*codec
)
1314 alc_hp_automute(codec
);
1315 alc_line_automute(codec
);
1316 alc_mic_automute(codec
);
1319 /* additional initialization for ALC888 variants */
1320 static void alc888_coef_init(struct hda_codec
*codec
)
1324 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
1325 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1326 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1327 if ((tmp
& 0xf0) == 0x20)
1329 snd_hda_codec_read(codec
, 0x20, 0,
1330 AC_VERB_SET_PROC_COEF
, 0x830);
1333 snd_hda_codec_read(codec
, 0x20, 0,
1334 AC_VERB_SET_PROC_COEF
, 0x3030);
1337 static void alc889_coef_init(struct hda_codec
*codec
)
1341 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1342 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1343 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1344 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
, tmp
|0x2010);
1347 /* turn on/off EAPD control (only if available) */
1348 static void set_eapd(struct hda_codec
*codec
, hda_nid_t nid
, int on
)
1350 if (get_wcaps_type(get_wcaps(codec
, nid
)) != AC_WID_PIN
)
1352 if (snd_hda_query_pin_caps(codec
, nid
) & AC_PINCAP_EAPD
)
1353 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
1357 /* turn on/off EAPD controls of the codec */
1358 static void alc_auto_setup_eapd(struct hda_codec
*codec
, bool on
)
1360 /* We currently only handle front, HP */
1361 switch (codec
->vendor_id
) {
1363 set_eapd(codec
, 0x0f, on
);
1364 set_eapd(codec
, 0x10, on
);
1379 set_eapd(codec
, 0x14, on
);
1380 set_eapd(codec
, 0x15, on
);
1385 /* generic shutup callback;
1386 * just turning off EPAD and a little pause for avoiding pop-noise
1388 static void alc_eapd_shutup(struct hda_codec
*codec
)
1390 alc_auto_setup_eapd(codec
, false);
1394 static void alc_auto_init_amp(struct hda_codec
*codec
, int type
)
1399 case ALC_INIT_GPIO1
:
1400 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
1402 case ALC_INIT_GPIO2
:
1403 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
1405 case ALC_INIT_GPIO3
:
1406 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
1408 case ALC_INIT_DEFAULT
:
1409 alc_auto_setup_eapd(codec
, true);
1410 switch (codec
->vendor_id
) {
1412 snd_hda_codec_write(codec
, 0x1a, 0,
1413 AC_VERB_SET_COEF_INDEX
, 7);
1414 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
1415 AC_VERB_GET_PROC_COEF
, 0);
1416 snd_hda_codec_write(codec
, 0x1a, 0,
1417 AC_VERB_SET_COEF_INDEX
, 7);
1418 snd_hda_codec_write(codec
, 0x1a, 0,
1419 AC_VERB_SET_PROC_COEF
,
1428 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
1429 alc889_coef_init(codec
);
1432 alc888_coef_init(codec
);
1434 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1437 snd_hda_codec_write(codec
, 0x20, 0,
1438 AC_VERB_SET_COEF_INDEX
, 7);
1439 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1440 AC_VERB_GET_PROC_COEF
, 0);
1441 snd_hda_codec_write(codec
, 0x20, 0,
1442 AC_VERB_SET_COEF_INDEX
, 7);
1443 snd_hda_codec_write(codec
, 0x20, 0,
1444 AC_VERB_SET_PROC_COEF
,
1453 static int alc_automute_mode_info(struct snd_kcontrol
*kcontrol
,
1454 struct snd_ctl_elem_info
*uinfo
)
1456 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1457 struct alc_spec
*spec
= codec
->spec
;
1458 static const char * const texts2
[] = {
1459 "Disabled", "Enabled"
1461 static const char * const texts3
[] = {
1462 "Disabled", "Speaker Only", "Line-Out+Speaker"
1464 const char * const *texts
;
1466 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
1468 if (spec
->automute_hp_lo
) {
1469 uinfo
->value
.enumerated
.items
= 3;
1472 uinfo
->value
.enumerated
.items
= 2;
1475 if (uinfo
->value
.enumerated
.item
>= uinfo
->value
.enumerated
.items
)
1476 uinfo
->value
.enumerated
.item
= uinfo
->value
.enumerated
.items
- 1;
1477 strcpy(uinfo
->value
.enumerated
.name
,
1478 texts
[uinfo
->value
.enumerated
.item
]);
1482 static int alc_automute_mode_get(struct snd_kcontrol
*kcontrol
,
1483 struct snd_ctl_elem_value
*ucontrol
)
1485 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1486 struct alc_spec
*spec
= codec
->spec
;
1488 if (!spec
->automute
)
1490 else if (!spec
->automute_lines
)
1494 ucontrol
->value
.enumerated
.item
[0] = val
;
1498 static int alc_automute_mode_put(struct snd_kcontrol
*kcontrol
,
1499 struct snd_ctl_elem_value
*ucontrol
)
1501 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1502 struct alc_spec
*spec
= codec
->spec
;
1504 switch (ucontrol
->value
.enumerated
.item
[0]) {
1506 if (!spec
->automute
)
1511 if (spec
->automute
&& !spec
->automute_lines
)
1514 spec
->automute_lines
= 0;
1517 if (!spec
->automute_hp_lo
)
1519 if (spec
->automute
&& spec
->automute_lines
)
1522 spec
->automute_lines
= 1;
1527 update_speakers(codec
);
1531 static const struct snd_kcontrol_new alc_automute_mode_enum
= {
1532 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1533 .name
= "Auto-Mute Mode",
1534 .info
= alc_automute_mode_info
,
1535 .get
= alc_automute_mode_get
,
1536 .put
= alc_automute_mode_put
,
1539 static struct snd_kcontrol_new
*alc_kcontrol_new(struct alc_spec
*spec
);
1541 static int alc_add_automute_mode_enum(struct hda_codec
*codec
)
1543 struct alc_spec
*spec
= codec
->spec
;
1544 struct snd_kcontrol_new
*knew
;
1546 knew
= alc_kcontrol_new(spec
);
1549 *knew
= alc_automute_mode_enum
;
1550 knew
->name
= kstrdup("Auto-Mute Mode", GFP_KERNEL
);
1556 static void alc_init_auto_hp(struct hda_codec
*codec
)
1558 struct alc_spec
*spec
= codec
->spec
;
1559 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1563 if (cfg
->hp_pins
[0])
1565 if (cfg
->line_out_pins
[0])
1567 if (cfg
->speaker_pins
[0])
1569 if (present
< 2) /* need two different output types */
1572 spec
->automute_hp_lo
= 1; /* both HP and LO automute */
1574 if (!cfg
->speaker_pins
[0]) {
1575 memcpy(cfg
->speaker_pins
, cfg
->line_out_pins
,
1576 sizeof(cfg
->speaker_pins
));
1577 cfg
->speaker_outs
= cfg
->line_outs
;
1580 if (!cfg
->hp_pins
[0]) {
1581 memcpy(cfg
->hp_pins
, cfg
->line_out_pins
,
1582 sizeof(cfg
->hp_pins
));
1583 cfg
->hp_outs
= cfg
->line_outs
;
1586 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
1587 hda_nid_t nid
= cfg
->hp_pins
[i
];
1588 if (!is_jack_detectable(codec
, nid
))
1590 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1592 snd_hda_codec_write_cache(codec
, nid
, 0,
1593 AC_VERB_SET_UNSOLICITED_ENABLE
,
1594 AC_USRSP_EN
| ALC880_HP_EVENT
);
1596 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
1598 if (spec
->automute
&& cfg
->line_out_pins
[0] &&
1599 cfg
->line_out_pins
[0] != cfg
->hp_pins
[0] &&
1600 cfg
->line_out_pins
[0] != cfg
->speaker_pins
[0]) {
1601 for (i
= 0; i
< cfg
->line_outs
; i
++) {
1602 hda_nid_t nid
= cfg
->line_out_pins
[i
];
1603 if (!is_jack_detectable(codec
, nid
))
1605 snd_printdd("realtek: Enable Line-Out auto-muting "
1606 "on NID 0x%x\n", nid
);
1607 snd_hda_codec_write_cache(codec
, nid
, 0,
1608 AC_VERB_SET_UNSOLICITED_ENABLE
,
1609 AC_USRSP_EN
| ALC880_FRONT_EVENT
);
1610 spec
->detect_line
= 1;
1612 spec
->automute_lines
= spec
->detect_line
;
1615 if (spec
->automute
) {
1616 /* create a control for automute mode */
1617 alc_add_automute_mode_enum(codec
);
1618 spec
->unsol_event
= alc_sku_unsol_event
;
1622 static void alc_init_auto_mic(struct hda_codec
*codec
)
1624 struct alc_spec
*spec
= codec
->spec
;
1625 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1626 hda_nid_t fixed
, ext
, dock
;
1629 fixed
= ext
= dock
= 0;
1630 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
1631 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
1632 unsigned int defcfg
;
1633 defcfg
= snd_hda_codec_get_pincfg(codec
, nid
);
1634 switch (snd_hda_get_input_pin_attr(defcfg
)) {
1635 case INPUT_PIN_ATTR_INT
:
1637 return; /* already occupied */
1638 if (cfg
->inputs
[i
].type
!= AUTO_PIN_MIC
)
1639 return; /* invalid type */
1642 case INPUT_PIN_ATTR_UNUSED
:
1643 return; /* invalid entry */
1644 case INPUT_PIN_ATTR_DOCK
:
1646 return; /* already occupied */
1647 if (cfg
->inputs
[i
].type
> AUTO_PIN_LINE_IN
)
1648 return; /* invalid type */
1653 return; /* already occupied */
1654 if (cfg
->inputs
[i
].type
!= AUTO_PIN_MIC
)
1655 return; /* invalid type */
1666 if (!is_jack_detectable(codec
, ext
))
1667 return; /* no unsol support */
1668 if (dock
&& !is_jack_detectable(codec
, dock
))
1669 return; /* no unsol support */
1670 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
1672 spec
->ext_mic
.pin
= ext
;
1673 spec
->dock_mic
.pin
= dock
;
1674 spec
->int_mic
.pin
= fixed
;
1675 spec
->ext_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1676 spec
->dock_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1677 spec
->int_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1679 snd_hda_codec_write_cache(codec
, spec
->ext_mic
.pin
, 0,
1680 AC_VERB_SET_UNSOLICITED_ENABLE
,
1681 AC_USRSP_EN
| ALC880_MIC_EVENT
);
1682 spec
->unsol_event
= alc_sku_unsol_event
;
1685 /* Could be any non-zero and even value. When used as fixup, tells
1686 * the driver to ignore any present sku defines.
1688 #define ALC_FIXUP_SKU_IGNORE (2)
1690 static int alc_auto_parse_customize_define(struct hda_codec
*codec
)
1692 unsigned int ass
, tmp
, i
;
1694 struct alc_spec
*spec
= codec
->spec
;
1696 spec
->cdefine
.enable_pcbeep
= 1; /* assume always enabled */
1698 if (spec
->cdefine
.fixup
) {
1699 ass
= spec
->cdefine
.sku_cfg
;
1700 if (ass
== ALC_FIXUP_SKU_IGNORE
)
1705 ass
= codec
->subsystem_id
& 0xffff;
1706 if (ass
!= codec
->bus
->pci
->subsystem_device
&& (ass
& 1))
1710 if (codec
->vendor_id
== 0x10ec0260)
1712 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1715 printk(KERN_INFO
"hda_codec: %s: SKU not ready 0x%08x\n",
1716 codec
->chip_name
, ass
);
1722 for (i
= 1; i
< 16; i
++) {
1726 if (((ass
>> 16) & 0xf) != tmp
)
1729 spec
->cdefine
.port_connectivity
= ass
>> 30;
1730 spec
->cdefine
.enable_pcbeep
= (ass
& 0x100000) >> 20;
1731 spec
->cdefine
.check_sum
= (ass
>> 16) & 0xf;
1732 spec
->cdefine
.customization
= ass
>> 8;
1734 spec
->cdefine
.sku_cfg
= ass
;
1735 spec
->cdefine
.external_amp
= (ass
& 0x38) >> 3;
1736 spec
->cdefine
.platform_type
= (ass
& 0x4) >> 2;
1737 spec
->cdefine
.swap
= (ass
& 0x2) >> 1;
1738 spec
->cdefine
.override
= ass
& 0x1;
1740 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1741 nid
, spec
->cdefine
.sku_cfg
);
1742 snd_printd("SKU: port_connectivity=0x%x\n",
1743 spec
->cdefine
.port_connectivity
);
1744 snd_printd("SKU: enable_pcbeep=0x%x\n", spec
->cdefine
.enable_pcbeep
);
1745 snd_printd("SKU: check_sum=0x%08x\n", spec
->cdefine
.check_sum
);
1746 snd_printd("SKU: customization=0x%08x\n", spec
->cdefine
.customization
);
1747 snd_printd("SKU: external_amp=0x%x\n", spec
->cdefine
.external_amp
);
1748 snd_printd("SKU: platform_type=0x%x\n", spec
->cdefine
.platform_type
);
1749 snd_printd("SKU: swap=0x%x\n", spec
->cdefine
.swap
);
1750 snd_printd("SKU: override=0x%x\n", spec
->cdefine
.override
);
1755 /* check subsystem ID and set up device-specific initialization;
1756 * return 1 if initialized, 0 if invalid SSID
1758 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1759 * 31 ~ 16 : Manufacture ID
1761 * 7 ~ 0 : Assembly ID
1762 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1764 static int alc_subsystem_id(struct hda_codec
*codec
,
1765 hda_nid_t porta
, hda_nid_t porte
,
1766 hda_nid_t portd
, hda_nid_t porti
)
1768 unsigned int ass
, tmp
, i
;
1770 struct alc_spec
*spec
= codec
->spec
;
1772 if (spec
->cdefine
.fixup
) {
1773 ass
= spec
->cdefine
.sku_cfg
;
1774 if (ass
== ALC_FIXUP_SKU_IGNORE
)
1779 ass
= codec
->subsystem_id
& 0xffff;
1780 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
1783 /* invalid SSID, check the special NID pin defcfg instead */
1785 * 31~30 : port connectivity
1788 * 19~16 : Check sum (15:1)
1793 if (codec
->vendor_id
== 0x10ec0260)
1795 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1796 snd_printd("realtek: No valid SSID, "
1797 "checking pincfg 0x%08x for NID 0x%x\n",
1801 if ((ass
>> 30) != 1) /* no physical connection */
1806 for (i
= 1; i
< 16; i
++) {
1810 if (((ass
>> 16) & 0xf) != tmp
)
1813 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1814 ass
& 0xffff, codec
->vendor_id
);
1818 * 2 : 0 --> Desktop, 1 --> Laptop
1819 * 3~5 : External Amplifier control
1822 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
1825 spec
->init_amp
= ALC_INIT_GPIO1
;
1828 spec
->init_amp
= ALC_INIT_GPIO2
;
1831 spec
->init_amp
= ALC_INIT_GPIO3
;
1835 spec
->init_amp
= ALC_INIT_DEFAULT
;
1839 /* is laptop or Desktop and enable the function "Mute internal speaker
1840 * when the external headphone out jack is plugged"
1842 if (!(ass
& 0x8000))
1845 * 10~8 : Jack location
1846 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1848 * 15 : 1 --> enable the function "Mute internal speaker
1849 * when the external headphone out jack is plugged"
1851 if (!spec
->autocfg
.hp_pins
[0]) {
1853 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
1864 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++)
1865 if (spec
->autocfg
.line_out_pins
[i
] == nid
)
1867 spec
->autocfg
.hp_pins
[0] = nid
;
1872 static void alc_ssid_check(struct hda_codec
*codec
,
1873 hda_nid_t porta
, hda_nid_t porte
,
1874 hda_nid_t portd
, hda_nid_t porti
)
1876 if (!alc_subsystem_id(codec
, porta
, porte
, portd
, porti
)) {
1877 struct alc_spec
*spec
= codec
->spec
;
1878 snd_printd("realtek: "
1879 "Enable default setup for auto mode as fallback\n");
1880 spec
->init_amp
= ALC_INIT_DEFAULT
;
1883 alc_init_auto_hp(codec
);
1884 alc_init_auto_mic(codec
);
1888 * Fix-up pin default configurations and add default verbs
1896 struct alc_model_fixup
{
1907 const struct alc_pincfg
*pins
;
1908 const struct hda_verb
*verbs
;
1909 void (*func
)(struct hda_codec
*codec
,
1910 const struct alc_fixup
*fix
,
1924 ALC_FIXUP_ACT_PRE_PROBE
,
1925 ALC_FIXUP_ACT_PROBE
,
1929 static void alc_apply_fixup(struct hda_codec
*codec
, int action
)
1931 struct alc_spec
*spec
= codec
->spec
;
1932 int id
= spec
->fixup_id
;
1933 #ifdef CONFIG_SND_DEBUG_VERBOSE
1934 const char *modelname
= spec
->fixup_name
;
1938 if (!spec
->fixup_list
)
1942 const struct alc_fixup
*fix
= spec
->fixup_list
+ id
;
1943 const struct alc_pincfg
*cfg
;
1945 switch (fix
->type
) {
1947 if (action
!= ALC_FIXUP_ACT_PRE_PROBE
|| !fix
->v
.sku
)
1949 snd_printdd(KERN_INFO
"hda_codec: %s: "
1950 "Apply sku override for %s\n",
1951 codec
->chip_name
, modelname
);
1952 spec
->cdefine
.sku_cfg
= fix
->v
.sku
;
1953 spec
->cdefine
.fixup
= 1;
1955 case ALC_FIXUP_PINS
:
1957 if (action
!= ALC_FIXUP_ACT_PRE_PROBE
|| !cfg
)
1959 snd_printdd(KERN_INFO
"hda_codec: %s: "
1960 "Apply pincfg for %s\n",
1961 codec
->chip_name
, modelname
);
1962 for (; cfg
->nid
; cfg
++)
1963 snd_hda_codec_set_pincfg(codec
, cfg
->nid
,
1966 case ALC_FIXUP_VERBS
:
1967 if (action
!= ALC_FIXUP_ACT_PROBE
|| !fix
->v
.verbs
)
1969 snd_printdd(KERN_INFO
"hda_codec: %s: "
1970 "Apply fix-verbs for %s\n",
1971 codec
->chip_name
, modelname
);
1972 add_verb(codec
->spec
, fix
->v
.verbs
);
1974 case ALC_FIXUP_FUNC
:
1977 snd_printdd(KERN_INFO
"hda_codec: %s: "
1978 "Apply fix-func for %s\n",
1979 codec
->chip_name
, modelname
);
1980 fix
->v
.func(codec
, fix
, action
);
1983 snd_printk(KERN_ERR
"hda_codec: %s: "
1984 "Invalid fixup type %d\n",
1985 codec
->chip_name
, fix
->type
);
1996 static void alc_pick_fixup(struct hda_codec
*codec
,
1997 const struct alc_model_fixup
*models
,
1998 const struct snd_pci_quirk
*quirk
,
1999 const struct alc_fixup
*fixlist
)
2001 struct alc_spec
*spec
= codec
->spec
;
2003 const char *name
= NULL
;
2005 if (codec
->modelname
&& models
) {
2006 while (models
->name
) {
2007 if (!strcmp(codec
->modelname
, models
->name
)) {
2009 name
= models
->name
;
2016 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
2019 #ifdef CONFIG_SND_DEBUG_VERBOSE
2025 spec
->fixup_id
= id
;
2027 spec
->fixup_list
= fixlist
;
2028 spec
->fixup_name
= name
;
2032 static int alc_read_coef_idx(struct hda_codec
*codec
,
2033 unsigned int coef_idx
)
2036 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
2038 val
= snd_hda_codec_read(codec
, 0x20, 0,
2039 AC_VERB_GET_PROC_COEF
, 0);
2043 static void alc_write_coef_idx(struct hda_codec
*codec
, unsigned int coef_idx
,
2044 unsigned int coef_val
)
2046 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
2048 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
,
2052 /* set right pin controls for digital I/O */
2053 static void alc_auto_init_digital(struct hda_codec
*codec
)
2055 struct alc_spec
*spec
= codec
->spec
;
2059 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
2060 pin
= spec
->autocfg
.dig_out_pins
[i
];
2062 snd_hda_codec_write(codec
, pin
, 0,
2063 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2067 pin
= spec
->autocfg
.dig_in_pin
;
2069 snd_hda_codec_write(codec
, pin
, 0,
2070 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2074 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
2075 static void alc_auto_parse_digital(struct hda_codec
*codec
)
2077 struct alc_spec
*spec
= codec
->spec
;
2081 /* support multiple SPDIFs; the secondary is set up as a slave */
2082 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
2083 err
= snd_hda_get_connections(codec
,
2084 spec
->autocfg
.dig_out_pins
[i
],
2089 spec
->multiout
.dig_out_nid
= dig_nid
;
2090 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
2092 spec
->multiout
.slave_dig_outs
= spec
->slave_dig_outs
;
2093 if (i
>= ARRAY_SIZE(spec
->slave_dig_outs
) - 1)
2095 spec
->slave_dig_outs
[i
- 1] = dig_nid
;
2099 if (spec
->autocfg
.dig_in_pin
) {
2100 dig_nid
= codec
->start_nid
;
2101 for (i
= 0; i
< codec
->num_nodes
; i
++, dig_nid
++) {
2102 unsigned int wcaps
= get_wcaps(codec
, dig_nid
);
2103 if (get_wcaps_type(wcaps
) != AC_WID_AUD_IN
)
2105 if (!(wcaps
& AC_WCAP_DIGITAL
))
2107 if (!(wcaps
& AC_WCAP_CONN_LIST
))
2109 err
= get_connection_index(codec
, dig_nid
,
2110 spec
->autocfg
.dig_in_pin
);
2112 spec
->dig_in_nid
= dig_nid
;
2126 static const struct hda_verb alc888_4ST_ch2_intel_init
[] = {
2127 /* Mic-in jack as mic in */
2128 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2129 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2130 /* Line-in jack as Line in */
2131 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2132 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2133 /* Line-Out as Front */
2134 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
2141 static const struct hda_verb alc888_4ST_ch4_intel_init
[] = {
2142 /* Mic-in jack as mic in */
2143 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2144 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2145 /* Line-in jack as Surround */
2146 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2147 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2148 /* Line-Out as Front */
2149 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
2156 static const struct hda_verb alc888_4ST_ch6_intel_init
[] = {
2157 /* Mic-in jack as CLFE */
2158 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2159 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2160 /* Line-in jack as Surround */
2161 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2162 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2163 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
2164 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
2171 static const struct hda_verb alc888_4ST_ch8_intel_init
[] = {
2172 /* Mic-in jack as CLFE */
2173 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2174 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2175 /* Line-in jack as Surround */
2176 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2177 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2178 /* Line-Out as Side */
2179 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
2183 static const struct hda_channel_mode alc888_4ST_8ch_intel_modes
[4] = {
2184 { 2, alc888_4ST_ch2_intel_init
},
2185 { 4, alc888_4ST_ch4_intel_init
},
2186 { 6, alc888_4ST_ch6_intel_init
},
2187 { 8, alc888_4ST_ch8_intel_init
},
2191 * ALC888 Fujitsu Siemens Amillo xa3530
2194 static const struct hda_verb alc888_fujitsu_xa3530_verbs
[] = {
2195 /* Front Mic: set to PIN_IN (empty by default) */
2196 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2197 /* Connect Internal HP to Front */
2198 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2199 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2200 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2201 /* Connect Bass HP to Front */
2202 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2204 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2205 /* Connect Line-Out side jack (SPDIF) to Side */
2206 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2207 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2208 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
2209 /* Connect Mic jack to CLFE */
2210 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2211 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2212 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
2213 /* Connect Line-in jack to Surround */
2214 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2215 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2216 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
2217 /* Connect HP out jack to Front */
2218 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2219 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2220 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2221 /* Enable unsolicited event for HP jack and Line-out jack */
2222 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2223 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2227 static void alc889_automute_setup(struct hda_codec
*codec
)
2229 struct alc_spec
*spec
= codec
->spec
;
2231 spec
->autocfg
.hp_pins
[0] = 0x15;
2232 spec
->autocfg
.speaker_pins
[0] = 0x14;
2233 spec
->autocfg
.speaker_pins
[1] = 0x16;
2234 spec
->autocfg
.speaker_pins
[2] = 0x17;
2235 spec
->autocfg
.speaker_pins
[3] = 0x19;
2236 spec
->autocfg
.speaker_pins
[4] = 0x1a;
2238 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2241 static void alc889_intel_init_hook(struct hda_codec
*codec
)
2243 alc889_coef_init(codec
);
2244 alc_hp_automute(codec
);
2247 static void alc888_fujitsu_xa3530_setup(struct hda_codec
*codec
)
2249 struct alc_spec
*spec
= codec
->spec
;
2251 spec
->autocfg
.hp_pins
[0] = 0x17; /* line-out */
2252 spec
->autocfg
.hp_pins
[1] = 0x1b; /* hp */
2253 spec
->autocfg
.speaker_pins
[0] = 0x14; /* speaker */
2254 spec
->autocfg
.speaker_pins
[1] = 0x15; /* bass */
2256 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2260 * ALC888 Acer Aspire 4930G model
2263 static const struct hda_verb alc888_acer_aspire_4930g_verbs
[] = {
2264 /* Front Mic: set to PIN_IN (empty by default) */
2265 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2266 /* Unselect Front Mic by default in input mixer 3 */
2267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2268 /* Enable unsolicited event for HP jack */
2269 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2270 /* Connect Internal HP to front */
2271 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2272 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2273 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2274 /* Connect HP out to front */
2275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2276 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2277 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2278 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2283 * ALC888 Acer Aspire 6530G model
2286 static const struct hda_verb alc888_acer_aspire_6530g_verbs
[] = {
2287 /* Route to built-in subwoofer as well as speakers */
2288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2291 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2292 /* Bias voltage on for external mic port */
2293 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
2294 /* Front Mic: set to PIN_IN (empty by default) */
2295 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2296 /* Unselect Front Mic by default in input mixer 3 */
2297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2298 /* Enable unsolicited event for HP jack */
2299 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2300 /* Enable speaker output */
2301 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2302 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2303 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2304 /* Enable headphone output */
2305 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2307 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2308 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2313 *ALC888 Acer Aspire 7730G model
2316 static const struct hda_verb alc888_acer_aspire_7730G_verbs
[] = {
2317 /* Bias voltage on for external mic port */
2318 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
2319 /* Front Mic: set to PIN_IN (empty by default) */
2320 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2321 /* Unselect Front Mic by default in input mixer 3 */
2322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2323 /* Enable unsolicited event for HP jack */
2324 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2325 /* Enable speaker output */
2326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2327 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2328 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2329 /* Enable headphone output */
2330 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2332 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2333 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2334 /*Enable internal subwoofer */
2335 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2336 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2337 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
2338 {0x17, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2343 * ALC889 Acer Aspire 8930G model
2346 static const struct hda_verb alc889_acer_aspire_8930g_verbs
[] = {
2347 /* Front Mic: set to PIN_IN (empty by default) */
2348 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2349 /* Unselect Front Mic by default in input mixer 3 */
2350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2351 /* Enable unsolicited event for HP jack */
2352 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2353 /* Connect Internal Front to Front */
2354 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2355 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2356 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2357 /* Connect Internal Rear to Rear */
2358 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2359 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2360 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
2361 /* Connect Internal CLFE to CLFE */
2362 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2363 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2364 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
2365 /* Connect HP out to Front */
2366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2368 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2369 /* Enable all DACs */
2370 /* DAC DISABLE/MUTE 1? */
2371 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2372 {0x20, AC_VERB_SET_COEF_INDEX
, 0x03},
2373 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
2374 /* DAC DISABLE/MUTE 2? */
2375 /* some bit here disables the other DACs. Init=0x4900 */
2376 {0x20, AC_VERB_SET_COEF_INDEX
, 0x08},
2377 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
2379 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2380 * which makes the stereo useless. However, either the mic or the ALC889
2381 * makes the signal become a difference/sum signal instead of standard
2382 * stereo, which is annoying. So instead we flip this bit which makes the
2383 * codec replicate the sum signal to both channels, turning it into a
2386 /* DMIC_CONTROL? Init value = 0x0001 */
2387 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
2388 {0x20, AC_VERB_SET_PROC_COEF
, 0x0003},
2392 static const struct hda_input_mux alc888_2_capture_sources
[2] = {
2393 /* Front mic only available on one ADC */
2400 { "Front Mic", 0xb },
2413 static const struct hda_input_mux alc888_acer_aspire_6530_sources
[2] = {
2414 /* Interal mic only available on one ADC */
2421 { "Input Mix", 0xa },
2422 { "Internal Mic", 0xb },
2431 { "Input Mix", 0xa },
2436 static const struct hda_input_mux alc889_capture_sources
[3] = {
2437 /* Digital mic only available on first "ADC" */
2444 { "Front Mic", 0xb },
2445 { "Input Mix", 0xa },
2454 { "Input Mix", 0xa },
2463 { "Input Mix", 0xa },
2468 static const struct snd_kcontrol_new alc888_base_mixer
[] = {
2469 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2470 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2471 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2472 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2473 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2475 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2476 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2477 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2478 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2479 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2480 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2481 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2482 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2483 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2485 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2490 static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer
[] = {
2491 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2492 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2493 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2494 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2495 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2497 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2498 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2499 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2500 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT
),
2501 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT
),
2502 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2503 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2504 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2505 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2506 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2507 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2508 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2512 static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer
[] = {
2513 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2514 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2515 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2516 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2517 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2519 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2520 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2521 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2522 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2523 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2525 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2526 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2531 static void alc888_acer_aspire_4930g_setup(struct hda_codec
*codec
)
2533 struct alc_spec
*spec
= codec
->spec
;
2535 spec
->autocfg
.hp_pins
[0] = 0x15;
2536 spec
->autocfg
.speaker_pins
[0] = 0x14;
2537 spec
->autocfg
.speaker_pins
[1] = 0x16;
2538 spec
->autocfg
.speaker_pins
[2] = 0x17;
2540 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2543 static void alc888_acer_aspire_6530g_setup(struct hda_codec
*codec
)
2545 struct alc_spec
*spec
= codec
->spec
;
2547 spec
->autocfg
.hp_pins
[0] = 0x15;
2548 spec
->autocfg
.speaker_pins
[0] = 0x14;
2549 spec
->autocfg
.speaker_pins
[1] = 0x16;
2550 spec
->autocfg
.speaker_pins
[2] = 0x17;
2552 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2555 static void alc888_acer_aspire_7730g_setup(struct hda_codec
*codec
)
2557 struct alc_spec
*spec
= codec
->spec
;
2559 spec
->autocfg
.hp_pins
[0] = 0x15;
2560 spec
->autocfg
.speaker_pins
[0] = 0x14;
2561 spec
->autocfg
.speaker_pins
[1] = 0x16;
2562 spec
->autocfg
.speaker_pins
[2] = 0x17;
2564 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2567 static void alc889_acer_aspire_8930g_setup(struct hda_codec
*codec
)
2569 struct alc_spec
*spec
= codec
->spec
;
2571 spec
->autocfg
.hp_pins
[0] = 0x15;
2572 spec
->autocfg
.speaker_pins
[0] = 0x14;
2573 spec
->autocfg
.speaker_pins
[1] = 0x16;
2574 spec
->autocfg
.speaker_pins
[2] = 0x1b;
2576 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2580 * ALC880 3-stack model
2582 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2583 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2584 * F-Mic = 0x1b, HP = 0x19
2587 static const hda_nid_t alc880_dac_nids
[4] = {
2588 /* front, rear, clfe, rear_surr */
2589 0x02, 0x05, 0x04, 0x03
2592 static const hda_nid_t alc880_adc_nids
[3] = {
2597 /* The datasheet says the node 0x07 is connected from inputs,
2598 * but it shows zero connection in the real implementation on some devices.
2599 * Note: this is a 915GAV bug, fixed on 915GLV
2601 static const hda_nid_t alc880_adc_nids_alt
[2] = {
2606 #define ALC880_DIGOUT_NID 0x06
2607 #define ALC880_DIGIN_NID 0x0a
2609 static const struct hda_input_mux alc880_capture_source
= {
2613 { "Front Mic", 0x3 },
2619 /* channel source setting (2/6 channel selection for 3-stack) */
2621 static const struct hda_verb alc880_threestack_ch2_init
[] = {
2622 /* set line-in to input, mute it */
2623 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2624 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2625 /* set mic-in to input vref 80%, mute it */
2626 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2627 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2632 static const struct hda_verb alc880_threestack_ch6_init
[] = {
2633 /* set line-in to output, unmute it */
2634 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2635 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2636 /* set mic-in to output, unmute it */
2637 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2638 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2642 static const struct hda_channel_mode alc880_threestack_modes
[2] = {
2643 { 2, alc880_threestack_ch2_init
},
2644 { 6, alc880_threestack_ch6_init
},
2647 static const struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
2648 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2649 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2650 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2651 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2652 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2653 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2654 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2655 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2656 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2657 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2658 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2659 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2660 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2661 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2662 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2663 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
2666 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2667 .name
= "Channel Mode",
2668 .info
= alc_ch_mode_info
,
2669 .get
= alc_ch_mode_get
,
2670 .put
= alc_ch_mode_put
,
2675 /* capture mixer elements */
2676 static int alc_cap_vol_info(struct snd_kcontrol
*kcontrol
,
2677 struct snd_ctl_elem_info
*uinfo
)
2679 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2680 struct alc_spec
*spec
= codec
->spec
;
2683 mutex_lock(&codec
->control_mutex
);
2684 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2686 err
= snd_hda_mixer_amp_volume_info(kcontrol
, uinfo
);
2687 mutex_unlock(&codec
->control_mutex
);
2691 static int alc_cap_vol_tlv(struct snd_kcontrol
*kcontrol
, int op_flag
,
2692 unsigned int size
, unsigned int __user
*tlv
)
2694 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2695 struct alc_spec
*spec
= codec
->spec
;
2698 mutex_lock(&codec
->control_mutex
);
2699 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2701 err
= snd_hda_mixer_amp_tlv(kcontrol
, op_flag
, size
, tlv
);
2702 mutex_unlock(&codec
->control_mutex
);
2706 typedef int (*getput_call_t
)(struct snd_kcontrol
*kcontrol
,
2707 struct snd_ctl_elem_value
*ucontrol
);
2709 static int alc_cap_getput_caller(struct snd_kcontrol
*kcontrol
,
2710 struct snd_ctl_elem_value
*ucontrol
,
2713 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2714 struct alc_spec
*spec
= codec
->spec
;
2715 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
2718 mutex_lock(&codec
->control_mutex
);
2719 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[adc_idx
],
2721 err
= func(kcontrol
, ucontrol
);
2722 mutex_unlock(&codec
->control_mutex
);
2726 static int alc_cap_vol_get(struct snd_kcontrol
*kcontrol
,
2727 struct snd_ctl_elem_value
*ucontrol
)
2729 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2730 snd_hda_mixer_amp_volume_get
);
2733 static int alc_cap_vol_put(struct snd_kcontrol
*kcontrol
,
2734 struct snd_ctl_elem_value
*ucontrol
)
2736 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2737 snd_hda_mixer_amp_volume_put
);
2740 /* capture mixer elements */
2741 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2743 static int alc_cap_sw_get(struct snd_kcontrol
*kcontrol
,
2744 struct snd_ctl_elem_value
*ucontrol
)
2746 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2747 snd_hda_mixer_amp_switch_get
);
2750 static int alc_cap_sw_put(struct snd_kcontrol
*kcontrol
,
2751 struct snd_ctl_elem_value
*ucontrol
)
2753 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2754 snd_hda_mixer_amp_switch_put
);
2757 #define _DEFINE_CAPMIX(num) \
2759 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2760 .name = "Capture Switch", \
2761 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2763 .info = alc_cap_sw_info, \
2764 .get = alc_cap_sw_get, \
2765 .put = alc_cap_sw_put, \
2768 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2769 .name = "Capture Volume", \
2770 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2771 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2772 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2774 .info = alc_cap_vol_info, \
2775 .get = alc_cap_vol_get, \
2776 .put = alc_cap_vol_put, \
2777 .tlv = { .c = alc_cap_vol_tlv }, \
2780 #define _DEFINE_CAPSRC(num) \
2782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2783 /* .name = "Capture Source", */ \
2784 .name = "Input Source", \
2786 .info = alc_mux_enum_info, \
2787 .get = alc_mux_enum_get, \
2788 .put = alc_mux_enum_put, \
2791 #define DEFINE_CAPMIX(num) \
2792 static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2793 _DEFINE_CAPMIX(num), \
2794 _DEFINE_CAPSRC(num), \
2798 #define DEFINE_CAPMIX_NOSRC(num) \
2799 static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2800 _DEFINE_CAPMIX(num), \
2804 /* up to three ADCs */
2808 DEFINE_CAPMIX_NOSRC(1);
2809 DEFINE_CAPMIX_NOSRC(2);
2810 DEFINE_CAPMIX_NOSRC(3);
2813 * ALC880 5-stack model
2815 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2817 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2818 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2821 /* additional mixers to alc880_three_stack_mixer */
2822 static const struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
2823 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2824 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
2828 /* channel source setting (6/8 channel selection for 5-stack) */
2830 static const struct hda_verb alc880_fivestack_ch6_init
[] = {
2831 /* set line-in to input, mute it */
2832 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2833 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2838 static const struct hda_verb alc880_fivestack_ch8_init
[] = {
2839 /* set line-in to output, unmute it */
2840 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2841 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2845 static const struct hda_channel_mode alc880_fivestack_modes
[2] = {
2846 { 6, alc880_fivestack_ch6_init
},
2847 { 8, alc880_fivestack_ch8_init
},
2852 * ALC880 6-stack model
2854 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2855 * Side = 0x05 (0x0f)
2856 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2857 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2860 static const hda_nid_t alc880_6st_dac_nids
[4] = {
2861 /* front, rear, clfe, rear_surr */
2862 0x02, 0x03, 0x04, 0x05
2865 static const struct hda_input_mux alc880_6stack_capture_source
= {
2869 { "Front Mic", 0x1 },
2875 /* fixed 8-channels */
2876 static const struct hda_channel_mode alc880_sixstack_modes
[1] = {
2880 static const struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
2881 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2882 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2883 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2884 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2885 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2886 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2887 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2888 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2889 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2890 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2891 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2892 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2893 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2894 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2897 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2898 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2900 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2901 .name
= "Channel Mode",
2902 .info
= alc_ch_mode_info
,
2903 .get
= alc_ch_mode_get
,
2904 .put
= alc_ch_mode_put
,
2913 * W810 has rear IO for:
2916 * Center/LFE (DAC 04)
2919 * The system also has a pair of internal speakers, and a headphone jack.
2920 * These are both connected to Line2 on the codec, hence to DAC 02.
2922 * There is a variable resistor to control the speaker or headphone
2923 * volume. This is a hardware-only device without a software API.
2925 * Plugging headphones in will disable the internal speakers. This is
2926 * implemented in hardware, not via the driver using jack sense. In
2927 * a similar fashion, plugging into the rear socket marked "front" will
2928 * disable both the speakers and headphones.
2930 * For input, there's a microphone jack, and an "audio in" jack.
2931 * These may not do anything useful with this driver yet, because I
2932 * haven't setup any initialization verbs for these yet...
2935 static const hda_nid_t alc880_w810_dac_nids
[3] = {
2936 /* front, rear/surround, clfe */
2940 /* fixed 6 channels */
2941 static const struct hda_channel_mode alc880_w810_modes
[1] = {
2945 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2946 static const struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
2947 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2948 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2949 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2950 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2951 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2952 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2953 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2954 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2955 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2963 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2964 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2968 static const hda_nid_t alc880_z71v_dac_nids
[1] = {
2971 #define ALC880_Z71V_HP_DAC 0x03
2973 /* fixed 2 channels */
2974 static const struct hda_channel_mode alc880_2_jack_modes
[1] = {
2978 static const struct snd_kcontrol_new alc880_z71v_mixer
[] = {
2979 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2980 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2981 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2982 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
2983 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2984 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2985 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2986 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2992 * ALC880 F1734 model
2994 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2995 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2998 static const hda_nid_t alc880_f1734_dac_nids
[1] = {
3001 #define ALC880_F1734_HP_DAC 0x02
3003 static const struct snd_kcontrol_new alc880_f1734_mixer
[] = {
3004 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3005 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3006 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3007 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3008 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3009 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3011 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3015 static const struct hda_input_mux alc880_f1734_capture_source
= {
3027 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3028 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3029 * Mic = 0x18, Line = 0x1a
3032 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
3033 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
3035 static const struct snd_kcontrol_new alc880_asus_mixer
[] = {
3036 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3037 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3038 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3039 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
3040 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3041 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3042 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3043 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3044 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3045 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3047 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3051 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3052 .name
= "Channel Mode",
3053 .info
= alc_ch_mode_info
,
3054 .get
= alc_ch_mode_get
,
3055 .put
= alc_ch_mode_put
,
3061 * ALC880 ASUS W1V model
3063 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3064 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3065 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
3068 /* additional mixers to alc880_asus_mixer */
3069 static const struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
3070 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
3071 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
3076 static const struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
3077 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3078 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
3079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
3080 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
3081 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
3082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
3083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
3084 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
3085 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
3090 static const struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
3091 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3092 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3093 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3094 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3095 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3096 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3097 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3098 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3099 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3100 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3101 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3102 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3104 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3105 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3106 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3108 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3109 .name
= "Channel Mode",
3110 .info
= alc_ch_mode_info
,
3111 .get
= alc_ch_mode_get
,
3112 .put
= alc_ch_mode_put
,
3117 static const struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
3118 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3119 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3120 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3121 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3126 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3127 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3131 static const struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
3132 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3133 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3134 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3135 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3137 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3142 * virtual master controls
3146 * slave controls for virtual master
3148 static const char * const alc_slave_vols
[] = {
3149 "Front Playback Volume",
3150 "Surround Playback Volume",
3151 "Center Playback Volume",
3152 "LFE Playback Volume",
3153 "Side Playback Volume",
3154 "Headphone Playback Volume",
3155 "Speaker Playback Volume",
3156 "Mono Playback Volume",
3157 "Line-Out Playback Volume",
3161 static const char * const alc_slave_sws
[] = {
3162 "Front Playback Switch",
3163 "Surround Playback Switch",
3164 "Center Playback Switch",
3165 "LFE Playback Switch",
3166 "Side Playback Switch",
3167 "Headphone Playback Switch",
3168 "Speaker Playback Switch",
3169 "Mono Playback Switch",
3170 "IEC958 Playback Switch",
3171 "Line-Out Playback Switch",
3176 * build control elements
3179 #define NID_MAPPING (-1)
3181 #define SUBDEV_SPEAKER_ (0 << 6)
3182 #define SUBDEV_HP_ (1 << 6)
3183 #define SUBDEV_LINE_ (2 << 6)
3184 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
3185 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
3186 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
3188 static void alc_free_kctls(struct hda_codec
*codec
);
3190 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3191 /* additional beep mixers; the actual parameters are overwritten at build */
3192 static const struct snd_kcontrol_new alc_beep_mixer
[] = {
3193 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT
),
3194 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT
),
3199 static int alc_build_controls(struct hda_codec
*codec
)
3201 struct alc_spec
*spec
= codec
->spec
;
3202 struct snd_kcontrol
*kctl
= NULL
;
3203 const struct snd_kcontrol_new
*knew
;
3208 for (i
= 0; i
< spec
->num_mixers
; i
++) {
3209 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
3213 if (spec
->cap_mixer
) {
3214 err
= snd_hda_add_new_ctls(codec
, spec
->cap_mixer
);
3218 if (spec
->multiout
.dig_out_nid
) {
3219 err
= snd_hda_create_spdif_out_ctls(codec
,
3220 spec
->multiout
.dig_out_nid
);
3223 if (!spec
->no_analog
) {
3224 err
= snd_hda_create_spdif_share_sw(codec
,
3228 spec
->multiout
.share_spdif
= 1;
3231 if (spec
->dig_in_nid
) {
3232 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
3237 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3238 /* create beep controls if needed */
3239 if (spec
->beep_amp
) {
3240 const struct snd_kcontrol_new
*knew
;
3241 for (knew
= alc_beep_mixer
; knew
->name
; knew
++) {
3242 struct snd_kcontrol
*kctl
;
3243 kctl
= snd_ctl_new1(knew
, codec
);
3246 kctl
->private_value
= spec
->beep_amp
;
3247 err
= snd_hda_ctl_add(codec
, 0, kctl
);
3254 /* if we have no master control, let's create it */
3255 if (!spec
->no_analog
&&
3256 !snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
3257 unsigned int vmaster_tlv
[4];
3258 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
3259 HDA_OUTPUT
, vmaster_tlv
);
3260 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
3261 vmaster_tlv
, alc_slave_vols
);
3265 if (!spec
->no_analog
&&
3266 !snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
3267 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
3268 NULL
, alc_slave_sws
);
3273 /* assign Capture Source enums to NID */
3274 if (spec
->capsrc_nids
|| spec
->adc_nids
) {
3275 kctl
= snd_hda_find_mixer_ctl(codec
, "Capture Source");
3277 kctl
= snd_hda_find_mixer_ctl(codec
, "Input Source");
3278 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
3279 const hda_nid_t
*nids
= spec
->capsrc_nids
;
3281 nids
= spec
->adc_nids
;
3282 err
= snd_hda_add_nid(codec
, kctl
, i
, nids
[i
]);
3287 if (spec
->cap_mixer
) {
3288 const char *kname
= kctl
? kctl
->id
.name
: NULL
;
3289 for (knew
= spec
->cap_mixer
; knew
->name
; knew
++) {
3290 if (kname
&& strcmp(knew
->name
, kname
) == 0)
3292 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
3293 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
3294 err
= snd_hda_add_nid(codec
, kctl
, i
,
3302 /* other nid->control mapping */
3303 for (i
= 0; i
< spec
->num_mixers
; i
++) {
3304 for (knew
= spec
->mixers
[i
]; knew
->name
; knew
++) {
3305 if (knew
->iface
!= NID_MAPPING
)
3307 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
3310 u
= knew
->subdevice
;
3311 for (j
= 0; j
< 4; j
++, u
>>= 8) {
3316 case SUBDEV_SPEAKER_
:
3317 nid
= spec
->autocfg
.speaker_pins
[nid
];
3320 nid
= spec
->autocfg
.line_out_pins
[nid
];
3323 nid
= spec
->autocfg
.hp_pins
[nid
];
3328 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
3332 u
= knew
->private_value
;
3333 for (j
= 0; j
< 4; j
++, u
>>= 8) {
3337 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
3344 alc_free_kctls(codec
); /* no longer needed */
3351 * initialize the codec volumes, etc
3355 * generic initialization of ADC, input mixers and output mixers
3357 static const struct hda_verb alc880_volume_init_verbs
[] = {
3359 * Unmute ADC0-2 and set the default input to mic-in
3361 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
3362 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3363 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
3364 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3365 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
3366 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3368 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3370 * Note: PASD motherboards uses the Line In 2 as the input for front
3373 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3374 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3380 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3383 * Set up output mixers (0x0c - 0x0f)
3385 /* set vol=0 to output mixers */
3386 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3387 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3388 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3389 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3390 /* set up input amps for analog loopback */
3391 /* Amp Indices: DAC = 0, mixer = 1 */
3392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3395 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3396 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3397 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3398 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3399 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3405 * 3-stack pin configuration:
3406 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3408 static const struct hda_verb alc880_pin_3stack_init_verbs
[] = {
3410 * preset connection lists of input pins
3411 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3413 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
3414 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3415 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
3418 * Set pin mode and muting
3420 /* set front pin widgets 0x14 for output */
3421 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3422 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3423 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3424 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3425 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3426 /* Mic2 (as headphone out) for HP output */
3427 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3428 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3429 /* Line In pin widget for input */
3430 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3431 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3432 /* Line2 (as front mic) pin widget for input and vref at 80% */
3433 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3434 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3435 /* CD pin widget for input */
3436 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3442 * 5-stack pin configuration:
3443 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3444 * line-in/side = 0x1a, f-mic = 0x1b
3446 static const struct hda_verb alc880_pin_5stack_init_verbs
[] = {
3448 * preset connection lists of input pins
3449 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3451 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3452 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
3455 * Set pin mode and muting
3457 /* set pin widgets 0x14-0x17 for output */
3458 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3459 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3460 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3461 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3462 /* unmute pins for output (no gain on this amp) */
3463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3464 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3465 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3466 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3468 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3469 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3470 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3471 /* Mic2 (as headphone out) for HP output */
3472 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3473 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3474 /* Line In pin widget for input */
3475 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3476 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3477 /* Line2 (as front mic) pin widget for input and vref at 80% */
3478 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3479 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3480 /* CD pin widget for input */
3481 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3487 * W810 pin configuration:
3488 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3490 static const struct hda_verb alc880_pin_w810_init_verbs
[] = {
3491 /* hphone/speaker input selector: front DAC */
3492 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
3494 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3495 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3498 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3499 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3501 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3502 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3508 * Z71V pin configuration:
3509 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3511 static const struct hda_verb alc880_pin_z71v_init_verbs
[] = {
3512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3513 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3514 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3515 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3517 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3518 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3519 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3520 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3526 * 6-stack pin configuration:
3527 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3528 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3530 static const struct hda_verb alc880_pin_6stack_init_verbs
[] = {
3531 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3533 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3534 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3535 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3536 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3537 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3538 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3539 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3540 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3542 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3543 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3544 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3545 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3546 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3547 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3548 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3549 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3550 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3556 * Uniwill pin configuration:
3557 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3560 static const struct hda_verb alc880_uniwill_init_verbs
[] = {
3561 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3564 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3565 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3566 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3567 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3568 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3569 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3570 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3571 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3572 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3573 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3574 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3575 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3576 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3578 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3579 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3580 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3581 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3582 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3583 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3584 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3585 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3586 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3588 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3589 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
3596 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3598 static const struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
3599 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3603 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3604 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3605 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3606 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3608 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3609 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3610 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3611 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3612 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3614 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3615 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3616 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3617 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3618 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3619 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3621 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3622 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
3627 static const struct hda_verb alc880_beep_init_verbs
[] = {
3628 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
3632 /* auto-toggle front mic */
3633 static void alc88x_simple_mic_automute(struct hda_codec
*codec
)
3635 unsigned int present
;
3638 present
= snd_hda_jack_detect(codec
, 0x18);
3639 bits
= present
? HDA_AMP_MUTE
: 0;
3640 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
3643 static void alc880_uniwill_setup(struct hda_codec
*codec
)
3645 struct alc_spec
*spec
= codec
->spec
;
3647 spec
->autocfg
.hp_pins
[0] = 0x14;
3648 spec
->autocfg
.speaker_pins
[0] = 0x15;
3649 spec
->autocfg
.speaker_pins
[0] = 0x16;
3651 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
3654 static void alc880_uniwill_init_hook(struct hda_codec
*codec
)
3656 alc_hp_automute(codec
);
3657 alc88x_simple_mic_automute(codec
);
3660 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
3663 /* Looks like the unsol event is incompatible with the standard
3664 * definition. 4bit tag is placed at 28 bit!
3666 switch (res
>> 28) {
3667 case ALC880_MIC_EVENT
:
3668 alc88x_simple_mic_automute(codec
);
3671 alc_sku_unsol_event(codec
, res
);
3676 static void alc880_uniwill_p53_setup(struct hda_codec
*codec
)
3678 struct alc_spec
*spec
= codec
->spec
;
3680 spec
->autocfg
.hp_pins
[0] = 0x14;
3681 spec
->autocfg
.speaker_pins
[0] = 0x15;
3683 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
3686 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
3688 unsigned int present
;
3690 present
= snd_hda_codec_read(codec
, 0x21, 0,
3691 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
3692 present
&= HDA_AMP_VOLMASK
;
3693 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
3694 HDA_AMP_VOLMASK
, present
);
3695 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
3696 HDA_AMP_VOLMASK
, present
);
3699 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
3702 /* Looks like the unsol event is incompatible with the standard
3703 * definition. 4bit tag is placed at 28 bit!
3705 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
3706 alc880_uniwill_p53_dcvol_automute(codec
);
3708 alc_sku_unsol_event(codec
, res
);
3712 * F1734 pin configuration:
3713 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3715 static const struct hda_verb alc880_pin_f1734_init_verbs
[] = {
3716 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
3717 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3718 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3719 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3720 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3722 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3723 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3725 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3727 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3729 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
3730 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3731 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3732 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3733 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3734 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3735 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3737 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
3738 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
3744 * ASUS pin configuration:
3745 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3747 static const struct hda_verb alc880_pin_asus_init_verbs
[] = {
3748 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3749 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3750 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3751 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3753 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3756 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3757 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3758 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3759 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3760 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3765 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3768 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3770 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3775 /* Enable GPIO mask and set output */
3776 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3777 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3778 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3780 /* Clevo m520g init */
3781 static const struct hda_verb alc880_pin_clevo_init_verbs
[] = {
3782 /* headphone output */
3783 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3785 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3786 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3788 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3789 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3791 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3792 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3793 /* Mic1 (rear panel) */
3794 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3795 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3796 /* Mic2 (front panel) */
3797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3798 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3800 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3802 /* change to EAPD mode */
3803 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3804 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3809 static const struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
3810 /* change to EAPD mode */
3811 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3812 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3814 /* Headphone output */
3815 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3817 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3818 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
3820 /* Line In pin widget for input */
3821 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3822 /* CD pin widget for input */
3823 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3824 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3825 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3827 /* change to EAPD mode */
3828 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3829 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
3835 * LG m1 express dual
3838 * Rear Line-In/Out (blue): 0x14
3839 * Build-in Mic-In: 0x15
3841 * HP-Out (green): 0x1b
3842 * Mic-In/Out (red): 0x19
3846 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3847 static const hda_nid_t alc880_lg_dac_nids
[3] = {
3851 /* seems analog CD is not working */
3852 static const struct hda_input_mux alc880_lg_capture_source
= {
3857 { "Internal Mic", 0x6 },
3861 /* 2,4,6 channel modes */
3862 static const struct hda_verb alc880_lg_ch2_init
[] = {
3863 /* set line-in and mic-in to input */
3864 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3865 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3869 static const struct hda_verb alc880_lg_ch4_init
[] = {
3870 /* set line-in to out and mic-in to input */
3871 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3872 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3876 static const struct hda_verb alc880_lg_ch6_init
[] = {
3877 /* set line-in and mic-in to output */
3878 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3879 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3883 static const struct hda_channel_mode alc880_lg_ch_modes
[3] = {
3884 { 2, alc880_lg_ch2_init
},
3885 { 4, alc880_lg_ch4_init
},
3886 { 6, alc880_lg_ch6_init
},
3889 static const struct snd_kcontrol_new alc880_lg_mixer
[] = {
3890 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3891 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
3892 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3893 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
3894 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
3895 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
3896 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
3897 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
3898 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3899 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3900 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
3901 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
3902 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
3903 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
3905 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3906 .name
= "Channel Mode",
3907 .info
= alc_ch_mode_info
,
3908 .get
= alc_ch_mode_get
,
3909 .put
= alc_ch_mode_put
,
3914 static const struct hda_verb alc880_lg_init_verbs
[] = {
3915 /* set capture source to mic-in */
3916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3917 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3918 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3919 /* mute all amp mixer inputs */
3920 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
3921 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3922 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3923 /* line-in to input */
3924 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3925 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3930 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3931 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3932 /* mic-in to input */
3933 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3934 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3935 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3937 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
3938 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3939 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3941 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3945 /* toggle speaker-output according to the hp-jack state */
3946 static void alc880_lg_setup(struct hda_codec
*codec
)
3948 struct alc_spec
*spec
= codec
->spec
;
3950 spec
->autocfg
.hp_pins
[0] = 0x1b;
3951 spec
->autocfg
.speaker_pins
[0] = 0x17;
3953 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
3962 * Built-in Mic-In: 0x19
3968 static const struct hda_input_mux alc880_lg_lw_capture_source
= {
3972 { "Internal Mic", 0x1 },
3977 #define alc880_lg_lw_modes alc880_threestack_modes
3979 static const struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
3980 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3981 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3982 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3983 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
3984 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3985 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3986 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3987 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3988 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3989 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3991 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3992 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
3993 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
3995 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3996 .name
= "Channel Mode",
3997 .info
= alc_ch_mode_info
,
3998 .get
= alc_ch_mode_get
,
3999 .put
= alc_ch_mode_put
,
4004 static const struct hda_verb alc880_lg_lw_init_verbs
[] = {
4005 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
4006 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
4007 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
4009 /* set capture source to mic-in */
4010 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4011 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4012 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
4015 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4016 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4018 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4019 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4020 /* mic-in to input */
4021 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4022 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4024 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4025 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4027 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4031 /* toggle speaker-output according to the hp-jack state */
4032 static void alc880_lg_lw_setup(struct hda_codec
*codec
)
4034 struct alc_spec
*spec
= codec
->spec
;
4036 spec
->autocfg
.hp_pins
[0] = 0x1b;
4037 spec
->autocfg
.speaker_pins
[0] = 0x14;
4039 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
4042 static const struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
4043 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4044 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
4045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4046 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4047 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4048 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4052 static const struct hda_input_mux alc880_medion_rim_capture_source
= {
4056 { "Internal Mic", 0x1 },
4060 static const struct hda_verb alc880_medion_rim_init_verbs
[] = {
4061 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
4063 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4064 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4066 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4067 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4068 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4069 /* Mic2 (as headphone out) for HP output */
4070 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4071 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4072 /* Internal Speaker */
4073 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4074 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4076 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
4077 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
4079 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4083 /* toggle speaker-output according to the hp-jack state */
4084 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
4086 struct alc_spec
*spec
= codec
->spec
;
4087 alc_hp_automute(codec
);
4089 if (spec
->jack_present
)
4090 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
4092 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
4095 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
4098 /* Looks like the unsol event is incompatible with the standard
4099 * definition. 4bit tag is placed at 28 bit!
4101 if ((res
>> 28) == ALC880_HP_EVENT
)
4102 alc880_medion_rim_automute(codec
);
4105 static void alc880_medion_rim_setup(struct hda_codec
*codec
)
4107 struct alc_spec
*spec
= codec
->spec
;
4109 spec
->autocfg
.hp_pins
[0] = 0x14;
4110 spec
->autocfg
.speaker_pins
[0] = 0x1b;
4112 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
4115 #ifdef CONFIG_SND_HDA_POWER_SAVE
4116 static const struct hda_amp_list alc880_loopbacks
[] = {
4117 { 0x0b, HDA_INPUT
, 0 },
4118 { 0x0b, HDA_INPUT
, 1 },
4119 { 0x0b, HDA_INPUT
, 2 },
4120 { 0x0b, HDA_INPUT
, 3 },
4121 { 0x0b, HDA_INPUT
, 4 },
4125 static const struct hda_amp_list alc880_lg_loopbacks
[] = {
4126 { 0x0b, HDA_INPUT
, 1 },
4127 { 0x0b, HDA_INPUT
, 6 },
4128 { 0x0b, HDA_INPUT
, 7 },
4137 static void alc_init_special_input_src(struct hda_codec
*codec
);
4139 static int alc_init(struct hda_codec
*codec
)
4141 struct alc_spec
*spec
= codec
->spec
;
4145 alc_auto_init_amp(codec
, spec
->init_amp
);
4147 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
4148 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
4149 alc_init_special_input_src(codec
);
4151 if (spec
->init_hook
)
4152 spec
->init_hook(codec
);
4154 alc_apply_fixup(codec
, ALC_FIXUP_ACT_INIT
);
4156 hda_call_check_power_status(codec
, 0x01);
4160 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4162 struct alc_spec
*spec
= codec
->spec
;
4164 if (spec
->unsol_event
)
4165 spec
->unsol_event(codec
, res
);
4168 #ifdef CONFIG_SND_HDA_POWER_SAVE
4169 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
4171 struct alc_spec
*spec
= codec
->spec
;
4172 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
4177 * Analog playback callbacks
4179 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
4180 struct hda_codec
*codec
,
4181 struct snd_pcm_substream
*substream
)
4183 struct alc_spec
*spec
= codec
->spec
;
4184 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
4188 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4189 struct hda_codec
*codec
,
4190 unsigned int stream_tag
,
4191 unsigned int format
,
4192 struct snd_pcm_substream
*substream
)
4194 struct alc_spec
*spec
= codec
->spec
;
4195 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
4196 stream_tag
, format
, substream
);
4199 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4200 struct hda_codec
*codec
,
4201 struct snd_pcm_substream
*substream
)
4203 struct alc_spec
*spec
= codec
->spec
;
4204 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
4210 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
4211 struct hda_codec
*codec
,
4212 struct snd_pcm_substream
*substream
)
4214 struct alc_spec
*spec
= codec
->spec
;
4215 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
4218 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4219 struct hda_codec
*codec
,
4220 unsigned int stream_tag
,
4221 unsigned int format
,
4222 struct snd_pcm_substream
*substream
)
4224 struct alc_spec
*spec
= codec
->spec
;
4225 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
4226 stream_tag
, format
, substream
);
4229 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4230 struct hda_codec
*codec
,
4231 struct snd_pcm_substream
*substream
)
4233 struct alc_spec
*spec
= codec
->spec
;
4234 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
4237 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
4238 struct hda_codec
*codec
,
4239 struct snd_pcm_substream
*substream
)
4241 struct alc_spec
*spec
= codec
->spec
;
4242 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
4248 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4249 struct hda_codec
*codec
,
4250 unsigned int stream_tag
,
4251 unsigned int format
,
4252 struct snd_pcm_substream
*substream
)
4254 struct alc_spec
*spec
= codec
->spec
;
4256 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
4257 stream_tag
, 0, format
);
4261 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4262 struct hda_codec
*codec
,
4263 struct snd_pcm_substream
*substream
)
4265 struct alc_spec
*spec
= codec
->spec
;
4267 snd_hda_codec_cleanup_stream(codec
,
4268 spec
->adc_nids
[substream
->number
+ 1]);
4272 /* analog capture with dynamic dual-adc changes */
4273 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4274 struct hda_codec
*codec
,
4275 unsigned int stream_tag
,
4276 unsigned int format
,
4277 struct snd_pcm_substream
*substream
)
4279 struct alc_spec
*spec
= codec
->spec
;
4280 spec
->cur_adc
= spec
->adc_nids
[spec
->cur_adc_idx
];
4281 spec
->cur_adc_stream_tag
= stream_tag
;
4282 spec
->cur_adc_format
= format
;
4283 snd_hda_codec_setup_stream(codec
, spec
->cur_adc
, stream_tag
, 0, format
);
4287 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4288 struct hda_codec
*codec
,
4289 struct snd_pcm_substream
*substream
)
4291 struct alc_spec
*spec
= codec
->spec
;
4292 snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
);
4297 static const struct hda_pcm_stream dualmic_pcm_analog_capture
= {
4301 .nid
= 0, /* fill later */
4303 .prepare
= dualmic_capture_pcm_prepare
,
4304 .cleanup
= dualmic_capture_pcm_cleanup
4310 static const struct hda_pcm_stream alc880_pcm_analog_playback
= {
4314 /* NID is set in alc_build_pcms */
4316 .open
= alc880_playback_pcm_open
,
4317 .prepare
= alc880_playback_pcm_prepare
,
4318 .cleanup
= alc880_playback_pcm_cleanup
4322 static const struct hda_pcm_stream alc880_pcm_analog_capture
= {
4326 /* NID is set in alc_build_pcms */
4329 static const struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
4333 /* NID is set in alc_build_pcms */
4336 static const struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
4337 .substreams
= 2, /* can be overridden */
4340 /* NID is set in alc_build_pcms */
4342 .prepare
= alc880_alt_capture_pcm_prepare
,
4343 .cleanup
= alc880_alt_capture_pcm_cleanup
4347 static const struct hda_pcm_stream alc880_pcm_digital_playback
= {
4351 /* NID is set in alc_build_pcms */
4353 .open
= alc880_dig_playback_pcm_open
,
4354 .close
= alc880_dig_playback_pcm_close
,
4355 .prepare
= alc880_dig_playback_pcm_prepare
,
4356 .cleanup
= alc880_dig_playback_pcm_cleanup
4360 static const struct hda_pcm_stream alc880_pcm_digital_capture
= {
4364 /* NID is set in alc_build_pcms */
4367 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4368 static const struct hda_pcm_stream alc_pcm_null_stream
= {
4374 static int alc_build_pcms(struct hda_codec
*codec
)
4376 struct alc_spec
*spec
= codec
->spec
;
4377 struct hda_pcm
*info
= spec
->pcm_rec
;
4380 codec
->num_pcms
= 1;
4381 codec
->pcm_info
= info
;
4383 if (spec
->no_analog
)
4386 snprintf(spec
->stream_name_analog
, sizeof(spec
->stream_name_analog
),
4387 "%s Analog", codec
->chip_name
);
4388 info
->name
= spec
->stream_name_analog
;
4390 if (spec
->stream_analog_playback
) {
4391 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
4393 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
4394 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
4396 if (spec
->stream_analog_capture
) {
4397 if (snd_BUG_ON(!spec
->adc_nids
))
4399 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
4400 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
4403 if (spec
->channel_mode
) {
4404 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
4405 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
4406 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
4407 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
4413 /* SPDIF for stream index #1 */
4414 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
4415 snprintf(spec
->stream_name_digital
,
4416 sizeof(spec
->stream_name_digital
),
4417 "%s Digital", codec
->chip_name
);
4418 codec
->num_pcms
= 2;
4419 codec
->slave_dig_outs
= spec
->multiout
.slave_dig_outs
;
4420 info
= spec
->pcm_rec
+ 1;
4421 info
->name
= spec
->stream_name_digital
;
4422 if (spec
->dig_out_type
)
4423 info
->pcm_type
= spec
->dig_out_type
;
4425 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
4426 if (spec
->multiout
.dig_out_nid
&&
4427 spec
->stream_digital_playback
) {
4428 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
4429 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
4431 if (spec
->dig_in_nid
&&
4432 spec
->stream_digital_capture
) {
4433 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
4434 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
4436 /* FIXME: do we need this for all Realtek codec models? */
4437 codec
->spdif_status_reset
= 1;
4440 if (spec
->no_analog
)
4443 /* If the use of more than one ADC is requested for the current
4444 * model, configure a second analog capture-only PCM.
4446 /* Additional Analaog capture for index #2 */
4447 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
4448 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
4449 codec
->num_pcms
= 3;
4450 info
= spec
->pcm_rec
+ 2;
4451 info
->name
= spec
->stream_name_analog
;
4452 if (spec
->alt_dac_nid
) {
4453 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
4454 *spec
->stream_analog_alt_playback
;
4455 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
4458 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
4459 alc_pcm_null_stream
;
4460 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
4462 if (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
) {
4463 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
4464 *spec
->stream_analog_alt_capture
;
4465 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
4467 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
4468 spec
->num_adc_nids
- 1;
4470 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
4471 alc_pcm_null_stream
;
4472 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
4479 static inline void alc_shutup(struct hda_codec
*codec
)
4481 struct alc_spec
*spec
= codec
->spec
;
4483 if (spec
&& spec
->shutup
)
4484 spec
->shutup(codec
);
4485 snd_hda_shutup_pins(codec
);
4488 static void alc_free_kctls(struct hda_codec
*codec
)
4490 struct alc_spec
*spec
= codec
->spec
;
4492 if (spec
->kctls
.list
) {
4493 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
4495 for (i
= 0; i
< spec
->kctls
.used
; i
++)
4496 kfree(kctl
[i
].name
);
4498 snd_array_free(&spec
->kctls
);
4501 static void alc_free(struct hda_codec
*codec
)
4503 struct alc_spec
*spec
= codec
->spec
;
4509 snd_hda_input_jack_free(codec
);
4510 alc_free_kctls(codec
);
4512 snd_hda_detach_beep_device(codec
);
4515 #ifdef CONFIG_SND_HDA_POWER_SAVE
4516 static void alc_power_eapd(struct hda_codec
*codec
)
4518 alc_auto_setup_eapd(codec
, false);
4521 static int alc_suspend(struct hda_codec
*codec
, pm_message_t state
)
4523 struct alc_spec
*spec
= codec
->spec
;
4525 if (spec
&& spec
->power_hook
)
4526 spec
->power_hook(codec
);
4531 #ifdef SND_HDA_NEEDS_RESUME
4532 static int alc_resume(struct hda_codec
*codec
)
4534 msleep(150); /* to avoid pop noise */
4535 codec
->patch_ops
.init(codec
);
4536 snd_hda_codec_resume_amp(codec
);
4537 snd_hda_codec_resume_cache(codec
);
4538 hda_call_check_power_status(codec
, 0x01);
4545 static const struct hda_codec_ops alc_patch_ops
= {
4546 .build_controls
= alc_build_controls
,
4547 .build_pcms
= alc_build_pcms
,
4550 .unsol_event
= alc_unsol_event
,
4551 #ifdef SND_HDA_NEEDS_RESUME
4552 .resume
= alc_resume
,
4554 #ifdef CONFIG_SND_HDA_POWER_SAVE
4555 .suspend
= alc_suspend
,
4556 .check_power_status
= alc_check_power_status
,
4558 .reboot_notify
= alc_shutup
,
4561 /* replace the codec chip_name with the given string */
4562 static int alc_codec_rename(struct hda_codec
*codec
, const char *name
)
4564 kfree(codec
->chip_name
);
4565 codec
->chip_name
= kstrdup(name
, GFP_KERNEL
);
4566 if (!codec
->chip_name
) {
4574 * Test configuration for debugging
4576 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4579 #ifdef CONFIG_SND_DEBUG
4580 static const hda_nid_t alc880_test_dac_nids
[4] = {
4581 0x02, 0x03, 0x04, 0x05
4584 static const struct hda_input_mux alc880_test_capture_source
= {
4593 { "Surround", 0x6 },
4597 static const struct hda_channel_mode alc880_test_modes
[4] = {
4604 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
4605 struct snd_ctl_elem_info
*uinfo
)
4607 static const char * const texts
[] = {
4608 "N/A", "Line Out", "HP Out",
4609 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4611 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4613 uinfo
->value
.enumerated
.items
= 8;
4614 if (uinfo
->value
.enumerated
.item
>= 8)
4615 uinfo
->value
.enumerated
.item
= 7;
4616 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4620 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
4621 struct snd_ctl_elem_value
*ucontrol
)
4623 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4624 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4625 unsigned int pin_ctl
, item
= 0;
4627 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
4628 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4629 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
4630 if (pin_ctl
& AC_PINCTL_HP_EN
)
4634 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
4635 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
4636 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
4637 case AC_PINCTL_VREF_50
: item
= 4; break;
4638 case AC_PINCTL_VREF_GRD
: item
= 5; break;
4639 case AC_PINCTL_VREF_80
: item
= 6; break;
4640 case AC_PINCTL_VREF_100
: item
= 7; break;
4643 ucontrol
->value
.enumerated
.item
[0] = item
;
4647 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
4648 struct snd_ctl_elem_value
*ucontrol
)
4650 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4651 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4652 static const unsigned int ctls
[] = {
4653 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
4654 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
4655 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
4656 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
4657 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
4658 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
4660 unsigned int old_ctl
, new_ctl
;
4662 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
4663 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4664 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
4665 if (old_ctl
!= new_ctl
) {
4667 snd_hda_codec_write_cache(codec
, nid
, 0,
4668 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4670 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
4672 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
4679 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
4680 struct snd_ctl_elem_info
*uinfo
)
4682 static const char * const texts
[] = {
4683 "Front", "Surround", "CLFE", "Side"
4685 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4687 uinfo
->value
.enumerated
.items
= 4;
4688 if (uinfo
->value
.enumerated
.item
>= 4)
4689 uinfo
->value
.enumerated
.item
= 3;
4690 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4694 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
4695 struct snd_ctl_elem_value
*ucontrol
)
4697 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4698 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4701 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
4702 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
4706 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
4707 struct snd_ctl_elem_value
*ucontrol
)
4709 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4710 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4713 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
4714 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
4715 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
4716 snd_hda_codec_write_cache(codec
, nid
, 0,
4717 AC_VERB_SET_CONNECT_SEL
, sel
);
4723 #define PIN_CTL_TEST(xname,nid) { \
4724 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4726 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4727 .info = alc_test_pin_ctl_info, \
4728 .get = alc_test_pin_ctl_get, \
4729 .put = alc_test_pin_ctl_put, \
4730 .private_value = nid \
4733 #define PIN_SRC_TEST(xname,nid) { \
4734 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4736 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4737 .info = alc_test_pin_src_info, \
4738 .get = alc_test_pin_src_get, \
4739 .put = alc_test_pin_src_put, \
4740 .private_value = nid \
4743 static const struct snd_kcontrol_new alc880_test_mixer
[] = {
4744 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4745 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4746 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
4747 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
4748 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4749 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4750 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
4751 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
4752 PIN_CTL_TEST("Front Pin Mode", 0x14),
4753 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4754 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4755 PIN_CTL_TEST("Side Pin Mode", 0x17),
4756 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4757 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4758 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4759 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4760 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4761 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4762 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4763 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4764 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4765 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4766 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4767 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4768 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
4769 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
4770 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
4771 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
4772 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
4773 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
4775 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4776 .name
= "Channel Mode",
4777 .info
= alc_ch_mode_info
,
4778 .get
= alc_ch_mode_get
,
4779 .put
= alc_ch_mode_put
,
4784 static const struct hda_verb alc880_test_init_verbs
[] = {
4785 /* Unmute inputs of 0x0c - 0x0f */
4786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4788 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4789 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4790 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4791 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4792 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4793 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4794 /* Vol output for 0x0c-0x0f */
4795 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4796 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4797 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4798 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4799 /* Set output pins 0x14-0x17 */
4800 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4802 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4803 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4804 /* Unmute output pins 0x14-0x17 */
4805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4806 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4807 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4808 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4809 /* Set input pins 0x18-0x1c */
4810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4811 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4812 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4813 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4814 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4815 /* Mute input pins 0x18-0x1b */
4816 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4817 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4818 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4819 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4822 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4824 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4825 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4826 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4827 /* Analog input/passthru */
4828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4840 static const char * const alc880_models
[ALC880_MODEL_LAST
] = {
4841 [ALC880_3ST
] = "3stack",
4842 [ALC880_TCL_S700
] = "tcl",
4843 [ALC880_3ST_DIG
] = "3stack-digout",
4844 [ALC880_CLEVO
] = "clevo",
4845 [ALC880_5ST
] = "5stack",
4846 [ALC880_5ST_DIG
] = "5stack-digout",
4847 [ALC880_W810
] = "w810",
4848 [ALC880_Z71V
] = "z71v",
4849 [ALC880_6ST
] = "6stack",
4850 [ALC880_6ST_DIG
] = "6stack-digout",
4851 [ALC880_ASUS
] = "asus",
4852 [ALC880_ASUS_W1V
] = "asus-w1v",
4853 [ALC880_ASUS_DIG
] = "asus-dig",
4854 [ALC880_ASUS_DIG2
] = "asus-dig2",
4855 [ALC880_UNIWILL_DIG
] = "uniwill",
4856 [ALC880_UNIWILL_P53
] = "uniwill-p53",
4857 [ALC880_FUJITSU
] = "fujitsu",
4858 [ALC880_F1734
] = "F1734",
4860 [ALC880_LG_LW
] = "lg-lw",
4861 [ALC880_MEDION_RIM
] = "medion",
4862 #ifdef CONFIG_SND_DEBUG
4863 [ALC880_TEST
] = "test",
4865 [ALC880_AUTO
] = "auto",
4868 static const struct snd_pci_quirk alc880_cfg_tbl
[] = {
4869 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
4870 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
4871 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
4872 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
4873 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
4874 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
4875 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
4876 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
4877 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
4878 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
4879 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
4880 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
4881 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
4882 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
4883 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
4884 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
4885 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
4886 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
4887 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4888 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
4889 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
4890 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
4891 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
4892 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
4893 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
4894 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS
), /* default ASUS */
4895 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
4896 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
4897 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
4898 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
4899 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
4900 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
4901 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
4902 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
4903 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
4904 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
4905 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
4906 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
4907 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
4908 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
4909 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734
),
4910 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
4911 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
4912 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
4913 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
4914 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
4915 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
4916 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
4917 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
4918 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734
),
4919 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
4920 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
4921 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
4922 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG
),
4923 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
4924 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
4925 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
4926 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
4927 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
4928 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
4929 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
4930 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
4931 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
4932 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
4933 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
4934 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
4935 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
4936 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
4937 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
4939 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST
),
4940 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
4941 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
4946 * ALC880 codec presets
4948 static const struct alc_config_preset alc880_presets
[] = {
4950 .mixers
= { alc880_three_stack_mixer
},
4951 .init_verbs
= { alc880_volume_init_verbs
,
4952 alc880_pin_3stack_init_verbs
},
4953 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4954 .dac_nids
= alc880_dac_nids
,
4955 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4956 .channel_mode
= alc880_threestack_modes
,
4958 .input_mux
= &alc880_capture_source
,
4960 [ALC880_3ST_DIG
] = {
4961 .mixers
= { alc880_three_stack_mixer
},
4962 .init_verbs
= { alc880_volume_init_verbs
,
4963 alc880_pin_3stack_init_verbs
},
4964 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4965 .dac_nids
= alc880_dac_nids
,
4966 .dig_out_nid
= ALC880_DIGOUT_NID
,
4967 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4968 .channel_mode
= alc880_threestack_modes
,
4970 .input_mux
= &alc880_capture_source
,
4972 [ALC880_TCL_S700
] = {
4973 .mixers
= { alc880_tcl_s700_mixer
},
4974 .init_verbs
= { alc880_volume_init_verbs
,
4975 alc880_pin_tcl_S700_init_verbs
,
4976 alc880_gpio2_init_verbs
},
4977 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4978 .dac_nids
= alc880_dac_nids
,
4979 .adc_nids
= alc880_adc_nids_alt
, /* FIXME: correct? */
4980 .num_adc_nids
= 1, /* single ADC */
4982 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4983 .channel_mode
= alc880_2_jack_modes
,
4984 .input_mux
= &alc880_capture_source
,
4987 .mixers
= { alc880_three_stack_mixer
,
4988 alc880_five_stack_mixer
},
4989 .init_verbs
= { alc880_volume_init_verbs
,
4990 alc880_pin_5stack_init_verbs
},
4991 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4992 .dac_nids
= alc880_dac_nids
,
4993 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
4994 .channel_mode
= alc880_fivestack_modes
,
4995 .input_mux
= &alc880_capture_source
,
4997 [ALC880_5ST_DIG
] = {
4998 .mixers
= { alc880_three_stack_mixer
,
4999 alc880_five_stack_mixer
},
5000 .init_verbs
= { alc880_volume_init_verbs
,
5001 alc880_pin_5stack_init_verbs
},
5002 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5003 .dac_nids
= alc880_dac_nids
,
5004 .dig_out_nid
= ALC880_DIGOUT_NID
,
5005 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
5006 .channel_mode
= alc880_fivestack_modes
,
5007 .input_mux
= &alc880_capture_source
,
5010 .mixers
= { alc880_six_stack_mixer
},
5011 .init_verbs
= { alc880_volume_init_verbs
,
5012 alc880_pin_6stack_init_verbs
},
5013 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
5014 .dac_nids
= alc880_6st_dac_nids
,
5015 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
5016 .channel_mode
= alc880_sixstack_modes
,
5017 .input_mux
= &alc880_6stack_capture_source
,
5019 [ALC880_6ST_DIG
] = {
5020 .mixers
= { alc880_six_stack_mixer
},
5021 .init_verbs
= { alc880_volume_init_verbs
,
5022 alc880_pin_6stack_init_verbs
},
5023 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
5024 .dac_nids
= alc880_6st_dac_nids
,
5025 .dig_out_nid
= ALC880_DIGOUT_NID
,
5026 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
5027 .channel_mode
= alc880_sixstack_modes
,
5028 .input_mux
= &alc880_6stack_capture_source
,
5031 .mixers
= { alc880_w810_base_mixer
},
5032 .init_verbs
= { alc880_volume_init_verbs
,
5033 alc880_pin_w810_init_verbs
,
5034 alc880_gpio2_init_verbs
},
5035 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
5036 .dac_nids
= alc880_w810_dac_nids
,
5037 .dig_out_nid
= ALC880_DIGOUT_NID
,
5038 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
5039 .channel_mode
= alc880_w810_modes
,
5040 .input_mux
= &alc880_capture_source
,
5043 .mixers
= { alc880_z71v_mixer
},
5044 .init_verbs
= { alc880_volume_init_verbs
,
5045 alc880_pin_z71v_init_verbs
},
5046 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
5047 .dac_nids
= alc880_z71v_dac_nids
,
5048 .dig_out_nid
= ALC880_DIGOUT_NID
,
5050 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5051 .channel_mode
= alc880_2_jack_modes
,
5052 .input_mux
= &alc880_capture_source
,
5055 .mixers
= { alc880_f1734_mixer
},
5056 .init_verbs
= { alc880_volume_init_verbs
,
5057 alc880_pin_f1734_init_verbs
},
5058 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
5059 .dac_nids
= alc880_f1734_dac_nids
,
5061 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5062 .channel_mode
= alc880_2_jack_modes
,
5063 .input_mux
= &alc880_f1734_capture_source
,
5064 .unsol_event
= alc880_uniwill_p53_unsol_event
,
5065 .setup
= alc880_uniwill_p53_setup
,
5066 .init_hook
= alc_hp_automute
,
5069 .mixers
= { alc880_asus_mixer
},
5070 .init_verbs
= { alc880_volume_init_verbs
,
5071 alc880_pin_asus_init_verbs
,
5072 alc880_gpio1_init_verbs
},
5073 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5074 .dac_nids
= alc880_asus_dac_nids
,
5075 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5076 .channel_mode
= alc880_asus_modes
,
5078 .input_mux
= &alc880_capture_source
,
5080 [ALC880_ASUS_DIG
] = {
5081 .mixers
= { alc880_asus_mixer
},
5082 .init_verbs
= { alc880_volume_init_verbs
,
5083 alc880_pin_asus_init_verbs
,
5084 alc880_gpio1_init_verbs
},
5085 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5086 .dac_nids
= alc880_asus_dac_nids
,
5087 .dig_out_nid
= ALC880_DIGOUT_NID
,
5088 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5089 .channel_mode
= alc880_asus_modes
,
5091 .input_mux
= &alc880_capture_source
,
5093 [ALC880_ASUS_DIG2
] = {
5094 .mixers
= { alc880_asus_mixer
},
5095 .init_verbs
= { alc880_volume_init_verbs
,
5096 alc880_pin_asus_init_verbs
,
5097 alc880_gpio2_init_verbs
}, /* use GPIO2 */
5098 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5099 .dac_nids
= alc880_asus_dac_nids
,
5100 .dig_out_nid
= ALC880_DIGOUT_NID
,
5101 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5102 .channel_mode
= alc880_asus_modes
,
5104 .input_mux
= &alc880_capture_source
,
5106 [ALC880_ASUS_W1V
] = {
5107 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
5108 .init_verbs
= { alc880_volume_init_verbs
,
5109 alc880_pin_asus_init_verbs
,
5110 alc880_gpio1_init_verbs
},
5111 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5112 .dac_nids
= alc880_asus_dac_nids
,
5113 .dig_out_nid
= ALC880_DIGOUT_NID
,
5114 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5115 .channel_mode
= alc880_asus_modes
,
5117 .input_mux
= &alc880_capture_source
,
5119 [ALC880_UNIWILL_DIG
] = {
5120 .mixers
= { alc880_asus_mixer
},
5121 .init_verbs
= { alc880_volume_init_verbs
,
5122 alc880_pin_asus_init_verbs
},
5123 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5124 .dac_nids
= alc880_asus_dac_nids
,
5125 .dig_out_nid
= ALC880_DIGOUT_NID
,
5126 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5127 .channel_mode
= alc880_asus_modes
,
5129 .input_mux
= &alc880_capture_source
,
5131 [ALC880_UNIWILL
] = {
5132 .mixers
= { alc880_uniwill_mixer
},
5133 .init_verbs
= { alc880_volume_init_verbs
,
5134 alc880_uniwill_init_verbs
},
5135 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5136 .dac_nids
= alc880_asus_dac_nids
,
5137 .dig_out_nid
= ALC880_DIGOUT_NID
,
5138 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
5139 .channel_mode
= alc880_threestack_modes
,
5141 .input_mux
= &alc880_capture_source
,
5142 .unsol_event
= alc880_uniwill_unsol_event
,
5143 .setup
= alc880_uniwill_setup
,
5144 .init_hook
= alc880_uniwill_init_hook
,
5146 [ALC880_UNIWILL_P53
] = {
5147 .mixers
= { alc880_uniwill_p53_mixer
},
5148 .init_verbs
= { alc880_volume_init_verbs
,
5149 alc880_uniwill_p53_init_verbs
},
5150 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5151 .dac_nids
= alc880_asus_dac_nids
,
5152 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
5153 .channel_mode
= alc880_threestack_modes
,
5154 .input_mux
= &alc880_capture_source
,
5155 .unsol_event
= alc880_uniwill_p53_unsol_event
,
5156 .setup
= alc880_uniwill_p53_setup
,
5157 .init_hook
= alc_hp_automute
,
5159 [ALC880_FUJITSU
] = {
5160 .mixers
= { alc880_fujitsu_mixer
},
5161 .init_verbs
= { alc880_volume_init_verbs
,
5162 alc880_uniwill_p53_init_verbs
,
5163 alc880_beep_init_verbs
},
5164 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5165 .dac_nids
= alc880_dac_nids
,
5166 .dig_out_nid
= ALC880_DIGOUT_NID
,
5167 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5168 .channel_mode
= alc880_2_jack_modes
,
5169 .input_mux
= &alc880_capture_source
,
5170 .unsol_event
= alc880_uniwill_p53_unsol_event
,
5171 .setup
= alc880_uniwill_p53_setup
,
5172 .init_hook
= alc_hp_automute
,
5175 .mixers
= { alc880_three_stack_mixer
},
5176 .init_verbs
= { alc880_volume_init_verbs
,
5177 alc880_pin_clevo_init_verbs
},
5178 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5179 .dac_nids
= alc880_dac_nids
,
5181 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
5182 .channel_mode
= alc880_threestack_modes
,
5184 .input_mux
= &alc880_capture_source
,
5187 .mixers
= { alc880_lg_mixer
},
5188 .init_verbs
= { alc880_volume_init_verbs
,
5189 alc880_lg_init_verbs
},
5190 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
5191 .dac_nids
= alc880_lg_dac_nids
,
5192 .dig_out_nid
= ALC880_DIGOUT_NID
,
5193 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
5194 .channel_mode
= alc880_lg_ch_modes
,
5196 .input_mux
= &alc880_lg_capture_source
,
5197 .unsol_event
= alc_sku_unsol_event
,
5198 .setup
= alc880_lg_setup
,
5199 .init_hook
= alc_hp_automute
,
5200 #ifdef CONFIG_SND_HDA_POWER_SAVE
5201 .loopbacks
= alc880_lg_loopbacks
,
5205 .mixers
= { alc880_lg_lw_mixer
},
5206 .init_verbs
= { alc880_volume_init_verbs
,
5207 alc880_lg_lw_init_verbs
},
5208 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5209 .dac_nids
= alc880_dac_nids
,
5210 .dig_out_nid
= ALC880_DIGOUT_NID
,
5211 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
5212 .channel_mode
= alc880_lg_lw_modes
,
5213 .input_mux
= &alc880_lg_lw_capture_source
,
5214 .unsol_event
= alc_sku_unsol_event
,
5215 .setup
= alc880_lg_lw_setup
,
5216 .init_hook
= alc_hp_automute
,
5218 [ALC880_MEDION_RIM
] = {
5219 .mixers
= { alc880_medion_rim_mixer
},
5220 .init_verbs
= { alc880_volume_init_verbs
,
5221 alc880_medion_rim_init_verbs
,
5222 alc_gpio2_init_verbs
},
5223 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5224 .dac_nids
= alc880_dac_nids
,
5225 .dig_out_nid
= ALC880_DIGOUT_NID
,
5226 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5227 .channel_mode
= alc880_2_jack_modes
,
5228 .input_mux
= &alc880_medion_rim_capture_source
,
5229 .unsol_event
= alc880_medion_rim_unsol_event
,
5230 .setup
= alc880_medion_rim_setup
,
5231 .init_hook
= alc880_medion_rim_automute
,
5233 #ifdef CONFIG_SND_DEBUG
5235 .mixers
= { alc880_test_mixer
},
5236 .init_verbs
= { alc880_test_init_verbs
},
5237 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
5238 .dac_nids
= alc880_test_dac_nids
,
5239 .dig_out_nid
= ALC880_DIGOUT_NID
,
5240 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
5241 .channel_mode
= alc880_test_modes
,
5242 .input_mux
= &alc880_test_capture_source
,
5248 * Automatic parse of I/O pins from the BIOS configuration
5253 ALC_CTL_WIDGET_MUTE
,
5256 static const struct snd_kcontrol_new alc880_control_templates
[] = {
5257 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
5258 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
5259 HDA_BIND_MUTE(NULL
, 0, 0, 0),
5262 static struct snd_kcontrol_new
*alc_kcontrol_new(struct alc_spec
*spec
)
5264 snd_array_init(&spec
->kctls
, sizeof(struct snd_kcontrol_new
), 32);
5265 return snd_array_new(&spec
->kctls
);
5268 /* add dynamic controls */
5269 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
5270 int cidx
, unsigned long val
)
5272 struct snd_kcontrol_new
*knew
;
5274 knew
= alc_kcontrol_new(spec
);
5277 *knew
= alc880_control_templates
[type
];
5278 knew
->name
= kstrdup(name
, GFP_KERNEL
);
5282 if (get_amp_nid_(val
))
5283 knew
->subdevice
= HDA_SUBDEV_AMP_FLAG
;
5284 knew
->private_value
= val
;
5288 static int add_control_with_pfx(struct alc_spec
*spec
, int type
,
5289 const char *pfx
, const char *dir
,
5290 const char *sfx
, int cidx
, unsigned long val
)
5293 snprintf(name
, sizeof(name
), "%s %s %s", pfx
, dir
, sfx
);
5294 return add_control(spec
, type
, name
, cidx
, val
);
5297 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5298 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5299 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5300 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5301 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5302 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5303 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5304 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5306 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5307 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5308 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5309 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5310 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5311 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5312 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5313 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5314 #define ALC880_PIN_CD_NID 0x1c
5316 /* fill in the dac_nids table from the parsed pin configuration */
5317 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
5318 const struct auto_pin_cfg
*cfg
)
5324 memset(assigned
, 0, sizeof(assigned
));
5325 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
5327 /* check the pins hardwired to audio widget */
5328 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5329 nid
= cfg
->line_out_pins
[i
];
5330 if (alc880_is_fixed_pin(nid
)) {
5331 int idx
= alc880_fixed_pin_idx(nid
);
5332 spec
->private_dac_nids
[i
] = alc880_idx_to_dac(idx
);
5336 /* left pins can be connect to any audio widget */
5337 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5338 nid
= cfg
->line_out_pins
[i
];
5339 if (alc880_is_fixed_pin(nid
))
5341 /* search for an empty channel */
5342 for (j
= 0; j
< cfg
->line_outs
; j
++) {
5344 spec
->private_dac_nids
[i
] =
5345 alc880_idx_to_dac(j
);
5351 spec
->multiout
.num_dacs
= cfg
->line_outs
;
5355 static const char *alc_get_line_out_pfx(struct alc_spec
*spec
,
5358 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5360 if (cfg
->line_outs
== 1 && !spec
->multi_ios
&&
5361 !cfg
->hp_outs
&& !cfg
->speaker_outs
&& can_be_master
)
5364 switch (cfg
->line_out_type
) {
5365 case AUTO_PIN_SPEAKER_OUT
:
5366 if (cfg
->line_outs
== 1)
5369 case AUTO_PIN_HP_OUT
:
5372 if (cfg
->line_outs
== 1 && !spec
->multi_ios
)
5379 /* add playback controls from the parsed DAC table */
5380 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
5381 const struct auto_pin_cfg
*cfg
)
5383 static const char * const chname
[4] = {
5384 "Front", "Surround", NULL
/*CLFE*/, "Side"
5386 const char *pfx
= alc_get_line_out_pfx(spec
, false);
5388 int i
, err
, noutputs
;
5390 noutputs
= cfg
->line_outs
;
5391 if (spec
->multi_ios
> 0)
5392 noutputs
+= spec
->multi_ios
;
5394 for (i
= 0; i
< noutputs
; i
++) {
5395 if (!spec
->multiout
.dac_nids
[i
])
5397 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
5398 if (!pfx
&& i
== 2) {
5400 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5402 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
5406 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5408 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
5412 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5414 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
5418 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5420 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
5425 const char *name
= pfx
;
5431 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5433 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
5437 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5439 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
5448 /* add playback controls for speaker and HP outputs */
5449 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
5458 if (alc880_is_fixed_pin(pin
)) {
5459 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
5460 /* specify the DAC as the extra output */
5461 if (!spec
->multiout
.hp_nid
)
5462 spec
->multiout
.hp_nid
= nid
;
5464 spec
->multiout
.extra_out_nid
[0] = nid
;
5465 /* control HP volume/switch on the output mixer amp */
5466 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
5467 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
5468 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
5471 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
5472 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
5475 } else if (alc880_is_multi_pin(pin
)) {
5476 /* set manual connection */
5477 /* we have only a switch on HP-out PIN */
5478 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
5479 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
5486 /* create input playback/capture controls for the given pin */
5487 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
5488 const char *ctlname
, int ctlidx
,
5489 int idx
, hda_nid_t mix_nid
)
5493 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
, ctlidx
,
5494 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
5497 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
, ctlidx
,
5498 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
5504 static int alc_is_input_pin(struct hda_codec
*codec
, hda_nid_t nid
)
5506 unsigned int pincap
= snd_hda_query_pin_caps(codec
, nid
);
5507 return (pincap
& AC_PINCAP_IN
) != 0;
5510 /* create playback/capture controls for input pins */
5511 static int alc_auto_create_input_ctls(struct hda_codec
*codec
,
5512 const struct auto_pin_cfg
*cfg
,
5514 hda_nid_t cap1
, hda_nid_t cap2
)
5516 struct alc_spec
*spec
= codec
->spec
;
5517 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
5518 int i
, err
, idx
, type_idx
= 0;
5519 const char *prev_label
= NULL
;
5521 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5525 pin
= cfg
->inputs
[i
].pin
;
5526 if (!alc_is_input_pin(codec
, pin
))
5529 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
5530 if (prev_label
&& !strcmp(label
, prev_label
))
5537 idx
= get_connection_index(codec
, mixer
, pin
);
5539 err
= new_analog_input(spec
, pin
,
5549 idx
= get_connection_index(codec
, cap1
, pin
);
5550 if (idx
< 0 && cap2
)
5551 idx
= get_connection_index(codec
, cap2
, pin
);
5553 snd_hda_add_imux_item(imux
, label
, idx
, NULL
);
5558 static int alc880_auto_create_input_ctls(struct hda_codec
*codec
,
5559 const struct auto_pin_cfg
*cfg
)
5561 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x08, 0x09);
5564 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
5565 unsigned int pin_type
)
5567 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5570 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5574 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
5575 hda_nid_t nid
, int pin_type
,
5578 alc_set_pin_output(codec
, nid
, pin_type
);
5579 /* need the manual connection? */
5580 if (alc880_is_multi_pin(nid
)) {
5581 struct alc_spec
*spec
= codec
->spec
;
5582 int idx
= alc880_multi_pin_idx(nid
);
5583 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
5584 AC_VERB_SET_CONNECT_SEL
,
5585 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
5589 static int get_pin_type(int line_out_type
)
5591 if (line_out_type
== AUTO_PIN_HP_OUT
)
5597 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
5599 struct alc_spec
*spec
= codec
->spec
;
5602 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
5603 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
5604 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5605 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
5609 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
5611 struct alc_spec
*spec
= codec
->spec
;
5614 pin
= spec
->autocfg
.speaker_pins
[0];
5615 if (pin
) /* connect to front */
5616 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
5617 pin
= spec
->autocfg
.hp_pins
[0];
5618 if (pin
) /* connect to front */
5619 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
5622 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
5624 struct alc_spec
*spec
= codec
->spec
;
5625 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5628 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5629 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5630 if (alc_is_input_pin(codec
, nid
)) {
5631 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
5632 if (nid
!= ALC880_PIN_CD_NID
&&
5633 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
5634 snd_hda_codec_write(codec
, nid
, 0,
5635 AC_VERB_SET_AMP_GAIN_MUTE
,
5641 static void alc880_auto_init_input_src(struct hda_codec
*codec
)
5643 struct alc_spec
*spec
= codec
->spec
;
5646 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
5647 unsigned int mux_idx
;
5648 const struct hda_input_mux
*imux
;
5649 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
5650 imux
= &spec
->input_mux
[mux_idx
];
5651 if (!imux
->num_items
&& mux_idx
> 0)
5652 imux
= &spec
->input_mux
[0];
5654 snd_hda_codec_write(codec
, spec
->adc_nids
[c
], 0,
5655 AC_VERB_SET_CONNECT_SEL
,
5656 imux
->items
[0].index
);
5660 static int alc_auto_add_multi_channel_mode(struct hda_codec
*codec
);
5662 /* parse the BIOS configuration and set up the alc_spec */
5663 /* return 1 if successful, 0 if the proper config is not found,
5664 * or a negative error code
5666 static int alc880_parse_auto_config(struct hda_codec
*codec
)
5668 struct alc_spec
*spec
= codec
->spec
;
5670 static const hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
5672 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5676 if (!spec
->autocfg
.line_outs
)
5677 return 0; /* can't find valid BIOS pin config */
5679 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
5682 err
= alc_auto_add_multi_channel_mode(codec
);
5685 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5688 err
= alc880_auto_create_extra_out(spec
,
5689 spec
->autocfg
.speaker_pins
[0],
5693 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
5697 err
= alc880_auto_create_input_ctls(codec
, &spec
->autocfg
);
5701 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
5703 alc_auto_parse_digital(codec
);
5705 if (spec
->kctls
.list
)
5706 add_mixer(spec
, spec
->kctls
.list
);
5708 add_verb(spec
, alc880_volume_init_verbs
);
5710 spec
->num_mux_defs
= 1;
5711 spec
->input_mux
= &spec
->private_imux
[0];
5713 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
5718 /* additional initialization for auto-configuration model */
5719 static void alc880_auto_init(struct hda_codec
*codec
)
5721 struct alc_spec
*spec
= codec
->spec
;
5722 alc880_auto_init_multi_out(codec
);
5723 alc880_auto_init_extra_out(codec
);
5724 alc880_auto_init_analog_input(codec
);
5725 alc880_auto_init_input_src(codec
);
5726 alc_auto_init_digital(codec
);
5727 if (spec
->unsol_event
)
5728 alc_inithook(codec
);
5731 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5732 * one of two digital mic pins, e.g. on ALC272
5734 static void fixup_automic_adc(struct hda_codec
*codec
)
5736 struct alc_spec
*spec
= codec
->spec
;
5739 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5740 hda_nid_t cap
= spec
->capsrc_nids
?
5741 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5744 iidx
= get_connection_index(codec
, cap
, spec
->int_mic
.pin
);
5747 eidx
= get_connection_index(codec
, cap
, spec
->ext_mic
.pin
);
5750 spec
->int_mic
.mux_idx
= iidx
;
5751 spec
->ext_mic
.mux_idx
= eidx
;
5752 if (spec
->capsrc_nids
)
5753 spec
->capsrc_nids
+= i
;
5754 spec
->adc_nids
+= i
;
5755 spec
->num_adc_nids
= 1;
5756 /* optional dock-mic */
5757 eidx
= get_connection_index(codec
, cap
, spec
->dock_mic
.pin
);
5759 spec
->dock_mic
.pin
= 0;
5761 spec
->dock_mic
.mux_idx
= eidx
;
5764 snd_printd(KERN_INFO
"hda_codec: %s: "
5765 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5766 codec
->chip_name
, spec
->int_mic
.pin
, spec
->ext_mic
.pin
);
5767 spec
->auto_mic
= 0; /* disable auto-mic to be sure */
5770 /* select or unmute the given capsrc route */
5771 static void select_or_unmute_capsrc(struct hda_codec
*codec
, hda_nid_t cap
,
5774 if (get_wcaps_type(get_wcaps(codec
, cap
)) == AC_WID_AUD_MIX
) {
5775 snd_hda_codec_amp_stereo(codec
, cap
, HDA_INPUT
, idx
,
5778 snd_hda_codec_write_cache(codec
, cap
, 0,
5779 AC_VERB_SET_CONNECT_SEL
, idx
);
5783 /* set the default connection to that pin */
5784 static int init_capsrc_for_pin(struct hda_codec
*codec
, hda_nid_t pin
)
5786 struct alc_spec
*spec
= codec
->spec
;
5791 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5792 hda_nid_t cap
= spec
->capsrc_nids
?
5793 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5796 idx
= get_connection_index(codec
, cap
, pin
);
5799 select_or_unmute_capsrc(codec
, cap
, idx
);
5800 return i
; /* return the found index */
5802 return -1; /* not found */
5805 /* choose the ADC/MUX containing the input pin and initialize the setup */
5806 static void fixup_single_adc(struct hda_codec
*codec
)
5808 struct alc_spec
*spec
= codec
->spec
;
5809 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5812 /* search for the input pin; there must be only one */
5813 if (cfg
->num_inputs
!= 1)
5815 i
= init_capsrc_for_pin(codec
, cfg
->inputs
[0].pin
);
5817 /* use only this ADC */
5818 if (spec
->capsrc_nids
)
5819 spec
->capsrc_nids
+= i
;
5820 spec
->adc_nids
+= i
;
5821 spec
->num_adc_nids
= 1;
5822 spec
->single_input_src
= 1;
5826 /* initialize dual adcs */
5827 static void fixup_dual_adc_switch(struct hda_codec
*codec
)
5829 struct alc_spec
*spec
= codec
->spec
;
5830 init_capsrc_for_pin(codec
, spec
->ext_mic
.pin
);
5831 init_capsrc_for_pin(codec
, spec
->dock_mic
.pin
);
5832 init_capsrc_for_pin(codec
, spec
->int_mic
.pin
);
5835 /* initialize some special cases for input sources */
5836 static void alc_init_special_input_src(struct hda_codec
*codec
)
5838 struct alc_spec
*spec
= codec
->spec
;
5839 if (spec
->dual_adc_switch
)
5840 fixup_dual_adc_switch(codec
);
5841 else if (spec
->single_input_src
)
5842 init_capsrc_for_pin(codec
, spec
->autocfg
.inputs
[0].pin
);
5845 static void set_capture_mixer(struct hda_codec
*codec
)
5847 struct alc_spec
*spec
= codec
->spec
;
5848 static const struct snd_kcontrol_new
*caps
[2][3] = {
5849 { alc_capture_mixer_nosrc1
,
5850 alc_capture_mixer_nosrc2
,
5851 alc_capture_mixer_nosrc3
},
5852 { alc_capture_mixer1
,
5854 alc_capture_mixer3
},
5856 if (spec
->num_adc_nids
> 0 && spec
->num_adc_nids
<= 3) {
5858 int num_adcs
= spec
->num_adc_nids
;
5859 if (spec
->dual_adc_switch
)
5861 else if (spec
->auto_mic
)
5862 fixup_automic_adc(codec
);
5863 else if (spec
->input_mux
) {
5864 if (spec
->input_mux
->num_items
> 1)
5866 else if (spec
->input_mux
->num_items
== 1)
5867 fixup_single_adc(codec
);
5869 spec
->cap_mixer
= caps
[mux
][num_adcs
- 1];
5873 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5874 static void fillup_priv_adc_nids(struct hda_codec
*codec
, const hda_nid_t
*nids
,
5877 struct alc_spec
*spec
= codec
->spec
;
5878 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5880 hda_nid_t fallback_adc
= 0, fallback_cap
= 0;
5882 for (n
= 0; n
< num_nids
; n
++) {
5884 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
5888 if (get_wcaps_type(get_wcaps(codec
, adc
)) != AC_WID_AUD_IN
)
5891 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5895 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5900 if (!fallback_adc
) {
5904 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5905 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5906 for (j
= 0; j
< nconns
; j
++) {
5913 if (i
>= cfg
->num_inputs
) {
5914 int num_adcs
= spec
->num_adc_nids
;
5915 spec
->private_adc_nids
[num_adcs
] = adc
;
5916 spec
->private_capsrc_nids
[num_adcs
] = cap
;
5917 spec
->num_adc_nids
++;
5918 spec
->adc_nids
= spec
->private_adc_nids
;
5920 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
5923 if (!spec
->num_adc_nids
) {
5924 printk(KERN_WARNING
"hda_codec: %s: no valid ADC found;"
5925 " using fallback 0x%x\n",
5926 codec
->chip_name
, fallback_adc
);
5927 spec
->private_adc_nids
[0] = fallback_adc
;
5928 spec
->adc_nids
= spec
->private_adc_nids
;
5929 if (fallback_adc
!= fallback_cap
) {
5930 spec
->private_capsrc_nids
[0] = fallback_cap
;
5931 spec
->capsrc_nids
= spec
->private_adc_nids
;
5936 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5937 #define set_beep_amp(spec, nid, idx, dir) \
5938 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5940 static const struct snd_pci_quirk beep_white_list
[] = {
5941 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5942 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5943 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
5944 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
5945 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5949 static inline int has_cdefine_beep(struct hda_codec
*codec
)
5951 struct alc_spec
*spec
= codec
->spec
;
5952 const struct snd_pci_quirk
*q
;
5953 q
= snd_pci_quirk_lookup(codec
->bus
->pci
, beep_white_list
);
5956 return spec
->cdefine
.enable_pcbeep
;
5959 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5960 #define has_cdefine_beep(codec) 0
5964 * OK, here we have finally the patch for ALC880
5967 static int patch_alc880(struct hda_codec
*codec
)
5969 struct alc_spec
*spec
;
5973 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5979 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
5982 if (board_config
< 0) {
5983 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5985 board_config
= ALC880_AUTO
;
5988 if (board_config
== ALC880_AUTO
) {
5989 /* automatic parse from the BIOS config */
5990 err
= alc880_parse_auto_config(codec
);
5996 "hda_codec: Cannot set up configuration "
5997 "from BIOS. Using 3-stack mode...\n");
5998 board_config
= ALC880_3ST
;
6002 err
= snd_hda_attach_beep_device(codec
, 0x1);
6008 if (board_config
!= ALC880_AUTO
)
6009 setup_preset(codec
, &alc880_presets
[board_config
]);
6011 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
6012 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
6013 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
6015 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
6016 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
6018 if (!spec
->adc_nids
&& spec
->input_mux
) {
6019 /* check whether NID 0x07 is valid */
6020 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
6022 wcap
= get_wcaps_type(wcap
);
6023 if (wcap
!= AC_WID_AUD_IN
) {
6024 spec
->adc_nids
= alc880_adc_nids_alt
;
6025 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
6027 spec
->adc_nids
= alc880_adc_nids
;
6028 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
6031 set_capture_mixer(codec
);
6032 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
6034 spec
->vmaster_nid
= 0x0c;
6036 codec
->patch_ops
= alc_patch_ops
;
6037 if (board_config
== ALC880_AUTO
)
6038 spec
->init_hook
= alc880_auto_init
;
6039 #ifdef CONFIG_SND_HDA_POWER_SAVE
6040 if (!spec
->loopback
.amplist
)
6041 spec
->loopback
.amplist
= alc880_loopbacks
;
6052 static const hda_nid_t alc260_dac_nids
[1] = {
6057 static const hda_nid_t alc260_adc_nids
[1] = {
6062 static const hda_nid_t alc260_adc_nids_alt
[1] = {
6067 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
6068 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
6070 static const hda_nid_t alc260_dual_adc_nids
[2] = {
6075 #define ALC260_DIGOUT_NID 0x03
6076 #define ALC260_DIGIN_NID 0x06
6078 static const struct hda_input_mux alc260_capture_source
= {
6082 { "Front Mic", 0x1 },
6088 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
6089 * headphone jack and the internal CD lines since these are the only pins at
6090 * which audio can appear. For flexibility, also allow the option of
6091 * recording the mixer output on the second ADC (ADC0 doesn't have a
6092 * connection to the mixer output).
6094 static const struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
6098 { "Mic/Line", 0x0 },
6100 { "Headphone", 0x2 },
6106 { "Mic/Line", 0x0 },
6108 { "Headphone", 0x2 },
6115 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
6116 * the Fujitsu S702x, but jacks are marked differently.
6118 static const struct hda_input_mux alc260_acer_capture_sources
[2] = {
6125 { "Headphone", 0x5 },
6134 { "Headphone", 0x6 },
6140 /* Maxdata Favorit 100XS */
6141 static const struct hda_input_mux alc260_favorit100_capture_sources
[2] = {
6145 { "Line/Mic", 0x0 },
6152 { "Line/Mic", 0x0 },
6160 * This is just place-holder, so there's something for alc_build_pcms to look
6161 * at when it calculates the maximum number of channels. ALC260 has no mixer
6162 * element which allows changing the channel mode, so the verb list is
6165 static const struct hda_channel_mode alc260_modes
[1] = {
6170 /* Mixer combinations
6172 * basic: base_output + input + pc_beep + capture
6173 * HP: base_output + input + capture_alt
6174 * HP_3013: hp_3013 + input + capture
6175 * fujitsu: fujitsu + capture
6176 * acer: acer + capture
6179 static const struct snd_kcontrol_new alc260_base_output_mixer
[] = {
6180 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6181 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
6182 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6183 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
6184 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6185 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6189 static const struct snd_kcontrol_new alc260_input_mixer
[] = {
6190 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6191 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6192 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6193 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6195 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6196 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
6197 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
6201 /* update HP, line and mono out pins according to the master switch */
6202 static void alc260_hp_master_update(struct hda_codec
*codec
)
6204 struct alc_spec
*spec
= codec
->spec
;
6206 /* change HP pins */
6207 do_automute(codec
, ARRAY_SIZE(spec
->autocfg
.hp_pins
),
6208 spec
->autocfg
.hp_pins
, spec
->master_mute
, true);
6209 update_speakers(codec
);
6212 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
6213 struct snd_ctl_elem_value
*ucontrol
)
6215 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6216 struct alc_spec
*spec
= codec
->spec
;
6217 *ucontrol
->value
.integer
.value
= !spec
->master_mute
;
6221 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
6222 struct snd_ctl_elem_value
*ucontrol
)
6224 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6225 struct alc_spec
*spec
= codec
->spec
;
6226 int val
= !*ucontrol
->value
.integer
.value
;
6228 if (val
== spec
->master_mute
)
6230 spec
->master_mute
= val
;
6231 alc260_hp_master_update(codec
);
6235 static const struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
6237 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6238 .name
= "Master Playback Switch",
6239 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
6240 .info
= snd_ctl_boolean_mono_info
,
6241 .get
= alc260_hp_master_sw_get
,
6242 .put
= alc260_hp_master_sw_put
,
6244 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6245 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
6246 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6247 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
6248 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6250 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6254 static const struct hda_verb alc260_hp_unsol_verbs
[] = {
6255 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6259 static void alc260_hp_setup(struct hda_codec
*codec
)
6261 struct alc_spec
*spec
= codec
->spec
;
6263 spec
->autocfg
.hp_pins
[0] = 0x0f;
6264 spec
->autocfg
.speaker_pins
[0] = 0x10;
6265 spec
->autocfg
.speaker_pins
[1] = 0x11;
6267 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
6270 static const struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
6272 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6273 .name
= "Master Playback Switch",
6274 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
6275 .info
= snd_ctl_boolean_mono_info
,
6276 .get
= alc260_hp_master_sw_get
,
6277 .put
= alc260_hp_master_sw_put
,
6279 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6280 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
6281 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
6282 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
6283 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6284 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6285 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6286 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
6290 static void alc260_hp_3013_setup(struct hda_codec
*codec
)
6292 struct alc_spec
*spec
= codec
->spec
;
6294 spec
->autocfg
.hp_pins
[0] = 0x15;
6295 spec
->autocfg
.speaker_pins
[0] = 0x10;
6296 spec
->autocfg
.speaker_pins
[1] = 0x11;
6298 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
6301 static const struct hda_bind_ctls alc260_dc7600_bind_master_vol
= {
6302 .ops
= &snd_hda_bind_vol
,
6304 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT
),
6305 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
6306 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT
),
6311 static const struct hda_bind_ctls alc260_dc7600_bind_switch
= {
6312 .ops
= &snd_hda_bind_sw
,
6314 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT
),
6315 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
6320 static const struct snd_kcontrol_new alc260_hp_dc7600_mixer
[] = {
6321 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol
),
6322 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch
),
6323 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT
),
6324 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
6328 static const struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
6329 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6333 static void alc260_hp_3012_setup(struct hda_codec
*codec
)
6335 struct alc_spec
*spec
= codec
->spec
;
6337 spec
->autocfg
.hp_pins
[0] = 0x10;
6338 spec
->autocfg
.speaker_pins
[0] = 0x0f;
6339 spec
->autocfg
.speaker_pins
[1] = 0x11;
6340 spec
->autocfg
.speaker_pins
[2] = 0x15;
6342 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
6345 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6346 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6348 static const struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
6349 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6350 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
6351 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6352 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6353 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6354 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
6355 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
6356 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6357 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6358 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
6362 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6363 * versions of the ALC260 don't act on requests to enable mic bias from NID
6364 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6365 * datasheet doesn't mention this restriction. At this stage it's not clear
6366 * whether this behaviour is intentional or is a hardware bug in chip
6367 * revisions available in early 2006. Therefore for now allow the
6368 * "Headphone Jack Mode" control to span all choices, but if it turns out
6369 * that the lack of mic bias for this NID is intentional we could change the
6370 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6372 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6373 * don't appear to make the mic bias available from the "line" jack, even
6374 * though the NID used for this jack (0x14) can supply it. The theory is
6375 * that perhaps Acer have included blocking capacitors between the ALC260
6376 * and the output jack. If this turns out to be the case for all such
6377 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6378 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6380 * The C20x Tablet series have a mono internal speaker which is controlled
6381 * via the chip's Mono sum widget and pin complex, so include the necessary
6382 * controls for such models. On models without a "mono speaker" the control
6383 * won't do anything.
6385 static const struct snd_kcontrol_new alc260_acer_mixer
[] = {
6386 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6387 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
6388 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
6389 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6391 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6393 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6394 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6396 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6397 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6398 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6399 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6400 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6404 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6406 static const struct snd_kcontrol_new alc260_favorit100_mixer
[] = {
6407 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6408 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
6409 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
6410 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6411 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6412 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6416 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6417 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6419 static const struct snd_kcontrol_new alc260_will_mixer
[] = {
6420 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6421 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
6422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6423 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6424 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6425 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6426 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6427 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6428 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6429 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6433 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6434 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6436 static const struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
6437 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6438 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
6439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6440 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6441 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6442 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
6443 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
6444 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6445 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6446 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6451 * initialization verbs
6453 static const struct hda_verb alc260_init_verbs
[] = {
6454 /* Line In pin widget for input */
6455 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6456 /* CD pin widget for input */
6457 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6458 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6459 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6460 /* Mic2 (front panel) pin widget for input and vref at 80% */
6461 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6462 /* LINE-2 is used for line-out in rear */
6463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6464 /* select line-out */
6465 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
6467 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6469 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6471 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6472 /* mute capture amp left and right */
6473 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6474 /* set connection select to line in (default select for this ADC) */
6475 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6476 /* mute capture amp left and right */
6477 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6478 /* set connection select to line in (default select for this ADC) */
6479 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
6480 /* set vol=0 Line-Out mixer amp left and right */
6481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6482 /* unmute pin widget amp left and right (no gain on this amp) */
6483 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6484 /* set vol=0 HP mixer amp left and right */
6485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6486 /* unmute pin widget amp left and right (no gain on this amp) */
6487 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6488 /* set vol=0 Mono mixer amp left and right */
6489 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6490 /* unmute pin widget amp left and right (no gain on this amp) */
6491 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6492 /* unmute LINE-2 out pin */
6493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6494 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6497 /* mute analog inputs */
6498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6503 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6504 /* mute Front out path */
6505 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6506 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6507 /* mute Headphone out path */
6508 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6509 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6510 /* mute Mono out path */
6511 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6512 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6516 #if 0 /* should be identical with alc260_init_verbs? */
6517 static const struct hda_verb alc260_hp_init_verbs
[] = {
6518 /* Headphone and output */
6519 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6521 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6522 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6523 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6524 /* Mic2 (front panel) pin widget for input and vref at 80% */
6525 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6526 /* Line In pin widget for input */
6527 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6528 /* Line-2 pin widget for output */
6529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6530 /* CD pin widget for input */
6531 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6532 /* unmute amp left and right */
6533 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
6534 /* set connection select to line in (default select for this ADC) */
6535 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6536 /* unmute Line-Out mixer amp left and right (volume = 0) */
6537 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6538 /* mute pin widget amp left and right (no gain on this amp) */
6539 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6540 /* unmute HP mixer amp left and right (volume = 0) */
6541 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6542 /* mute pin widget amp left and right (no gain on this amp) */
6543 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6544 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6547 /* mute analog inputs */
6548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6553 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6554 /* Unmute Front out path */
6555 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6556 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6557 /* Unmute Headphone out path */
6558 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6559 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6560 /* Unmute Mono out path */
6561 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6562 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6567 static const struct hda_verb alc260_hp_3013_init_verbs
[] = {
6568 /* Line out and output */
6569 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6571 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6572 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6573 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6574 /* Mic2 (front panel) pin widget for input and vref at 80% */
6575 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6576 /* Line In pin widget for input */
6577 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6578 /* Headphone pin widget for output */
6579 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6580 /* CD pin widget for input */
6581 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6582 /* unmute amp left and right */
6583 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
6584 /* set connection select to line in (default select for this ADC) */
6585 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6586 /* unmute Line-Out mixer amp left and right (volume = 0) */
6587 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6588 /* mute pin widget amp left and right (no gain on this amp) */
6589 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6590 /* unmute HP mixer amp left and right (volume = 0) */
6591 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6592 /* mute pin widget amp left and right (no gain on this amp) */
6593 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6594 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6597 /* mute analog inputs */
6598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6603 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6604 /* Unmute Front out path */
6605 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6606 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6607 /* Unmute Headphone out path */
6608 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6609 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6610 /* Unmute Mono out path */
6611 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6612 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6616 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6617 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6618 * audio = 0x16, internal speaker = 0x10.
6620 static const struct hda_verb alc260_fujitsu_init_verbs
[] = {
6621 /* Disable all GPIOs */
6622 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
6623 /* Internal speaker is connected to headphone pin */
6624 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6625 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6626 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6627 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6628 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6629 /* Ensure all other unused pins are disabled and muted. */
6630 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6631 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6632 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6633 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6634 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6635 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6639 /* Disable digital (SPDIF) pins */
6640 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6641 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6643 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6644 * when acting as an output.
6646 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6648 /* Start with output sum widgets muted and their output gains at min */
6649 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6650 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6651 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6652 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6653 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6654 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6655 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6656 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6657 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6659 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6660 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6661 /* Unmute Line1 pin widget output buffer since it starts as an output.
6662 * If the pin mode is changed by the user the pin mode control will
6663 * take care of enabling the pin's input/output buffers as needed.
6664 * Therefore there's no need to enable the input buffer at this
6667 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6668 /* Unmute input buffer of pin widget used for Line-in (no equiv
6671 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6673 /* Mute capture amp left and right */
6674 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6675 /* Set ADC connection select to match default mixer setting - line
6678 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6680 /* Do the same for the second ADC: mute capture input amp and
6681 * set ADC connection to line in (on mic1 pin)
6683 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6684 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6686 /* Mute all inputs to mixer widget (even unconnected ones) */
6687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6699 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6700 * similar laptops (adapted from Fujitsu init verbs).
6702 static const struct hda_verb alc260_acer_init_verbs
[] = {
6703 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6704 * the headphone jack. Turn this on and rely on the standard mute
6705 * methods whenever the user wants to turn these outputs off.
6707 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6708 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6709 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6710 /* Internal speaker/Headphone jack is connected to Line-out pin */
6711 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6712 /* Internal microphone/Mic jack is connected to Mic1 pin */
6713 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6714 /* Line In jack is connected to Line1 pin */
6715 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6716 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6717 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6718 /* Ensure all other unused pins are disabled and muted. */
6719 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6720 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6721 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6722 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6723 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6724 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6725 /* Disable digital (SPDIF) pins */
6726 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6727 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6729 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6730 * bus when acting as outputs.
6732 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6733 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6735 /* Start with output sum widgets muted and their output gains at min */
6736 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6737 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6738 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6739 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6740 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6741 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6742 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6743 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6744 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6746 /* Unmute Line-out pin widget amp left and right
6747 * (no equiv mixer ctrl)
6749 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6750 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6751 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6752 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6753 * inputs. If the pin mode is changed by the user the pin mode control
6754 * will take care of enabling the pin's input/output buffers as needed.
6755 * Therefore there's no need to enable the input buffer at this
6758 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6759 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6761 /* Mute capture amp left and right */
6762 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6763 /* Set ADC connection select to match default mixer setting - mic
6766 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6768 /* Do similar with the second ADC: mute capture input amp and
6769 * set ADC connection to mic to match ALSA's default state.
6771 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6772 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6774 /* Mute all inputs to mixer widget (even unconnected ones) */
6775 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6776 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6777 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6778 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6779 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6780 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6781 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6787 /* Initialisation sequence for Maxdata Favorit 100XS
6788 * (adapted from Acer init verbs).
6790 static const struct hda_verb alc260_favorit100_init_verbs
[] = {
6791 /* GPIO 0 enables the output jack.
6792 * Turn this on and rely on the standard mute
6793 * methods whenever the user wants to turn these outputs off.
6795 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6796 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6797 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6798 /* Line/Mic input jack is connected to Mic1 pin */
6799 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6800 /* Ensure all other unused pins are disabled and muted. */
6801 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6802 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6803 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6804 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6805 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6806 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6809 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6811 /* Disable digital (SPDIF) pins */
6812 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6813 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6815 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6816 * bus when acting as outputs.
6818 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6819 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6821 /* Start with output sum widgets muted and their output gains at min */
6822 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6824 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6825 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6826 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6828 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6829 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6830 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6832 /* Unmute Line-out pin widget amp left and right
6833 * (no equiv mixer ctrl)
6835 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6836 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6837 * inputs. If the pin mode is changed by the user the pin mode control
6838 * will take care of enabling the pin's input/output buffers as needed.
6839 * Therefore there's no need to enable the input buffer at this
6842 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6844 /* Mute capture amp left and right */
6845 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6846 /* Set ADC connection select to match default mixer setting - mic
6849 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6851 /* Do similar with the second ADC: mute capture input amp and
6852 * set ADC connection to mic to match ALSA's default state.
6854 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6855 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6857 /* Mute all inputs to mixer widget (even unconnected ones) */
6858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6863 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6865 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6870 static const struct hda_verb alc260_will_verbs
[] = {
6871 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6872 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6873 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
6874 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6875 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6876 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
6880 static const struct hda_verb alc260_replacer_672v_verbs
[] = {
6881 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6882 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6883 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
6885 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6886 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6887 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
6889 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6893 /* toggle speaker-output according to the hp-jack state */
6894 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
6896 unsigned int present
;
6898 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6899 present
= snd_hda_jack_detect(codec
, 0x0f);
6901 snd_hda_codec_write_cache(codec
, 0x01, 0,
6902 AC_VERB_SET_GPIO_DATA
, 1);
6903 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6904 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6907 snd_hda_codec_write_cache(codec
, 0x01, 0,
6908 AC_VERB_SET_GPIO_DATA
, 0);
6909 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6910 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6915 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
6918 if ((res
>> 26) == ALC880_HP_EVENT
)
6919 alc260_replacer_672v_automute(codec
);
6922 static const struct hda_verb alc260_hp_dc7600_verbs
[] = {
6923 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x01},
6924 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6925 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6926 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6927 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6928 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6929 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6930 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6931 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6932 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6936 /* Test configuration for debugging, modelled after the ALC880 test
6939 #ifdef CONFIG_SND_DEBUG
6940 static const hda_nid_t alc260_test_dac_nids
[1] = {
6943 static const hda_nid_t alc260_test_adc_nids
[2] = {
6946 /* For testing the ALC260, each input MUX needs its own definition since
6947 * the signal assignments are different. This assumes that the first ADC
6950 static const struct hda_input_mux alc260_test_capture_sources
[2] = {
6954 { "MIC1 pin", 0x0 },
6955 { "MIC2 pin", 0x1 },
6956 { "LINE1 pin", 0x2 },
6957 { "LINE2 pin", 0x3 },
6959 { "LINE-OUT pin", 0x5 },
6960 { "HP-OUT pin", 0x6 },
6966 { "MIC1 pin", 0x0 },
6967 { "MIC2 pin", 0x1 },
6968 { "LINE1 pin", 0x2 },
6969 { "LINE2 pin", 0x3 },
6972 { "LINE-OUT pin", 0x6 },
6973 { "HP-OUT pin", 0x7 },
6977 static const struct snd_kcontrol_new alc260_test_mixer
[] = {
6978 /* Output driver widgets */
6979 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6980 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6981 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6982 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
6983 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6984 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
6986 /* Modes for retasking pin widgets
6987 * Note: the ALC260 doesn't seem to act on requests to enable mic
6988 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6989 * mention this restriction. At this stage it's not clear whether
6990 * this behaviour is intentional or is a hardware bug in chip
6991 * revisions available at least up until early 2006. Therefore for
6992 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6993 * choices, but if it turns out that the lack of mic bias for these
6994 * NIDs is intentional we could change their modes from
6995 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6997 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
6998 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
6999 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
7000 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
7001 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
7002 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
7004 /* Loopback mixer controls */
7005 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
7006 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
7007 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
7008 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
7009 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
7010 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
7011 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
7012 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
7013 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
7014 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
7015 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
7016 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
7017 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
7018 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
7020 /* Controls for GPIO pins, assuming they are configured as outputs */
7021 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
7022 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
7023 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
7024 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
7026 /* Switches to allow the digital IO pins to be enabled. The datasheet
7027 * is ambigious as to which NID is which; testing on laptops which
7028 * make this output available should provide clarification.
7030 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
7031 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
7033 /* A switch allowing EAPD to be enabled. Some laptops seem to use
7034 * this output to turn on an external amplifier.
7036 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
7037 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
7041 static const struct hda_verb alc260_test_init_verbs
[] = {
7042 /* Enable all GPIOs as outputs with an initial value of 0 */
7043 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
7044 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
7045 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
7047 /* Enable retasking pins as output, initially without power amp */
7048 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7049 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7050 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7051 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7052 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7053 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7055 /* Disable digital (SPDIF) pins initially, but users can enable
7056 * them via a mixer switch. In the case of SPDIF-out, this initverb
7057 * payload also sets the generation to 0, output to be in "consumer"
7058 * PCM format, copyright asserted, no pre-emphasis and no validity
7061 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
7062 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
7064 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
7065 * OUT1 sum bus when acting as an output.
7067 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
7068 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
7069 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
7070 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
7072 /* Start with output sum widgets muted and their output gains at min */
7073 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7074 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7075 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7076 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7077 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7078 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7079 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7080 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7081 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7083 /* Unmute retasking pin widget output buffers since the default
7084 * state appears to be output. As the pin mode is changed by the
7085 * user the pin mode control will take care of enabling the pin's
7086 * input/output buffers as needed.
7088 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7089 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7090 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7091 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7092 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7093 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7094 /* Also unmute the mono-out pin widget */
7095 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7097 /* Mute capture amp left and right */
7098 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7099 /* Set ADC connection select to match default mixer setting (mic1
7102 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
7104 /* Do the same for the second ADC: mute capture input amp and
7105 * set ADC connection to mic1 pin
7107 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7108 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
7110 /* Mute all inputs to mixer widget (even unconnected ones) */
7111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
7112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
7113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
7114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
7115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
7116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
7117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
7118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
7124 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
7125 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
7127 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
7128 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
7131 * for BIOS auto-configuration
7134 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
7135 const char *pfx
, int *vol_bits
)
7138 unsigned long vol_val
, sw_val
;
7141 if (nid
>= 0x0f && nid
< 0x11) {
7142 nid_vol
= nid
- 0x7;
7143 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
7144 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
7145 } else if (nid
== 0x11) {
7146 nid_vol
= nid
- 0x7;
7147 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
7148 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
7149 } else if (nid
>= 0x12 && nid
<= 0x15) {
7151 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
7152 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
7156 if (!(*vol_bits
& (1 << nid_vol
))) {
7157 /* first control for the volume widget */
7158 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, vol_val
);
7161 *vol_bits
|= (1 << nid_vol
);
7163 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, sw_val
);
7169 /* add playback controls from the parsed DAC table */
7170 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
7171 const struct auto_pin_cfg
*cfg
)
7177 spec
->multiout
.num_dacs
= 1;
7178 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
7179 spec
->private_dac_nids
[0] = 0x02;
7181 nid
= cfg
->line_out_pins
[0];
7184 if (!cfg
->speaker_pins
[0] && !cfg
->hp_pins
[0])
7186 else if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
7190 err
= alc260_add_playback_controls(spec
, nid
, pfx
, &vols
);
7195 nid
= cfg
->speaker_pins
[0];
7197 err
= alc260_add_playback_controls(spec
, nid
, "Speaker", &vols
);
7202 nid
= cfg
->hp_pins
[0];
7204 err
= alc260_add_playback_controls(spec
, nid
, "Headphone",
7212 /* create playback/capture controls for input pins */
7213 static int alc260_auto_create_input_ctls(struct hda_codec
*codec
,
7214 const struct auto_pin_cfg
*cfg
)
7216 return alc_auto_create_input_ctls(codec
, cfg
, 0x07, 0x04, 0x05);
7219 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
7220 hda_nid_t nid
, int pin_type
,
7223 alc_set_pin_output(codec
, nid
, pin_type
);
7224 /* need the manual connection? */
7226 int idx
= nid
- 0x12;
7227 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
7228 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
7232 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
7234 struct alc_spec
*spec
= codec
->spec
;
7237 nid
= spec
->autocfg
.line_out_pins
[0];
7239 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
7240 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
7243 nid
= spec
->autocfg
.speaker_pins
[0];
7245 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
7247 nid
= spec
->autocfg
.hp_pins
[0];
7249 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
7252 #define ALC260_PIN_CD_NID 0x16
7253 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
7255 struct alc_spec
*spec
= codec
->spec
;
7256 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
7259 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
7260 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
7262 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
7263 if (nid
!= ALC260_PIN_CD_NID
&&
7264 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
7265 snd_hda_codec_write(codec
, nid
, 0,
7266 AC_VERB_SET_AMP_GAIN_MUTE
,
7272 #define alc260_auto_init_input_src alc880_auto_init_input_src
7275 * generic initialization of ADC, input mixers and output mixers
7277 static const struct hda_verb alc260_volume_init_verbs
[] = {
7279 * Unmute ADC0-1 and set the default input to mic-in
7281 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
7282 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7283 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
7284 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7286 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7288 * Note: PASD motherboards uses the Line In 2 as the input for
7289 * front panel mic (mic 2)
7291 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7292 /* mute analog inputs */
7293 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7294 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7295 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7296 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7300 * Set up output mixers (0x08 - 0x0a)
7302 /* set vol=0 to output mixers */
7303 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7304 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7305 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7306 /* set up input amps for analog loopback */
7307 /* Amp Indices: DAC = 0, mixer = 1 */
7308 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7309 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7310 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7311 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7312 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7313 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7318 static int alc260_parse_auto_config(struct hda_codec
*codec
)
7320 struct alc_spec
*spec
= codec
->spec
;
7322 static const hda_nid_t alc260_ignore
[] = { 0x17, 0 };
7324 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
7328 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
7331 if (!spec
->kctls
.list
)
7332 return 0; /* can't find valid BIOS pin config */
7333 err
= alc260_auto_create_input_ctls(codec
, &spec
->autocfg
);
7337 spec
->multiout
.max_channels
= 2;
7339 if (spec
->autocfg
.dig_outs
)
7340 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
7341 if (spec
->kctls
.list
)
7342 add_mixer(spec
, spec
->kctls
.list
);
7344 add_verb(spec
, alc260_volume_init_verbs
);
7346 spec
->num_mux_defs
= 1;
7347 spec
->input_mux
= &spec
->private_imux
[0];
7349 alc_ssid_check(codec
, 0x10, 0x15, 0x0f, 0);
7354 /* additional initialization for auto-configuration model */
7355 static void alc260_auto_init(struct hda_codec
*codec
)
7357 struct alc_spec
*spec
= codec
->spec
;
7358 alc260_auto_init_multi_out(codec
);
7359 alc260_auto_init_analog_input(codec
);
7360 alc260_auto_init_input_src(codec
);
7361 alc_auto_init_digital(codec
);
7362 if (spec
->unsol_event
)
7363 alc_inithook(codec
);
7366 #ifdef CONFIG_SND_HDA_POWER_SAVE
7367 static const struct hda_amp_list alc260_loopbacks
[] = {
7368 { 0x07, HDA_INPUT
, 0 },
7369 { 0x07, HDA_INPUT
, 1 },
7370 { 0x07, HDA_INPUT
, 2 },
7371 { 0x07, HDA_INPUT
, 3 },
7372 { 0x07, HDA_INPUT
, 4 },
7384 static const struct alc_fixup alc260_fixups
[] = {
7385 [PINFIX_HP_DC5750
] = {
7386 .type
= ALC_FIXUP_PINS
,
7387 .v
.pins
= (const struct alc_pincfg
[]) {
7388 { 0x11, 0x90130110 }, /* speaker */
7394 static const struct snd_pci_quirk alc260_fixup_tbl
[] = {
7395 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750
),
7400 * ALC260 configurations
7402 static const char * const alc260_models
[ALC260_MODEL_LAST
] = {
7403 [ALC260_BASIC
] = "basic",
7405 [ALC260_HP_3013
] = "hp-3013",
7406 [ALC260_HP_DC7600
] = "hp-dc7600",
7407 [ALC260_FUJITSU_S702X
] = "fujitsu",
7408 [ALC260_ACER
] = "acer",
7409 [ALC260_WILL
] = "will",
7410 [ALC260_REPLACER_672V
] = "replacer",
7411 [ALC260_FAVORIT100
] = "favorit100",
7412 #ifdef CONFIG_SND_DEBUG
7413 [ALC260_TEST
] = "test",
7415 [ALC260_AUTO
] = "auto",
7418 static const struct snd_pci_quirk alc260_cfg_tbl
[] = {
7419 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
7420 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL
),
7421 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
7422 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100
),
7423 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
7424 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO
), /* no quirk */
7425 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
7426 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
7427 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600
),
7428 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
7429 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
7430 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
7431 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
7432 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
7433 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
7434 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
7435 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
7436 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
7437 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
7438 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
7442 static const struct alc_config_preset alc260_presets
[] = {
7444 .mixers
= { alc260_base_output_mixer
,
7445 alc260_input_mixer
},
7446 .init_verbs
= { alc260_init_verbs
},
7447 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7448 .dac_nids
= alc260_dac_nids
,
7449 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7450 .adc_nids
= alc260_dual_adc_nids
,
7451 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7452 .channel_mode
= alc260_modes
,
7453 .input_mux
= &alc260_capture_source
,
7456 .mixers
= { alc260_hp_output_mixer
,
7457 alc260_input_mixer
},
7458 .init_verbs
= { alc260_init_verbs
,
7459 alc260_hp_unsol_verbs
},
7460 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7461 .dac_nids
= alc260_dac_nids
,
7462 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7463 .adc_nids
= alc260_adc_nids_alt
,
7464 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7465 .channel_mode
= alc260_modes
,
7466 .input_mux
= &alc260_capture_source
,
7467 .unsol_event
= alc_sku_unsol_event
,
7468 .setup
= alc260_hp_setup
,
7469 .init_hook
= alc_inithook
,
7471 [ALC260_HP_DC7600
] = {
7472 .mixers
= { alc260_hp_dc7600_mixer
,
7473 alc260_input_mixer
},
7474 .init_verbs
= { alc260_init_verbs
,
7475 alc260_hp_dc7600_verbs
},
7476 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7477 .dac_nids
= alc260_dac_nids
,
7478 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7479 .adc_nids
= alc260_adc_nids_alt
,
7480 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7481 .channel_mode
= alc260_modes
,
7482 .input_mux
= &alc260_capture_source
,
7483 .unsol_event
= alc_sku_unsol_event
,
7484 .setup
= alc260_hp_3012_setup
,
7485 .init_hook
= alc_inithook
,
7487 [ALC260_HP_3013
] = {
7488 .mixers
= { alc260_hp_3013_mixer
,
7489 alc260_input_mixer
},
7490 .init_verbs
= { alc260_hp_3013_init_verbs
,
7491 alc260_hp_3013_unsol_verbs
},
7492 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7493 .dac_nids
= alc260_dac_nids
,
7494 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7495 .adc_nids
= alc260_adc_nids_alt
,
7496 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7497 .channel_mode
= alc260_modes
,
7498 .input_mux
= &alc260_capture_source
,
7499 .unsol_event
= alc_sku_unsol_event
,
7500 .setup
= alc260_hp_3013_setup
,
7501 .init_hook
= alc_inithook
,
7503 [ALC260_FUJITSU_S702X
] = {
7504 .mixers
= { alc260_fujitsu_mixer
},
7505 .init_verbs
= { alc260_fujitsu_init_verbs
},
7506 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7507 .dac_nids
= alc260_dac_nids
,
7508 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7509 .adc_nids
= alc260_dual_adc_nids
,
7510 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7511 .channel_mode
= alc260_modes
,
7512 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
7513 .input_mux
= alc260_fujitsu_capture_sources
,
7516 .mixers
= { alc260_acer_mixer
},
7517 .init_verbs
= { alc260_acer_init_verbs
},
7518 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7519 .dac_nids
= alc260_dac_nids
,
7520 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7521 .adc_nids
= alc260_dual_adc_nids
,
7522 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7523 .channel_mode
= alc260_modes
,
7524 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
7525 .input_mux
= alc260_acer_capture_sources
,
7527 [ALC260_FAVORIT100
] = {
7528 .mixers
= { alc260_favorit100_mixer
},
7529 .init_verbs
= { alc260_favorit100_init_verbs
},
7530 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7531 .dac_nids
= alc260_dac_nids
,
7532 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7533 .adc_nids
= alc260_dual_adc_nids
,
7534 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7535 .channel_mode
= alc260_modes
,
7536 .num_mux_defs
= ARRAY_SIZE(alc260_favorit100_capture_sources
),
7537 .input_mux
= alc260_favorit100_capture_sources
,
7540 .mixers
= { alc260_will_mixer
},
7541 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
7542 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7543 .dac_nids
= alc260_dac_nids
,
7544 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
7545 .adc_nids
= alc260_adc_nids
,
7546 .dig_out_nid
= ALC260_DIGOUT_NID
,
7547 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7548 .channel_mode
= alc260_modes
,
7549 .input_mux
= &alc260_capture_source
,
7551 [ALC260_REPLACER_672V
] = {
7552 .mixers
= { alc260_replacer_672v_mixer
},
7553 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
7554 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7555 .dac_nids
= alc260_dac_nids
,
7556 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
7557 .adc_nids
= alc260_adc_nids
,
7558 .dig_out_nid
= ALC260_DIGOUT_NID
,
7559 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7560 .channel_mode
= alc260_modes
,
7561 .input_mux
= &alc260_capture_source
,
7562 .unsol_event
= alc260_replacer_672v_unsol_event
,
7563 .init_hook
= alc260_replacer_672v_automute
,
7565 #ifdef CONFIG_SND_DEBUG
7567 .mixers
= { alc260_test_mixer
},
7568 .init_verbs
= { alc260_test_init_verbs
},
7569 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
7570 .dac_nids
= alc260_test_dac_nids
,
7571 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
7572 .adc_nids
= alc260_test_adc_nids
,
7573 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7574 .channel_mode
= alc260_modes
,
7575 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
7576 .input_mux
= alc260_test_capture_sources
,
7581 static int patch_alc260(struct hda_codec
*codec
)
7583 struct alc_spec
*spec
;
7584 int err
, board_config
;
7586 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
7592 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
7595 if (board_config
< 0) {
7596 snd_printd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
7598 board_config
= ALC260_AUTO
;
7601 if (board_config
== ALC260_AUTO
) {
7602 alc_pick_fixup(codec
, NULL
, alc260_fixup_tbl
, alc260_fixups
);
7603 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
7606 if (board_config
== ALC260_AUTO
) {
7607 /* automatic parse from the BIOS config */
7608 err
= alc260_parse_auto_config(codec
);
7614 "hda_codec: Cannot set up configuration "
7615 "from BIOS. Using base mode...\n");
7616 board_config
= ALC260_BASIC
;
7620 err
= snd_hda_attach_beep_device(codec
, 0x1);
7626 if (board_config
!= ALC260_AUTO
)
7627 setup_preset(codec
, &alc260_presets
[board_config
]);
7629 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
7630 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
7631 spec
->stream_analog_alt_capture
= &alc260_pcm_analog_capture
;
7633 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
7634 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
7636 if (!spec
->adc_nids
&& spec
->input_mux
) {
7637 /* check whether NID 0x04 is valid */
7638 unsigned int wcap
= get_wcaps(codec
, 0x04);
7639 wcap
= get_wcaps_type(wcap
);
7641 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
7642 spec
->adc_nids
= alc260_adc_nids_alt
;
7643 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
7645 spec
->adc_nids
= alc260_adc_nids
;
7646 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
7649 set_capture_mixer(codec
);
7650 set_beep_amp(spec
, 0x07, 0x05, HDA_INPUT
);
7652 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
7654 spec
->vmaster_nid
= 0x08;
7656 codec
->patch_ops
= alc_patch_ops
;
7657 if (board_config
== ALC260_AUTO
)
7658 spec
->init_hook
= alc260_auto_init
;
7659 spec
->shutup
= alc_eapd_shutup
;
7660 #ifdef CONFIG_SND_HDA_POWER_SAVE
7661 if (!spec
->loopback
.amplist
)
7662 spec
->loopback
.amplist
= alc260_loopbacks
;
7670 * ALC882/883/885/888/889 support
7672 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7673 * configuration. Each pin widget can choose any input DACs and a mixer.
7674 * Each ADC is connected from a mixer of all inputs. This makes possible
7675 * 6-channel independent captures.
7677 * In addition, an independent DAC for the multi-playback (not used in this
7680 #define ALC882_DIGOUT_NID 0x06
7681 #define ALC882_DIGIN_NID 0x0a
7682 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7683 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7684 #define ALC1200_DIGOUT_NID 0x10
7687 static const struct hda_channel_mode alc882_ch_modes
[1] = {
7692 static const hda_nid_t alc882_dac_nids
[4] = {
7693 /* front, rear, clfe, rear_surr */
7694 0x02, 0x03, 0x04, 0x05
7696 #define alc883_dac_nids alc882_dac_nids
7699 #define alc882_adc_nids alc880_adc_nids
7700 #define alc882_adc_nids_alt alc880_adc_nids_alt
7701 #define alc883_adc_nids alc882_adc_nids_alt
7702 static const hda_nid_t alc883_adc_nids_alt
[1] = { 0x08 };
7703 static const hda_nid_t alc883_adc_nids_rev
[2] = { 0x09, 0x08 };
7704 #define alc889_adc_nids alc880_adc_nids
7706 static const hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
7707 static const hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
7708 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7709 static const hda_nid_t alc883_capsrc_nids_rev
[2] = { 0x22, 0x23 };
7710 #define alc889_capsrc_nids alc882_capsrc_nids
7713 /* FIXME: should be a matrix-type input source selection */
7715 static const struct hda_input_mux alc882_capture_source
= {
7719 { "Front Mic", 0x1 },
7725 #define alc883_capture_source alc882_capture_source
7727 static const struct hda_input_mux alc889_capture_source
= {
7730 { "Front Mic", 0x0 },
7736 static const struct hda_input_mux mb5_capture_source
= {
7745 static const struct hda_input_mux macmini3_capture_source
= {
7753 static const struct hda_input_mux alc883_3stack_6ch_intel
= {
7757 { "Front Mic", 0x0 },
7763 static const struct hda_input_mux alc883_lenovo_101e_capture_source
= {
7771 static const struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
7775 { "Internal Mic", 0x1 },
7781 static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
7785 { "Internal Mic", 0x1 },
7789 static const struct hda_input_mux alc883_lenovo_sky_capture_source
= {
7793 { "Front Mic", 0x1 },
7798 static const struct hda_input_mux alc883_asus_eee1601_capture_source
= {
7806 static const struct hda_input_mux alc889A_mb31_capture_source
= {
7810 /* Front Mic (0x01) unused */
7812 /* Line 2 (0x03) unused */
7813 /* CD (0x04) unused? */
7817 static const struct hda_input_mux alc889A_imac91_capture_source
= {
7821 { "Line", 0x2 }, /* Not sure! */
7828 static const struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
7835 static const struct hda_verb alc882_3ST_ch2_init
[] = {
7836 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7837 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7838 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7839 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7846 static const struct hda_verb alc882_3ST_ch4_init
[] = {
7847 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7848 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7850 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7851 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7858 static const struct hda_verb alc882_3ST_ch6_init
[] = {
7859 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7860 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7861 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7862 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7863 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7864 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7868 static const struct hda_channel_mode alc882_3ST_6ch_modes
[3] = {
7869 { 2, alc882_3ST_ch2_init
},
7870 { 4, alc882_3ST_ch4_init
},
7871 { 6, alc882_3ST_ch6_init
},
7874 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7879 static const struct hda_verb alc883_3ST_ch2_clevo_init
[] = {
7880 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7881 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7882 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7883 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7884 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7891 static const struct hda_verb alc883_3ST_ch4_clevo_init
[] = {
7892 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7893 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7894 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7895 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7896 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7897 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7904 static const struct hda_verb alc883_3ST_ch6_clevo_init
[] = {
7905 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7906 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7907 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7908 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7909 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7910 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7911 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7915 static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes
[3] = {
7916 { 2, alc883_3ST_ch2_clevo_init
},
7917 { 4, alc883_3ST_ch4_clevo_init
},
7918 { 6, alc883_3ST_ch6_clevo_init
},
7925 static const struct hda_verb alc882_sixstack_ch6_init
[] = {
7926 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7927 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7928 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7929 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7936 static const struct hda_verb alc882_sixstack_ch8_init
[] = {
7937 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7938 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7939 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7940 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7944 static const struct hda_channel_mode alc882_sixstack_modes
[2] = {
7945 { 6, alc882_sixstack_ch6_init
},
7946 { 8, alc882_sixstack_ch8_init
},
7950 /* Macbook Air 2,1 */
7952 static const struct hda_channel_mode alc885_mba21_ch_modes
[1] = {
7957 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7963 static const struct hda_verb alc885_mbp_ch2_init
[] = {
7964 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7965 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7966 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7973 static const struct hda_verb alc885_mbp_ch4_init
[] = {
7974 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7975 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7976 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7977 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7978 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7982 static const struct hda_channel_mode alc885_mbp_4ch_modes
[2] = {
7983 { 2, alc885_mbp_ch2_init
},
7984 { 4, alc885_mbp_ch4_init
},
7989 * Speakers/Woofer/HP = Front
7992 static const struct hda_verb alc885_mb5_ch2_init
[] = {
7993 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8000 * Speakers/HP = Front
8004 static const struct hda_verb alc885_mb5_ch6_init
[] = {
8005 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8007 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8011 static const struct hda_channel_mode alc885_mb5_6ch_modes
[2] = {
8012 { 2, alc885_mb5_ch2_init
},
8013 { 6, alc885_mb5_ch6_init
},
8016 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
8021 static const struct hda_verb alc883_4ST_ch2_init
[] = {
8022 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8023 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8024 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8025 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8026 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8027 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8034 static const struct hda_verb alc883_4ST_ch4_init
[] = {
8035 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8036 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8037 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8038 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8039 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8040 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8041 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8048 static const struct hda_verb alc883_4ST_ch6_init
[] = {
8049 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8050 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8051 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8052 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8053 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8054 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8055 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8056 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8063 static const struct hda_verb alc883_4ST_ch8_init
[] = {
8064 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8065 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8066 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
8067 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8068 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8069 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8070 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8071 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8072 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8076 static const struct hda_channel_mode alc883_4ST_8ch_modes
[4] = {
8077 { 2, alc883_4ST_ch2_init
},
8078 { 4, alc883_4ST_ch4_init
},
8079 { 6, alc883_4ST_ch6_init
},
8080 { 8, alc883_4ST_ch8_init
},
8087 static const struct hda_verb alc883_3ST_ch2_intel_init
[] = {
8088 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8089 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8090 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8091 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8098 static const struct hda_verb alc883_3ST_ch4_intel_init
[] = {
8099 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8100 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8101 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8102 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8103 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8110 static const struct hda_verb alc883_3ST_ch6_intel_init
[] = {
8111 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8112 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8113 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8114 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8115 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8116 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8120 static const struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
8121 { 2, alc883_3ST_ch2_intel_init
},
8122 { 4, alc883_3ST_ch4_intel_init
},
8123 { 6, alc883_3ST_ch6_intel_init
},
8129 static const struct hda_verb alc889_ch2_intel_init
[] = {
8130 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8131 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8132 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8133 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8134 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8135 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8142 static const struct hda_verb alc889_ch6_intel_init
[] = {
8143 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8144 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8145 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8146 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
8147 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8148 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8155 static const struct hda_verb alc889_ch8_intel_init
[] = {
8156 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8157 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8158 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8159 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
8160 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x03 },
8161 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8162 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8166 static const struct hda_channel_mode alc889_8ch_intel_modes
[3] = {
8167 { 2, alc889_ch2_intel_init
},
8168 { 6, alc889_ch6_intel_init
},
8169 { 8, alc889_ch8_intel_init
},
8175 static const struct hda_verb alc883_sixstack_ch6_init
[] = {
8176 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
8177 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8178 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8179 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8186 static const struct hda_verb alc883_sixstack_ch8_init
[] = {
8187 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8188 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8189 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8190 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8194 static const struct hda_channel_mode alc883_sixstack_modes
[2] = {
8195 { 6, alc883_sixstack_ch6_init
},
8196 { 8, alc883_sixstack_ch8_init
},
8200 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
8201 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
8203 static const struct snd_kcontrol_new alc882_base_mixer
[] = {
8204 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8205 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8206 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8207 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8208 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8209 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8210 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8211 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8212 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8213 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
8214 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8215 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8216 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8220 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8222 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8223 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8224 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8228 /* Macbook Air 2,1 same control for HP and internal Speaker */
8230 static const struct snd_kcontrol_new alc885_mba21_mixer
[] = {
8231 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8232 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT
),
8237 static const struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
8238 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8239 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
8241 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT
),
8242 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8243 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8244 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8245 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
8246 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
8247 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT
),
8248 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT
),
8252 static const struct snd_kcontrol_new alc885_mb5_mixer
[] = {
8253 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8254 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8255 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8256 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
8257 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
8258 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
8259 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
8260 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
8261 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
8262 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
8263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8264 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8265 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT
),
8266 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT
),
8270 static const struct snd_kcontrol_new alc885_macmini3_mixer
[] = {
8271 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8272 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8273 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8274 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
8275 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
8276 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
8277 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
8278 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
8279 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
8280 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
8281 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT
),
8285 static const struct snd_kcontrol_new alc885_imac91_mixer
[] = {
8286 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8287 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8292 static const struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
8293 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8294 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8295 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8296 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8297 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8298 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8299 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8300 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8305 static const struct snd_kcontrol_new alc882_targa_mixer
[] = {
8306 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8307 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8308 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8309 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8310 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8311 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8312 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8314 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8315 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8316 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8317 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8318 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8322 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8323 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8325 static const struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
8326 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8327 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8328 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8329 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
8330 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8331 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8332 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8333 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8334 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
8335 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
8336 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8337 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8338 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8342 static const struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
8343 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8344 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8345 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8346 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8347 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8348 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8349 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8351 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8356 static const struct snd_kcontrol_new alc882_chmode_mixer
[] = {
8358 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8359 .name
= "Channel Mode",
8360 .info
= alc_ch_mode_info
,
8361 .get
= alc_ch_mode_get
,
8362 .put
= alc_ch_mode_put
,
8367 static const struct hda_verb alc882_base_init_verbs
[] = {
8368 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8369 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8372 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8375 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8376 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8378 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8379 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8381 /* Front Pin: output 0 (0x0c) */
8382 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8383 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8384 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8385 /* Rear Pin: output 1 (0x0d) */
8386 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8388 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8389 /* CLFE Pin: output 2 (0x0e) */
8390 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8391 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8392 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8393 /* Side Pin: output 3 (0x0f) */
8394 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8395 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8396 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8397 /* Mic (rear) pin: input vref at 80% */
8398 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8399 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8400 /* Front Mic pin: input vref at 80% */
8401 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8402 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8403 /* Line In pin: input */
8404 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8405 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8406 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8407 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8408 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8409 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8410 /* CD pin widget for input */
8411 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8413 /* FIXME: use matrix-type input source selection */
8414 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8416 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8418 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8419 /* ADC2: mute amp left and right */
8420 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8421 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8422 /* ADC3: mute amp left and right */
8423 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8424 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8429 static const struct hda_verb alc882_adc1_init_verbs
[] = {
8430 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8431 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8432 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8433 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8434 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8435 /* ADC1: mute amp left and right */
8436 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8437 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8441 static const struct hda_verb alc882_eapd_verbs
[] = {
8442 /* change to EAPD mode */
8443 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8444 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
8448 static const struct hda_verb alc889_eapd_verbs
[] = {
8449 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8450 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8454 static const struct hda_verb alc_hp15_unsol_verbs
[] = {
8455 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8456 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8460 static const struct hda_verb alc885_init_verbs
[] = {
8461 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8469 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8471 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8472 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8474 /* Front HP Pin: output 0 (0x0c) */
8475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8476 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8477 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8478 /* Front Pin: output 0 (0x0c) */
8479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8481 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8482 /* Rear Pin: output 1 (0x0d) */
8483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8484 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8485 {0x19, AC_VERB_SET_CONNECT_SEL
, 0x01},
8486 /* CLFE Pin: output 2 (0x0e) */
8487 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8488 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8489 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8490 /* Side Pin: output 3 (0x0f) */
8491 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8492 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8493 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8494 /* Mic (rear) pin: input vref at 80% */
8495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8496 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8497 /* Front Mic pin: input vref at 80% */
8498 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8499 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8500 /* Line In pin: input */
8501 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8502 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8504 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8506 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8508 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8510 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8511 /* ADC2: mute amp left and right */
8512 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8513 /* ADC3: mute amp left and right */
8514 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8519 static const struct hda_verb alc885_init_input_verbs
[] = {
8520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
8527 /* Unmute Selector 24h and set the default input to front mic */
8528 static const struct hda_verb alc889_init_input_verbs
[] = {
8529 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
8530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8535 #define alc883_init_verbs alc882_base_init_verbs
8538 static const struct snd_kcontrol_new alc882_macpro_mixer
[] = {
8539 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8540 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8541 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
8542 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8543 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8544 /* FIXME: this looks suspicious...
8545 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8546 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8551 static const struct hda_verb alc882_macpro_init_verbs
[] = {
8552 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8556 /* Front Pin: output 0 (0x0c) */
8557 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8559 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8560 /* Front Mic pin: input vref at 80% */
8561 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8562 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8563 /* Speaker: output */
8564 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8565 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8566 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
8567 /* Headphone output (output 0 - 0x0c) */
8568 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8569 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8570 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8572 /* FIXME: use matrix-type input source selection */
8573 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8574 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8575 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8577 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8578 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8580 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8581 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8582 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8583 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8585 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8589 /* ADC1: mute amp left and right */
8590 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8591 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8592 /* ADC2: mute amp left and right */
8593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8594 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8595 /* ADC3: mute amp left and right */
8596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8597 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8603 static const struct hda_verb alc885_mb5_init_verbs
[] = {
8605 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8606 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8607 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8608 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8610 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8611 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8613 /* Surround mixer */
8614 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8615 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8618 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8619 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8620 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8622 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8623 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8624 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8625 /* Front Pin (0x0c) */
8626 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8627 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8628 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8629 /* LFE Pin (0x0e) */
8630 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8631 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8632 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
8634 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8635 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8636 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
8637 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8638 /* Front Mic pin: input vref at 80% */
8639 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8640 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0x1)},
8646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x7)},
8647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x4)},
8652 static const struct hda_verb alc885_macmini3_init_verbs
[] = {
8654 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8655 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8656 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8657 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8662 /* Surround mixer */
8663 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8665 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8667 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8668 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8669 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8671 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8672 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8673 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8674 /* Front Pin (0x0c) */
8675 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8676 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8677 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8678 /* LFE Pin (0x0e) */
8679 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8680 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8681 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
8683 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8684 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8685 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
8686 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8691 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8692 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8693 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8694 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8699 static const struct hda_verb alc885_mba21_init_verbs
[] = {
8700 /*Internal and HP Speaker Mixer*/
8701 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8704 /*Internal Speaker Pin (0x0c)*/
8705 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8706 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8707 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8708 /* HP Pin: output 0 (0x0e) */
8709 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
8710 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8711 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8712 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8713 /* Line in (is hp when jack connected)*/
8714 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8715 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8721 /* Macbook Pro rev3 */
8722 static const struct hda_verb alc885_mbp3_init_verbs
[] = {
8723 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8726 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8728 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8729 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8730 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8732 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8733 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8735 /* Front Pin: output 0 (0x0c) */
8736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8737 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8738 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8739 /* HP Pin: output 0 (0x0e) */
8740 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
8741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8742 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x02},
8743 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8744 /* Mic (rear) pin: input vref at 80% */
8745 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8746 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8747 /* Front Mic pin: input vref at 80% */
8748 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8750 /* Line In pin: use output 1 when in LineOut mode */
8751 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8752 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8753 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
8755 /* FIXME: use matrix-type input source selection */
8756 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8757 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8758 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8763 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8764 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8765 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8768 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8772 /* ADC1: mute amp left and right */
8773 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8774 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8775 /* ADC2: mute amp left and right */
8776 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8777 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8778 /* ADC3: mute amp left and right */
8779 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8780 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8786 static const struct hda_verb alc885_imac91_init_verbs
[] = {
8787 /* Internal Speaker Pin (0x0c) */
8788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8790 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8791 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8792 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8793 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8796 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8797 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8798 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8802 /* Front Mic pin: input vref at 80% */
8803 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8804 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8806 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8809 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8813 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8814 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8815 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8816 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8817 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8818 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8819 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8820 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8821 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8822 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8823 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8824 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8825 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8826 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8827 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8828 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8829 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8830 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8831 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8832 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8833 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8834 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8835 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8836 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8840 /* iMac 24 mixer. */
8841 static const struct snd_kcontrol_new alc885_imac24_mixer
[] = {
8842 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8843 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
8847 /* iMac 24 init verbs. */
8848 static const struct hda_verb alc885_imac24_init_verbs
[] = {
8849 /* Internal speakers: output 0 (0x0c) */
8850 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8851 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8852 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8853 /* Internal speakers: output 0 (0x0c) */
8854 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8855 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8856 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8857 /* Headphone: output 0 (0x0c) */
8858 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8859 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8860 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8861 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8862 /* Front Mic: input vref at 80% */
8863 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8864 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8868 /* Toggle speaker-output according to the hp-jack state */
8869 static void alc885_imac24_setup(struct hda_codec
*codec
)
8871 struct alc_spec
*spec
= codec
->spec
;
8873 spec
->autocfg
.hp_pins
[0] = 0x14;
8874 spec
->autocfg
.speaker_pins
[0] = 0x18;
8875 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8877 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8880 #define alc885_mb5_setup alc885_imac24_setup
8881 #define alc885_macmini3_setup alc885_imac24_setup
8883 /* Macbook Air 2,1 */
8884 static void alc885_mba21_setup(struct hda_codec
*codec
)
8886 struct alc_spec
*spec
= codec
->spec
;
8888 spec
->autocfg
.hp_pins
[0] = 0x14;
8889 spec
->autocfg
.speaker_pins
[0] = 0x18;
8891 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8896 static void alc885_mbp3_setup(struct hda_codec
*codec
)
8898 struct alc_spec
*spec
= codec
->spec
;
8900 spec
->autocfg
.hp_pins
[0] = 0x15;
8901 spec
->autocfg
.speaker_pins
[0] = 0x14;
8903 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8906 static void alc885_imac91_setup(struct hda_codec
*codec
)
8908 struct alc_spec
*spec
= codec
->spec
;
8910 spec
->autocfg
.hp_pins
[0] = 0x14;
8911 spec
->autocfg
.speaker_pins
[0] = 0x18;
8912 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8914 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8917 static const struct hda_verb alc882_targa_verbs
[] = {
8918 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8921 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8922 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8924 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8925 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8926 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8928 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8932 /* toggle speaker-output according to the hp-jack state */
8933 static void alc882_targa_automute(struct hda_codec
*codec
)
8935 struct alc_spec
*spec
= codec
->spec
;
8936 alc_hp_automute(codec
);
8937 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
8938 spec
->jack_present
? 1 : 3);
8941 static void alc882_targa_setup(struct hda_codec
*codec
)
8943 struct alc_spec
*spec
= codec
->spec
;
8945 spec
->autocfg
.hp_pins
[0] = 0x14;
8946 spec
->autocfg
.speaker_pins
[0] = 0x1b;
8948 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8951 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8953 if ((res
>> 26) == ALC880_HP_EVENT
)
8954 alc882_targa_automute(codec
);
8957 static const struct hda_verb alc882_asus_a7j_verbs
[] = {
8958 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8959 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8961 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8963 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8965 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8966 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8967 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8969 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8970 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8971 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8975 static const struct hda_verb alc882_asus_a7m_verbs
[] = {
8976 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8979 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8980 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8981 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8983 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8984 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8985 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8987 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8988 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8989 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8993 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
8995 unsigned int gpiostate
, gpiomask
, gpiodir
;
8997 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8998 AC_VERB_GET_GPIO_DATA
, 0);
9001 gpiostate
|= (1 << pin
);
9003 gpiostate
&= ~(1 << pin
);
9005 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
9006 AC_VERB_GET_GPIO_MASK
, 0);
9007 gpiomask
|= (1 << pin
);
9009 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
9010 AC_VERB_GET_GPIO_DIRECTION
, 0);
9011 gpiodir
|= (1 << pin
);
9014 snd_hda_codec_write(codec
, codec
->afg
, 0,
9015 AC_VERB_SET_GPIO_MASK
, gpiomask
);
9016 snd_hda_codec_write(codec
, codec
->afg
, 0,
9017 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
9021 snd_hda_codec_write(codec
, codec
->afg
, 0,
9022 AC_VERB_SET_GPIO_DATA
, gpiostate
);
9025 /* set up GPIO at initialization */
9026 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
9028 alc882_gpio_mute(codec
, 0, 0);
9029 alc882_gpio_mute(codec
, 1, 0);
9032 /* set up GPIO and update auto-muting at initialization */
9033 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
9035 alc885_macpro_init_hook(codec
);
9036 alc_hp_automute(codec
);
9040 * generic initialization of ADC, input mixers and output mixers
9042 static const struct hda_verb alc883_auto_init_verbs
[] = {
9044 * Unmute ADC0-2 and set the default input to mic-in
9046 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9047 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9048 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9049 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9052 * Set up output mixers (0x0c - 0x0f)
9054 /* set vol=0 to output mixers */
9055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9058 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9059 /* set up input amps for analog loopback */
9060 /* Amp Indices: DAC = 0, mixer = 1 */
9061 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9062 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9063 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9064 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9065 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9066 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9067 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9068 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9069 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9070 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9072 /* FIXME: use matrix-type input source selection */
9073 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9075 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9081 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
9082 static const struct hda_verb alc889A_mb31_ch2_init
[] = {
9083 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
9084 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
9085 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
9086 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
9090 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
9091 static const struct hda_verb alc889A_mb31_ch4_init
[] = {
9092 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
9093 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
9094 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
9095 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
9099 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
9100 static const struct hda_verb alc889A_mb31_ch5_init
[] = {
9101 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as rear */
9102 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
9103 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
9104 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
9108 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
9109 static const struct hda_verb alc889A_mb31_ch6_init
[] = {
9110 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as front */
9111 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Subwoofer off */
9112 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
9113 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
9117 static const struct hda_channel_mode alc889A_mb31_6ch_modes
[4] = {
9118 { 2, alc889A_mb31_ch2_init
},
9119 { 4, alc889A_mb31_ch4_init
},
9120 { 5, alc889A_mb31_ch5_init
},
9121 { 6, alc889A_mb31_ch6_init
},
9124 static const struct hda_verb alc883_medion_eapd_verbs
[] = {
9125 /* eanable EAPD on medion laptop */
9126 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9127 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
9131 #define alc883_base_mixer alc882_base_mixer
9133 static const struct snd_kcontrol_new alc883_mitac_mixer
[] = {
9134 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9135 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9136 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9137 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9138 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9139 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9140 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9142 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9144 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9145 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9146 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9150 static const struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
9151 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9152 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
9153 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9154 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
9155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9156 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9158 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9159 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9160 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9164 static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
9165 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9166 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
9167 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9168 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
9169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9170 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9172 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9173 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9174 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9178 static const struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
9179 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9180 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9181 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9182 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9183 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9184 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9185 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9186 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9187 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9188 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9189 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9190 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9191 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9195 static const struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
9196 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9197 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9198 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9199 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9200 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9201 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9202 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9203 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9204 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9205 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9206 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9207 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9208 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9209 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9210 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9211 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9212 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9213 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9214 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9218 static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
9219 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9220 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9221 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9222 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9223 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9225 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9226 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9227 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9228 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9229 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9230 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9231 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9232 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9234 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9237 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9238 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9242 static const struct snd_kcontrol_new alc885_8ch_intel_mixer
[] = {
9243 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9244 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9245 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9246 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9247 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9249 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9250 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9251 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9252 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9253 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT
),
9254 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9255 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9256 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9257 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
9258 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT
),
9259 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
9260 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9261 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9262 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9266 static const struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
9267 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9268 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9269 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9270 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9271 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9272 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9273 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9274 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9276 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9277 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9278 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9279 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9281 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9282 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9283 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9284 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9285 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9289 static const struct snd_kcontrol_new alc883_targa_mixer
[] = {
9290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9291 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9293 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9294 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9295 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9296 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9297 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9298 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9299 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9300 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9301 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9302 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9303 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9304 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9305 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9306 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9310 static const struct snd_kcontrol_new alc883_targa_2ch_mixer
[] = {
9311 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9312 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9313 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9314 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9315 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9316 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9318 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9320 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9321 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9322 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9326 static const struct snd_kcontrol_new alc883_targa_8ch_mixer
[] = {
9327 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9328 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
9329 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9330 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9331 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9335 static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
9336 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9337 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9338 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9339 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
9340 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9342 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9347 static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
9348 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9349 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
9350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9351 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9352 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9355 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9356 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9360 static const struct snd_kcontrol_new alc883_medion_wim2160_mixer
[] = {
9361 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9362 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9363 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9364 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT
),
9365 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT
),
9366 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT
),
9370 static const struct hda_verb alc883_medion_wim2160_verbs
[] = {
9371 /* Unmute front mixer */
9372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9375 /* Set speaker pin to front mixer */
9376 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9378 /* Init headphone pin */
9379 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9380 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9381 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
9382 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9387 /* toggle speaker-output according to the hp-jack state */
9388 static void alc883_medion_wim2160_setup(struct hda_codec
*codec
)
9390 struct alc_spec
*spec
= codec
->spec
;
9392 spec
->autocfg
.hp_pins
[0] = 0x1a;
9393 spec
->autocfg
.speaker_pins
[0] = 0x15;
9395 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9398 static const struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
9399 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9400 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9401 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9402 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9403 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9405 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9406 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9410 static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer
[] = {
9411 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9412 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9413 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9414 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9415 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9416 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9418 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9423 static const struct snd_kcontrol_new alc888_lenovo_sky_mixer
[] = {
9424 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9425 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9426 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
9427 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
9428 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9429 0x0d, 1, 0x0, HDA_OUTPUT
),
9430 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
9431 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
9432 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
9433 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9434 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
9435 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9436 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9437 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9438 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9440 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9442 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9443 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9444 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9448 static const struct snd_kcontrol_new alc889A_mb31_mixer
[] = {
9450 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
9451 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
9452 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
9453 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
9454 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9456 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT
),
9457 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT
),
9458 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT
),
9459 /* Output switches */
9460 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT
),
9461 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT
),
9462 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT
),
9464 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT
),
9465 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT
),
9467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
9468 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
9469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9474 static const struct snd_kcontrol_new alc883_vaiott_mixer
[] = {
9475 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9476 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9477 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9479 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9480 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9484 static const struct hda_bind_ctls alc883_bind_cap_vol
= {
9485 .ops
= &snd_hda_bind_vol
,
9487 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
9488 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
9493 static const struct hda_bind_ctls alc883_bind_cap_switch
= {
9494 .ops
= &snd_hda_bind_sw
,
9496 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
9497 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
9502 static const struct snd_kcontrol_new alc883_asus_eee1601_mixer
[] = {
9503 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9504 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9506 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9507 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9508 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9509 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9510 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9514 static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer
[] = {
9515 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol
),
9516 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch
),
9518 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9519 /* .name = "Capture Source", */
9520 .name
= "Input Source",
9522 .info
= alc_mux_enum_info
,
9523 .get
= alc_mux_enum_get
,
9524 .put
= alc_mux_enum_put
,
9529 static const struct snd_kcontrol_new alc883_chmode_mixer
[] = {
9531 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9532 .name
= "Channel Mode",
9533 .info
= alc_ch_mode_info
,
9534 .get
= alc_ch_mode_get
,
9535 .put
= alc_ch_mode_put
,
9540 /* toggle speaker-output according to the hp-jack state */
9541 static void alc883_mitac_setup(struct hda_codec
*codec
)
9543 struct alc_spec
*spec
= codec
->spec
;
9545 spec
->autocfg
.hp_pins
[0] = 0x15;
9546 spec
->autocfg
.speaker_pins
[0] = 0x14;
9547 spec
->autocfg
.speaker_pins
[1] = 0x17;
9549 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9552 static const struct hda_verb alc883_mitac_verbs
[] = {
9554 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9557 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
9558 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9560 /* enable unsolicited event */
9561 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9562 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9567 static const struct hda_verb alc883_clevo_m540r_verbs
[] = {
9569 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9570 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9572 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9574 /* enable unsolicited event */
9576 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9577 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9583 static const struct hda_verb alc883_clevo_m720_verbs
[] = {
9585 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9586 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9588 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
9589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9591 /* enable unsolicited event */
9592 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9593 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9598 static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
9600 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9603 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9604 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9606 /* enable unsolicited event */
9607 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9612 static const struct hda_verb alc883_targa_verbs
[] = {
9613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9616 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9617 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9619 /* Connect Line-Out side jack (SPDIF) to Side */
9620 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9621 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9622 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
9623 /* Connect Mic jack to CLFE */
9624 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9625 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9626 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
9627 /* Connect Line-in jack to Surround */
9628 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9629 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9630 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
9631 /* Connect HP out jack to Front */
9632 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9633 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9634 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9636 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9641 static const struct hda_verb alc883_lenovo_101e_verbs
[] = {
9642 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9643 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
9644 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
9648 static const struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
9649 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9650 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9651 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9656 static const struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
9657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9659 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9660 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
9661 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9665 static const struct hda_verb alc883_haier_w66_verbs
[] = {
9666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9669 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9671 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9672 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9673 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9674 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9678 static const struct hda_verb alc888_lenovo_sky_verbs
[] = {
9679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9681 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9682 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9683 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9684 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9685 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
9686 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9690 static const struct hda_verb alc888_6st_dell_verbs
[] = {
9691 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9695 static const struct hda_verb alc883_vaiott_verbs
[] = {
9697 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9700 /* enable unsolicited event */
9701 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9706 static void alc888_3st_hp_setup(struct hda_codec
*codec
)
9708 struct alc_spec
*spec
= codec
->spec
;
9710 spec
->autocfg
.hp_pins
[0] = 0x1b;
9711 spec
->autocfg
.speaker_pins
[0] = 0x14;
9712 spec
->autocfg
.speaker_pins
[1] = 0x16;
9713 spec
->autocfg
.speaker_pins
[2] = 0x18;
9715 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9718 static const struct hda_verb alc888_3st_hp_verbs
[] = {
9719 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
9720 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
9721 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
9722 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9729 static const struct hda_verb alc888_3st_hp_2ch_init
[] = {
9730 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9731 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9732 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
9733 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9740 static const struct hda_verb alc888_3st_hp_4ch_init
[] = {
9741 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9742 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9743 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9744 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9745 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9752 static const struct hda_verb alc888_3st_hp_6ch_init
[] = {
9753 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9754 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9755 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
9756 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9757 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9758 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9762 static const struct hda_channel_mode alc888_3st_hp_modes
[3] = {
9763 { 2, alc888_3st_hp_2ch_init
},
9764 { 4, alc888_3st_hp_4ch_init
},
9765 { 6, alc888_3st_hp_6ch_init
},
9768 static void alc888_lenovo_ms7195_setup(struct hda_codec
*codec
)
9770 struct alc_spec
*spec
= codec
->spec
;
9772 spec
->autocfg
.hp_pins
[0] = 0x1b;
9773 spec
->autocfg
.line_out_pins
[0] = 0x14;
9774 spec
->autocfg
.speaker_pins
[0] = 0x15;
9776 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9779 /* toggle speaker-output according to the hp-jack state */
9780 static void alc883_lenovo_nb0763_setup(struct hda_codec
*codec
)
9782 struct alc_spec
*spec
= codec
->spec
;
9784 spec
->autocfg
.hp_pins
[0] = 0x14;
9785 spec
->autocfg
.speaker_pins
[0] = 0x15;
9787 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9790 /* toggle speaker-output according to the hp-jack state */
9791 #define alc883_targa_init_hook alc882_targa_init_hook
9792 #define alc883_targa_unsol_event alc882_targa_unsol_event
9794 static void alc883_clevo_m720_setup(struct hda_codec
*codec
)
9796 struct alc_spec
*spec
= codec
->spec
;
9798 spec
->autocfg
.hp_pins
[0] = 0x15;
9799 spec
->autocfg
.speaker_pins
[0] = 0x14;
9801 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9804 static void alc883_clevo_m720_init_hook(struct hda_codec
*codec
)
9806 alc_hp_automute(codec
);
9807 alc88x_simple_mic_automute(codec
);
9810 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
9813 switch (res
>> 26) {
9814 case ALC880_MIC_EVENT
:
9815 alc88x_simple_mic_automute(codec
);
9818 alc_sku_unsol_event(codec
, res
);
9823 /* toggle speaker-output according to the hp-jack state */
9824 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec
*codec
)
9826 struct alc_spec
*spec
= codec
->spec
;
9828 spec
->autocfg
.hp_pins
[0] = 0x14;
9829 spec
->autocfg
.speaker_pins
[0] = 0x15;
9831 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9834 static void alc883_haier_w66_setup(struct hda_codec
*codec
)
9836 struct alc_spec
*spec
= codec
->spec
;
9838 spec
->autocfg
.hp_pins
[0] = 0x1b;
9839 spec
->autocfg
.speaker_pins
[0] = 0x14;
9841 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9844 static void alc883_lenovo_101e_setup(struct hda_codec
*codec
)
9846 struct alc_spec
*spec
= codec
->spec
;
9848 spec
->autocfg
.hp_pins
[0] = 0x1b;
9849 spec
->autocfg
.line_out_pins
[0] = 0x14;
9850 spec
->autocfg
.speaker_pins
[0] = 0x15;
9852 spec
->detect_line
= 1;
9853 spec
->automute_lines
= 1;
9854 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9857 /* toggle speaker-output according to the hp-jack state */
9858 static void alc883_acer_aspire_setup(struct hda_codec
*codec
)
9860 struct alc_spec
*spec
= codec
->spec
;
9862 spec
->autocfg
.hp_pins
[0] = 0x14;
9863 spec
->autocfg
.speaker_pins
[0] = 0x15;
9864 spec
->autocfg
.speaker_pins
[1] = 0x16;
9866 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9869 static const struct hda_verb alc883_acer_eapd_verbs
[] = {
9870 /* HP Pin: output 0 (0x0c) */
9871 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9872 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9873 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9874 /* Front Pin: output 0 (0x0c) */
9875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9876 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9877 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9878 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
9879 /* eanable EAPD on medion laptop */
9880 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9881 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9882 /* enable unsolicited event */
9883 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9887 static void alc888_6st_dell_setup(struct hda_codec
*codec
)
9889 struct alc_spec
*spec
= codec
->spec
;
9891 spec
->autocfg
.hp_pins
[0] = 0x1b;
9892 spec
->autocfg
.speaker_pins
[0] = 0x14;
9893 spec
->autocfg
.speaker_pins
[1] = 0x15;
9894 spec
->autocfg
.speaker_pins
[2] = 0x16;
9895 spec
->autocfg
.speaker_pins
[3] = 0x17;
9897 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9900 static void alc888_lenovo_sky_setup(struct hda_codec
*codec
)
9902 struct alc_spec
*spec
= codec
->spec
;
9904 spec
->autocfg
.hp_pins
[0] = 0x1b;
9905 spec
->autocfg
.speaker_pins
[0] = 0x14;
9906 spec
->autocfg
.speaker_pins
[1] = 0x15;
9907 spec
->autocfg
.speaker_pins
[2] = 0x16;
9908 spec
->autocfg
.speaker_pins
[3] = 0x17;
9909 spec
->autocfg
.speaker_pins
[4] = 0x1a;
9911 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9914 static void alc883_vaiott_setup(struct hda_codec
*codec
)
9916 struct alc_spec
*spec
= codec
->spec
;
9918 spec
->autocfg
.hp_pins
[0] = 0x15;
9919 spec
->autocfg
.speaker_pins
[0] = 0x14;
9920 spec
->autocfg
.speaker_pins
[1] = 0x17;
9922 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9925 static const struct hda_verb alc888_asus_m90v_verbs
[] = {
9926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9927 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9928 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9929 /* enable unsolicited event */
9930 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9931 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9935 static void alc883_mode2_setup(struct hda_codec
*codec
)
9937 struct alc_spec
*spec
= codec
->spec
;
9939 spec
->autocfg
.hp_pins
[0] = 0x1b;
9940 spec
->autocfg
.speaker_pins
[0] = 0x14;
9941 spec
->autocfg
.speaker_pins
[1] = 0x15;
9942 spec
->autocfg
.speaker_pins
[2] = 0x16;
9943 spec
->ext_mic
.pin
= 0x18;
9944 spec
->int_mic
.pin
= 0x19;
9945 spec
->ext_mic
.mux_idx
= 0;
9946 spec
->int_mic
.mux_idx
= 1;
9949 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9952 static const struct hda_verb alc888_asus_eee1601_verbs
[] = {
9953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9954 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9956 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9957 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9958 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
9959 {0x20, AC_VERB_SET_PROC_COEF
, 0x0838},
9960 /* enable unsolicited event */
9961 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9965 static void alc883_eee1601_inithook(struct hda_codec
*codec
)
9967 struct alc_spec
*spec
= codec
->spec
;
9969 spec
->autocfg
.hp_pins
[0] = 0x14;
9970 spec
->autocfg
.speaker_pins
[0] = 0x1b;
9971 alc_hp_automute(codec
);
9974 static const struct hda_verb alc889A_mb31_verbs
[] = {
9975 /* Init rear pin (used as headphone output) */
9976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4}, /* Apple Headphones */
9977 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Connect to front */
9978 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9979 /* Init line pin (used as output in 4ch and 6ch mode) */
9980 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Connect to CLFE */
9981 /* Init line 2 pin (used as headphone out by default) */
9982 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Use as input */
9983 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Mute output */
9987 /* Mute speakers according to the headphone jack state */
9988 static void alc889A_mb31_automute(struct hda_codec
*codec
)
9990 unsigned int present
;
9992 /* Mute only in 2ch or 4ch mode */
9993 if (snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_CONNECT_SEL
, 0)
9995 present
= snd_hda_jack_detect(codec
, 0x15);
9996 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9997 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9998 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9999 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
10003 static void alc889A_mb31_unsol_event(struct hda_codec
*codec
, unsigned int res
)
10005 if ((res
>> 26) == ALC880_HP_EVENT
)
10006 alc889A_mb31_automute(codec
);
10010 #ifdef CONFIG_SND_HDA_POWER_SAVE
10011 #define alc882_loopbacks alc880_loopbacks
10014 /* pcm configuration: identical with ALC880 */
10015 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
10016 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
10017 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
10018 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
10020 static const hda_nid_t alc883_slave_dig_outs
[] = {
10021 ALC1200_DIGOUT_NID
, 0,
10024 static const hda_nid_t alc1200_slave_dig_outs
[] = {
10025 ALC883_DIGOUT_NID
, 0,
10029 * configuration and preset
10031 static const char * const alc882_models
[ALC882_MODEL_LAST
] = {
10032 [ALC882_3ST_DIG
] = "3stack-dig",
10033 [ALC882_6ST_DIG
] = "6stack-dig",
10034 [ALC882_ARIMA
] = "arima",
10035 [ALC882_W2JC
] = "w2jc",
10036 [ALC882_TARGA
] = "targa",
10037 [ALC882_ASUS_A7J
] = "asus-a7j",
10038 [ALC882_ASUS_A7M
] = "asus-a7m",
10039 [ALC885_MACPRO
] = "macpro",
10040 [ALC885_MB5
] = "mb5",
10041 [ALC885_MACMINI3
] = "macmini3",
10042 [ALC885_MBA21
] = "mba21",
10043 [ALC885_MBP3
] = "mbp3",
10044 [ALC885_IMAC24
] = "imac24",
10045 [ALC885_IMAC91
] = "imac91",
10046 [ALC883_3ST_2ch_DIG
] = "3stack-2ch-dig",
10047 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
10048 [ALC883_3ST_6ch
] = "3stack-6ch",
10049 [ALC883_6ST_DIG
] = "alc883-6stack-dig",
10050 [ALC883_TARGA_DIG
] = "targa-dig",
10051 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
10052 [ALC883_TARGA_8ch_DIG
] = "targa-8ch-dig",
10053 [ALC883_ACER
] = "acer",
10054 [ALC883_ACER_ASPIRE
] = "acer-aspire",
10055 [ALC888_ACER_ASPIRE_4930G
] = "acer-aspire-4930g",
10056 [ALC888_ACER_ASPIRE_6530G
] = "acer-aspire-6530g",
10057 [ALC888_ACER_ASPIRE_8930G
] = "acer-aspire-8930g",
10058 [ALC888_ACER_ASPIRE_7730G
] = "acer-aspire-7730g",
10059 [ALC883_MEDION
] = "medion",
10060 [ALC883_MEDION_WIM2160
] = "medion-wim2160",
10061 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
10062 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
10063 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
10064 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
10065 [ALC888_LENOVO_SKY
] = "lenovo-sky",
10066 [ALC883_HAIER_W66
] = "haier-w66",
10067 [ALC888_3ST_HP
] = "3stack-hp",
10068 [ALC888_6ST_DELL
] = "6stack-dell",
10069 [ALC883_MITAC
] = "mitac",
10070 [ALC883_CLEVO_M540R
] = "clevo-m540r",
10071 [ALC883_CLEVO_M720
] = "clevo-m720",
10072 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
10073 [ALC888_FUJITSU_XA3530
] = "fujitsu-xa3530",
10074 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
10075 [ALC889A_INTEL
] = "intel-alc889a",
10076 [ALC889_INTEL
] = "intel-x58",
10077 [ALC1200_ASUS_P5Q
] = "asus-p5q",
10078 [ALC889A_MB31
] = "mb31",
10079 [ALC883_SONY_VAIO_TT
] = "sony-vaio-tt",
10080 [ALC882_AUTO
] = "auto",
10083 static const struct snd_pci_quirk alc882_cfg_tbl
[] = {
10084 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
10086 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
10087 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE
),
10088 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE
),
10089 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
10090 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
10091 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
10092 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
10093 ALC888_ACER_ASPIRE_4930G
),
10094 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
10095 ALC888_ACER_ASPIRE_4930G
),
10096 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
10097 ALC888_ACER_ASPIRE_8930G
),
10098 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
10099 ALC888_ACER_ASPIRE_8930G
),
10100 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO
),
10101 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO
),
10102 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
10103 ALC888_ACER_ASPIRE_6530G
),
10104 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
10105 ALC888_ACER_ASPIRE_6530G
),
10106 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
10107 ALC888_ACER_ASPIRE_7730G
),
10108 /* default Acer -- disabled as it causes more problems.
10109 * model=auto should work fine now
10111 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
10113 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
10115 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG
),
10116 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
10117 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
10118 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
10119 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP
),
10120 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP
),
10122 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
10123 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
10124 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
10125 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V
),
10126 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
10127 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
10128 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
10129 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
10130 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG
),
10131 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q
),
10132 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601
),
10134 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT
),
10135 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
10136 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
10137 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC
),
10138 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
10139 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
10140 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL
),
10141 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
10142 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
10144 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
10145 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
10146 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
10147 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
10148 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO
),
10149 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
10150 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
10151 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
10152 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
10153 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
10154 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
10155 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
10156 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
10157 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
10158 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG
),
10159 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
10160 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
10161 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
10162 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG
),
10163 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG
),
10164 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
10165 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
10166 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
10167 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG
),
10168 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
10169 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
10170 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
10171 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG
),
10172 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG
),
10173 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
10174 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG
),
10176 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
10177 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG
),
10178 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
10179 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
10180 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R
),
10181 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD
),
10182 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
10183 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
10184 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
10185 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
10186 ALC883_FUJITSU_PI2515
),
10187 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
10188 ALC888_FUJITSU_XA3530
),
10189 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
10190 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
10191 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
10192 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
10193 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY
),
10194 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG
),
10195 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
10196 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
10198 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
10199 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
10200 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC
),
10201 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL
),
10202 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL
),
10203 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL
),
10204 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG
),
10209 /* codec SSID table for Intel Mac */
10210 static const struct snd_pci_quirk alc882_ssid_cfg_tbl
[] = {
10211 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3
),
10212 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3
),
10213 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3
),
10214 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO
),
10215 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24
),
10216 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24
),
10217 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3
),
10218 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31
),
10219 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M
),
10220 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3
),
10221 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21
),
10222 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31
),
10223 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3
),
10224 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24
),
10225 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91
),
10226 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5
),
10227 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5
),
10228 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10229 * so apparently no perfect solution yet
10231 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5
),
10232 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5
),
10233 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3
),
10234 {} /* terminator */
10237 static const struct alc_config_preset alc882_presets
[] = {
10238 [ALC882_3ST_DIG
] = {
10239 .mixers
= { alc882_base_mixer
},
10240 .init_verbs
= { alc882_base_init_verbs
,
10241 alc882_adc1_init_verbs
},
10242 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10243 .dac_nids
= alc882_dac_nids
,
10244 .dig_out_nid
= ALC882_DIGOUT_NID
,
10245 .dig_in_nid
= ALC882_DIGIN_NID
,
10246 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10247 .channel_mode
= alc882_ch_modes
,
10249 .input_mux
= &alc882_capture_source
,
10251 [ALC882_6ST_DIG
] = {
10252 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
10253 .init_verbs
= { alc882_base_init_verbs
,
10254 alc882_adc1_init_verbs
},
10255 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10256 .dac_nids
= alc882_dac_nids
,
10257 .dig_out_nid
= ALC882_DIGOUT_NID
,
10258 .dig_in_nid
= ALC882_DIGIN_NID
,
10259 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
10260 .channel_mode
= alc882_sixstack_modes
,
10261 .input_mux
= &alc882_capture_source
,
10264 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
10265 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10266 alc882_eapd_verbs
},
10267 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10268 .dac_nids
= alc882_dac_nids
,
10269 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
10270 .channel_mode
= alc882_sixstack_modes
,
10271 .input_mux
= &alc882_capture_source
,
10274 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
10275 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10276 alc882_eapd_verbs
, alc880_gpio1_init_verbs
},
10277 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10278 .dac_nids
= alc882_dac_nids
,
10279 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
10280 .channel_mode
= alc880_threestack_modes
,
10282 .input_mux
= &alc882_capture_source
,
10283 .dig_out_nid
= ALC882_DIGOUT_NID
,
10286 .mixers
= { alc885_mba21_mixer
},
10287 .init_verbs
= { alc885_mba21_init_verbs
, alc880_gpio1_init_verbs
},
10289 .dac_nids
= alc882_dac_nids
,
10290 .channel_mode
= alc885_mba21_ch_modes
,
10291 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
10292 .input_mux
= &alc882_capture_source
,
10293 .unsol_event
= alc_sku_unsol_event
,
10294 .setup
= alc885_mba21_setup
,
10295 .init_hook
= alc_hp_automute
,
10298 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
10299 .init_verbs
= { alc885_mbp3_init_verbs
,
10300 alc880_gpio1_init_verbs
},
10302 .dac_nids
= alc882_dac_nids
,
10304 .channel_mode
= alc885_mbp_4ch_modes
,
10305 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_4ch_modes
),
10306 .input_mux
= &alc882_capture_source
,
10307 .dig_out_nid
= ALC882_DIGOUT_NID
,
10308 .dig_in_nid
= ALC882_DIGIN_NID
,
10309 .unsol_event
= alc_sku_unsol_event
,
10310 .setup
= alc885_mbp3_setup
,
10311 .init_hook
= alc_hp_automute
,
10314 .mixers
= { alc885_mb5_mixer
, alc882_chmode_mixer
},
10315 .init_verbs
= { alc885_mb5_init_verbs
,
10316 alc880_gpio1_init_verbs
},
10317 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10318 .dac_nids
= alc882_dac_nids
,
10319 .channel_mode
= alc885_mb5_6ch_modes
,
10320 .num_channel_mode
= ARRAY_SIZE(alc885_mb5_6ch_modes
),
10321 .input_mux
= &mb5_capture_source
,
10322 .dig_out_nid
= ALC882_DIGOUT_NID
,
10323 .dig_in_nid
= ALC882_DIGIN_NID
,
10324 .unsol_event
= alc_sku_unsol_event
,
10325 .setup
= alc885_mb5_setup
,
10326 .init_hook
= alc_hp_automute
,
10328 [ALC885_MACMINI3
] = {
10329 .mixers
= { alc885_macmini3_mixer
, alc882_chmode_mixer
},
10330 .init_verbs
= { alc885_macmini3_init_verbs
,
10331 alc880_gpio1_init_verbs
},
10332 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10333 .dac_nids
= alc882_dac_nids
,
10334 .channel_mode
= alc885_macmini3_6ch_modes
,
10335 .num_channel_mode
= ARRAY_SIZE(alc885_macmini3_6ch_modes
),
10336 .input_mux
= &macmini3_capture_source
,
10337 .dig_out_nid
= ALC882_DIGOUT_NID
,
10338 .dig_in_nid
= ALC882_DIGIN_NID
,
10339 .unsol_event
= alc_sku_unsol_event
,
10340 .setup
= alc885_macmini3_setup
,
10341 .init_hook
= alc_hp_automute
,
10343 [ALC885_MACPRO
] = {
10344 .mixers
= { alc882_macpro_mixer
},
10345 .init_verbs
= { alc882_macpro_init_verbs
},
10346 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10347 .dac_nids
= alc882_dac_nids
,
10348 .dig_out_nid
= ALC882_DIGOUT_NID
,
10349 .dig_in_nid
= ALC882_DIGIN_NID
,
10350 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10351 .channel_mode
= alc882_ch_modes
,
10352 .input_mux
= &alc882_capture_source
,
10353 .init_hook
= alc885_macpro_init_hook
,
10355 [ALC885_IMAC24
] = {
10356 .mixers
= { alc885_imac24_mixer
},
10357 .init_verbs
= { alc885_imac24_init_verbs
},
10358 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10359 .dac_nids
= alc882_dac_nids
,
10360 .dig_out_nid
= ALC882_DIGOUT_NID
,
10361 .dig_in_nid
= ALC882_DIGIN_NID
,
10362 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10363 .channel_mode
= alc882_ch_modes
,
10364 .input_mux
= &alc882_capture_source
,
10365 .unsol_event
= alc_sku_unsol_event
,
10366 .setup
= alc885_imac24_setup
,
10367 .init_hook
= alc885_imac24_init_hook
,
10369 [ALC885_IMAC91
] = {
10370 .mixers
= {alc885_imac91_mixer
},
10371 .init_verbs
= { alc885_imac91_init_verbs
,
10372 alc880_gpio1_init_verbs
},
10373 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10374 .dac_nids
= alc882_dac_nids
,
10375 .channel_mode
= alc885_mba21_ch_modes
,
10376 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
10377 .input_mux
= &alc889A_imac91_capture_source
,
10378 .dig_out_nid
= ALC882_DIGOUT_NID
,
10379 .dig_in_nid
= ALC882_DIGIN_NID
,
10380 .unsol_event
= alc_sku_unsol_event
,
10381 .setup
= alc885_imac91_setup
,
10382 .init_hook
= alc_hp_automute
,
10385 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
},
10386 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10387 alc880_gpio3_init_verbs
, alc882_targa_verbs
},
10388 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10389 .dac_nids
= alc882_dac_nids
,
10390 .dig_out_nid
= ALC882_DIGOUT_NID
,
10391 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
10392 .adc_nids
= alc882_adc_nids
,
10393 .capsrc_nids
= alc882_capsrc_nids
,
10394 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
10395 .channel_mode
= alc882_3ST_6ch_modes
,
10397 .input_mux
= &alc882_capture_source
,
10398 .unsol_event
= alc_sku_unsol_event
,
10399 .setup
= alc882_targa_setup
,
10400 .init_hook
= alc882_targa_automute
,
10402 [ALC882_ASUS_A7J
] = {
10403 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
},
10404 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10405 alc882_asus_a7j_verbs
},
10406 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10407 .dac_nids
= alc882_dac_nids
,
10408 .dig_out_nid
= ALC882_DIGOUT_NID
,
10409 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
10410 .adc_nids
= alc882_adc_nids
,
10411 .capsrc_nids
= alc882_capsrc_nids
,
10412 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
10413 .channel_mode
= alc882_3ST_6ch_modes
,
10415 .input_mux
= &alc882_capture_source
,
10417 [ALC882_ASUS_A7M
] = {
10418 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
10419 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10420 alc882_eapd_verbs
, alc880_gpio1_init_verbs
,
10421 alc882_asus_a7m_verbs
},
10422 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10423 .dac_nids
= alc882_dac_nids
,
10424 .dig_out_nid
= ALC882_DIGOUT_NID
,
10425 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
10426 .channel_mode
= alc880_threestack_modes
,
10428 .input_mux
= &alc882_capture_source
,
10430 [ALC883_3ST_2ch_DIG
] = {
10431 .mixers
= { alc883_3ST_2ch_mixer
},
10432 .init_verbs
= { alc883_init_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_2ch_modes
),
10438 .channel_mode
= alc883_3ST_2ch_modes
,
10439 .input_mux
= &alc883_capture_source
,
10441 [ALC883_3ST_6ch_DIG
] = {
10442 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10443 .init_verbs
= { alc883_init_verbs
},
10444 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10445 .dac_nids
= alc883_dac_nids
,
10446 .dig_out_nid
= ALC883_DIGOUT_NID
,
10447 .dig_in_nid
= ALC883_DIGIN_NID
,
10448 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10449 .channel_mode
= alc883_3ST_6ch_modes
,
10451 .input_mux
= &alc883_capture_source
,
10453 [ALC883_3ST_6ch
] = {
10454 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10455 .init_verbs
= { alc883_init_verbs
},
10456 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10457 .dac_nids
= alc883_dac_nids
,
10458 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10459 .channel_mode
= alc883_3ST_6ch_modes
,
10461 .input_mux
= &alc883_capture_source
,
10463 [ALC883_3ST_6ch_INTEL
] = {
10464 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
10465 .init_verbs
= { alc883_init_verbs
},
10466 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10467 .dac_nids
= alc883_dac_nids
,
10468 .dig_out_nid
= ALC883_DIGOUT_NID
,
10469 .dig_in_nid
= ALC883_DIGIN_NID
,
10470 .slave_dig_outs
= alc883_slave_dig_outs
,
10471 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
10472 .channel_mode
= alc883_3ST_6ch_intel_modes
,
10474 .input_mux
= &alc883_3stack_6ch_intel
,
10476 [ALC889A_INTEL
] = {
10477 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
10478 .init_verbs
= { alc885_init_verbs
, alc885_init_input_verbs
,
10479 alc_hp15_unsol_verbs
},
10480 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10481 .dac_nids
= alc883_dac_nids
,
10482 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10483 .adc_nids
= alc889_adc_nids
,
10484 .dig_out_nid
= ALC883_DIGOUT_NID
,
10485 .dig_in_nid
= ALC883_DIGIN_NID
,
10486 .slave_dig_outs
= alc883_slave_dig_outs
,
10487 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
10488 .channel_mode
= alc889_8ch_intel_modes
,
10489 .capsrc_nids
= alc889_capsrc_nids
,
10490 .input_mux
= &alc889_capture_source
,
10491 .setup
= alc889_automute_setup
,
10492 .init_hook
= alc_hp_automute
,
10493 .unsol_event
= alc_sku_unsol_event
,
10497 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
10498 .init_verbs
= { alc885_init_verbs
, alc889_init_input_verbs
,
10499 alc889_eapd_verbs
, alc_hp15_unsol_verbs
},
10500 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10501 .dac_nids
= alc883_dac_nids
,
10502 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10503 .adc_nids
= alc889_adc_nids
,
10504 .dig_out_nid
= ALC883_DIGOUT_NID
,
10505 .dig_in_nid
= ALC883_DIGIN_NID
,
10506 .slave_dig_outs
= alc883_slave_dig_outs
,
10507 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
10508 .channel_mode
= alc889_8ch_intel_modes
,
10509 .capsrc_nids
= alc889_capsrc_nids
,
10510 .input_mux
= &alc889_capture_source
,
10511 .setup
= alc889_automute_setup
,
10512 .init_hook
= alc889_intel_init_hook
,
10513 .unsol_event
= alc_sku_unsol_event
,
10516 [ALC883_6ST_DIG
] = {
10517 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10518 .init_verbs
= { alc883_init_verbs
},
10519 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10520 .dac_nids
= alc883_dac_nids
,
10521 .dig_out_nid
= ALC883_DIGOUT_NID
,
10522 .dig_in_nid
= ALC883_DIGIN_NID
,
10523 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10524 .channel_mode
= alc883_sixstack_modes
,
10525 .input_mux
= &alc883_capture_source
,
10527 [ALC883_TARGA_DIG
] = {
10528 .mixers
= { alc883_targa_mixer
, alc883_chmode_mixer
},
10529 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10530 alc883_targa_verbs
},
10531 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10532 .dac_nids
= alc883_dac_nids
,
10533 .dig_out_nid
= ALC883_DIGOUT_NID
,
10534 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10535 .channel_mode
= alc883_3ST_6ch_modes
,
10537 .input_mux
= &alc883_capture_source
,
10538 .unsol_event
= alc883_targa_unsol_event
,
10539 .setup
= alc882_targa_setup
,
10540 .init_hook
= alc882_targa_automute
,
10542 [ALC883_TARGA_2ch_DIG
] = {
10543 .mixers
= { alc883_targa_2ch_mixer
},
10544 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10545 alc883_targa_verbs
},
10546 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10547 .dac_nids
= alc883_dac_nids
,
10548 .adc_nids
= alc883_adc_nids_alt
,
10549 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10550 .capsrc_nids
= alc883_capsrc_nids
,
10551 .dig_out_nid
= ALC883_DIGOUT_NID
,
10552 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10553 .channel_mode
= alc883_3ST_2ch_modes
,
10554 .input_mux
= &alc883_capture_source
,
10555 .unsol_event
= alc883_targa_unsol_event
,
10556 .setup
= alc882_targa_setup
,
10557 .init_hook
= alc882_targa_automute
,
10559 [ALC883_TARGA_8ch_DIG
] = {
10560 .mixers
= { alc883_targa_mixer
, alc883_targa_8ch_mixer
,
10561 alc883_chmode_mixer
},
10562 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10563 alc883_targa_verbs
},
10564 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10565 .dac_nids
= alc883_dac_nids
,
10566 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10567 .adc_nids
= alc883_adc_nids_rev
,
10568 .capsrc_nids
= alc883_capsrc_nids_rev
,
10569 .dig_out_nid
= ALC883_DIGOUT_NID
,
10570 .dig_in_nid
= ALC883_DIGIN_NID
,
10571 .num_channel_mode
= ARRAY_SIZE(alc883_4ST_8ch_modes
),
10572 .channel_mode
= alc883_4ST_8ch_modes
,
10574 .input_mux
= &alc883_capture_source
,
10575 .unsol_event
= alc883_targa_unsol_event
,
10576 .setup
= alc882_targa_setup
,
10577 .init_hook
= alc882_targa_automute
,
10580 .mixers
= { alc883_base_mixer
},
10581 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10582 * and the headphone jack. Turn this on and rely on the
10583 * standard mute methods whenever the user wants to turn
10584 * these outputs off.
10586 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
10587 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10588 .dac_nids
= alc883_dac_nids
,
10589 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10590 .channel_mode
= alc883_3ST_2ch_modes
,
10591 .input_mux
= &alc883_capture_source
,
10593 [ALC883_ACER_ASPIRE
] = {
10594 .mixers
= { alc883_acer_aspire_mixer
},
10595 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
10596 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10597 .dac_nids
= alc883_dac_nids
,
10598 .dig_out_nid
= ALC883_DIGOUT_NID
,
10599 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10600 .channel_mode
= alc883_3ST_2ch_modes
,
10601 .input_mux
= &alc883_capture_source
,
10602 .unsol_event
= alc_sku_unsol_event
,
10603 .setup
= alc883_acer_aspire_setup
,
10604 .init_hook
= alc_hp_automute
,
10606 [ALC888_ACER_ASPIRE_4930G
] = {
10607 .mixers
= { alc888_acer_aspire_4930g_mixer
,
10608 alc883_chmode_mixer
},
10609 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10610 alc888_acer_aspire_4930g_verbs
},
10611 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10612 .dac_nids
= alc883_dac_nids
,
10613 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10614 .adc_nids
= alc883_adc_nids_rev
,
10615 .capsrc_nids
= alc883_capsrc_nids_rev
,
10616 .dig_out_nid
= ALC883_DIGOUT_NID
,
10617 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10618 .channel_mode
= alc883_3ST_6ch_modes
,
10620 .const_channel_count
= 6,
10622 ARRAY_SIZE(alc888_2_capture_sources
),
10623 .input_mux
= alc888_2_capture_sources
,
10624 .unsol_event
= alc_sku_unsol_event
,
10625 .setup
= alc888_acer_aspire_4930g_setup
,
10626 .init_hook
= alc_hp_automute
,
10628 [ALC888_ACER_ASPIRE_6530G
] = {
10629 .mixers
= { alc888_acer_aspire_6530_mixer
},
10630 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10631 alc888_acer_aspire_6530g_verbs
},
10632 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10633 .dac_nids
= alc883_dac_nids
,
10634 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10635 .adc_nids
= alc883_adc_nids_rev
,
10636 .capsrc_nids
= alc883_capsrc_nids_rev
,
10637 .dig_out_nid
= ALC883_DIGOUT_NID
,
10638 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10639 .channel_mode
= alc883_3ST_2ch_modes
,
10641 ARRAY_SIZE(alc888_2_capture_sources
),
10642 .input_mux
= alc888_acer_aspire_6530_sources
,
10643 .unsol_event
= alc_sku_unsol_event
,
10644 .setup
= alc888_acer_aspire_6530g_setup
,
10645 .init_hook
= alc_hp_automute
,
10647 [ALC888_ACER_ASPIRE_8930G
] = {
10648 .mixers
= { alc889_acer_aspire_8930g_mixer
,
10649 alc883_chmode_mixer
},
10650 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10651 alc889_acer_aspire_8930g_verbs
,
10652 alc889_eapd_verbs
},
10653 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10654 .dac_nids
= alc883_dac_nids
,
10655 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10656 .adc_nids
= alc889_adc_nids
,
10657 .capsrc_nids
= alc889_capsrc_nids
,
10658 .dig_out_nid
= ALC883_DIGOUT_NID
,
10659 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10660 .channel_mode
= alc883_3ST_6ch_modes
,
10662 .const_channel_count
= 6,
10664 ARRAY_SIZE(alc889_capture_sources
),
10665 .input_mux
= alc889_capture_sources
,
10666 .unsol_event
= alc_sku_unsol_event
,
10667 .setup
= alc889_acer_aspire_8930g_setup
,
10668 .init_hook
= alc_hp_automute
,
10669 #ifdef CONFIG_SND_HDA_POWER_SAVE
10670 .power_hook
= alc_power_eapd
,
10673 [ALC888_ACER_ASPIRE_7730G
] = {
10674 .mixers
= { alc883_3ST_6ch_mixer
,
10675 alc883_chmode_mixer
},
10676 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10677 alc888_acer_aspire_7730G_verbs
},
10678 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10679 .dac_nids
= alc883_dac_nids
,
10680 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10681 .adc_nids
= alc883_adc_nids_rev
,
10682 .capsrc_nids
= alc883_capsrc_nids_rev
,
10683 .dig_out_nid
= ALC883_DIGOUT_NID
,
10684 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10685 .channel_mode
= alc883_3ST_6ch_modes
,
10687 .const_channel_count
= 6,
10688 .input_mux
= &alc883_capture_source
,
10689 .unsol_event
= alc_sku_unsol_event
,
10690 .setup
= alc888_acer_aspire_7730g_setup
,
10691 .init_hook
= alc_hp_automute
,
10693 [ALC883_MEDION
] = {
10694 .mixers
= { alc883_fivestack_mixer
,
10695 alc883_chmode_mixer
},
10696 .init_verbs
= { alc883_init_verbs
,
10697 alc883_medion_eapd_verbs
},
10698 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10699 .dac_nids
= alc883_dac_nids
,
10700 .adc_nids
= alc883_adc_nids_alt
,
10701 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10702 .capsrc_nids
= alc883_capsrc_nids
,
10703 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10704 .channel_mode
= alc883_sixstack_modes
,
10705 .input_mux
= &alc883_capture_source
,
10707 [ALC883_MEDION_WIM2160
] = {
10708 .mixers
= { alc883_medion_wim2160_mixer
},
10709 .init_verbs
= { alc883_init_verbs
, alc883_medion_wim2160_verbs
},
10710 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10711 .dac_nids
= alc883_dac_nids
,
10712 .dig_out_nid
= ALC883_DIGOUT_NID
,
10713 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10714 .adc_nids
= alc883_adc_nids
,
10715 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10716 .channel_mode
= alc883_3ST_2ch_modes
,
10717 .input_mux
= &alc883_capture_source
,
10718 .unsol_event
= alc_sku_unsol_event
,
10719 .setup
= alc883_medion_wim2160_setup
,
10720 .init_hook
= alc_hp_automute
,
10722 [ALC883_LAPTOP_EAPD
] = {
10723 .mixers
= { alc883_base_mixer
},
10724 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
10725 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10726 .dac_nids
= alc883_dac_nids
,
10727 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10728 .channel_mode
= alc883_3ST_2ch_modes
,
10729 .input_mux
= &alc883_capture_source
,
10731 [ALC883_CLEVO_M540R
] = {
10732 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10733 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m540r_verbs
},
10734 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10735 .dac_nids
= alc883_dac_nids
,
10736 .dig_out_nid
= ALC883_DIGOUT_NID
,
10737 .dig_in_nid
= ALC883_DIGIN_NID
,
10738 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_clevo_modes
),
10739 .channel_mode
= alc883_3ST_6ch_clevo_modes
,
10741 .input_mux
= &alc883_capture_source
,
10742 /* This machine has the hardware HP auto-muting, thus
10743 * we need no software mute via unsol event
10746 [ALC883_CLEVO_M720
] = {
10747 .mixers
= { alc883_clevo_m720_mixer
},
10748 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
10749 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10750 .dac_nids
= alc883_dac_nids
,
10751 .dig_out_nid
= ALC883_DIGOUT_NID
,
10752 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10753 .channel_mode
= alc883_3ST_2ch_modes
,
10754 .input_mux
= &alc883_capture_source
,
10755 .unsol_event
= alc883_clevo_m720_unsol_event
,
10756 .setup
= alc883_clevo_m720_setup
,
10757 .init_hook
= alc883_clevo_m720_init_hook
,
10759 [ALC883_LENOVO_101E_2ch
] = {
10760 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
10761 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
10762 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10763 .dac_nids
= alc883_dac_nids
,
10764 .adc_nids
= alc883_adc_nids_alt
,
10765 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10766 .capsrc_nids
= alc883_capsrc_nids
,
10767 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10768 .channel_mode
= alc883_3ST_2ch_modes
,
10769 .input_mux
= &alc883_lenovo_101e_capture_source
,
10770 .setup
= alc883_lenovo_101e_setup
,
10771 .unsol_event
= alc_sku_unsol_event
,
10772 .init_hook
= alc_inithook
,
10774 [ALC883_LENOVO_NB0763
] = {
10775 .mixers
= { alc883_lenovo_nb0763_mixer
},
10776 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
10777 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10778 .dac_nids
= alc883_dac_nids
,
10779 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10780 .channel_mode
= alc883_3ST_2ch_modes
,
10782 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
10783 .unsol_event
= alc_sku_unsol_event
,
10784 .setup
= alc883_lenovo_nb0763_setup
,
10785 .init_hook
= alc_hp_automute
,
10787 [ALC888_LENOVO_MS7195_DIG
] = {
10788 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10789 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
10790 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10791 .dac_nids
= alc883_dac_nids
,
10792 .dig_out_nid
= ALC883_DIGOUT_NID
,
10793 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10794 .channel_mode
= alc883_3ST_6ch_modes
,
10796 .input_mux
= &alc883_capture_source
,
10797 .unsol_event
= alc_sku_unsol_event
,
10798 .setup
= alc888_lenovo_ms7195_setup
,
10799 .init_hook
= alc_inithook
,
10801 [ALC883_HAIER_W66
] = {
10802 .mixers
= { alc883_targa_2ch_mixer
},
10803 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
10804 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10805 .dac_nids
= alc883_dac_nids
,
10806 .dig_out_nid
= ALC883_DIGOUT_NID
,
10807 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10808 .channel_mode
= alc883_3ST_2ch_modes
,
10809 .input_mux
= &alc883_capture_source
,
10810 .unsol_event
= alc_sku_unsol_event
,
10811 .setup
= alc883_haier_w66_setup
,
10812 .init_hook
= alc_hp_automute
,
10814 [ALC888_3ST_HP
] = {
10815 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10816 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
10817 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10818 .dac_nids
= alc883_dac_nids
,
10819 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
10820 .channel_mode
= alc888_3st_hp_modes
,
10822 .input_mux
= &alc883_capture_source
,
10823 .unsol_event
= alc_sku_unsol_event
,
10824 .setup
= alc888_3st_hp_setup
,
10825 .init_hook
= alc_hp_automute
,
10827 [ALC888_6ST_DELL
] = {
10828 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10829 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
10830 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10831 .dac_nids
= alc883_dac_nids
,
10832 .dig_out_nid
= ALC883_DIGOUT_NID
,
10833 .dig_in_nid
= ALC883_DIGIN_NID
,
10834 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10835 .channel_mode
= alc883_sixstack_modes
,
10836 .input_mux
= &alc883_capture_source
,
10837 .unsol_event
= alc_sku_unsol_event
,
10838 .setup
= alc888_6st_dell_setup
,
10839 .init_hook
= alc_hp_automute
,
10842 .mixers
= { alc883_mitac_mixer
},
10843 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
10844 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10845 .dac_nids
= alc883_dac_nids
,
10846 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10847 .channel_mode
= alc883_3ST_2ch_modes
,
10848 .input_mux
= &alc883_capture_source
,
10849 .unsol_event
= alc_sku_unsol_event
,
10850 .setup
= alc883_mitac_setup
,
10851 .init_hook
= alc_hp_automute
,
10853 [ALC883_FUJITSU_PI2515
] = {
10854 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
10855 .init_verbs
= { alc883_init_verbs
,
10856 alc883_2ch_fujitsu_pi2515_verbs
},
10857 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10858 .dac_nids
= alc883_dac_nids
,
10859 .dig_out_nid
= ALC883_DIGOUT_NID
,
10860 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10861 .channel_mode
= alc883_3ST_2ch_modes
,
10862 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10863 .unsol_event
= alc_sku_unsol_event
,
10864 .setup
= alc883_2ch_fujitsu_pi2515_setup
,
10865 .init_hook
= alc_hp_automute
,
10867 [ALC888_FUJITSU_XA3530
] = {
10868 .mixers
= { alc888_base_mixer
, alc883_chmode_mixer
},
10869 .init_verbs
= { alc883_init_verbs
,
10870 alc888_fujitsu_xa3530_verbs
},
10871 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10872 .dac_nids
= alc883_dac_nids
,
10873 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10874 .adc_nids
= alc883_adc_nids_rev
,
10875 .capsrc_nids
= alc883_capsrc_nids_rev
,
10876 .dig_out_nid
= ALC883_DIGOUT_NID
,
10877 .num_channel_mode
= ARRAY_SIZE(alc888_4ST_8ch_intel_modes
),
10878 .channel_mode
= alc888_4ST_8ch_intel_modes
,
10880 ARRAY_SIZE(alc888_2_capture_sources
),
10881 .input_mux
= alc888_2_capture_sources
,
10882 .unsol_event
= alc_sku_unsol_event
,
10883 .setup
= alc888_fujitsu_xa3530_setup
,
10884 .init_hook
= alc_hp_automute
,
10886 [ALC888_LENOVO_SKY
] = {
10887 .mixers
= { alc888_lenovo_sky_mixer
, alc883_chmode_mixer
},
10888 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_sky_verbs
},
10889 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10890 .dac_nids
= alc883_dac_nids
,
10891 .dig_out_nid
= ALC883_DIGOUT_NID
,
10892 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10893 .channel_mode
= alc883_sixstack_modes
,
10895 .input_mux
= &alc883_lenovo_sky_capture_source
,
10896 .unsol_event
= alc_sku_unsol_event
,
10897 .setup
= alc888_lenovo_sky_setup
,
10898 .init_hook
= alc_hp_automute
,
10900 [ALC888_ASUS_M90V
] = {
10901 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10902 .init_verbs
= { alc883_init_verbs
, alc888_asus_m90v_verbs
},
10903 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10904 .dac_nids
= alc883_dac_nids
,
10905 .dig_out_nid
= ALC883_DIGOUT_NID
,
10906 .dig_in_nid
= ALC883_DIGIN_NID
,
10907 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10908 .channel_mode
= alc883_3ST_6ch_modes
,
10910 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10911 .unsol_event
= alc_sku_unsol_event
,
10912 .setup
= alc883_mode2_setup
,
10913 .init_hook
= alc_inithook
,
10915 [ALC888_ASUS_EEE1601
] = {
10916 .mixers
= { alc883_asus_eee1601_mixer
},
10917 .cap_mixer
= alc883_asus_eee1601_cap_mixer
,
10918 .init_verbs
= { alc883_init_verbs
, alc888_asus_eee1601_verbs
},
10919 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10920 .dac_nids
= alc883_dac_nids
,
10921 .dig_out_nid
= ALC883_DIGOUT_NID
,
10922 .dig_in_nid
= ALC883_DIGIN_NID
,
10923 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10924 .channel_mode
= alc883_3ST_2ch_modes
,
10926 .input_mux
= &alc883_asus_eee1601_capture_source
,
10927 .unsol_event
= alc_sku_unsol_event
,
10928 .init_hook
= alc883_eee1601_inithook
,
10930 [ALC1200_ASUS_P5Q
] = {
10931 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10932 .init_verbs
= { alc883_init_verbs
},
10933 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10934 .dac_nids
= alc883_dac_nids
,
10935 .dig_out_nid
= ALC1200_DIGOUT_NID
,
10936 .dig_in_nid
= ALC883_DIGIN_NID
,
10937 .slave_dig_outs
= alc1200_slave_dig_outs
,
10938 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10939 .channel_mode
= alc883_sixstack_modes
,
10940 .input_mux
= &alc883_capture_source
,
10943 .mixers
= { alc889A_mb31_mixer
, alc883_chmode_mixer
},
10944 .init_verbs
= { alc883_init_verbs
, alc889A_mb31_verbs
,
10945 alc880_gpio1_init_verbs
},
10946 .adc_nids
= alc883_adc_nids
,
10947 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10948 .capsrc_nids
= alc883_capsrc_nids
,
10949 .dac_nids
= alc883_dac_nids
,
10950 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10951 .channel_mode
= alc889A_mb31_6ch_modes
,
10952 .num_channel_mode
= ARRAY_SIZE(alc889A_mb31_6ch_modes
),
10953 .input_mux
= &alc889A_mb31_capture_source
,
10954 .dig_out_nid
= ALC883_DIGOUT_NID
,
10955 .unsol_event
= alc889A_mb31_unsol_event
,
10956 .init_hook
= alc889A_mb31_automute
,
10958 [ALC883_SONY_VAIO_TT
] = {
10959 .mixers
= { alc883_vaiott_mixer
},
10960 .init_verbs
= { alc883_init_verbs
, alc883_vaiott_verbs
},
10961 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10962 .dac_nids
= alc883_dac_nids
,
10963 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10964 .channel_mode
= alc883_3ST_2ch_modes
,
10965 .input_mux
= &alc883_capture_source
,
10966 .unsol_event
= alc_sku_unsol_event
,
10967 .setup
= alc883_vaiott_setup
,
10968 .init_hook
= alc_hp_automute
,
10977 PINFIX_ABIT_AW9D_MAX
,
10978 PINFIX_LENOVO_Y530
,
10980 PINFIX_ACER_ASPIRE_7736
,
10983 static const struct alc_fixup alc882_fixups
[] = {
10984 [PINFIX_ABIT_AW9D_MAX
] = {
10985 .type
= ALC_FIXUP_PINS
,
10986 .v
.pins
= (const struct alc_pincfg
[]) {
10987 { 0x15, 0x01080104 }, /* side */
10988 { 0x16, 0x01011012 }, /* rear */
10989 { 0x17, 0x01016011 }, /* clfe */
10993 [PINFIX_LENOVO_Y530
] = {
10994 .type
= ALC_FIXUP_PINS
,
10995 .v
.pins
= (const struct alc_pincfg
[]) {
10996 { 0x15, 0x99130112 }, /* rear int speakers */
10997 { 0x16, 0x99130111 }, /* subwoofer */
11001 [PINFIX_PB_M5210
] = {
11002 .type
= ALC_FIXUP_VERBS
,
11003 .v
.verbs
= (const struct hda_verb
[]) {
11004 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11008 [PINFIX_ACER_ASPIRE_7736
] = {
11009 .type
= ALC_FIXUP_SKU
,
11010 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
11014 static const struct snd_pci_quirk alc882_fixup_tbl
[] = {
11015 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210
),
11016 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530
),
11017 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
11018 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736
),
11023 * BIOS auto configuration
11025 static int alc882_auto_create_input_ctls(struct hda_codec
*codec
,
11026 const struct auto_pin_cfg
*cfg
)
11028 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x23, 0x22);
11031 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
11032 hda_nid_t nid
, int pin_type
,
11037 /* set as output */
11038 alc_set_pin_output(codec
, nid
, pin_type
);
11042 else if (dac
>= 0x02 && dac
<= 0x05)
11046 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
11049 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
11051 struct alc_spec
*spec
= codec
->spec
;
11054 for (i
= 0; i
<= HDA_SIDE
; i
++) {
11055 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
11056 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
11058 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
11059 spec
->multiout
.dac_nids
[i
]);
11063 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
11065 struct alc_spec
*spec
= codec
->spec
;
11066 hda_nid_t pin
, dac
;
11069 if (spec
->autocfg
.line_out_type
!= AUTO_PIN_HP_OUT
) {
11070 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.hp_pins
); i
++) {
11071 pin
= spec
->autocfg
.hp_pins
[i
];
11074 dac
= spec
->multiout
.hp_nid
;
11076 dac
= spec
->multiout
.dac_nids
[0]; /* to front */
11077 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, dac
);
11081 if (spec
->autocfg
.line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
11082 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
11083 pin
= spec
->autocfg
.speaker_pins
[i
];
11086 dac
= spec
->multiout
.extra_out_nid
[0];
11088 dac
= spec
->multiout
.dac_nids
[0]; /* to front */
11089 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, dac
);
11094 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
11096 struct alc_spec
*spec
= codec
->spec
;
11097 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
11100 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
11101 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
11102 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
11103 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
11104 snd_hda_codec_write(codec
, nid
, 0,
11105 AC_VERB_SET_AMP_GAIN_MUTE
,
11110 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
11112 struct alc_spec
*spec
= codec
->spec
;
11115 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
11116 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
11117 hda_nid_t nid
= spec
->capsrc_nids
[c
];
11118 unsigned int mux_idx
;
11119 const struct hda_input_mux
*imux
;
11120 int conns
, mute
, idx
, item
;
11123 snd_hda_codec_write(codec
, spec
->adc_nids
[c
], 0,
11124 AC_VERB_SET_AMP_GAIN_MUTE
,
11127 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
11128 ARRAY_SIZE(conn_list
));
11131 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
11132 imux
= &spec
->input_mux
[mux_idx
];
11133 if (!imux
->num_items
&& mux_idx
> 0)
11134 imux
= &spec
->input_mux
[0];
11135 for (idx
= 0; idx
< conns
; idx
++) {
11136 /* if the current connection is the selected one,
11137 * unmute it as default - otherwise mute it
11139 mute
= AMP_IN_MUTE(idx
);
11140 for (item
= 0; item
< imux
->num_items
; item
++) {
11141 if (imux
->items
[item
].index
== idx
) {
11142 if (spec
->cur_mux
[c
] == item
)
11143 mute
= AMP_IN_UNMUTE(idx
);
11147 /* check if we have a selector or mixer
11148 * we could check for the widget type instead, but
11149 * just check for Amp-In presence (in case of mixer
11150 * without amp-in there is something wrong, this
11151 * function shouldn't be used or capsrc nid is wrong)
11153 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)
11154 snd_hda_codec_write(codec
, nid
, 0,
11155 AC_VERB_SET_AMP_GAIN_MUTE
,
11157 else if (mute
!= AMP_IN_MUTE(idx
))
11158 snd_hda_codec_write(codec
, nid
, 0,
11159 AC_VERB_SET_CONNECT_SEL
,
11165 /* add mic boosts if needed */
11166 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
11168 struct alc_spec
*spec
= codec
->spec
;
11169 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
11173 const char *prev_label
= NULL
;
11175 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
11176 if (cfg
->inputs
[i
].type
> AUTO_PIN_MIC
)
11178 nid
= cfg
->inputs
[i
].pin
;
11179 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
) {
11181 char boost_label
[32];
11183 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
11184 if (prev_label
&& !strcmp(label
, prev_label
))
11188 prev_label
= label
;
11190 snprintf(boost_label
, sizeof(boost_label
),
11191 "%s Boost Volume", label
);
11192 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11193 boost_label
, type_idx
,
11194 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
11202 /* almost identical with ALC880 parser... */
11203 static int alc882_parse_auto_config(struct hda_codec
*codec
)
11205 struct alc_spec
*spec
= codec
->spec
;
11206 static const hda_nid_t alc882_ignore
[] = { 0x1d, 0 };
11209 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11213 if (!spec
->autocfg
.line_outs
)
11214 return 0; /* can't find valid BIOS pin config */
11216 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
11219 err
= alc_auto_add_multi_channel_mode(codec
);
11222 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11225 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
11229 err
= alc880_auto_create_extra_out(spec
,
11230 spec
->autocfg
.speaker_pins
[0],
11234 err
= alc882_auto_create_input_ctls(codec
, &spec
->autocfg
);
11238 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
11240 alc_auto_parse_digital(codec
);
11242 if (spec
->kctls
.list
)
11243 add_mixer(spec
, spec
->kctls
.list
);
11245 add_verb(spec
, alc883_auto_init_verbs
);
11246 /* if ADC 0x07 is available, initialize it, too */
11247 if (get_wcaps_type(get_wcaps(codec
, 0x07)) == AC_WID_AUD_IN
)
11248 add_verb(spec
, alc882_adc1_init_verbs
);
11250 spec
->num_mux_defs
= 1;
11251 spec
->input_mux
= &spec
->private_imux
[0];
11253 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
11255 err
= alc_auto_add_mic_boost(codec
);
11259 return 1; /* config found */
11262 /* additional initialization for auto-configuration model */
11263 static void alc882_auto_init(struct hda_codec
*codec
)
11265 struct alc_spec
*spec
= codec
->spec
;
11266 alc882_auto_init_multi_out(codec
);
11267 alc882_auto_init_hp_out(codec
);
11268 alc882_auto_init_analog_input(codec
);
11269 alc882_auto_init_input_src(codec
);
11270 alc_auto_init_digital(codec
);
11271 if (spec
->unsol_event
)
11272 alc_inithook(codec
);
11275 static int patch_alc882(struct hda_codec
*codec
)
11277 struct alc_spec
*spec
;
11278 int err
, board_config
;
11280 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
11284 codec
->spec
= spec
;
11286 switch (codec
->vendor_id
) {
11291 /* ALC883 and variants */
11292 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
11296 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
11300 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
)
11301 board_config
= snd_hda_check_board_codec_sid_config(codec
,
11302 ALC882_MODEL_LAST
, alc882_models
, alc882_ssid_cfg_tbl
);
11304 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
11305 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
11307 board_config
= ALC882_AUTO
;
11310 if (board_config
== ALC882_AUTO
) {
11311 alc_pick_fixup(codec
, NULL
, alc882_fixup_tbl
, alc882_fixups
);
11312 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
11315 alc_auto_parse_customize_define(codec
);
11317 if (board_config
== ALC882_AUTO
) {
11318 /* automatic parse from the BIOS config */
11319 err
= alc882_parse_auto_config(codec
);
11325 "hda_codec: Cannot set up configuration "
11326 "from BIOS. Using base mode...\n");
11327 board_config
= ALC882_3ST_DIG
;
11331 if (has_cdefine_beep(codec
)) {
11332 err
= snd_hda_attach_beep_device(codec
, 0x1);
11339 if (board_config
!= ALC882_AUTO
)
11340 setup_preset(codec
, &alc882_presets
[board_config
]);
11342 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
11343 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
11344 /* FIXME: setup DAC5 */
11345 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11346 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
11348 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
11349 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
11351 if (!spec
->adc_nids
&& spec
->input_mux
) {
11353 spec
->num_adc_nids
= 0;
11354 for (i
= 0; i
< ARRAY_SIZE(alc882_adc_nids
); i
++) {
11355 const struct hda_input_mux
*imux
= spec
->input_mux
;
11357 hda_nid_t items
[16];
11358 hda_nid_t nid
= alc882_adc_nids
[i
];
11359 unsigned int wcap
= get_wcaps(codec
, nid
);
11361 wcap
= get_wcaps_type(wcap
);
11362 if (wcap
!= AC_WID_AUD_IN
)
11364 spec
->private_adc_nids
[spec
->num_adc_nids
] = nid
;
11365 err
= snd_hda_get_connections(codec
, nid
, &cap
, 1);
11368 err
= snd_hda_get_connections(codec
, cap
, items
,
11369 ARRAY_SIZE(items
));
11372 for (j
= 0; j
< imux
->num_items
; j
++)
11373 if (imux
->items
[j
].index
>= err
)
11375 if (j
< imux
->num_items
)
11377 spec
->private_capsrc_nids
[spec
->num_adc_nids
] = cap
;
11378 spec
->num_adc_nids
++;
11380 spec
->adc_nids
= spec
->private_adc_nids
;
11381 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
11384 set_capture_mixer(codec
);
11386 if (has_cdefine_beep(codec
))
11387 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
11389 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
11391 spec
->vmaster_nid
= 0x0c;
11393 codec
->patch_ops
= alc_patch_ops
;
11394 if (board_config
== ALC882_AUTO
)
11395 spec
->init_hook
= alc882_auto_init
;
11397 alc_init_jacks(codec
);
11398 #ifdef CONFIG_SND_HDA_POWER_SAVE
11399 if (!spec
->loopback
.amplist
)
11400 spec
->loopback
.amplist
= alc882_loopbacks
;
11411 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11412 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11414 #define alc262_dac_nids alc260_dac_nids
11415 #define alc262_adc_nids alc882_adc_nids
11416 #define alc262_adc_nids_alt alc882_adc_nids_alt
11417 #define alc262_capsrc_nids alc882_capsrc_nids
11418 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11420 #define alc262_modes alc260_modes
11421 #define alc262_capture_source alc882_capture_source
11423 static const hda_nid_t alc262_dmic_adc_nids
[1] = {
11428 static const hda_nid_t alc262_dmic_capsrc_nids
[1] = { 0x22 };
11430 static const struct snd_kcontrol_new alc262_base_mixer
[] = {
11431 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11432 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11433 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11434 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11435 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11436 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
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("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11440 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11441 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11442 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11443 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
11444 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11445 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
11446 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
11450 /* update HP, line and mono-out pins according to the master switch */
11451 #define alc262_hp_master_update alc260_hp_master_update
11453 static void alc262_hp_bpc_setup(struct hda_codec
*codec
)
11455 struct alc_spec
*spec
= codec
->spec
;
11457 spec
->autocfg
.hp_pins
[0] = 0x1b;
11458 spec
->autocfg
.speaker_pins
[0] = 0x16;
11459 spec
->automute
= 1;
11460 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11463 static void alc262_hp_wildwest_setup(struct hda_codec
*codec
)
11465 struct alc_spec
*spec
= codec
->spec
;
11467 spec
->autocfg
.hp_pins
[0] = 0x15;
11468 spec
->autocfg
.speaker_pins
[0] = 0x16;
11469 spec
->automute
= 1;
11470 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11473 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11474 #define alc262_hp_master_sw_put alc260_hp_master_sw_put
11476 #define ALC262_HP_MASTER_SWITCH \
11478 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11479 .name = "Master Playback Switch", \
11480 .info = snd_ctl_boolean_mono_info, \
11481 .get = alc262_hp_master_sw_get, \
11482 .put = alc262_hp_master_sw_put, \
11485 .iface = NID_MAPPING, \
11486 .name = "Master Playback Switch", \
11487 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11491 static const struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
11492 ALC262_HP_MASTER_SWITCH
,
11493 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11494 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11495 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11496 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11498 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11500 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11501 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11502 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11503 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11504 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11505 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11506 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11507 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11508 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11509 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11510 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11511 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11515 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
11516 ALC262_HP_MASTER_SWITCH
,
11517 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11518 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11519 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11520 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11521 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11523 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11525 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11526 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11527 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT
),
11528 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11529 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11530 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11531 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11535 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
11536 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11537 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11538 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11542 /* mute/unmute internal speaker according to the hp jack and mute state */
11543 static void alc262_hp_t5735_setup(struct hda_codec
*codec
)
11545 struct alc_spec
*spec
= codec
->spec
;
11547 spec
->autocfg
.hp_pins
[0] = 0x15;
11548 spec
->autocfg
.speaker_pins
[0] = 0x14;
11549 spec
->automute
= 1;
11550 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11553 static const struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
11554 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11555 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11556 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11557 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11558 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11559 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11560 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11564 static const struct hda_verb alc262_hp_t5735_verbs
[] = {
11565 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11566 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11568 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11572 static const struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
11573 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11575 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
11576 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
11577 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11578 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11582 static const struct hda_verb alc262_hp_rp5700_verbs
[] = {
11583 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11584 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11585 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11586 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11587 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11588 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11589 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11590 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11591 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
11592 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
11596 static const struct hda_input_mux alc262_hp_rp5700_capture_source
= {
11603 /* bind hp and internal speaker mute (with plug check) as master switch */
11604 #define alc262_hippo_master_update alc262_hp_master_update
11605 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11606 #define alc262_hippo_master_sw_put alc262_hp_master_sw_put
11608 #define ALC262_HIPPO_MASTER_SWITCH \
11610 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11611 .name = "Master Playback Switch", \
11612 .info = snd_ctl_boolean_mono_info, \
11613 .get = alc262_hippo_master_sw_get, \
11614 .put = alc262_hippo_master_sw_put, \
11617 .iface = NID_MAPPING, \
11618 .name = "Master Playback Switch", \
11619 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11620 (SUBDEV_SPEAKER(0) << 16), \
11623 static const struct snd_kcontrol_new alc262_hippo_mixer
[] = {
11624 ALC262_HIPPO_MASTER_SWITCH
,
11625 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11626 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11627 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11628 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11629 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11630 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11631 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11632 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11633 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11634 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11635 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11636 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11640 static const struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
11641 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11642 ALC262_HIPPO_MASTER_SWITCH
,
11643 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11644 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11645 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11646 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11649 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11650 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11651 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11652 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11656 /* mute/unmute internal speaker according to the hp jack and mute state */
11657 static void alc262_hippo_setup(struct hda_codec
*codec
)
11659 struct alc_spec
*spec
= codec
->spec
;
11661 spec
->autocfg
.hp_pins
[0] = 0x15;
11662 spec
->autocfg
.speaker_pins
[0] = 0x14;
11663 spec
->automute
= 1;
11664 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11667 static void alc262_hippo1_setup(struct hda_codec
*codec
)
11669 struct alc_spec
*spec
= codec
->spec
;
11671 spec
->autocfg
.hp_pins
[0] = 0x1b;
11672 spec
->autocfg
.speaker_pins
[0] = 0x14;
11673 spec
->automute
= 1;
11674 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11678 static const struct snd_kcontrol_new alc262_sony_mixer
[] = {
11679 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11680 ALC262_HIPPO_MASTER_SWITCH
,
11681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11682 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11683 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11684 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11688 static const struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
11689 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11690 ALC262_HIPPO_MASTER_SWITCH
,
11691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11692 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11693 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11694 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11695 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11699 static const struct snd_kcontrol_new alc262_tyan_mixer
[] = {
11700 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11701 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
11702 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11703 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11704 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11705 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11708 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11709 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11710 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11711 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11715 static const struct hda_verb alc262_tyan_verbs
[] = {
11716 /* Headphone automute */
11717 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11718 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11719 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11721 /* P11 AUX_IN, white 4-pin connector */
11722 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11723 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
, 0xe1},
11724 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
, 0x93},
11725 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
, 0x19},
11730 /* unsolicited event for HP jack sensing */
11731 static void alc262_tyan_setup(struct hda_codec
*codec
)
11733 struct alc_spec
*spec
= codec
->spec
;
11735 spec
->autocfg
.hp_pins
[0] = 0x1b;
11736 spec
->autocfg
.speaker_pins
[0] = 0x15;
11737 spec
->automute
= 1;
11738 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11742 #define alc262_capture_mixer alc882_capture_mixer
11743 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11746 * generic initialization of ADC, input mixers and output mixers
11748 static const struct hda_verb alc262_init_verbs
[] = {
11750 * Unmute ADC0-2 and set the default input to mic-in
11752 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11753 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11754 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11755 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11756 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11757 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11759 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11761 * Note: PASD motherboards uses the Line In 2 as the input for
11762 * front panel mic (mic 2)
11764 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11765 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11767 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11768 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11769 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11772 * Set up output mixers (0x0c - 0x0e)
11774 /* set vol=0 to output mixers */
11775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11776 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11777 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11778 /* set up input amps for analog loopback */
11779 /* Amp Indices: DAC = 0, mixer = 1 */
11780 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11781 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11782 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11783 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11784 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11785 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11787 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11789 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11790 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11791 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11792 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11794 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11795 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11796 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11797 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11798 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11800 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11801 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11803 /* FIXME: use matrix-type input source selection */
11804 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11805 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11806 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11807 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11808 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11809 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11811 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11812 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11813 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11814 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11819 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11824 static const struct hda_verb alc262_eapd_verbs
[] = {
11825 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11826 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11830 static const struct hda_verb alc262_hippo1_unsol_verbs
[] = {
11831 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11832 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11833 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11835 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11836 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11840 static const struct hda_verb alc262_sony_unsol_verbs
[] = {
11841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11842 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11843 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
11845 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11846 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11850 static const struct snd_kcontrol_new alc262_toshiba_s06_mixer
[] = {
11851 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11852 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11853 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11855 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11859 static const struct hda_verb alc262_toshiba_s06_verbs
[] = {
11860 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11861 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11862 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11863 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11864 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x09},
11865 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11867 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11871 static void alc262_toshiba_s06_setup(struct hda_codec
*codec
)
11873 struct alc_spec
*spec
= codec
->spec
;
11875 spec
->autocfg
.hp_pins
[0] = 0x15;
11876 spec
->autocfg
.speaker_pins
[0] = 0x14;
11877 spec
->ext_mic
.pin
= 0x18;
11878 spec
->ext_mic
.mux_idx
= 0;
11879 spec
->int_mic
.pin
= 0x12;
11880 spec
->int_mic
.mux_idx
= 9;
11881 spec
->auto_mic
= 1;
11882 spec
->automute
= 1;
11883 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11889 * 0x16 = internal speaker
11890 * 0x18 = external mic
11893 static const struct snd_kcontrol_new alc262_nec_mixer
[] = {
11894 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
11895 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
11897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11898 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11899 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11901 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11902 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11906 static const struct hda_verb alc262_nec_verbs
[] = {
11907 /* Unmute Speaker */
11908 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11911 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11912 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11914 /* External mic to headphone */
11915 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11916 /* External mic to speaker */
11917 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11923 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11924 * 0x1b = port replicator headphone out
11927 #define ALC_HP_EVENT 0x37
11929 static const struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
11930 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11931 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11932 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11933 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11937 static const struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
11938 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11939 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11943 static const struct hda_verb alc262_lenovo_3000_init_verbs
[] = {
11944 /* Front Mic pin: input vref at 50% */
11945 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11950 static const struct hda_input_mux alc262_fujitsu_capture_source
= {
11954 { "Internal Mic", 0x1 },
11959 static const struct hda_input_mux alc262_HP_capture_source
= {
11963 { "Front Mic", 0x1 },
11970 static const struct hda_input_mux alc262_HP_D7000_capture_source
= {
11974 { "Front Mic", 0x2 },
11980 static void alc262_fujitsu_setup(struct hda_codec
*codec
)
11982 struct alc_spec
*spec
= codec
->spec
;
11984 spec
->autocfg
.hp_pins
[0] = 0x14;
11985 spec
->autocfg
.hp_pins
[1] = 0x1b;
11986 spec
->autocfg
.speaker_pins
[0] = 0x15;
11987 spec
->automute
= 1;
11988 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11991 /* bind volumes of both NID 0x0c and 0x0d */
11992 static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
11993 .ops
= &snd_hda_bind_vol
,
11995 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
11996 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
12001 static const struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
12002 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
12004 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12005 .name
= "Master Playback Switch",
12006 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x14,
12007 .info
= snd_ctl_boolean_mono_info
,
12008 .get
= alc262_hp_master_sw_get
,
12009 .put
= alc262_hp_master_sw_put
,
12012 .iface
= NID_MAPPING
,
12013 .name
= "Master Playback Switch",
12014 .private_value
= 0x1b,
12016 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12017 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12018 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12021 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12022 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12023 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12027 static void alc262_lenovo_3000_setup(struct hda_codec
*codec
)
12029 struct alc_spec
*spec
= codec
->spec
;
12031 spec
->autocfg
.hp_pins
[0] = 0x1b;
12032 spec
->autocfg
.speaker_pins
[0] = 0x14;
12033 spec
->autocfg
.speaker_pins
[1] = 0x16;
12034 spec
->automute
= 1;
12035 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
12038 static const struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
12039 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
12041 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12042 .name
= "Master Playback Switch",
12043 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x1b,
12044 .info
= snd_ctl_boolean_mono_info
,
12045 .get
= alc262_hp_master_sw_get
,
12046 .put
= alc262_hp_master_sw_put
,
12048 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12049 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12050 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12052 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12053 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12054 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12055 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12059 static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer
[] = {
12060 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
12061 ALC262_HIPPO_MASTER_SWITCH
,
12062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12063 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12064 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12065 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12066 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12067 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12071 /* additional init verbs for Benq laptops */
12072 static const struct hda_verb alc262_EAPD_verbs
[] = {
12073 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
12074 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
12078 static const struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
12079 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12082 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
12083 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
12087 /* Samsung Q1 Ultra Vista model setup */
12088 static const struct snd_kcontrol_new alc262_ultra_mixer
[] = {
12089 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
12090 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
12091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12092 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12093 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12094 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT
),
12098 static const struct hda_verb alc262_ultra_verbs
[] = {
12100 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12104 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12105 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12106 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12107 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
12109 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12110 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12112 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12113 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12115 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12117 /* ADC, choose mic */
12118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12119 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12120 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12121 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12122 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12123 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12124 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12125 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12126 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
12127 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
12131 /* mute/unmute internal speaker according to the hp jack and mute state */
12132 static void alc262_ultra_automute(struct hda_codec
*codec
)
12134 struct alc_spec
*spec
= codec
->spec
;
12138 /* auto-mute only when HP is used as HP */
12139 if (!spec
->cur_mux
[0]) {
12140 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
12141 if (spec
->jack_present
)
12142 mute
= HDA_AMP_MUTE
;
12144 /* mute/unmute internal speaker */
12145 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
12146 HDA_AMP_MUTE
, mute
);
12147 /* mute/unmute HP */
12148 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
12149 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
12152 /* unsolicited event for HP jack sensing */
12153 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
12156 if ((res
>> 26) != ALC880_HP_EVENT
)
12158 alc262_ultra_automute(codec
);
12161 static const struct hda_input_mux alc262_ultra_capture_source
= {
12165 { "Headphone", 0x7 },
12169 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
12170 struct snd_ctl_elem_value
*ucontrol
)
12172 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
12173 struct alc_spec
*spec
= codec
->spec
;
12176 ret
= alc_mux_enum_put(kcontrol
, ucontrol
);
12179 /* reprogram the HP pin as mic or HP according to the input source */
12180 snd_hda_codec_write_cache(codec
, 0x15, 0,
12181 AC_VERB_SET_PIN_WIDGET_CONTROL
,
12182 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
12183 alc262_ultra_automute(codec
); /* mute/unmute HP */
12187 static const struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
12188 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
12189 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
12191 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12192 .name
= "Capture Source",
12193 .info
= alc_mux_enum_info
,
12194 .get
= alc_mux_enum_get
,
12195 .put
= alc262_ultra_mux_enum_put
,
12198 .iface
= NID_MAPPING
,
12199 .name
= "Capture Source",
12200 .private_value
= 0x15,
12205 /* We use two mixers depending on the output pin; 0x16 is a mono output
12206 * and thus it's bound with a different mixer.
12207 * This function returns which mixer amp should be used.
12209 static int alc262_check_volbit(hda_nid_t nid
)
12213 else if (nid
== 0x16)
12219 static int alc262_add_out_vol_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
12220 const char *pfx
, int *vbits
, int idx
)
12225 vbit
= alc262_check_volbit(nid
);
12228 if (*vbits
& vbit
) /* a volume control for this mixer already there */
12232 val
= HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
);
12234 val
= HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
);
12235 return __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, idx
, val
);
12238 static int alc262_add_out_sw_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
12239 const char *pfx
, int idx
)
12246 val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
12248 val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
12249 return __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
, val
);
12252 /* add playback controls from the parsed DAC table */
12253 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12254 const struct auto_pin_cfg
*cfg
)
12260 spec
->multiout
.num_dacs
= 1; /* only use one dac */
12261 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
12262 spec
->private_dac_nids
[0] = 2;
12264 pfx
= alc_get_line_out_pfx(spec
, true);
12267 for (i
= 0; i
< 2; i
++) {
12268 err
= alc262_add_out_sw_ctl(spec
, cfg
->line_out_pins
[i
], pfx
, i
);
12271 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
12272 err
= alc262_add_out_sw_ctl(spec
, cfg
->speaker_pins
[i
],
12277 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
) {
12278 err
= alc262_add_out_sw_ctl(spec
, cfg
->hp_pins
[i
],
12285 vbits
= alc262_check_volbit(cfg
->line_out_pins
[0]) |
12286 alc262_check_volbit(cfg
->speaker_pins
[0]) |
12287 alc262_check_volbit(cfg
->hp_pins
[0]);
12288 if (vbits
== 1 || vbits
== 2)
12289 pfx
= "Master"; /* only one mixer is used */
12291 for (i
= 0; i
< 2; i
++) {
12292 err
= alc262_add_out_vol_ctl(spec
, cfg
->line_out_pins
[i
], pfx
,
12296 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
12297 err
= alc262_add_out_vol_ctl(spec
, cfg
->speaker_pins
[i
],
12298 "Speaker", &vbits
, i
);
12302 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
) {
12303 err
= alc262_add_out_vol_ctl(spec
, cfg
->hp_pins
[i
],
12304 "Headphone", &vbits
, i
);
12312 #define alc262_auto_create_input_ctls \
12313 alc882_auto_create_input_ctls
12316 * generic initialization of ADC, input mixers and output mixers
12318 static const struct hda_verb alc262_volume_init_verbs
[] = {
12320 * Unmute ADC0-2 and set the default input to mic-in
12322 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12323 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12324 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12325 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12326 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12327 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12329 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12331 * Note: PASD motherboards uses the Line In 2 as the input for
12332 * front panel mic (mic 2)
12334 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12342 * Set up output mixers (0x0c - 0x0f)
12344 /* set vol=0 to output mixers */
12345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12346 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12349 /* set up input amps for analog loopback */
12350 /* Amp Indices: DAC = 0, mixer = 1 */
12351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12358 /* FIXME: use matrix-type input source selection */
12359 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12360 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12361 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12369 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12379 static const struct hda_verb alc262_HP_BPC_init_verbs
[] = {
12381 * Unmute ADC0-2 and set the default input to mic-in
12383 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12385 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12386 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12387 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12388 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12390 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12392 * Note: PASD motherboards uses the Line In 2 as the input for
12393 * front panel mic (mic 2)
12395 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12396 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12405 * Set up output mixers (0x0c - 0x0e)
12407 /* set vol=0 to output mixers */
12408 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12409 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12410 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12412 /* set up input amps for analog loopback */
12413 /* Amp Indices: DAC = 0, mixer = 1 */
12414 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12416 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12417 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12418 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12419 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12421 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12422 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12423 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12425 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12426 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12428 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12429 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12432 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12433 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12434 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12435 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12437 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12438 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12439 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12440 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12441 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12442 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12445 /* FIXME: use matrix-type input source selection */
12446 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12447 /* Input mixer1: only unmute Mic */
12448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12473 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12474 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12475 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12476 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12478 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12483 static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
12485 * Unmute ADC0-2 and set the default input to mic-in
12487 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12489 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12491 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12494 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12496 * Note: PASD motherboards uses the Line In 2 as the input for front
12497 * panel mic (mic 2)
12499 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12500 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
12509 * Set up output mixers (0x0c - 0x0e)
12511 /* set vol=0 to output mixers */
12512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12513 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12514 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12516 /* set up input amps for analog loopback */
12517 /* Amp Indices: DAC = 0, mixer = 1 */
12518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12523 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
12527 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
12528 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
12529 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
12530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
12531 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
12532 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
12534 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12535 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12537 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12538 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12540 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12541 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12542 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12543 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
12544 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12545 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12547 /* FIXME: use matrix-type input source selection */
12548 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12549 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12550 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
12552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
12553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
12554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
12555 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12556 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
12558 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12559 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
12560 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
12561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
12562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
12563 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
12566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
12568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
12569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
12570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
12571 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
12574 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12579 static const struct hda_verb alc262_toshiba_rx1_unsol_verbs
[] = {
12581 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Front Speaker */
12582 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12583 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
12585 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* MIC jack */
12586 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
12587 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
12588 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
12590 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP jack */
12591 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12592 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12603 static const struct alc_fixup alc262_fixups
[] = {
12604 [PINFIX_FSC_H270
] = {
12605 .type
= ALC_FIXUP_PINS
,
12606 .v
.pins
= (const struct alc_pincfg
[]) {
12607 { 0x14, 0x99130110 }, /* speaker */
12608 { 0x15, 0x0221142f }, /* front HP */
12609 { 0x1b, 0x0121141f }, /* rear HP */
12615 static const struct snd_pci_quirk alc262_fixup_tbl
[] = {
12616 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270
),
12621 #ifdef CONFIG_SND_HDA_POWER_SAVE
12622 #define alc262_loopbacks alc880_loopbacks
12625 /* pcm configuration: identical with ALC880 */
12626 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12627 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12628 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12629 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12632 * BIOS auto configuration
12634 static int alc262_parse_auto_config(struct hda_codec
*codec
)
12636 struct alc_spec
*spec
= codec
->spec
;
12638 static const hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
12640 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12644 if (!spec
->autocfg
.line_outs
) {
12645 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
12646 spec
->multiout
.max_channels
= 2;
12647 spec
->no_analog
= 1;
12650 return 0; /* can't find valid BIOS pin config */
12652 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12655 err
= alc262_auto_create_input_ctls(codec
, &spec
->autocfg
);
12659 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12662 alc_auto_parse_digital(codec
);
12664 if (spec
->kctls
.list
)
12665 add_mixer(spec
, spec
->kctls
.list
);
12667 add_verb(spec
, alc262_volume_init_verbs
);
12668 spec
->num_mux_defs
= 1;
12669 spec
->input_mux
= &spec
->private_imux
[0];
12671 err
= alc_auto_add_mic_boost(codec
);
12675 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
12680 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12681 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12682 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12683 #define alc262_auto_init_input_src alc882_auto_init_input_src
12686 /* init callback for auto-configuration model -- overriding the default init */
12687 static void alc262_auto_init(struct hda_codec
*codec
)
12689 struct alc_spec
*spec
= codec
->spec
;
12690 alc262_auto_init_multi_out(codec
);
12691 alc262_auto_init_hp_out(codec
);
12692 alc262_auto_init_analog_input(codec
);
12693 alc262_auto_init_input_src(codec
);
12694 alc_auto_init_digital(codec
);
12695 if (spec
->unsol_event
)
12696 alc_inithook(codec
);
12700 * configuration and preset
12702 static const char * const alc262_models
[ALC262_MODEL_LAST
] = {
12703 [ALC262_BASIC
] = "basic",
12704 [ALC262_HIPPO
] = "hippo",
12705 [ALC262_HIPPO_1
] = "hippo_1",
12706 [ALC262_FUJITSU
] = "fujitsu",
12707 [ALC262_HP_BPC
] = "hp-bpc",
12708 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
12709 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
12710 [ALC262_HP_RP5700
] = "hp-rp5700",
12711 [ALC262_BENQ_ED8
] = "benq",
12712 [ALC262_BENQ_T31
] = "benq-t31",
12713 [ALC262_SONY_ASSAMD
] = "sony-assamd",
12714 [ALC262_TOSHIBA_S06
] = "toshiba-s06",
12715 [ALC262_TOSHIBA_RX1
] = "toshiba-rx1",
12716 [ALC262_ULTRA
] = "ultra",
12717 [ALC262_LENOVO_3000
] = "lenovo-3000",
12718 [ALC262_NEC
] = "nec",
12719 [ALC262_TYAN
] = "tyan",
12720 [ALC262_AUTO
] = "auto",
12723 static const struct snd_pci_quirk alc262_cfg_tbl
[] = {
12724 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
12725 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
12726 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12728 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12730 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12732 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12734 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12735 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12736 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12737 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12738 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12739 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12740 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12741 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12742 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
12743 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
12744 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
12745 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12746 ALC262_HP_TC_T5735
),
12747 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
12748 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12749 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
12750 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12751 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO
), /* dig-only */
12752 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06
),
12753 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO
),
12754 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO
),
12755 #if 0 /* disable the quirk since model=auto works better in recent versions */
12756 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12757 ALC262_SONY_ASSAMD
),
12759 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12760 ALC262_TOSHIBA_RX1
),
12761 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06
),
12762 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
12763 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
12764 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN
),
12765 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12767 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO
),
12768 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
12769 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
12770 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
12771 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
12775 static const struct alc_config_preset alc262_presets
[] = {
12777 .mixers
= { alc262_base_mixer
},
12778 .init_verbs
= { alc262_init_verbs
},
12779 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12780 .dac_nids
= alc262_dac_nids
,
12782 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12783 .channel_mode
= alc262_modes
,
12784 .input_mux
= &alc262_capture_source
,
12787 .mixers
= { alc262_hippo_mixer
},
12788 .init_verbs
= { alc262_init_verbs
, alc_hp15_unsol_verbs
},
12789 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12790 .dac_nids
= alc262_dac_nids
,
12792 .dig_out_nid
= ALC262_DIGOUT_NID
,
12793 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12794 .channel_mode
= alc262_modes
,
12795 .input_mux
= &alc262_capture_source
,
12796 .unsol_event
= alc_sku_unsol_event
,
12797 .setup
= alc262_hippo_setup
,
12798 .init_hook
= alc_inithook
,
12800 [ALC262_HIPPO_1
] = {
12801 .mixers
= { alc262_hippo1_mixer
},
12802 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
12803 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12804 .dac_nids
= alc262_dac_nids
,
12806 .dig_out_nid
= ALC262_DIGOUT_NID
,
12807 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12808 .channel_mode
= alc262_modes
,
12809 .input_mux
= &alc262_capture_source
,
12810 .unsol_event
= alc_sku_unsol_event
,
12811 .setup
= alc262_hippo1_setup
,
12812 .init_hook
= alc_inithook
,
12814 [ALC262_FUJITSU
] = {
12815 .mixers
= { alc262_fujitsu_mixer
},
12816 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12817 alc262_fujitsu_unsol_verbs
},
12818 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12819 .dac_nids
= alc262_dac_nids
,
12821 .dig_out_nid
= ALC262_DIGOUT_NID
,
12822 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12823 .channel_mode
= alc262_modes
,
12824 .input_mux
= &alc262_fujitsu_capture_source
,
12825 .unsol_event
= alc_sku_unsol_event
,
12826 .setup
= alc262_fujitsu_setup
,
12827 .init_hook
= alc_inithook
,
12829 [ALC262_HP_BPC
] = {
12830 .mixers
= { alc262_HP_BPC_mixer
},
12831 .init_verbs
= { alc262_HP_BPC_init_verbs
},
12832 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12833 .dac_nids
= alc262_dac_nids
,
12835 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12836 .channel_mode
= alc262_modes
,
12837 .input_mux
= &alc262_HP_capture_source
,
12838 .unsol_event
= alc_sku_unsol_event
,
12839 .setup
= alc262_hp_bpc_setup
,
12840 .init_hook
= alc_inithook
,
12842 [ALC262_HP_BPC_D7000_WF
] = {
12843 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
12844 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12845 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12846 .dac_nids
= alc262_dac_nids
,
12848 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12849 .channel_mode
= alc262_modes
,
12850 .input_mux
= &alc262_HP_D7000_capture_source
,
12851 .unsol_event
= alc_sku_unsol_event
,
12852 .setup
= alc262_hp_wildwest_setup
,
12853 .init_hook
= alc_inithook
,
12855 [ALC262_HP_BPC_D7000_WL
] = {
12856 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
12857 alc262_HP_BPC_WildWest_option_mixer
},
12858 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12859 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12860 .dac_nids
= alc262_dac_nids
,
12862 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12863 .channel_mode
= alc262_modes
,
12864 .input_mux
= &alc262_HP_D7000_capture_source
,
12865 .unsol_event
= alc_sku_unsol_event
,
12866 .setup
= alc262_hp_wildwest_setup
,
12867 .init_hook
= alc_inithook
,
12869 [ALC262_HP_TC_T5735
] = {
12870 .mixers
= { alc262_hp_t5735_mixer
},
12871 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
12872 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12873 .dac_nids
= alc262_dac_nids
,
12875 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12876 .channel_mode
= alc262_modes
,
12877 .input_mux
= &alc262_capture_source
,
12878 .unsol_event
= alc_sku_unsol_event
,
12879 .setup
= alc262_hp_t5735_setup
,
12880 .init_hook
= alc_inithook
,
12882 [ALC262_HP_RP5700
] = {
12883 .mixers
= { alc262_hp_rp5700_mixer
},
12884 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
12885 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12886 .dac_nids
= alc262_dac_nids
,
12887 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12888 .channel_mode
= alc262_modes
,
12889 .input_mux
= &alc262_hp_rp5700_capture_source
,
12891 [ALC262_BENQ_ED8
] = {
12892 .mixers
= { alc262_base_mixer
},
12893 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
12894 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12895 .dac_nids
= alc262_dac_nids
,
12897 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12898 .channel_mode
= alc262_modes
,
12899 .input_mux
= &alc262_capture_source
,
12901 [ALC262_SONY_ASSAMD
] = {
12902 .mixers
= { alc262_sony_mixer
},
12903 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
12904 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12905 .dac_nids
= alc262_dac_nids
,
12907 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12908 .channel_mode
= alc262_modes
,
12909 .input_mux
= &alc262_capture_source
,
12910 .unsol_event
= alc_sku_unsol_event
,
12911 .setup
= alc262_hippo_setup
,
12912 .init_hook
= alc_inithook
,
12914 [ALC262_BENQ_T31
] = {
12915 .mixers
= { alc262_benq_t31_mixer
},
12916 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
,
12917 alc_hp15_unsol_verbs
},
12918 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12919 .dac_nids
= alc262_dac_nids
,
12921 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12922 .channel_mode
= alc262_modes
,
12923 .input_mux
= &alc262_capture_source
,
12924 .unsol_event
= alc_sku_unsol_event
,
12925 .setup
= alc262_hippo_setup
,
12926 .init_hook
= alc_inithook
,
12929 .mixers
= { alc262_ultra_mixer
},
12930 .cap_mixer
= alc262_ultra_capture_mixer
,
12931 .init_verbs
= { alc262_ultra_verbs
},
12932 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12933 .dac_nids
= alc262_dac_nids
,
12934 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12935 .channel_mode
= alc262_modes
,
12936 .input_mux
= &alc262_ultra_capture_source
,
12937 .adc_nids
= alc262_adc_nids
, /* ADC0 */
12938 .capsrc_nids
= alc262_capsrc_nids
,
12939 .num_adc_nids
= 1, /* single ADC */
12940 .unsol_event
= alc262_ultra_unsol_event
,
12941 .init_hook
= alc262_ultra_automute
,
12943 [ALC262_LENOVO_3000
] = {
12944 .mixers
= { alc262_lenovo_3000_mixer
},
12945 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12946 alc262_lenovo_3000_unsol_verbs
,
12947 alc262_lenovo_3000_init_verbs
},
12948 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12949 .dac_nids
= alc262_dac_nids
,
12951 .dig_out_nid
= ALC262_DIGOUT_NID
,
12952 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12953 .channel_mode
= alc262_modes
,
12954 .input_mux
= &alc262_fujitsu_capture_source
,
12955 .unsol_event
= alc_sku_unsol_event
,
12956 .setup
= alc262_lenovo_3000_setup
,
12957 .init_hook
= alc_inithook
,
12960 .mixers
= { alc262_nec_mixer
},
12961 .init_verbs
= { alc262_nec_verbs
},
12962 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12963 .dac_nids
= alc262_dac_nids
,
12965 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12966 .channel_mode
= alc262_modes
,
12967 .input_mux
= &alc262_capture_source
,
12969 [ALC262_TOSHIBA_S06
] = {
12970 .mixers
= { alc262_toshiba_s06_mixer
},
12971 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_s06_verbs
,
12972 alc262_eapd_verbs
},
12973 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12974 .capsrc_nids
= alc262_dmic_capsrc_nids
,
12975 .dac_nids
= alc262_dac_nids
,
12976 .adc_nids
= alc262_dmic_adc_nids
, /* ADC0 */
12977 .num_adc_nids
= 1, /* single ADC */
12978 .dig_out_nid
= ALC262_DIGOUT_NID
,
12979 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12980 .channel_mode
= alc262_modes
,
12981 .unsol_event
= alc_sku_unsol_event
,
12982 .setup
= alc262_toshiba_s06_setup
,
12983 .init_hook
= alc_inithook
,
12985 [ALC262_TOSHIBA_RX1
] = {
12986 .mixers
= { alc262_toshiba_rx1_mixer
},
12987 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_rx1_unsol_verbs
},
12988 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12989 .dac_nids
= alc262_dac_nids
,
12991 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12992 .channel_mode
= alc262_modes
,
12993 .input_mux
= &alc262_capture_source
,
12994 .unsol_event
= alc_sku_unsol_event
,
12995 .setup
= alc262_hippo_setup
,
12996 .init_hook
= alc_inithook
,
12999 .mixers
= { alc262_tyan_mixer
},
13000 .init_verbs
= { alc262_init_verbs
, alc262_tyan_verbs
},
13001 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
13002 .dac_nids
= alc262_dac_nids
,
13004 .dig_out_nid
= ALC262_DIGOUT_NID
,
13005 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
13006 .channel_mode
= alc262_modes
,
13007 .input_mux
= &alc262_capture_source
,
13008 .unsol_event
= alc_sku_unsol_event
,
13009 .setup
= alc262_tyan_setup
,
13010 .init_hook
= alc_hp_automute
,
13014 static int patch_alc262(struct hda_codec
*codec
)
13016 struct alc_spec
*spec
;
13020 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13024 codec
->spec
= spec
;
13026 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
13031 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
13032 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
13033 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
13034 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
13037 alc_auto_parse_customize_define(codec
);
13039 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
13041 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
13045 if (board_config
< 0) {
13046 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
13048 board_config
= ALC262_AUTO
;
13051 if (board_config
== ALC262_AUTO
) {
13052 alc_pick_fixup(codec
, NULL
, alc262_fixup_tbl
, alc262_fixups
);
13053 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
13056 if (board_config
== ALC262_AUTO
) {
13057 /* automatic parse from the BIOS config */
13058 err
= alc262_parse_auto_config(codec
);
13064 "hda_codec: Cannot set up configuration "
13065 "from BIOS. Using base mode...\n");
13066 board_config
= ALC262_BASIC
;
13070 if (!spec
->no_analog
&& has_cdefine_beep(codec
)) {
13071 err
= snd_hda_attach_beep_device(codec
, 0x1);
13078 if (board_config
!= ALC262_AUTO
)
13079 setup_preset(codec
, &alc262_presets
[board_config
]);
13081 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
13082 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
13084 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
13085 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
13087 if (!spec
->adc_nids
&& spec
->input_mux
) {
13089 /* check whether the digital-mic has to be supported */
13090 for (i
= 0; i
< spec
->input_mux
->num_items
; i
++) {
13091 if (spec
->input_mux
->items
[i
].index
>= 9)
13094 if (i
< spec
->input_mux
->num_items
) {
13095 /* use only ADC0 */
13096 spec
->adc_nids
= alc262_dmic_adc_nids
;
13097 spec
->num_adc_nids
= 1;
13098 spec
->capsrc_nids
= alc262_dmic_capsrc_nids
;
13100 /* all analog inputs */
13101 /* check whether NID 0x07 is valid */
13102 unsigned int wcap
= get_wcaps(codec
, 0x07);
13105 wcap
= get_wcaps_type(wcap
);
13106 if (wcap
!= AC_WID_AUD_IN
) {
13107 spec
->adc_nids
= alc262_adc_nids_alt
;
13108 spec
->num_adc_nids
=
13109 ARRAY_SIZE(alc262_adc_nids_alt
);
13110 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
13112 spec
->adc_nids
= alc262_adc_nids
;
13113 spec
->num_adc_nids
=
13114 ARRAY_SIZE(alc262_adc_nids
);
13115 spec
->capsrc_nids
= alc262_capsrc_nids
;
13119 if (!spec
->cap_mixer
&& !spec
->no_analog
)
13120 set_capture_mixer(codec
);
13121 if (!spec
->no_analog
&& has_cdefine_beep(codec
))
13122 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
13124 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
13126 spec
->vmaster_nid
= 0x0c;
13128 codec
->patch_ops
= alc_patch_ops
;
13129 if (board_config
== ALC262_AUTO
)
13130 spec
->init_hook
= alc262_auto_init
;
13131 spec
->shutup
= alc_eapd_shutup
;
13133 alc_init_jacks(codec
);
13134 #ifdef CONFIG_SND_HDA_POWER_SAVE
13135 if (!spec
->loopback
.amplist
)
13136 spec
->loopback
.amplist
= alc262_loopbacks
;
13143 * ALC268 channel source setting (2 channel)
13145 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13146 #define alc268_modes alc260_modes
13148 static const hda_nid_t alc268_dac_nids
[2] = {
13153 static const hda_nid_t alc268_adc_nids
[2] = {
13158 static const hda_nid_t alc268_adc_nids_alt
[1] = {
13163 static const hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
13165 static const struct snd_kcontrol_new alc268_base_mixer
[] = {
13166 /* output mixer control */
13167 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13168 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13169 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13170 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13171 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13172 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13173 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13177 static const struct snd_kcontrol_new alc268_toshiba_mixer
[] = {
13178 /* output mixer control */
13179 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13180 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13181 ALC262_HIPPO_MASTER_SWITCH
,
13182 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13183 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13184 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13188 /* bind Beep switches of both NID 0x0f and 0x10 */
13189 static const struct hda_bind_ctls alc268_bind_beep_sw
= {
13190 .ops
= &snd_hda_bind_sw
,
13192 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
13193 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
13198 static const struct snd_kcontrol_new alc268_beep_mixer
[] = {
13199 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
13200 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
13204 static const struct hda_verb alc268_eapd_verbs
[] = {
13205 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13206 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13210 /* Toshiba specific */
13211 static const struct hda_verb alc268_toshiba_verbs
[] = {
13212 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13216 /* Acer specific */
13217 /* bind volumes of both NID 0x02 and 0x03 */
13218 static const struct hda_bind_ctls alc268_acer_bind_master_vol
= {
13219 .ops
= &snd_hda_bind_vol
,
13221 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
13222 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
13227 static void alc268_acer_setup(struct hda_codec
*codec
)
13229 struct alc_spec
*spec
= codec
->spec
;
13231 spec
->autocfg
.hp_pins
[0] = 0x14;
13232 spec
->autocfg
.speaker_pins
[0] = 0x15;
13233 spec
->automute
= 1;
13234 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
13237 #define alc268_acer_master_sw_get alc262_hp_master_sw_get
13238 #define alc268_acer_master_sw_put alc262_hp_master_sw_put
13240 static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer
[] = {
13241 /* output mixer control */
13242 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13244 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13245 .name
= "Master Playback Switch",
13246 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x15,
13247 .info
= snd_ctl_boolean_mono_info
,
13248 .get
= alc268_acer_master_sw_get
,
13249 .put
= alc268_acer_master_sw_put
,
13251 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT
),
13255 static const struct snd_kcontrol_new alc268_acer_mixer
[] = {
13256 /* output mixer control */
13257 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13259 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13260 .name
= "Master Playback Switch",
13261 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x14,
13262 .info
= snd_ctl_boolean_mono_info
,
13263 .get
= alc268_acer_master_sw_get
,
13264 .put
= alc268_acer_master_sw_put
,
13266 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13267 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13268 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13272 static const struct snd_kcontrol_new alc268_acer_dmic_mixer
[] = {
13273 /* output mixer control */
13274 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13276 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13277 .name
= "Master Playback Switch",
13278 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x14,
13279 .info
= snd_ctl_boolean_mono_info
,
13280 .get
= alc268_acer_master_sw_get
,
13281 .put
= alc268_acer_master_sw_put
,
13283 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13284 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13288 static const struct hda_verb alc268_acer_aspire_one_verbs
[] = {
13289 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13291 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13292 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13293 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x06},
13294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, 0xa017},
13298 static const struct hda_verb alc268_acer_verbs
[] = {
13299 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
13300 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13301 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13302 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13303 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13305 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13309 /* unsolicited event for HP jack sensing */
13310 #define alc268_toshiba_setup alc262_hippo_setup
13312 static void alc268_acer_lc_setup(struct hda_codec
*codec
)
13314 struct alc_spec
*spec
= codec
->spec
;
13315 spec
->autocfg
.hp_pins
[0] = 0x15;
13316 spec
->autocfg
.speaker_pins
[0] = 0x14;
13317 spec
->automute_mixer_nid
[0] = 0x0f;
13318 spec
->automute
= 1;
13319 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
13320 spec
->ext_mic
.pin
= 0x18;
13321 spec
->ext_mic
.mux_idx
= 0;
13322 spec
->int_mic
.pin
= 0x12;
13323 spec
->int_mic
.mux_idx
= 6;
13324 spec
->auto_mic
= 1;
13327 static const struct snd_kcontrol_new alc268_dell_mixer
[] = {
13328 /* output mixer control */
13329 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13330 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13331 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13332 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13333 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13334 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13338 static const struct hda_verb alc268_dell_verbs
[] = {
13339 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13341 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13342 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
13346 /* mute/unmute internal speaker according to the hp jack and mute state */
13347 static void alc268_dell_setup(struct hda_codec
*codec
)
13349 struct alc_spec
*spec
= codec
->spec
;
13351 spec
->autocfg
.hp_pins
[0] = 0x15;
13352 spec
->autocfg
.speaker_pins
[0] = 0x14;
13353 spec
->ext_mic
.pin
= 0x18;
13354 spec
->ext_mic
.mux_idx
= 0;
13355 spec
->int_mic
.pin
= 0x19;
13356 spec
->int_mic
.mux_idx
= 1;
13357 spec
->auto_mic
= 1;
13358 spec
->automute
= 1;
13359 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
13362 static const struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
13363 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13364 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13365 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13366 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13367 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13368 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
13369 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13370 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13374 static const struct hda_verb alc267_quanta_il1_verbs
[] = {
13375 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13376 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
13380 static void alc267_quanta_il1_setup(struct hda_codec
*codec
)
13382 struct alc_spec
*spec
= codec
->spec
;
13383 spec
->autocfg
.hp_pins
[0] = 0x15;
13384 spec
->autocfg
.speaker_pins
[0] = 0x14;
13385 spec
->ext_mic
.pin
= 0x18;
13386 spec
->ext_mic
.mux_idx
= 0;
13387 spec
->int_mic
.pin
= 0x19;
13388 spec
->int_mic
.mux_idx
= 1;
13389 spec
->auto_mic
= 1;
13390 spec
->automute
= 1;
13391 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
13395 * generic initialization of ADC, input mixers and output mixers
13397 static const struct hda_verb alc268_base_init_verbs
[] = {
13398 /* Unmute DAC0-1 and set vol = 0 */
13399 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13400 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13403 * Set up output mixers (0x0c - 0x0e)
13405 /* set vol=0 to output mixers */
13406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13407 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
13409 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13410 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
13413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
13414 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
13415 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13416 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13417 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13418 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13419 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13421 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13423 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13424 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13425 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13427 /* set PCBEEP vol = 0, mute connections */
13428 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13429 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13430 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13432 /* Unmute Selector 23h,24h and set the default input to mic-in */
13434 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
13435 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13436 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
13437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13443 * generic initialization of ADC, input mixers and output mixers
13445 static const struct hda_verb alc268_volume_init_verbs
[] = {
13446 /* set output DAC */
13447 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13448 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13450 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13451 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13452 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13453 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13454 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13456 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13457 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13458 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13460 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13461 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13463 /* set PCBEEP vol = 0, mute connections */
13464 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13466 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13471 static const struct snd_kcontrol_new alc268_capture_nosrc_mixer
[] = {
13472 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13473 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13477 static const struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
13478 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13479 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13484 static const struct snd_kcontrol_new alc268_capture_mixer
[] = {
13485 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13486 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13487 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
13488 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
13493 static const struct hda_input_mux alc268_capture_source
= {
13497 { "Front Mic", 0x1 },
13503 static const struct hda_input_mux alc268_acer_capture_source
= {
13507 { "Internal Mic", 0x1 },
13512 static const struct hda_input_mux alc268_acer_dmic_capture_source
= {
13516 { "Internal Mic", 0x6 },
13521 #ifdef CONFIG_SND_DEBUG
13522 static const struct snd_kcontrol_new alc268_test_mixer
[] = {
13523 /* Volume widgets */
13524 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13525 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13526 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
13527 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
13528 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
13529 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
13530 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
13531 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
13532 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
13533 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
13534 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
13535 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
13536 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
13537 /* The below appears problematic on some hardwares */
13538 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13539 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13540 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
13541 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
13542 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
13544 /* Modes for retasking pin widgets */
13545 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
13546 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
13547 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
13548 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
13550 /* Controls for GPIO pins, assuming they are configured as outputs */
13551 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13552 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13553 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13554 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13556 /* Switches to allow the digital SPDIF output pin to be enabled.
13557 * The ALC268 does not have an SPDIF input.
13559 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13561 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13562 * this output to turn on an external amplifier.
13564 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13565 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13571 /* create input playback/capture controls for the given pin */
13572 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
13573 const char *ctlname
, int idx
)
13584 case 0x1a: /* ALC259/269 only */
13585 case 0x1b: /* ALC259/269 only */
13586 case 0x21: /* ALC269vb has this pin, too */
13590 snd_printd(KERN_WARNING
"hda_codec: "
13591 "ignoring pin 0x%x as unknown\n", nid
);
13594 if (spec
->multiout
.dac_nids
[0] != dac
&&
13595 spec
->multiout
.dac_nids
[1] != dac
) {
13596 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
13597 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
13601 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
13605 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13606 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
13608 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13609 HDA_COMPOSE_AMP_VAL(nid
, 2, idx
, HDA_OUTPUT
));
13615 /* add playback controls from the parsed DAC table */
13616 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13617 const struct auto_pin_cfg
*cfg
)
13622 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
13624 nid
= cfg
->line_out_pins
[0];
13627 if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
13631 err
= alc268_new_analog_output(spec
, nid
, name
, 0);
13636 nid
= cfg
->speaker_pins
[0];
13638 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, "Speaker",
13639 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
13643 err
= alc268_new_analog_output(spec
, nid
, "Speaker", 0);
13647 nid
= cfg
->hp_pins
[0];
13649 err
= alc268_new_analog_output(spec
, nid
, "Headphone", 0);
13654 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
13656 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, "Mono",
13657 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
));
13664 /* create playback/capture controls for input pins */
13665 static int alc268_auto_create_input_ctls(struct hda_codec
*codec
,
13666 const struct auto_pin_cfg
*cfg
)
13668 return alc_auto_create_input_ctls(codec
, cfg
, 0, 0x23, 0x24);
13671 static void alc268_auto_set_output_and_unmute(struct hda_codec
*codec
,
13672 hda_nid_t nid
, int pin_type
)
13676 alc_set_pin_output(codec
, nid
, pin_type
);
13677 if (nid
== 0x14 || nid
== 0x16)
13681 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
13684 static void alc268_auto_init_multi_out(struct hda_codec
*codec
)
13686 struct alc_spec
*spec
= codec
->spec
;
13689 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
13690 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13691 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13692 alc268_auto_set_output_and_unmute(codec
, nid
, pin_type
);
13696 static void alc268_auto_init_hp_out(struct hda_codec
*codec
)
13698 struct alc_spec
*spec
= codec
->spec
;
13702 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
13703 pin
= spec
->autocfg
.hp_pins
[i
];
13704 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
13706 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
13707 pin
= spec
->autocfg
.speaker_pins
[i
];
13708 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
13710 if (spec
->autocfg
.mono_out_pin
)
13711 snd_hda_codec_write(codec
, spec
->autocfg
.mono_out_pin
, 0,
13712 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13715 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
13717 struct alc_spec
*spec
= codec
->spec
;
13718 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
13719 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
13720 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
13721 unsigned int dac_vol1
, dac_vol2
;
13723 if (line_nid
== 0x1d || speaker_nid
== 0x1d) {
13724 snd_hda_codec_write(codec
, speaker_nid
, 0,
13725 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13726 /* mute mixer inputs from 0x1d */
13727 snd_hda_codec_write(codec
, 0x0f, 0,
13728 AC_VERB_SET_AMP_GAIN_MUTE
,
13730 snd_hda_codec_write(codec
, 0x10, 0,
13731 AC_VERB_SET_AMP_GAIN_MUTE
,
13734 /* unmute mixer inputs from 0x1d */
13735 snd_hda_codec_write(codec
, 0x0f, 0,
13736 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13737 snd_hda_codec_write(codec
, 0x10, 0,
13738 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13741 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
13742 if (line_nid
== 0x14)
13743 dac_vol2
= AMP_OUT_ZERO
;
13744 else if (line_nid
== 0x15)
13745 dac_vol1
= AMP_OUT_ZERO
;
13746 if (hp_nid
== 0x14)
13747 dac_vol2
= AMP_OUT_ZERO
;
13748 else if (hp_nid
== 0x15)
13749 dac_vol1
= AMP_OUT_ZERO
;
13750 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
13751 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
13752 spec
->autocfg
.line_out_pins
[2] != 0x16)
13753 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
13755 snd_hda_codec_write(codec
, 0x02, 0,
13756 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
13757 snd_hda_codec_write(codec
, 0x03, 0,
13758 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
13761 /* pcm configuration: identical with ALC880 */
13762 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13763 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13764 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13765 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13768 * BIOS auto configuration
13770 static int alc268_parse_auto_config(struct hda_codec
*codec
)
13772 struct alc_spec
*spec
= codec
->spec
;
13774 static const hda_nid_t alc268_ignore
[] = { 0 };
13776 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13780 if (!spec
->autocfg
.line_outs
) {
13781 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
13782 spec
->multiout
.max_channels
= 2;
13783 spec
->no_analog
= 1;
13786 return 0; /* can't find valid BIOS pin config */
13788 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13791 err
= alc268_auto_create_input_ctls(codec
, &spec
->autocfg
);
13795 spec
->multiout
.max_channels
= 2;
13798 /* digital only support output */
13799 alc_auto_parse_digital(codec
);
13800 if (spec
->kctls
.list
)
13801 add_mixer(spec
, spec
->kctls
.list
);
13803 if (!spec
->no_analog
&& spec
->autocfg
.speaker_pins
[0] != 0x1d)
13804 add_mixer(spec
, alc268_beep_mixer
);
13806 add_verb(spec
, alc268_volume_init_verbs
);
13807 spec
->num_mux_defs
= 2;
13808 spec
->input_mux
= &spec
->private_imux
[0];
13810 err
= alc_auto_add_mic_boost(codec
);
13814 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
13819 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13820 #define alc268_auto_init_input_src alc882_auto_init_input_src
13822 /* init callback for auto-configuration model -- overriding the default init */
13823 static void alc268_auto_init(struct hda_codec
*codec
)
13825 struct alc_spec
*spec
= codec
->spec
;
13826 alc268_auto_init_multi_out(codec
);
13827 alc268_auto_init_hp_out(codec
);
13828 alc268_auto_init_mono_speaker_out(codec
);
13829 alc268_auto_init_analog_input(codec
);
13830 alc268_auto_init_input_src(codec
);
13831 alc_auto_init_digital(codec
);
13832 if (spec
->unsol_event
)
13833 alc_inithook(codec
);
13837 * configuration and preset
13839 static const char * const alc268_models
[ALC268_MODEL_LAST
] = {
13840 [ALC267_QUANTA_IL1
] = "quanta-il1",
13841 [ALC268_3ST
] = "3stack",
13842 [ALC268_TOSHIBA
] = "toshiba",
13843 [ALC268_ACER
] = "acer",
13844 [ALC268_ACER_DMIC
] = "acer-dmic",
13845 [ALC268_ACER_ASPIRE_ONE
] = "acer-aspire",
13846 [ALC268_DELL
] = "dell",
13847 [ALC268_ZEPTO
] = "zepto",
13848 #ifdef CONFIG_SND_DEBUG
13849 [ALC268_TEST
] = "test",
13851 [ALC268_AUTO
] = "auto",
13854 static const struct snd_pci_quirk alc268_cfg_tbl
[] = {
13855 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
13856 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
13857 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
13858 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
13859 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
13860 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13861 ALC268_ACER_ASPIRE_ONE
),
13862 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
13863 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO
),
13864 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13865 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL
),
13866 /* almost compatible with toshiba but with optional digital outs;
13867 * auto-probing seems working fine
13869 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13871 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
13872 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
13873 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
13874 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
13875 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
13879 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13880 static const struct snd_pci_quirk alc268_ssid_cfg_tbl
[] = {
13881 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO
),
13882 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO
),
13883 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13888 static const struct alc_config_preset alc268_presets
[] = {
13889 [ALC267_QUANTA_IL1
] = {
13890 .mixers
= { alc267_quanta_il1_mixer
, alc268_beep_mixer
,
13891 alc268_capture_nosrc_mixer
},
13892 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13893 alc267_quanta_il1_verbs
},
13894 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13895 .dac_nids
= alc268_dac_nids
,
13896 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13897 .adc_nids
= alc268_adc_nids_alt
,
13899 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13900 .channel_mode
= alc268_modes
,
13901 .unsol_event
= alc_sku_unsol_event
,
13902 .setup
= alc267_quanta_il1_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
},
13909 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13910 .dac_nids
= alc268_dac_nids
,
13911 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13912 .adc_nids
= alc268_adc_nids_alt
,
13913 .capsrc_nids
= alc268_capsrc_nids
,
13915 .dig_out_nid
= ALC268_DIGOUT_NID
,
13916 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13917 .channel_mode
= alc268_modes
,
13918 .input_mux
= &alc268_capture_source
,
13920 [ALC268_TOSHIBA
] = {
13921 .mixers
= { alc268_toshiba_mixer
, alc268_capture_alt_mixer
,
13922 alc268_beep_mixer
},
13923 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13924 alc268_toshiba_verbs
},
13925 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13926 .dac_nids
= alc268_dac_nids
,
13927 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13928 .adc_nids
= alc268_adc_nids_alt
,
13929 .capsrc_nids
= alc268_capsrc_nids
,
13931 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13932 .channel_mode
= alc268_modes
,
13933 .input_mux
= &alc268_capture_source
,
13934 .unsol_event
= alc_sku_unsol_event
,
13935 .setup
= alc268_toshiba_setup
,
13936 .init_hook
= alc_inithook
,
13939 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
13940 alc268_beep_mixer
},
13941 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13942 alc268_acer_verbs
},
13943 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13944 .dac_nids
= alc268_dac_nids
,
13945 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13946 .adc_nids
= alc268_adc_nids_alt
,
13947 .capsrc_nids
= alc268_capsrc_nids
,
13949 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13950 .channel_mode
= alc268_modes
,
13951 .input_mux
= &alc268_acer_capture_source
,
13952 .unsol_event
= alc_sku_unsol_event
,
13953 .setup
= alc268_acer_setup
,
13954 .init_hook
= alc_inithook
,
13956 [ALC268_ACER_DMIC
] = {
13957 .mixers
= { alc268_acer_dmic_mixer
, alc268_capture_alt_mixer
,
13958 alc268_beep_mixer
},
13959 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13960 alc268_acer_verbs
},
13961 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13962 .dac_nids
= alc268_dac_nids
,
13963 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13964 .adc_nids
= alc268_adc_nids_alt
,
13965 .capsrc_nids
= alc268_capsrc_nids
,
13967 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13968 .channel_mode
= alc268_modes
,
13969 .input_mux
= &alc268_acer_dmic_capture_source
,
13970 .unsol_event
= alc_sku_unsol_event
,
13971 .setup
= alc268_acer_setup
,
13972 .init_hook
= alc_inithook
,
13974 [ALC268_ACER_ASPIRE_ONE
] = {
13975 .mixers
= { alc268_acer_aspire_one_mixer
,
13977 alc268_capture_nosrc_mixer
},
13978 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13979 alc268_acer_aspire_one_verbs
},
13980 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13981 .dac_nids
= alc268_dac_nids
,
13982 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13983 .adc_nids
= alc268_adc_nids_alt
,
13984 .capsrc_nids
= alc268_capsrc_nids
,
13986 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13987 .channel_mode
= alc268_modes
,
13988 .unsol_event
= alc_sku_unsol_event
,
13989 .setup
= alc268_acer_lc_setup
,
13990 .init_hook
= alc_inithook
,
13993 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
,
13994 alc268_capture_nosrc_mixer
},
13995 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13996 alc268_dell_verbs
},
13997 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13998 .dac_nids
= alc268_dac_nids
,
13999 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
14000 .adc_nids
= alc268_adc_nids_alt
,
14001 .capsrc_nids
= alc268_capsrc_nids
,
14003 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
14004 .channel_mode
= alc268_modes
,
14005 .unsol_event
= alc_sku_unsol_event
,
14006 .setup
= alc268_dell_setup
,
14007 .init_hook
= alc_inithook
,
14010 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
14011 alc268_beep_mixer
},
14012 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
14013 alc268_toshiba_verbs
},
14014 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
14015 .dac_nids
= alc268_dac_nids
,
14016 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
14017 .adc_nids
= alc268_adc_nids_alt
,
14018 .capsrc_nids
= alc268_capsrc_nids
,
14020 .dig_out_nid
= ALC268_DIGOUT_NID
,
14021 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
14022 .channel_mode
= alc268_modes
,
14023 .input_mux
= &alc268_capture_source
,
14024 .unsol_event
= alc_sku_unsol_event
,
14025 .setup
= alc268_toshiba_setup
,
14026 .init_hook
= alc_inithook
,
14028 #ifdef CONFIG_SND_DEBUG
14030 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
14031 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
14032 alc268_volume_init_verbs
},
14033 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
14034 .dac_nids
= alc268_dac_nids
,
14035 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
14036 .adc_nids
= alc268_adc_nids_alt
,
14037 .capsrc_nids
= alc268_capsrc_nids
,
14039 .dig_out_nid
= ALC268_DIGOUT_NID
,
14040 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
14041 .channel_mode
= alc268_modes
,
14042 .input_mux
= &alc268_capture_source
,
14047 static int patch_alc268(struct hda_codec
*codec
)
14049 struct alc_spec
*spec
;
14051 int i
, has_beep
, err
;
14053 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14057 codec
->spec
= spec
;
14059 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
14063 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
)
14064 board_config
= snd_hda_check_board_codec_sid_config(codec
,
14065 ALC268_MODEL_LAST
, alc268_models
, alc268_ssid_cfg_tbl
);
14067 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
14068 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
14070 board_config
= ALC268_AUTO
;
14073 if (board_config
== ALC268_AUTO
) {
14074 /* automatic parse from the BIOS config */
14075 err
= alc268_parse_auto_config(codec
);
14081 "hda_codec: Cannot set up configuration "
14082 "from BIOS. Using base mode...\n");
14083 board_config
= ALC268_3ST
;
14087 if (board_config
!= ALC268_AUTO
)
14088 setup_preset(codec
, &alc268_presets
[board_config
]);
14090 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
14091 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
14092 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
14094 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
14097 for (i
= 0; i
< spec
->num_mixers
; i
++) {
14098 if (spec
->mixers
[i
] == alc268_beep_mixer
) {
14105 err
= snd_hda_attach_beep_device(codec
, 0x1);
14110 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
14111 /* override the amp caps for beep generator */
14112 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
14113 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
14114 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
14115 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
14116 (0 << AC_AMPCAP_MUTE_SHIFT
));
14119 if (!spec
->no_analog
&& !spec
->adc_nids
&& spec
->input_mux
) {
14120 /* check whether NID 0x07 is valid */
14121 unsigned int wcap
= get_wcaps(codec
, 0x07);
14123 spec
->capsrc_nids
= alc268_capsrc_nids
;
14125 wcap
= get_wcaps_type(wcap
);
14126 if (spec
->auto_mic
||
14127 wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
14128 spec
->adc_nids
= alc268_adc_nids_alt
;
14129 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
14130 if (spec
->auto_mic
)
14131 fixup_automic_adc(codec
);
14132 if (spec
->auto_mic
|| spec
->input_mux
->num_items
== 1)
14133 add_mixer(spec
, alc268_capture_nosrc_mixer
);
14135 add_mixer(spec
, alc268_capture_alt_mixer
);
14137 spec
->adc_nids
= alc268_adc_nids
;
14138 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
14139 add_mixer(spec
, alc268_capture_mixer
);
14143 spec
->vmaster_nid
= 0x02;
14145 codec
->patch_ops
= alc_patch_ops
;
14146 if (board_config
== ALC268_AUTO
)
14147 spec
->init_hook
= alc268_auto_init
;
14148 spec
->shutup
= alc_eapd_shutup
;
14150 alc_init_jacks(codec
);
14156 * ALC269 channel source setting (2 channel)
14158 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14160 #define alc269_dac_nids alc260_dac_nids
14162 static const hda_nid_t alc269_adc_nids
[1] = {
14167 static const hda_nid_t alc269_capsrc_nids
[1] = {
14171 static const hda_nid_t alc269vb_adc_nids
[1] = {
14176 static const hda_nid_t alc269vb_capsrc_nids
[1] = {
14180 static const hda_nid_t alc269_adc_candidates
[] = {
14181 0x08, 0x09, 0x07, 0x11,
14184 #define alc269_modes alc260_modes
14185 #define alc269_capture_source alc880_lg_lw_capture_source
14187 static const struct snd_kcontrol_new alc269_base_mixer
[] = {
14188 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14189 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14190 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14191 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14194 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14195 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14196 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14197 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14199 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
14203 static const struct snd_kcontrol_new alc269_quanta_fl1_mixer
[] = {
14204 /* output mixer control */
14205 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
14207 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14208 .name
= "Master Playback Switch",
14209 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
14210 .info
= snd_hda_mixer_amp_switch_info
,
14211 .get
= snd_hda_mixer_amp_switch_get
,
14212 .put
= alc268_acer_master_sw_put
,
14213 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14217 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14218 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14219 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14220 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14224 static const struct snd_kcontrol_new alc269_lifebook_mixer
[] = {
14225 /* output mixer control */
14226 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
14228 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14229 .name
= "Master Playback Switch",
14230 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
14231 .info
= snd_hda_mixer_amp_switch_info
,
14232 .get
= snd_hda_mixer_amp_switch_get
,
14233 .put
= alc268_acer_master_sw_put
,
14234 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14238 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14239 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14240 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14241 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14242 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT
),
14243 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT
),
14244 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT
),
14248 static const struct snd_kcontrol_new alc269_laptop_mixer
[] = {
14249 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14250 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14251 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14252 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14256 static const struct snd_kcontrol_new alc269vb_laptop_mixer
[] = {
14257 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14258 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
14260 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14264 static const struct snd_kcontrol_new alc269_asus_mixer
[] = {
14265 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14266 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT
),
14270 /* capture mixer elements */
14271 static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer
[] = {
14272 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
14273 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
14274 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14275 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14279 static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer
[] = {
14280 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
14281 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
14282 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14286 static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer
[] = {
14287 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
14288 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
14289 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14290 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14294 static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer
[] = {
14295 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
14296 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
14297 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14302 #define alc269_fujitsu_mixer alc269_laptop_mixer
14304 static const struct hda_verb alc269_quanta_fl1_verbs
[] = {
14305 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14306 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14307 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14308 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14309 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14310 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14314 static const struct hda_verb alc269_lifebook_verbs
[] = {
14315 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14316 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
14317 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14318 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14320 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14321 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14322 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14323 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14324 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14328 /* toggle speaker-output according to the hp-jack state */
14329 static void alc269_quanta_fl1_speaker_automute(struct hda_codec
*codec
)
14331 alc_hp_automute(codec
);
14333 snd_hda_codec_write(codec
, 0x20, 0,
14334 AC_VERB_SET_COEF_INDEX
, 0x0c);
14335 snd_hda_codec_write(codec
, 0x20, 0,
14336 AC_VERB_SET_PROC_COEF
, 0x680);
14338 snd_hda_codec_write(codec
, 0x20, 0,
14339 AC_VERB_SET_COEF_INDEX
, 0x0c);
14340 snd_hda_codec_write(codec
, 0x20, 0,
14341 AC_VERB_SET_PROC_COEF
, 0x480);
14344 #define alc269_lifebook_speaker_automute \
14345 alc269_quanta_fl1_speaker_automute
14347 static void alc269_lifebook_mic_autoswitch(struct hda_codec
*codec
)
14349 unsigned int present_laptop
;
14350 unsigned int present_dock
;
14352 present_laptop
= snd_hda_jack_detect(codec
, 0x18);
14353 present_dock
= snd_hda_jack_detect(codec
, 0x1b);
14355 /* Laptop mic port overrides dock mic port, design decision */
14357 snd_hda_codec_write(codec
, 0x23, 0,
14358 AC_VERB_SET_CONNECT_SEL
, 0x3);
14359 if (present_laptop
)
14360 snd_hda_codec_write(codec
, 0x23, 0,
14361 AC_VERB_SET_CONNECT_SEL
, 0x0);
14362 if (!present_dock
&& !present_laptop
)
14363 snd_hda_codec_write(codec
, 0x23, 0,
14364 AC_VERB_SET_CONNECT_SEL
, 0x1);
14367 static void alc269_quanta_fl1_unsol_event(struct hda_codec
*codec
,
14370 switch (res
>> 26) {
14371 case ALC880_HP_EVENT
:
14372 alc269_quanta_fl1_speaker_automute(codec
);
14374 case ALC880_MIC_EVENT
:
14375 alc_mic_automute(codec
);
14380 static void alc269_lifebook_unsol_event(struct hda_codec
*codec
,
14383 if ((res
>> 26) == ALC880_HP_EVENT
)
14384 alc269_lifebook_speaker_automute(codec
);
14385 if ((res
>> 26) == ALC880_MIC_EVENT
)
14386 alc269_lifebook_mic_autoswitch(codec
);
14389 static void alc269_quanta_fl1_setup(struct hda_codec
*codec
)
14391 struct alc_spec
*spec
= codec
->spec
;
14392 spec
->autocfg
.hp_pins
[0] = 0x15;
14393 spec
->autocfg
.speaker_pins
[0] = 0x14;
14394 spec
->automute_mixer_nid
[0] = 0x0c;
14395 spec
->automute
= 1;
14396 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14397 spec
->ext_mic
.pin
= 0x18;
14398 spec
->ext_mic
.mux_idx
= 0;
14399 spec
->int_mic
.pin
= 0x19;
14400 spec
->int_mic
.mux_idx
= 1;
14401 spec
->auto_mic
= 1;
14404 static void alc269_quanta_fl1_init_hook(struct hda_codec
*codec
)
14406 alc269_quanta_fl1_speaker_automute(codec
);
14407 alc_mic_automute(codec
);
14410 static void alc269_lifebook_setup(struct hda_codec
*codec
)
14412 struct alc_spec
*spec
= codec
->spec
;
14413 spec
->autocfg
.hp_pins
[0] = 0x15;
14414 spec
->autocfg
.hp_pins
[1] = 0x1a;
14415 spec
->autocfg
.speaker_pins
[0] = 0x14;
14416 spec
->automute_mixer_nid
[0] = 0x0c;
14417 spec
->automute
= 1;
14418 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14421 static void alc269_lifebook_init_hook(struct hda_codec
*codec
)
14423 alc269_lifebook_speaker_automute(codec
);
14424 alc269_lifebook_mic_autoswitch(codec
);
14427 static const struct hda_verb alc269_laptop_dmic_init_verbs
[] = {
14428 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14429 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
14430 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14431 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14432 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14433 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14434 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14438 static const struct hda_verb alc269_laptop_amic_init_verbs
[] = {
14439 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14440 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
14441 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
14443 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14444 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14448 static const struct hda_verb alc269vb_laptop_dmic_init_verbs
[] = {
14449 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
14450 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x06},
14451 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14452 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14453 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14454 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14455 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14459 static const struct hda_verb alc269vb_laptop_amic_init_verbs
[] = {
14460 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
14461 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x01},
14462 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14463 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14464 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14465 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14466 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14470 static const struct hda_verb alc271_acer_dmic_verbs
[] = {
14471 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0d},
14472 {0x20, AC_VERB_SET_PROC_COEF
, 0x4000},
14473 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14475 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14476 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14477 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00},
14478 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14479 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14480 {0x22, AC_VERB_SET_CONNECT_SEL
, 6},
14484 static void alc269_laptop_amic_setup(struct hda_codec
*codec
)
14486 struct alc_spec
*spec
= codec
->spec
;
14487 spec
->autocfg
.hp_pins
[0] = 0x15;
14488 spec
->autocfg
.speaker_pins
[0] = 0x14;
14489 spec
->automute_mixer_nid
[0] = 0x0c;
14490 spec
->automute
= 1;
14491 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14492 spec
->ext_mic
.pin
= 0x18;
14493 spec
->ext_mic
.mux_idx
= 0;
14494 spec
->int_mic
.pin
= 0x19;
14495 spec
->int_mic
.mux_idx
= 1;
14496 spec
->auto_mic
= 1;
14499 static void alc269_laptop_dmic_setup(struct hda_codec
*codec
)
14501 struct alc_spec
*spec
= codec
->spec
;
14502 spec
->autocfg
.hp_pins
[0] = 0x15;
14503 spec
->autocfg
.speaker_pins
[0] = 0x14;
14504 spec
->automute_mixer_nid
[0] = 0x0c;
14505 spec
->automute
= 1;
14506 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14507 spec
->ext_mic
.pin
= 0x18;
14508 spec
->ext_mic
.mux_idx
= 0;
14509 spec
->int_mic
.pin
= 0x12;
14510 spec
->int_mic
.mux_idx
= 5;
14511 spec
->auto_mic
= 1;
14514 static void alc269vb_laptop_amic_setup(struct hda_codec
*codec
)
14516 struct alc_spec
*spec
= codec
->spec
;
14517 spec
->autocfg
.hp_pins
[0] = 0x21;
14518 spec
->autocfg
.speaker_pins
[0] = 0x14;
14519 spec
->automute_mixer_nid
[0] = 0x0c;
14520 spec
->automute
= 1;
14521 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14522 spec
->ext_mic
.pin
= 0x18;
14523 spec
->ext_mic
.mux_idx
= 0;
14524 spec
->int_mic
.pin
= 0x19;
14525 spec
->int_mic
.mux_idx
= 1;
14526 spec
->auto_mic
= 1;
14529 static void alc269vb_laptop_dmic_setup(struct hda_codec
*codec
)
14531 struct alc_spec
*spec
= codec
->spec
;
14532 spec
->autocfg
.hp_pins
[0] = 0x21;
14533 spec
->autocfg
.speaker_pins
[0] = 0x14;
14534 spec
->automute_mixer_nid
[0] = 0x0c;
14535 spec
->automute
= 1;
14536 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14537 spec
->ext_mic
.pin
= 0x18;
14538 spec
->ext_mic
.mux_idx
= 0;
14539 spec
->int_mic
.pin
= 0x12;
14540 spec
->int_mic
.mux_idx
= 6;
14541 spec
->auto_mic
= 1;
14545 * generic initialization of ADC, input mixers and output mixers
14547 static const struct hda_verb alc269_init_verbs
[] = {
14549 * Unmute ADC0 and set the default input to mic-in
14551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14554 * Set up output mixers (0x02 - 0x03)
14556 /* set vol=0 to output mixers */
14557 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14558 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14560 /* set up input amps for analog loopback */
14561 /* Amp Indices: DAC = 0, mixer = 1 */
14562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14567 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14569 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14570 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14571 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14572 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14573 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14574 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14575 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14577 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14578 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14580 /* FIXME: use Mux-type input source selection */
14581 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14582 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14583 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
14586 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14590 static const struct hda_verb alc269vb_init_verbs
[] = {
14592 * Unmute ADC0 and set the default input to mic-in
14594 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14597 * Set up output mixers (0x02 - 0x03)
14599 /* set vol=0 to output mixers */
14600 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14601 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14603 /* set up input amps for analog loopback */
14604 /* Amp Indices: DAC = 0, mixer = 1 */
14605 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14606 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14607 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14608 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14609 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14610 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14612 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14613 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14614 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14615 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14616 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14617 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14618 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14620 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14621 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14623 /* FIXME: use Mux-type input source selection */
14624 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14625 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14626 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x00},
14629 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14633 #define alc269_auto_create_multi_out_ctls \
14634 alc268_auto_create_multi_out_ctls
14635 #define alc269_auto_create_input_ctls \
14636 alc268_auto_create_input_ctls
14638 #ifdef CONFIG_SND_HDA_POWER_SAVE
14639 #define alc269_loopbacks alc880_loopbacks
14642 /* pcm configuration: identical with ALC880 */
14643 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14644 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14645 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14646 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14648 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback
= {
14652 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14653 /* NID is set in alc_build_pcms */
14655 .open
= alc880_playback_pcm_open
,
14656 .prepare
= alc880_playback_pcm_prepare
,
14657 .cleanup
= alc880_playback_pcm_cleanup
14661 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture
= {
14665 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14666 /* NID is set in alc_build_pcms */
14669 #ifdef CONFIG_SND_HDA_POWER_SAVE
14670 static int alc269_mic2_for_mute_led(struct hda_codec
*codec
)
14672 switch (codec
->subsystem_id
) {
14679 static int alc269_mic2_mute_check_ps(struct hda_codec
*codec
, hda_nid_t nid
)
14681 /* update mute-LED according to the speaker mute state */
14682 if (nid
== 0x01 || nid
== 0x14) {
14684 if (snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0) &
14689 /* mic2 vref pin is used for mute LED control */
14690 snd_hda_codec_update_cache(codec
, 0x19, 0,
14691 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14694 return alc_check_power_status(codec
, nid
);
14696 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14698 static int alc275_setup_dual_adc(struct hda_codec
*codec
)
14700 struct alc_spec
*spec
= codec
->spec
;
14702 if (codec
->vendor_id
!= 0x10ec0275 || !spec
->auto_mic
)
14704 if ((spec
->ext_mic
.pin
>= 0x18 && spec
->int_mic
.pin
<= 0x13) ||
14705 (spec
->ext_mic
.pin
<= 0x12 && spec
->int_mic
.pin
>= 0x18)) {
14706 if (spec
->ext_mic
.pin
<= 0x12) {
14707 spec
->private_adc_nids
[0] = 0x08;
14708 spec
->private_adc_nids
[1] = 0x11;
14709 spec
->private_capsrc_nids
[0] = 0x23;
14710 spec
->private_capsrc_nids
[1] = 0x22;
14712 spec
->private_adc_nids
[0] = 0x11;
14713 spec
->private_adc_nids
[1] = 0x08;
14714 spec
->private_capsrc_nids
[0] = 0x22;
14715 spec
->private_capsrc_nids
[1] = 0x23;
14717 spec
->adc_nids
= spec
->private_adc_nids
;
14718 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
14719 spec
->num_adc_nids
= 2;
14720 spec
->dual_adc_switch
= 1;
14721 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14722 spec
->adc_nids
[0], spec
->adc_nids
[1]);
14728 /* different alc269-variants */
14730 ALC269_TYPE_NORMAL
,
14731 ALC269_TYPE_ALC258
,
14732 ALC269_TYPE_ALC259
,
14733 ALC269_TYPE_ALC269VB
,
14734 ALC269_TYPE_ALC270
,
14735 ALC269_TYPE_ALC271X
,
14739 * BIOS auto configuration
14741 static int alc269_parse_auto_config(struct hda_codec
*codec
)
14743 struct alc_spec
*spec
= codec
->spec
;
14745 static const hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
14747 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14752 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14755 if (spec
->codec_variant
== ALC269_TYPE_NORMAL
)
14756 err
= alc269_auto_create_input_ctls(codec
, &spec
->autocfg
);
14758 err
= alc_auto_create_input_ctls(codec
, &spec
->autocfg
, 0,
14763 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14765 alc_auto_parse_digital(codec
);
14767 if (spec
->kctls
.list
)
14768 add_mixer(spec
, spec
->kctls
.list
);
14770 if (spec
->codec_variant
!= ALC269_TYPE_NORMAL
) {
14771 add_verb(spec
, alc269vb_init_verbs
);
14772 alc_ssid_check(codec
, 0, 0x1b, 0x14, 0x21);
14774 add_verb(spec
, alc269_init_verbs
);
14775 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
14778 spec
->num_mux_defs
= 1;
14779 spec
->input_mux
= &spec
->private_imux
[0];
14781 if (!alc275_setup_dual_adc(codec
))
14782 fillup_priv_adc_nids(codec
, alc269_adc_candidates
,
14783 sizeof(alc269_adc_candidates
));
14785 err
= alc_auto_add_mic_boost(codec
);
14789 if (!spec
->cap_mixer
&& !spec
->no_analog
)
14790 set_capture_mixer(codec
);
14795 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14796 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14797 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14798 #define alc269_auto_init_input_src alc882_auto_init_input_src
14801 /* init callback for auto-configuration model -- overriding the default init */
14802 static void alc269_auto_init(struct hda_codec
*codec
)
14804 struct alc_spec
*spec
= codec
->spec
;
14805 alc269_auto_init_multi_out(codec
);
14806 alc269_auto_init_hp_out(codec
);
14807 alc269_auto_init_analog_input(codec
);
14808 if (!spec
->dual_adc_switch
)
14809 alc269_auto_init_input_src(codec
);
14810 alc_auto_init_digital(codec
);
14811 if (spec
->unsol_event
)
14812 alc_inithook(codec
);
14815 static void alc269_toggle_power_output(struct hda_codec
*codec
, int power_up
)
14817 int val
= alc_read_coef_idx(codec
, 0x04);
14822 alc_write_coef_idx(codec
, 0x04, val
);
14825 static void alc269_shutup(struct hda_codec
*codec
)
14827 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017)
14828 alc269_toggle_power_output(codec
, 0);
14829 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14830 alc269_toggle_power_output(codec
, 0);
14835 #ifdef SND_HDA_NEEDS_RESUME
14836 static int alc269_resume(struct hda_codec
*codec
)
14838 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14839 alc269_toggle_power_output(codec
, 0);
14843 codec
->patch_ops
.init(codec
);
14845 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017) {
14846 alc269_toggle_power_output(codec
, 1);
14850 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018)
14851 alc269_toggle_power_output(codec
, 1);
14853 snd_hda_codec_resume_amp(codec
);
14854 snd_hda_codec_resume_cache(codec
);
14855 hda_call_check_power_status(codec
, 0x01);
14858 #endif /* SND_HDA_NEEDS_RESUME */
14860 static void alc269_fixup_hweq(struct hda_codec
*codec
,
14861 const struct alc_fixup
*fix
, int action
)
14865 if (action
!= ALC_FIXUP_ACT_INIT
)
14867 coef
= alc_read_coef_idx(codec
, 0x1e);
14868 alc_write_coef_idx(codec
, 0x1e, coef
| 0x80);
14871 static void alc271_fixup_dmic(struct hda_codec
*codec
,
14872 const struct alc_fixup
*fix
, int action
)
14874 static const struct hda_verb verbs
[] = {
14875 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0d},
14876 {0x20, AC_VERB_SET_PROC_COEF
, 0x4000},
14881 if (strcmp(codec
->chip_name
, "ALC271X"))
14883 cfg
= snd_hda_codec_get_pincfg(codec
, 0x12);
14884 if (get_defcfg_connect(cfg
) == AC_JACK_PORT_FIXED
)
14885 snd_hda_sequence_write(codec
, verbs
);
14889 ALC269_FIXUP_SONY_VAIO
,
14890 ALC275_FIXUP_SONY_VAIO_GPIO2
,
14891 ALC269_FIXUP_DELL_M101Z
,
14892 ALC269_FIXUP_SKU_IGNORE
,
14893 ALC269_FIXUP_ASUS_G73JW
,
14894 ALC269_FIXUP_LENOVO_EAPD
,
14895 ALC275_FIXUP_SONY_HWEQ
,
14899 static const struct alc_fixup alc269_fixups
[] = {
14900 [ALC269_FIXUP_SONY_VAIO
] = {
14901 .type
= ALC_FIXUP_VERBS
,
14902 .v
.verbs
= (const struct hda_verb
[]) {
14903 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREFGRD
},
14907 [ALC275_FIXUP_SONY_VAIO_GPIO2
] = {
14908 .type
= ALC_FIXUP_VERBS
,
14909 .v
.verbs
= (const struct hda_verb
[]) {
14910 {0x01, AC_VERB_SET_GPIO_MASK
, 0x04},
14911 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x04},
14912 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
14916 .chain_id
= ALC269_FIXUP_SONY_VAIO
14918 [ALC269_FIXUP_DELL_M101Z
] = {
14919 .type
= ALC_FIXUP_VERBS
,
14920 .v
.verbs
= (const struct hda_verb
[]) {
14921 /* Enables internal speaker */
14922 {0x20, AC_VERB_SET_COEF_INDEX
, 13},
14923 {0x20, AC_VERB_SET_PROC_COEF
, 0x4040},
14927 [ALC269_FIXUP_SKU_IGNORE
] = {
14928 .type
= ALC_FIXUP_SKU
,
14929 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
14931 [ALC269_FIXUP_ASUS_G73JW
] = {
14932 .type
= ALC_FIXUP_PINS
,
14933 .v
.pins
= (const struct alc_pincfg
[]) {
14934 { 0x17, 0x99130111 }, /* subwoofer */
14938 [ALC269_FIXUP_LENOVO_EAPD
] = {
14939 .type
= ALC_FIXUP_VERBS
,
14940 .v
.verbs
= (const struct hda_verb
[]) {
14941 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
14945 [ALC275_FIXUP_SONY_HWEQ
] = {
14946 .type
= ALC_FIXUP_FUNC
,
14947 .v
.func
= alc269_fixup_hweq
,
14949 .chain_id
= ALC275_FIXUP_SONY_VAIO_GPIO2
14951 [ALC271_FIXUP_DMIC
] = {
14952 .type
= ALC_FIXUP_FUNC
,
14953 .v
.func
= alc271_fixup_dmic
,
14957 static const struct snd_pci_quirk alc269_fixup_tbl
[] = {
14958 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2
),
14959 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ
),
14960 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ
),
14961 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO
),
14962 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z
),
14963 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC
),
14964 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE
),
14965 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE
),
14966 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE
),
14967 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE
),
14968 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE
),
14969 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW
),
14970 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD
),
14976 * configuration and preset
14978 static const char * const alc269_models
[ALC269_MODEL_LAST
] = {
14979 [ALC269_BASIC
] = "basic",
14980 [ALC269_QUANTA_FL1
] = "quanta",
14981 [ALC269_AMIC
] = "laptop-amic",
14982 [ALC269_DMIC
] = "laptop-dmic",
14983 [ALC269_FUJITSU
] = "fujitsu",
14984 [ALC269_LIFEBOOK
] = "lifebook",
14985 [ALC269_AUTO
] = "auto",
14988 static const struct snd_pci_quirk alc269_cfg_tbl
[] = {
14989 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1
),
14990 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER
),
14991 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14993 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC
),
14994 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC
),
14995 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC
),
14996 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC
),
14997 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC
),
14998 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC
),
14999 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC
),
15000 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC
),
15001 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC
),
15002 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC
),
15003 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC
),
15004 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC
),
15005 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC
),
15006 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC
),
15007 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC
),
15008 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC
),
15009 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC
),
15010 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC
),
15011 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC
),
15012 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC
),
15013 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC
),
15014 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC
),
15015 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC
),
15016 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC
),
15017 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC
),
15018 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC
),
15019 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC
),
15020 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC
),
15021 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC
),
15022 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC
),
15023 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC
),
15024 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC
),
15025 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC
),
15026 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC
),
15027 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC
),
15028 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC
),
15029 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
15031 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15033 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC
),
15034 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC
),
15035 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO
),
15036 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK
),
15037 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC
),
15038 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU
),
15039 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC
),
15040 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC
),
15041 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC
),
15042 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC
),
15046 static const struct alc_config_preset alc269_presets
[] = {
15048 .mixers
= { alc269_base_mixer
},
15049 .init_verbs
= { alc269_init_verbs
},
15050 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15051 .dac_nids
= alc269_dac_nids
,
15053 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15054 .channel_mode
= alc269_modes
,
15055 .input_mux
= &alc269_capture_source
,
15057 [ALC269_QUANTA_FL1
] = {
15058 .mixers
= { alc269_quanta_fl1_mixer
},
15059 .init_verbs
= { alc269_init_verbs
, alc269_quanta_fl1_verbs
},
15060 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15061 .dac_nids
= alc269_dac_nids
,
15063 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15064 .channel_mode
= alc269_modes
,
15065 .input_mux
= &alc269_capture_source
,
15066 .unsol_event
= alc269_quanta_fl1_unsol_event
,
15067 .setup
= alc269_quanta_fl1_setup
,
15068 .init_hook
= alc269_quanta_fl1_init_hook
,
15071 .mixers
= { alc269_laptop_mixer
},
15072 .cap_mixer
= alc269_laptop_analog_capture_mixer
,
15073 .init_verbs
= { alc269_init_verbs
,
15074 alc269_laptop_amic_init_verbs
},
15075 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15076 .dac_nids
= alc269_dac_nids
,
15078 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15079 .channel_mode
= alc269_modes
,
15080 .unsol_event
= alc_sku_unsol_event
,
15081 .setup
= alc269_laptop_amic_setup
,
15082 .init_hook
= alc_inithook
,
15085 .mixers
= { alc269_laptop_mixer
},
15086 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
15087 .init_verbs
= { alc269_init_verbs
,
15088 alc269_laptop_dmic_init_verbs
},
15089 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15090 .dac_nids
= alc269_dac_nids
,
15092 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15093 .channel_mode
= alc269_modes
,
15094 .unsol_event
= alc_sku_unsol_event
,
15095 .setup
= alc269_laptop_dmic_setup
,
15096 .init_hook
= alc_inithook
,
15098 [ALC269VB_AMIC
] = {
15099 .mixers
= { alc269vb_laptop_mixer
},
15100 .cap_mixer
= alc269vb_laptop_analog_capture_mixer
,
15101 .init_verbs
= { alc269vb_init_verbs
,
15102 alc269vb_laptop_amic_init_verbs
},
15103 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15104 .dac_nids
= alc269_dac_nids
,
15106 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15107 .channel_mode
= alc269_modes
,
15108 .unsol_event
= alc_sku_unsol_event
,
15109 .setup
= alc269vb_laptop_amic_setup
,
15110 .init_hook
= alc_inithook
,
15112 [ALC269VB_DMIC
] = {
15113 .mixers
= { alc269vb_laptop_mixer
},
15114 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
15115 .init_verbs
= { alc269vb_init_verbs
,
15116 alc269vb_laptop_dmic_init_verbs
},
15117 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15118 .dac_nids
= alc269_dac_nids
,
15120 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15121 .channel_mode
= alc269_modes
,
15122 .unsol_event
= alc_sku_unsol_event
,
15123 .setup
= alc269vb_laptop_dmic_setup
,
15124 .init_hook
= alc_inithook
,
15126 [ALC269_FUJITSU
] = {
15127 .mixers
= { alc269_fujitsu_mixer
},
15128 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
15129 .init_verbs
= { alc269_init_verbs
,
15130 alc269_laptop_dmic_init_verbs
},
15131 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15132 .dac_nids
= alc269_dac_nids
,
15134 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15135 .channel_mode
= alc269_modes
,
15136 .unsol_event
= alc_sku_unsol_event
,
15137 .setup
= alc269_laptop_dmic_setup
,
15138 .init_hook
= alc_inithook
,
15140 [ALC269_LIFEBOOK
] = {
15141 .mixers
= { alc269_lifebook_mixer
},
15142 .init_verbs
= { alc269_init_verbs
, alc269_lifebook_verbs
},
15143 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15144 .dac_nids
= alc269_dac_nids
,
15146 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15147 .channel_mode
= alc269_modes
,
15148 .input_mux
= &alc269_capture_source
,
15149 .unsol_event
= alc269_lifebook_unsol_event
,
15150 .setup
= alc269_lifebook_setup
,
15151 .init_hook
= alc269_lifebook_init_hook
,
15154 .mixers
= { alc269_asus_mixer
},
15155 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
15156 .init_verbs
= { alc269_init_verbs
, alc271_acer_dmic_verbs
},
15157 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15158 .dac_nids
= alc269_dac_nids
,
15159 .adc_nids
= alc262_dmic_adc_nids
,
15160 .num_adc_nids
= ARRAY_SIZE(alc262_dmic_adc_nids
),
15161 .capsrc_nids
= alc262_dmic_capsrc_nids
,
15162 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15163 .channel_mode
= alc269_modes
,
15164 .input_mux
= &alc269_capture_source
,
15165 .dig_out_nid
= ALC880_DIGOUT_NID
,
15166 .unsol_event
= alc_sku_unsol_event
,
15167 .setup
= alc269vb_laptop_dmic_setup
,
15168 .init_hook
= alc_inithook
,
15172 static int alc269_fill_coef(struct hda_codec
*codec
)
15176 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) < 0x015) {
15177 alc_write_coef_idx(codec
, 0xf, 0x960b);
15178 alc_write_coef_idx(codec
, 0xe, 0x8817);
15181 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x016) {
15182 alc_write_coef_idx(codec
, 0xf, 0x960b);
15183 alc_write_coef_idx(codec
, 0xe, 0x8814);
15186 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017) {
15187 val
= alc_read_coef_idx(codec
, 0x04);
15188 /* Power up output pin */
15189 alc_write_coef_idx(codec
, 0x04, val
| (1<<11));
15192 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
15193 val
= alc_read_coef_idx(codec
, 0xd);
15194 if ((val
& 0x0c00) >> 10 != 0x1) {
15195 /* Capless ramp up clock control */
15196 alc_write_coef_idx(codec
, 0xd, val
| (1<<10));
15198 val
= alc_read_coef_idx(codec
, 0x17);
15199 if ((val
& 0x01c0) >> 6 != 0x4) {
15200 /* Class D power on reset */
15201 alc_write_coef_idx(codec
, 0x17, val
| (1<<7));
15205 val
= alc_read_coef_idx(codec
, 0xd); /* Class D */
15206 alc_write_coef_idx(codec
, 0xd, val
| (1<<14));
15208 val
= alc_read_coef_idx(codec
, 0x4); /* HP */
15209 alc_write_coef_idx(codec
, 0x4, val
| (1<<11));
15214 static int patch_alc269(struct hda_codec
*codec
)
15216 struct alc_spec
*spec
;
15217 int board_config
, coef
;
15220 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
15224 codec
->spec
= spec
;
15226 alc_auto_parse_customize_define(codec
);
15228 if (codec
->vendor_id
== 0x10ec0269) {
15229 coef
= alc_read_coef_idx(codec
, 0);
15230 if ((coef
& 0x00f0) == 0x0010) {
15231 if (codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
15232 spec
->cdefine
.platform_type
== 1) {
15233 alc_codec_rename(codec
, "ALC271X");
15234 spec
->codec_variant
= ALC269_TYPE_ALC271X
;
15235 } else if ((coef
& 0xf000) == 0x1000) {
15236 spec
->codec_variant
= ALC269_TYPE_ALC270
;
15237 } else if ((coef
& 0xf000) == 0x2000) {
15238 alc_codec_rename(codec
, "ALC259");
15239 spec
->codec_variant
= ALC269_TYPE_ALC259
;
15240 } else if ((coef
& 0xf000) == 0x3000) {
15241 alc_codec_rename(codec
, "ALC258");
15242 spec
->codec_variant
= ALC269_TYPE_ALC258
;
15244 alc_codec_rename(codec
, "ALC269VB");
15245 spec
->codec_variant
= ALC269_TYPE_ALC269VB
;
15248 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
15249 alc269_fill_coef(codec
);
15252 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
15256 if (board_config
< 0) {
15257 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
15259 board_config
= ALC269_AUTO
;
15262 if (board_config
== ALC269_AUTO
) {
15263 alc_pick_fixup(codec
, NULL
, alc269_fixup_tbl
, alc269_fixups
);
15264 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
15267 if (board_config
== ALC269_AUTO
) {
15268 /* automatic parse from the BIOS config */
15269 err
= alc269_parse_auto_config(codec
);
15275 "hda_codec: Cannot set up configuration "
15276 "from BIOS. Using base mode...\n");
15277 board_config
= ALC269_BASIC
;
15281 if (has_cdefine_beep(codec
)) {
15282 err
= snd_hda_attach_beep_device(codec
, 0x1);
15289 if (board_config
!= ALC269_AUTO
)
15290 setup_preset(codec
, &alc269_presets
[board_config
]);
15292 if (board_config
== ALC269_QUANTA_FL1
) {
15293 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15294 * fix the sample rate of analog I/O to 44.1kHz
15296 spec
->stream_analog_playback
= &alc269_44k_pcm_analog_playback
;
15297 spec
->stream_analog_capture
= &alc269_44k_pcm_analog_capture
;
15298 } else if (spec
->dual_adc_switch
) {
15299 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
15300 /* switch ADC dynamically */
15301 spec
->stream_analog_capture
= &dualmic_pcm_analog_capture
;
15303 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
15304 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
15306 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
15307 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
15309 if (!spec
->adc_nids
) { /* wasn't filled automatically? use default */
15310 if (spec
->codec_variant
== ALC269_TYPE_NORMAL
) {
15311 spec
->adc_nids
= alc269_adc_nids
;
15312 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
15313 spec
->capsrc_nids
= alc269_capsrc_nids
;
15315 spec
->adc_nids
= alc269vb_adc_nids
;
15316 spec
->num_adc_nids
= ARRAY_SIZE(alc269vb_adc_nids
);
15317 spec
->capsrc_nids
= alc269vb_capsrc_nids
;
15321 if (!spec
->cap_mixer
)
15322 set_capture_mixer(codec
);
15323 if (has_cdefine_beep(codec
))
15324 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
15326 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
15328 spec
->vmaster_nid
= 0x02;
15330 codec
->patch_ops
= alc_patch_ops
;
15331 #ifdef SND_HDA_NEEDS_RESUME
15332 codec
->patch_ops
.resume
= alc269_resume
;
15334 if (board_config
== ALC269_AUTO
)
15335 spec
->init_hook
= alc269_auto_init
;
15336 spec
->shutup
= alc269_shutup
;
15338 alc_init_jacks(codec
);
15339 #ifdef CONFIG_SND_HDA_POWER_SAVE
15340 if (!spec
->loopback
.amplist
)
15341 spec
->loopback
.amplist
= alc269_loopbacks
;
15342 if (alc269_mic2_for_mute_led(codec
))
15343 codec
->patch_ops
.check_power_status
= alc269_mic2_mute_check_ps
;
15350 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15354 * set the path ways for 2 channel output
15355 * need to set the codec line out and mic 1 pin widgets to inputs
15357 static const struct hda_verb alc861_threestack_ch2_init
[] = {
15358 /* set pin widget 1Ah (line in) for input */
15359 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15360 /* set pin widget 18h (mic1/2) for input, for mic also enable
15363 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15365 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
15367 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15368 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
15374 * need to set the codec line out and mic 1 pin widgets to outputs
15376 static const struct hda_verb alc861_threestack_ch6_init
[] = {
15377 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15378 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15379 /* set pin widget 18h (mic1) for output (CLFE)*/
15380 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15382 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15383 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15385 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
15387 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15388 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
15393 static const struct hda_channel_mode alc861_threestack_modes
[2] = {
15394 { 2, alc861_threestack_ch2_init
},
15395 { 6, alc861_threestack_ch6_init
},
15397 /* Set mic1 as input and unmute the mixer */
15398 static const struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
15399 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15400 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15403 /* Set mic1 as output and mute mixer */
15404 static const struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
15405 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15406 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15410 static const struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
15411 { 2, alc861_uniwill_m31_ch2_init
},
15412 { 4, alc861_uniwill_m31_ch4_init
},
15415 /* Set mic1 and line-in as input and unmute the mixer */
15416 static const struct hda_verb alc861_asus_ch2_init
[] = {
15417 /* set pin widget 1Ah (line in) for input */
15418 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15419 /* set pin widget 18h (mic1/2) for input, for mic also enable
15422 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15424 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
15426 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15427 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
15431 /* Set mic1 nad line-in as output and mute mixer */
15432 static const struct hda_verb alc861_asus_ch6_init
[] = {
15433 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15434 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15435 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15436 /* set pin widget 18h (mic1) for output (CLFE)*/
15437 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15438 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15439 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15440 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15442 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
15444 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15445 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
15450 static const struct hda_channel_mode alc861_asus_modes
[2] = {
15451 { 2, alc861_asus_ch2_init
},
15452 { 6, alc861_asus_ch6_init
},
15457 static const struct snd_kcontrol_new alc861_base_mixer
[] = {
15458 /* output mixer control */
15459 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15460 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15461 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15462 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15463 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
15465 /*Input mixer control */
15466 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15467 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15468 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15469 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15470 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15471 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15473 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15474 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15475 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15480 static const struct snd_kcontrol_new alc861_3ST_mixer
[] = {
15481 /* output mixer control */
15482 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15483 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15484 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15485 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15486 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15488 /* Input mixer control */
15489 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15490 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15491 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15492 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15493 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15494 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15496 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15497 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15498 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15501 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15502 .name
= "Channel Mode",
15503 .info
= alc_ch_mode_info
,
15504 .get
= alc_ch_mode_get
,
15505 .put
= alc_ch_mode_put
,
15506 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
15511 static const struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
15512 /* output mixer control */
15513 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15515 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15520 static const struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
15521 /* output mixer control */
15522 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15523 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15524 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15525 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15526 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15528 /* Input mixer control */
15529 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15530 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15531 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15532 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15533 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15534 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15535 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15536 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15537 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15538 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15541 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15542 .name
= "Channel Mode",
15543 .info
= alc_ch_mode_info
,
15544 .get
= alc_ch_mode_get
,
15545 .put
= alc_ch_mode_put
,
15546 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
15551 static const struct snd_kcontrol_new alc861_asus_mixer
[] = {
15552 /* output mixer control */
15553 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15554 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15555 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15556 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15557 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
15559 /* Input mixer control */
15560 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
15561 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15562 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15563 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15564 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15565 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15567 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15568 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15569 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
15572 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15573 .name
= "Channel Mode",
15574 .info
= alc_ch_mode_info
,
15575 .get
= alc_ch_mode_get
,
15576 .put
= alc_ch_mode_put
,
15577 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
15582 /* additional mixer */
15583 static const struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
15584 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15585 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15590 * generic initialization of ADC, input mixers and output mixers
15592 static const struct hda_verb alc861_base_init_verbs
[] = {
15594 * Unmute ADC0 and set the default input to mic-in
15596 /* port-A for surround (rear panel) */
15597 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15598 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15599 /* port-B for mic-in (rear panel) with vref */
15600 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15601 /* port-C for line-in (rear panel) */
15602 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15603 /* port-D for Front */
15604 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15605 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15606 /* port-E for HP out (front panel) */
15607 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
15608 /* route front PCM to HP */
15609 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15610 /* port-F for mic-in (front panel) with vref */
15611 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15612 /* port-G for CLFE (rear panel) */
15613 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15614 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15615 /* port-H for side (rear panel) */
15616 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15617 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15619 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15620 /* route front mic to ADC1*/
15621 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15622 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15624 /* Unmute DAC0~3 & spdif out*/
15625 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15626 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15627 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15628 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15629 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15631 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15632 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15633 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15634 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15635 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15637 /* Unmute Stereo Mixer 15 */
15638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15643 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15644 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15645 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15646 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15647 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15648 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15649 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15650 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15651 /* hp used DAC 3 (Front) */
15652 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15653 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15658 static const struct hda_verb alc861_threestack_init_verbs
[] = {
15660 * Unmute ADC0 and set the default input to mic-in
15662 /* port-A for surround (rear panel) */
15663 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15664 /* port-B for mic-in (rear panel) with vref */
15665 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15666 /* port-C for line-in (rear panel) */
15667 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15668 /* port-D for Front */
15669 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15670 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15671 /* port-E for HP out (front panel) */
15672 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
15673 /* route front PCM to HP */
15674 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15675 /* port-F for mic-in (front panel) with vref */
15676 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15677 /* port-G for CLFE (rear panel) */
15678 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15679 /* port-H for side (rear panel) */
15680 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15682 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15683 /* route front mic to ADC1*/
15684 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15685 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15686 /* Unmute DAC0~3 & spdif out*/
15687 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15688 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15689 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15690 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15693 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15694 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15695 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15696 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15697 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15699 /* Unmute Stereo Mixer 15 */
15700 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15701 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15702 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15703 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15705 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15706 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15707 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15708 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15709 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15710 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15711 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15712 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15713 /* hp used DAC 3 (Front) */
15714 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15715 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15719 static const struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
15721 * Unmute ADC0 and set the default input to mic-in
15723 /* port-A for surround (rear panel) */
15724 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15725 /* port-B for mic-in (rear panel) with vref */
15726 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15727 /* port-C for line-in (rear panel) */
15728 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15729 /* port-D for Front */
15730 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15731 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15732 /* port-E for HP out (front panel) */
15733 /* this has to be set to VREF80 */
15734 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15735 /* route front PCM to HP */
15736 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15737 /* port-F for mic-in (front panel) with vref */
15738 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15739 /* port-G for CLFE (rear panel) */
15740 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15741 /* port-H for side (rear panel) */
15742 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15744 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15745 /* route front mic to ADC1*/
15746 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15747 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15748 /* Unmute DAC0~3 & spdif out*/
15749 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15750 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15751 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15752 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15753 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15755 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15756 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15757 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15758 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15759 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15761 /* Unmute Stereo Mixer 15 */
15762 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15763 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15764 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15767 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15768 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15769 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15770 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15771 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15772 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15773 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15774 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15775 /* hp used DAC 3 (Front) */
15776 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15781 static const struct hda_verb alc861_asus_init_verbs
[] = {
15783 * Unmute ADC0 and set the default input to mic-in
15785 /* port-A for surround (rear panel)
15786 * according to codec#0 this is the HP jack
15788 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
15789 /* route front PCM to HP */
15790 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
15791 /* port-B for mic-in (rear panel) with vref */
15792 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15793 /* port-C for line-in (rear panel) */
15794 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15795 /* port-D for Front */
15796 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15797 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15798 /* port-E for HP out (front panel) */
15799 /* this has to be set to VREF80 */
15800 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15801 /* route front PCM to HP */
15802 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15803 /* port-F for mic-in (front panel) with vref */
15804 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15805 /* port-G for CLFE (rear panel) */
15806 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15807 /* port-H for side (rear panel) */
15808 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15810 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15811 /* route front mic to ADC1*/
15812 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15813 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15814 /* Unmute DAC0~3 & spdif out*/
15815 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15816 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15817 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15818 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15820 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15821 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15822 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15823 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15824 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15826 /* Unmute Stereo Mixer 15 */
15827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15828 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15829 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15830 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15832 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15833 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15834 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15835 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15836 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15837 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15838 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15839 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15840 /* hp used DAC 3 (Front) */
15841 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15842 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15846 /* additional init verbs for ASUS laptops */
15847 static const struct hda_verb alc861_asus_laptop_init_verbs
[] = {
15848 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
15849 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
15854 * generic initialization of ADC, input mixers and output mixers
15856 static const struct hda_verb alc861_auto_init_verbs
[] = {
15858 * Unmute ADC0 and set the default input to mic-in
15860 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15861 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15863 /* Unmute DAC0~3 & spdif out*/
15864 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15865 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15866 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15867 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15868 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15870 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15871 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15872 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15873 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15874 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15876 /* Unmute Stereo Mixer 15 */
15877 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15878 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
15882 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15883 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15884 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15885 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15886 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15887 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15888 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15889 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15891 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15892 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15894 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15895 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15896 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15897 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15898 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15900 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
15905 static const struct hda_verb alc861_toshiba_init_verbs
[] = {
15906 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15911 /* toggle speaker-output according to the hp-jack state */
15912 static void alc861_toshiba_automute(struct hda_codec
*codec
)
15914 unsigned int present
= snd_hda_jack_detect(codec
, 0x0f);
15916 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
15917 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
15918 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
15919 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
15922 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
15925 if ((res
>> 26) == ALC880_HP_EVENT
)
15926 alc861_toshiba_automute(codec
);
15929 /* pcm configuration: identical with ALC880 */
15930 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15931 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15932 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15933 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15936 #define ALC861_DIGOUT_NID 0x07
15938 static const struct hda_channel_mode alc861_8ch_modes
[1] = {
15942 static const hda_nid_t alc861_dac_nids
[4] = {
15943 /* front, surround, clfe, side */
15944 0x03, 0x06, 0x05, 0x04
15947 static const hda_nid_t alc660_dac_nids
[3] = {
15948 /* front, clfe, surround */
15952 static const hda_nid_t alc861_adc_nids
[1] = {
15957 static const struct hda_input_mux alc861_capture_source
= {
15961 { "Front Mic", 0x3 },
15968 static hda_nid_t
alc861_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
15970 struct alc_spec
*spec
= codec
->spec
;
15971 hda_nid_t mix
, srcs
[5];
15974 if (snd_hda_get_connections(codec
, pin
, &mix
, 1) != 1)
15976 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
15979 for (i
= 0; i
< num
; i
++) {
15981 type
= get_wcaps_type(get_wcaps(codec
, srcs
[i
]));
15982 if (type
!= AC_WID_AUD_OUT
)
15984 for (j
= 0; j
< spec
->multiout
.num_dacs
; j
++)
15985 if (spec
->multiout
.dac_nids
[j
] == srcs
[i
])
15987 if (j
>= spec
->multiout
.num_dacs
)
15993 /* fill in the dac_nids table from the parsed pin configuration */
15994 static int alc861_auto_fill_dac_nids(struct hda_codec
*codec
,
15995 const struct auto_pin_cfg
*cfg
)
15997 struct alc_spec
*spec
= codec
->spec
;
15999 hda_nid_t nid
, dac
;
16001 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
16002 for (i
= 0; i
< cfg
->line_outs
; i
++) {
16003 nid
= cfg
->line_out_pins
[i
];
16004 dac
= alc861_look_for_dac(codec
, nid
);
16007 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
16012 static int __alc861_create_out_sw(struct hda_codec
*codec
, const char *pfx
,
16013 hda_nid_t nid
, int idx
, unsigned int chs
)
16015 return __add_pb_sw_ctrl(codec
->spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
,
16016 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
16019 #define alc861_create_out_sw(codec, pfx, nid, chs) \
16020 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
16022 /* add playback controls from the parsed DAC table */
16023 static int alc861_auto_create_multi_out_ctls(struct hda_codec
*codec
,
16024 const struct auto_pin_cfg
*cfg
)
16026 struct alc_spec
*spec
= codec
->spec
;
16027 static const char * const chname
[4] = {
16028 "Front", "Surround", NULL
/*CLFE*/, "Side"
16030 const char *pfx
= alc_get_line_out_pfx(spec
, true);
16032 int i
, err
, noutputs
;
16034 noutputs
= cfg
->line_outs
;
16035 if (spec
->multi_ios
> 0)
16036 noutputs
+= spec
->multi_ios
;
16038 for (i
= 0; i
< noutputs
; i
++) {
16039 nid
= spec
->multiout
.dac_nids
[i
];
16042 if (!pfx
&& i
== 2) {
16044 err
= alc861_create_out_sw(codec
, "Center", nid
, 1);
16047 err
= alc861_create_out_sw(codec
, "LFE", nid
, 2);
16051 const char *name
= pfx
;
16057 err
= __alc861_create_out_sw(codec
, name
, nid
, index
, 3);
16065 static int alc861_auto_create_hp_ctls(struct hda_codec
*codec
, hda_nid_t pin
)
16067 struct alc_spec
*spec
= codec
->spec
;
16074 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
16075 nid
= alc861_look_for_dac(codec
, pin
);
16077 err
= alc861_create_out_sw(codec
, "Headphone", nid
, 3);
16080 spec
->multiout
.hp_nid
= nid
;
16086 /* create playback/capture controls for input pins */
16087 static int alc861_auto_create_input_ctls(struct hda_codec
*codec
,
16088 const struct auto_pin_cfg
*cfg
)
16090 return alc_auto_create_input_ctls(codec
, cfg
, 0x15, 0x08, 0);
16093 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
16095 int pin_type
, hda_nid_t dac
)
16097 hda_nid_t mix
, srcs
[5];
16100 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
16102 snd_hda_codec_write(codec
, dac
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16104 if (snd_hda_get_connections(codec
, nid
, &mix
, 1) != 1)
16106 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
16109 for (i
= 0; i
< num
; i
++) {
16111 if (srcs
[i
] == dac
|| srcs
[i
] == 0x15)
16112 mute
= AMP_IN_UNMUTE(i
);
16114 mute
= AMP_IN_MUTE(i
);
16115 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16120 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
16122 struct alc_spec
*spec
= codec
->spec
;
16125 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
16126 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
16127 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
16129 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
16130 spec
->multiout
.dac_nids
[i
]);
16134 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
16136 struct alc_spec
*spec
= codec
->spec
;
16138 if (spec
->autocfg
.hp_outs
)
16139 alc861_auto_set_output_and_unmute(codec
,
16140 spec
->autocfg
.hp_pins
[0],
16142 spec
->multiout
.hp_nid
);
16143 if (spec
->autocfg
.speaker_outs
)
16144 alc861_auto_set_output_and_unmute(codec
,
16145 spec
->autocfg
.speaker_pins
[0],
16147 spec
->multiout
.dac_nids
[0]);
16150 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
16152 struct alc_spec
*spec
= codec
->spec
;
16153 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
16156 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
16157 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
16158 if (nid
>= 0x0c && nid
<= 0x11)
16159 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
16163 /* parse the BIOS configuration and set up the alc_spec */
16164 /* return 1 if successful, 0 if the proper config is not found,
16165 * or a negative error code
16167 static int alc861_parse_auto_config(struct hda_codec
*codec
)
16169 struct alc_spec
*spec
= codec
->spec
;
16171 static const hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
16173 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
16177 if (!spec
->autocfg
.line_outs
)
16178 return 0; /* can't find valid BIOS pin config */
16180 err
= alc861_auto_fill_dac_nids(codec
, &spec
->autocfg
);
16183 err
= alc_auto_add_multi_channel_mode(codec
);
16186 err
= alc861_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
16189 err
= alc861_auto_create_hp_ctls(codec
, spec
->autocfg
.hp_pins
[0]);
16192 err
= alc861_auto_create_input_ctls(codec
, &spec
->autocfg
);
16196 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
16198 alc_auto_parse_digital(codec
);
16200 if (spec
->kctls
.list
)
16201 add_mixer(spec
, spec
->kctls
.list
);
16203 add_verb(spec
, alc861_auto_init_verbs
);
16205 spec
->num_mux_defs
= 1;
16206 spec
->input_mux
= &spec
->private_imux
[0];
16208 spec
->adc_nids
= alc861_adc_nids
;
16209 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
16210 set_capture_mixer(codec
);
16212 alc_ssid_check(codec
, 0x0e, 0x0f, 0x0b, 0);
16217 /* additional initialization for auto-configuration model */
16218 static void alc861_auto_init(struct hda_codec
*codec
)
16220 struct alc_spec
*spec
= codec
->spec
;
16221 alc861_auto_init_multi_out(codec
);
16222 alc861_auto_init_hp_out(codec
);
16223 alc861_auto_init_analog_input(codec
);
16224 alc_auto_init_digital(codec
);
16225 if (spec
->unsol_event
)
16226 alc_inithook(codec
);
16229 #ifdef CONFIG_SND_HDA_POWER_SAVE
16230 static const struct hda_amp_list alc861_loopbacks
[] = {
16231 { 0x15, HDA_INPUT
, 0 },
16232 { 0x15, HDA_INPUT
, 1 },
16233 { 0x15, HDA_INPUT
, 2 },
16234 { 0x15, HDA_INPUT
, 3 },
16241 * configuration and preset
16243 static const char * const alc861_models
[ALC861_MODEL_LAST
] = {
16244 [ALC861_3ST
] = "3stack",
16245 [ALC660_3ST
] = "3stack-660",
16246 [ALC861_3ST_DIG
] = "3stack-dig",
16247 [ALC861_6ST_DIG
] = "6stack-dig",
16248 [ALC861_UNIWILL_M31
] = "uniwill-m31",
16249 [ALC861_TOSHIBA
] = "toshiba",
16250 [ALC861_ASUS
] = "asus",
16251 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
16252 [ALC861_AUTO
] = "auto",
16255 static const struct snd_pci_quirk alc861_cfg_tbl
[] = {
16256 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
16257 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
16258 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
16259 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
16260 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
16261 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
16262 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
16263 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16264 * Any other models that need this preset?
16266 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16267 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
16268 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
16269 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
16270 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
16271 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
16272 /* FIXME: the below seems conflict */
16273 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16274 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
16275 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
16279 static const struct alc_config_preset alc861_presets
[] = {
16281 .mixers
= { alc861_3ST_mixer
},
16282 .init_verbs
= { alc861_threestack_init_verbs
},
16283 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16284 .dac_nids
= alc861_dac_nids
,
16285 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16286 .channel_mode
= alc861_threestack_modes
,
16288 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16289 .adc_nids
= alc861_adc_nids
,
16290 .input_mux
= &alc861_capture_source
,
16292 [ALC861_3ST_DIG
] = {
16293 .mixers
= { alc861_base_mixer
},
16294 .init_verbs
= { alc861_threestack_init_verbs
},
16295 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16296 .dac_nids
= alc861_dac_nids
,
16297 .dig_out_nid
= ALC861_DIGOUT_NID
,
16298 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16299 .channel_mode
= alc861_threestack_modes
,
16301 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16302 .adc_nids
= alc861_adc_nids
,
16303 .input_mux
= &alc861_capture_source
,
16305 [ALC861_6ST_DIG
] = {
16306 .mixers
= { alc861_base_mixer
},
16307 .init_verbs
= { alc861_base_init_verbs
},
16308 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16309 .dac_nids
= alc861_dac_nids
,
16310 .dig_out_nid
= ALC861_DIGOUT_NID
,
16311 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
16312 .channel_mode
= alc861_8ch_modes
,
16313 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16314 .adc_nids
= alc861_adc_nids
,
16315 .input_mux
= &alc861_capture_source
,
16318 .mixers
= { alc861_3ST_mixer
},
16319 .init_verbs
= { alc861_threestack_init_verbs
},
16320 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
16321 .dac_nids
= alc660_dac_nids
,
16322 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16323 .channel_mode
= alc861_threestack_modes
,
16325 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16326 .adc_nids
= alc861_adc_nids
,
16327 .input_mux
= &alc861_capture_source
,
16329 [ALC861_UNIWILL_M31
] = {
16330 .mixers
= { alc861_uniwill_m31_mixer
},
16331 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
16332 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16333 .dac_nids
= alc861_dac_nids
,
16334 .dig_out_nid
= ALC861_DIGOUT_NID
,
16335 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
16336 .channel_mode
= alc861_uniwill_m31_modes
,
16338 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16339 .adc_nids
= alc861_adc_nids
,
16340 .input_mux
= &alc861_capture_source
,
16342 [ALC861_TOSHIBA
] = {
16343 .mixers
= { alc861_toshiba_mixer
},
16344 .init_verbs
= { alc861_base_init_verbs
,
16345 alc861_toshiba_init_verbs
},
16346 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16347 .dac_nids
= alc861_dac_nids
,
16348 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
16349 .channel_mode
= alc883_3ST_2ch_modes
,
16350 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16351 .adc_nids
= alc861_adc_nids
,
16352 .input_mux
= &alc861_capture_source
,
16353 .unsol_event
= alc861_toshiba_unsol_event
,
16354 .init_hook
= alc861_toshiba_automute
,
16357 .mixers
= { alc861_asus_mixer
},
16358 .init_verbs
= { alc861_asus_init_verbs
},
16359 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16360 .dac_nids
= alc861_dac_nids
,
16361 .dig_out_nid
= ALC861_DIGOUT_NID
,
16362 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
16363 .channel_mode
= alc861_asus_modes
,
16366 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16367 .adc_nids
= alc861_adc_nids
,
16368 .input_mux
= &alc861_capture_source
,
16370 [ALC861_ASUS_LAPTOP
] = {
16371 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
16372 .init_verbs
= { alc861_asus_init_verbs
,
16373 alc861_asus_laptop_init_verbs
},
16374 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16375 .dac_nids
= alc861_dac_nids
,
16376 .dig_out_nid
= ALC861_DIGOUT_NID
,
16377 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
16378 .channel_mode
= alc883_3ST_2ch_modes
,
16380 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16381 .adc_nids
= alc861_adc_nids
,
16382 .input_mux
= &alc861_capture_source
,
16386 /* Pin config fixes */
16388 PINFIX_FSC_AMILO_PI1505
,
16391 static const struct alc_fixup alc861_fixups
[] = {
16392 [PINFIX_FSC_AMILO_PI1505
] = {
16393 .type
= ALC_FIXUP_PINS
,
16394 .v
.pins
= (const struct alc_pincfg
[]) {
16395 { 0x0b, 0x0221101f }, /* HP */
16396 { 0x0f, 0x90170310 }, /* speaker */
16402 static const struct snd_pci_quirk alc861_fixup_tbl
[] = {
16403 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505
),
16407 static int patch_alc861(struct hda_codec
*codec
)
16409 struct alc_spec
*spec
;
16413 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
16417 codec
->spec
= spec
;
16419 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
16423 if (board_config
< 0) {
16424 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
16426 board_config
= ALC861_AUTO
;
16429 if (board_config
== ALC861_AUTO
) {
16430 alc_pick_fixup(codec
, NULL
, alc861_fixup_tbl
, alc861_fixups
);
16431 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
16434 if (board_config
== ALC861_AUTO
) {
16435 /* automatic parse from the BIOS config */
16436 err
= alc861_parse_auto_config(codec
);
16442 "hda_codec: Cannot set up configuration "
16443 "from BIOS. Using base mode...\n");
16444 board_config
= ALC861_3ST_DIG
;
16448 err
= snd_hda_attach_beep_device(codec
, 0x23);
16454 if (board_config
!= ALC861_AUTO
)
16455 setup_preset(codec
, &alc861_presets
[board_config
]);
16457 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
16458 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
16460 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
16461 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
16463 if (!spec
->cap_mixer
)
16464 set_capture_mixer(codec
);
16465 set_beep_amp(spec
, 0x23, 0, HDA_OUTPUT
);
16467 spec
->vmaster_nid
= 0x03;
16469 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
16471 codec
->patch_ops
= alc_patch_ops
;
16472 if (board_config
== ALC861_AUTO
) {
16473 spec
->init_hook
= alc861_auto_init
;
16474 #ifdef CONFIG_SND_HDA_POWER_SAVE
16475 spec
->power_hook
= alc_power_eapd
;
16478 #ifdef CONFIG_SND_HDA_POWER_SAVE
16479 if (!spec
->loopback
.amplist
)
16480 spec
->loopback
.amplist
= alc861_loopbacks
;
16487 * ALC861-VD support
16491 * In addition, an independent DAC
16493 #define ALC861VD_DIGOUT_NID 0x06
16495 static const hda_nid_t alc861vd_dac_nids
[4] = {
16496 /* front, surr, clfe, side surr */
16497 0x02, 0x03, 0x04, 0x05
16500 /* dac_nids for ALC660vd are in a different order - according to
16501 * Realtek's driver.
16502 * This should probably result in a different mixer for 6stack models
16503 * of ALC660vd codecs, but for now there is only 3stack mixer
16504 * - and it is the same as in 861vd.
16505 * adc_nids in ALC660vd are (is) the same as in 861vd
16507 static const hda_nid_t alc660vd_dac_nids
[3] = {
16508 /* front, rear, clfe, rear_surr */
16512 static const hda_nid_t alc861vd_adc_nids
[1] = {
16517 static const hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
16520 /* FIXME: should be a matrix-type input source selection */
16521 static const struct hda_input_mux alc861vd_capture_source
= {
16525 { "Front Mic", 0x1 },
16531 static const struct hda_input_mux alc861vd_dallas_capture_source
= {
16535 { "Internal Mic", 0x1 },
16539 static const struct hda_input_mux alc861vd_hp_capture_source
= {
16542 { "Front Mic", 0x0 },
16543 { "ATAPI Mic", 0x1 },
16550 static const struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
16557 static const struct hda_verb alc861vd_6stack_ch6_init
[] = {
16558 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
16559 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16560 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16561 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16568 static const struct hda_verb alc861vd_6stack_ch8_init
[] = {
16569 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16570 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16571 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16572 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16576 static const struct hda_channel_mode alc861vd_6stack_modes
[2] = {
16577 { 6, alc861vd_6stack_ch6_init
},
16578 { 8, alc861vd_6stack_ch8_init
},
16581 static const struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
16583 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
16584 .name
= "Channel Mode",
16585 .info
= alc_ch_mode_info
,
16586 .get
= alc_ch_mode_get
,
16587 .put
= alc_ch_mode_put
,
16592 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16593 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16595 static const struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
16596 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16597 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16599 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16600 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
16602 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16604 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16606 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
16607 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
16609 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
16610 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
16612 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16614 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16615 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16618 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16619 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16620 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16622 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16623 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16625 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16626 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16631 static const struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
16632 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16633 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16637 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16641 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16642 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16643 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16645 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16646 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16648 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16649 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16654 static const struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
16655 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16656 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16657 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
16659 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16661 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16662 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16663 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16665 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16666 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16667 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16669 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16670 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16675 /* Pin assignment: Speaker=0x14, HP = 0x15,
16676 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16678 static const struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
16679 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16680 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
16681 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16682 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
16683 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16684 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16685 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16686 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16687 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16688 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16692 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16693 * Front Mic=0x18, ATAPI Mic = 0x19,
16695 static const struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
16696 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16697 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16698 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16699 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
16700 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16701 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16702 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16703 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16709 * generic initialization of ADC, input mixers and output mixers
16711 static const struct hda_verb alc861vd_volume_init_verbs
[] = {
16713 * Unmute ADC0 and set the default input to mic-in
16715 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16716 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16718 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16719 * the analog-loopback mixer widget
16721 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16722 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16728 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16729 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16730 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16731 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
16732 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
16735 * Set up output mixers (0x02 - 0x05)
16737 /* set vol=0 to output mixers */
16738 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16739 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16740 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16741 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16743 /* set up input amps for analog loopback */
16744 /* Amp Indices: DAC = 0, mixer = 1 */
16745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16748 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16749 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16750 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16751 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16752 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16758 * 3-stack pin configuration:
16759 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16761 static const struct hda_verb alc861vd_3stack_init_verbs
[] = {
16763 * Set pin mode and muting
16765 /* set front pin widgets 0x14 for output */
16766 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16768 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
16770 /* Mic (rear) pin: input vref at 80% */
16771 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16772 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16773 /* Front Mic pin: input vref at 80% */
16774 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16775 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16776 /* Line In pin: input */
16777 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16778 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16779 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16780 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16781 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16782 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16783 /* CD pin widget for input */
16784 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16790 * 6-stack pin configuration:
16792 static const struct hda_verb alc861vd_6stack_init_verbs
[] = {
16794 * Set pin mode and muting
16796 /* set front pin widgets 0x14 for output */
16797 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16798 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16799 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
16801 /* Rear Pin: output 1 (0x0d) */
16802 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16803 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16804 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
16805 /* CLFE Pin: output 2 (0x0e) */
16806 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16807 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16808 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
16809 /* Side Pin: output 3 (0x0f) */
16810 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16811 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16812 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
16814 /* Mic (rear) pin: input vref at 80% */
16815 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16816 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16817 /* Front Mic pin: input vref at 80% */
16818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16820 /* Line In pin: input */
16821 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16822 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16823 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16825 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16826 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16827 /* CD pin widget for input */
16828 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16833 static const struct hda_verb alc861vd_eapd_verbs
[] = {
16834 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16838 static const struct hda_verb alc660vd_eapd_verbs
[] = {
16839 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16840 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16844 static const struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
16845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16847 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
16848 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16849 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16853 static void alc861vd_lenovo_setup(struct hda_codec
*codec
)
16855 struct alc_spec
*spec
= codec
->spec
;
16856 spec
->autocfg
.hp_pins
[0] = 0x1b;
16857 spec
->autocfg
.speaker_pins
[0] = 0x14;
16858 spec
->automute
= 1;
16859 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
16862 static void alc861vd_lenovo_init_hook(struct hda_codec
*codec
)
16864 alc_hp_automute(codec
);
16865 alc88x_simple_mic_automute(codec
);
16868 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
16871 switch (res
>> 26) {
16872 case ALC880_MIC_EVENT
:
16873 alc88x_simple_mic_automute(codec
);
16876 alc_sku_unsol_event(codec
, res
);
16881 static const struct hda_verb alc861vd_dallas_verbs
[] = {
16882 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16883 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16884 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16885 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16891 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16893 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16894 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16896 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16897 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16898 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16899 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16900 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16901 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16902 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16903 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16905 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16906 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16907 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16908 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16909 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16910 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16911 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16912 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16915 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16916 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16919 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16920 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16921 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16926 /* toggle speaker-output according to the hp-jack state */
16927 static void alc861vd_dallas_setup(struct hda_codec
*codec
)
16929 struct alc_spec
*spec
= codec
->spec
;
16931 spec
->autocfg
.hp_pins
[0] = 0x15;
16932 spec
->autocfg
.speaker_pins
[0] = 0x14;
16933 spec
->automute
= 1;
16934 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
16937 #ifdef CONFIG_SND_HDA_POWER_SAVE
16938 #define alc861vd_loopbacks alc880_loopbacks
16941 /* pcm configuration: identical with ALC880 */
16942 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16943 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16944 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16945 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16948 * configuration and preset
16950 static const char * const alc861vd_models
[ALC861VD_MODEL_LAST
] = {
16951 [ALC660VD_3ST
] = "3stack-660",
16952 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
16953 [ALC660VD_ASUS_V1S
] = "asus-v1s",
16954 [ALC861VD_3ST
] = "3stack",
16955 [ALC861VD_3ST_DIG
] = "3stack-digout",
16956 [ALC861VD_6ST_DIG
] = "6stack-digout",
16957 [ALC861VD_LENOVO
] = "lenovo",
16958 [ALC861VD_DALLAS
] = "dallas",
16959 [ALC861VD_HP
] = "hp",
16960 [ALC861VD_AUTO
] = "auto",
16963 static const struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
16964 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
16965 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
16966 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
16967 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16968 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S
),
16969 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
16970 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
16971 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
16972 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16973 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO
),
16974 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
16975 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
16976 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
16977 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO
),
16978 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
16982 static const struct alc_config_preset alc861vd_presets
[] = {
16984 .mixers
= { alc861vd_3st_mixer
},
16985 .init_verbs
= { alc861vd_volume_init_verbs
,
16986 alc861vd_3stack_init_verbs
},
16987 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16988 .dac_nids
= alc660vd_dac_nids
,
16989 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16990 .channel_mode
= alc861vd_3stack_2ch_modes
,
16991 .input_mux
= &alc861vd_capture_source
,
16993 [ALC660VD_3ST_DIG
] = {
16994 .mixers
= { alc861vd_3st_mixer
},
16995 .init_verbs
= { alc861vd_volume_init_verbs
,
16996 alc861vd_3stack_init_verbs
},
16997 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16998 .dac_nids
= alc660vd_dac_nids
,
16999 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17000 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17001 .channel_mode
= alc861vd_3stack_2ch_modes
,
17002 .input_mux
= &alc861vd_capture_source
,
17005 .mixers
= { alc861vd_3st_mixer
},
17006 .init_verbs
= { alc861vd_volume_init_verbs
,
17007 alc861vd_3stack_init_verbs
},
17008 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17009 .dac_nids
= alc861vd_dac_nids
,
17010 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17011 .channel_mode
= alc861vd_3stack_2ch_modes
,
17012 .input_mux
= &alc861vd_capture_source
,
17014 [ALC861VD_3ST_DIG
] = {
17015 .mixers
= { alc861vd_3st_mixer
},
17016 .init_verbs
= { alc861vd_volume_init_verbs
,
17017 alc861vd_3stack_init_verbs
},
17018 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17019 .dac_nids
= alc861vd_dac_nids
,
17020 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17021 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17022 .channel_mode
= alc861vd_3stack_2ch_modes
,
17023 .input_mux
= &alc861vd_capture_source
,
17025 [ALC861VD_6ST_DIG
] = {
17026 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
17027 .init_verbs
= { alc861vd_volume_init_verbs
,
17028 alc861vd_6stack_init_verbs
},
17029 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17030 .dac_nids
= alc861vd_dac_nids
,
17031 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17032 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
17033 .channel_mode
= alc861vd_6stack_modes
,
17034 .input_mux
= &alc861vd_capture_source
,
17036 [ALC861VD_LENOVO
] = {
17037 .mixers
= { alc861vd_lenovo_mixer
},
17038 .init_verbs
= { alc861vd_volume_init_verbs
,
17039 alc861vd_3stack_init_verbs
,
17040 alc861vd_eapd_verbs
,
17041 alc861vd_lenovo_unsol_verbs
},
17042 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
17043 .dac_nids
= alc660vd_dac_nids
,
17044 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17045 .channel_mode
= alc861vd_3stack_2ch_modes
,
17046 .input_mux
= &alc861vd_capture_source
,
17047 .unsol_event
= alc861vd_lenovo_unsol_event
,
17048 .setup
= alc861vd_lenovo_setup
,
17049 .init_hook
= alc861vd_lenovo_init_hook
,
17051 [ALC861VD_DALLAS
] = {
17052 .mixers
= { alc861vd_dallas_mixer
},
17053 .init_verbs
= { alc861vd_dallas_verbs
},
17054 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17055 .dac_nids
= alc861vd_dac_nids
,
17056 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17057 .channel_mode
= alc861vd_3stack_2ch_modes
,
17058 .input_mux
= &alc861vd_dallas_capture_source
,
17059 .unsol_event
= alc_sku_unsol_event
,
17060 .setup
= alc861vd_dallas_setup
,
17061 .init_hook
= alc_hp_automute
,
17064 .mixers
= { alc861vd_hp_mixer
},
17065 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
17066 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17067 .dac_nids
= alc861vd_dac_nids
,
17068 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17069 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17070 .channel_mode
= alc861vd_3stack_2ch_modes
,
17071 .input_mux
= &alc861vd_hp_capture_source
,
17072 .unsol_event
= alc_sku_unsol_event
,
17073 .setup
= alc861vd_dallas_setup
,
17074 .init_hook
= alc_hp_automute
,
17076 [ALC660VD_ASUS_V1S
] = {
17077 .mixers
= { alc861vd_lenovo_mixer
},
17078 .init_verbs
= { alc861vd_volume_init_verbs
,
17079 alc861vd_3stack_init_verbs
,
17080 alc861vd_eapd_verbs
,
17081 alc861vd_lenovo_unsol_verbs
},
17082 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
17083 .dac_nids
= alc660vd_dac_nids
,
17084 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17085 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17086 .channel_mode
= alc861vd_3stack_2ch_modes
,
17087 .input_mux
= &alc861vd_capture_source
,
17088 .unsol_event
= alc861vd_lenovo_unsol_event
,
17089 .setup
= alc861vd_lenovo_setup
,
17090 .init_hook
= alc861vd_lenovo_init_hook
,
17095 * BIOS auto configuration
17097 static int alc861vd_auto_create_input_ctls(struct hda_codec
*codec
,
17098 const struct auto_pin_cfg
*cfg
)
17100 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x22, 0);
17104 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
17105 hda_nid_t nid
, int pin_type
, int dac_idx
)
17107 alc_set_pin_output(codec
, nid
, pin_type
);
17110 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
17112 struct alc_spec
*spec
= codec
->spec
;
17115 for (i
= 0; i
<= HDA_SIDE
; i
++) {
17116 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
17117 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
17119 alc861vd_auto_set_output_and_unmute(codec
, nid
,
17125 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
17127 struct alc_spec
*spec
= codec
->spec
;
17130 pin
= spec
->autocfg
.hp_pins
[0];
17131 if (pin
) /* connect to front and use dac 0 */
17132 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
17133 pin
= spec
->autocfg
.speaker_pins
[0];
17135 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
17138 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17140 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
17142 struct alc_spec
*spec
= codec
->spec
;
17143 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
17146 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
17147 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
17148 if (alc_is_input_pin(codec
, nid
)) {
17149 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
17150 if (nid
!= ALC861VD_PIN_CD_NID
&&
17151 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
17152 snd_hda_codec_write(codec
, nid
, 0,
17153 AC_VERB_SET_AMP_GAIN_MUTE
,
17159 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17161 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17162 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17164 /* add playback controls from the parsed DAC table */
17165 /* Based on ALC880 version. But ALC861VD has separate,
17166 * different NIDs for mute/unmute switch and volume control */
17167 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
17168 const struct auto_pin_cfg
*cfg
)
17170 static const char * const chname
[4] = {
17171 "Front", "Surround", "CLFE", "Side"
17173 const char *pfx
= alc_get_line_out_pfx(spec
, true);
17174 hda_nid_t nid_v
, nid_s
;
17175 int i
, err
, noutputs
;
17177 noutputs
= cfg
->line_outs
;
17178 if (spec
->multi_ios
> 0)
17179 noutputs
+= spec
->multi_ios
;
17181 for (i
= 0; i
< noutputs
; i
++) {
17182 if (!spec
->multiout
.dac_nids
[i
])
17184 nid_v
= alc861vd_idx_to_mixer_vol(
17186 spec
->multiout
.dac_nids
[i
]));
17187 nid_s
= alc861vd_idx_to_mixer_switch(
17189 spec
->multiout
.dac_nids
[i
]));
17191 if (!pfx
&& i
== 2) {
17193 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17195 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
17199 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17201 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
17205 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17207 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
17211 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17213 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
17218 const char *name
= pfx
;
17224 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17226 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
17230 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17232 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
17241 /* add playback controls for speaker and HP outputs */
17242 /* Based on ALC880 version. But ALC861VD has separate,
17243 * different NIDs for mute/unmute switch and volume control */
17244 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
17245 hda_nid_t pin
, const char *pfx
)
17247 hda_nid_t nid_v
, nid_s
;
17253 if (alc880_is_fixed_pin(pin
)) {
17254 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
17255 /* specify the DAC as the extra output */
17256 if (!spec
->multiout
.hp_nid
)
17257 spec
->multiout
.hp_nid
= nid_v
;
17259 spec
->multiout
.extra_out_nid
[0] = nid_v
;
17260 /* control HP volume/switch on the output mixer amp */
17261 nid_v
= alc861vd_idx_to_mixer_vol(
17262 alc880_fixed_pin_idx(pin
));
17263 nid_s
= alc861vd_idx_to_mixer_switch(
17264 alc880_fixed_pin_idx(pin
));
17266 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
17267 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
17270 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
17271 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
17274 } else if (alc880_is_multi_pin(pin
)) {
17275 /* set manual connection */
17276 /* we have only a switch on HP-out PIN */
17277 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
17278 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
17285 /* parse the BIOS configuration and set up the alc_spec
17286 * return 1 if successful, 0 if the proper config is not found,
17287 * or a negative error code
17288 * Based on ALC880 version - had to change it to override
17289 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17290 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
17292 struct alc_spec
*spec
= codec
->spec
;
17294 static const hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
17296 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
17300 if (!spec
->autocfg
.line_outs
)
17301 return 0; /* can't find valid BIOS pin config */
17303 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
17306 err
= alc_auto_add_multi_channel_mode(codec
);
17309 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
17312 err
= alc861vd_auto_create_extra_out(spec
,
17313 spec
->autocfg
.speaker_pins
[0],
17317 err
= alc861vd_auto_create_extra_out(spec
,
17318 spec
->autocfg
.hp_pins
[0],
17322 err
= alc861vd_auto_create_input_ctls(codec
, &spec
->autocfg
);
17326 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
17328 alc_auto_parse_digital(codec
);
17330 if (spec
->kctls
.list
)
17331 add_mixer(spec
, spec
->kctls
.list
);
17333 add_verb(spec
, alc861vd_volume_init_verbs
);
17335 spec
->num_mux_defs
= 1;
17336 spec
->input_mux
= &spec
->private_imux
[0];
17338 err
= alc_auto_add_mic_boost(codec
);
17342 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
17347 /* additional initialization for auto-configuration model */
17348 static void alc861vd_auto_init(struct hda_codec
*codec
)
17350 struct alc_spec
*spec
= codec
->spec
;
17351 alc861vd_auto_init_multi_out(codec
);
17352 alc861vd_auto_init_hp_out(codec
);
17353 alc861vd_auto_init_analog_input(codec
);
17354 alc861vd_auto_init_input_src(codec
);
17355 alc_auto_init_digital(codec
);
17356 if (spec
->unsol_event
)
17357 alc_inithook(codec
);
17361 ALC660VD_FIX_ASUS_GPIO1
17365 static const struct alc_fixup alc861vd_fixups
[] = {
17366 [ALC660VD_FIX_ASUS_GPIO1
] = {
17367 .type
= ALC_FIXUP_VERBS
,
17368 .v
.verbs
= (const struct hda_verb
[]) {
17369 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
17370 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
17371 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
17377 static const struct snd_pci_quirk alc861vd_fixup_tbl
[] = {
17378 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1
),
17382 static int patch_alc861vd(struct hda_codec
*codec
)
17384 struct alc_spec
*spec
;
17385 int err
, board_config
;
17387 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
17391 codec
->spec
= spec
;
17393 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
17397 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
17398 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
17400 board_config
= ALC861VD_AUTO
;
17403 if (board_config
== ALC861VD_AUTO
) {
17404 alc_pick_fixup(codec
, NULL
, alc861vd_fixup_tbl
, alc861vd_fixups
);
17405 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
17408 if (board_config
== ALC861VD_AUTO
) {
17409 /* automatic parse from the BIOS config */
17410 err
= alc861vd_parse_auto_config(codec
);
17416 "hda_codec: Cannot set up configuration "
17417 "from BIOS. Using base mode...\n");
17418 board_config
= ALC861VD_3ST
;
17422 err
= snd_hda_attach_beep_device(codec
, 0x23);
17428 if (board_config
!= ALC861VD_AUTO
)
17429 setup_preset(codec
, &alc861vd_presets
[board_config
]);
17431 if (codec
->vendor_id
== 0x10ec0660) {
17432 /* always turn on EAPD */
17433 add_verb(spec
, alc660vd_eapd_verbs
);
17436 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
17437 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
17439 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
17440 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
17442 if (!spec
->adc_nids
) {
17443 spec
->adc_nids
= alc861vd_adc_nids
;
17444 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
17446 if (!spec
->capsrc_nids
)
17447 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
17449 set_capture_mixer(codec
);
17450 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
17452 spec
->vmaster_nid
= 0x02;
17454 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
17456 codec
->patch_ops
= alc_patch_ops
;
17458 if (board_config
== ALC861VD_AUTO
)
17459 spec
->init_hook
= alc861vd_auto_init
;
17460 spec
->shutup
= alc_eapd_shutup
;
17461 #ifdef CONFIG_SND_HDA_POWER_SAVE
17462 if (!spec
->loopback
.amplist
)
17463 spec
->loopback
.amplist
= alc861vd_loopbacks
;
17472 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17473 * configuration. Each pin widget can choose any input DACs and a mixer.
17474 * Each ADC is connected from a mixer of all inputs. This makes possible
17475 * 6-channel independent captures.
17477 * In addition, an independent DAC for the multi-playback (not used in this
17480 #define ALC662_DIGOUT_NID 0x06
17481 #define ALC662_DIGIN_NID 0x0a
17483 static const hda_nid_t alc662_dac_nids
[3] = {
17484 /* front, rear, clfe */
17488 static const hda_nid_t alc272_dac_nids
[2] = {
17492 static const hda_nid_t alc662_adc_nids
[2] = {
17497 static const hda_nid_t alc272_adc_nids
[1] = {
17502 static const hda_nid_t alc662_capsrc_nids
[2] = { 0x22, 0x23 };
17503 static const hda_nid_t alc272_capsrc_nids
[1] = { 0x23 };
17507 /* FIXME: should be a matrix-type input source selection */
17508 static const struct hda_input_mux alc662_capture_source
= {
17512 { "Front Mic", 0x1 },
17518 static const struct hda_input_mux alc662_lenovo_101e_capture_source
= {
17526 static const struct hda_input_mux alc663_capture_source
= {
17530 { "Front Mic", 0x1 },
17535 #if 0 /* set to 1 for testing other input sources below */
17536 static const struct hda_input_mux alc272_nc10_capture_source
= {
17539 { "Autoselect Mic", 0x0 },
17540 { "Internal Mic", 0x1 },
17541 { "In-0x02", 0x2 },
17542 { "In-0x03", 0x3 },
17543 { "In-0x04", 0x4 },
17544 { "In-0x05", 0x5 },
17545 { "In-0x06", 0x6 },
17546 { "In-0x07", 0x7 },
17547 { "In-0x08", 0x8 },
17548 { "In-0x09", 0x9 },
17549 { "In-0x0a", 0x0a },
17550 { "In-0x0b", 0x0b },
17551 { "In-0x0c", 0x0c },
17552 { "In-0x0d", 0x0d },
17553 { "In-0x0e", 0x0e },
17554 { "In-0x0f", 0x0f },
17562 static const struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
17569 static const struct hda_verb alc662_3ST_ch2_init
[] = {
17570 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17571 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17572 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17573 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17580 static const struct hda_verb alc662_3ST_ch6_init
[] = {
17581 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17582 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17583 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
17584 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17585 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17586 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
17590 static const struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
17591 { 2, alc662_3ST_ch2_init
},
17592 { 6, alc662_3ST_ch6_init
},
17598 static const struct hda_verb alc662_sixstack_ch6_init
[] = {
17599 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
17600 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
17601 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17608 static const struct hda_verb alc662_sixstack_ch8_init
[] = {
17609 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17610 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17611 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17615 static const struct hda_channel_mode alc662_5stack_modes
[2] = {
17616 { 2, alc662_sixstack_ch6_init
},
17617 { 6, alc662_sixstack_ch8_init
},
17620 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17621 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17624 static const struct snd_kcontrol_new alc662_base_mixer
[] = {
17625 /* output mixer control */
17626 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
17627 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17628 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
17629 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
17630 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17631 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17632 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
17633 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
17634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17636 /*Input mixer control */
17637 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
17638 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
17639 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
17640 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
17641 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
17642 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
17643 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
17644 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
17648 static const struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
17649 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17650 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17651 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17652 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
17653 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
17654 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17655 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17656 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17657 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17658 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17659 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17663 static const struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
17664 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17665 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17666 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17667 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
17668 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17669 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17670 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
17671 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
17672 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17673 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
17674 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
17675 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17676 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17678 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17679 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17680 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17684 static const struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
17685 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17686 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
17687 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17688 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
17689 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17690 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17691 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17692 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17693 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17697 static const struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
17698 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17699 ALC262_HIPPO_MASTER_SWITCH
,
17701 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
17702 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17703 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17705 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
17706 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17707 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17711 static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
17712 ALC262_HIPPO_MASTER_SWITCH
,
17713 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17714 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17715 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17716 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17717 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
17718 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17719 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17721 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17725 static const struct hda_bind_ctls alc663_asus_bind_master_vol
= {
17726 .ops
= &snd_hda_bind_vol
,
17728 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
17729 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
17734 static const struct hda_bind_ctls alc663_asus_one_bind_switch
= {
17735 .ops
= &snd_hda_bind_sw
,
17737 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17738 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17743 static const struct snd_kcontrol_new alc663_m51va_mixer
[] = {
17744 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17745 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch
),
17746 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17747 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17751 static const struct hda_bind_ctls alc663_asus_tree_bind_switch
= {
17752 .ops
= &snd_hda_bind_sw
,
17754 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17755 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17756 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17761 static const struct snd_kcontrol_new alc663_two_hp_m1_mixer
[] = {
17762 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17763 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch
),
17764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17765 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17766 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17767 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17772 static const struct hda_bind_ctls alc663_asus_four_bind_switch
= {
17773 .ops
= &snd_hda_bind_sw
,
17775 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17776 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17777 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17782 static const struct snd_kcontrol_new alc663_two_hp_m2_mixer
[] = {
17783 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17784 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch
),
17785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17787 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17788 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17792 static const struct snd_kcontrol_new alc662_1bjd_mixer
[] = {
17793 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17794 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17798 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17799 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17803 static const struct hda_bind_ctls alc663_asus_two_bind_master_vol
= {
17804 .ops
= &snd_hda_bind_vol
,
17806 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
17807 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT
),
17812 static const struct hda_bind_ctls alc663_asus_two_bind_switch
= {
17813 .ops
= &snd_hda_bind_sw
,
17815 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17816 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT
),
17821 static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer
[] = {
17822 HDA_BIND_VOL("Master Playback Volume",
17823 &alc663_asus_two_bind_master_vol
),
17824 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
17825 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17826 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17828 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17832 static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer
[] = {
17833 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17834 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
17835 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17842 static const struct snd_kcontrol_new alc663_g71v_mixer
[] = {
17843 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17844 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17845 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17846 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17847 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17849 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17850 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17851 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17852 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17856 static const struct snd_kcontrol_new alc663_g50v_mixer
[] = {
17857 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17858 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17859 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17862 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17863 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17864 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17865 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17866 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17870 static const struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch
= {
17871 .ops
= &snd_hda_bind_sw
,
17873 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17874 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17875 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17876 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17877 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17882 static const struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch
= {
17883 .ops
= &snd_hda_bind_sw
,
17885 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17886 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17891 static const struct snd_kcontrol_new alc663_mode7_mixer
[] = {
17892 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17893 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17894 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17895 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17896 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17897 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17898 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17899 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17900 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17904 static const struct snd_kcontrol_new alc663_mode8_mixer
[] = {
17905 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17906 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17907 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17908 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17909 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17910 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17911 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17916 static const struct snd_kcontrol_new alc662_chmode_mixer
[] = {
17918 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
17919 .name
= "Channel Mode",
17920 .info
= alc_ch_mode_info
,
17921 .get
= alc_ch_mode_get
,
17922 .put
= alc_ch_mode_put
,
17927 static const struct hda_verb alc662_init_verbs
[] = {
17928 /* ADC: mute amp left and right */
17929 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17930 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
17932 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17933 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17934 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17935 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17936 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17937 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17939 /* Front Pin: output 0 (0x0c) */
17940 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17941 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17943 /* Rear Pin: output 1 (0x0d) */
17944 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17945 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17947 /* CLFE Pin: output 2 (0x0e) */
17948 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17949 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17951 /* Mic (rear) pin: input vref at 80% */
17952 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17953 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17954 /* Front Mic pin: input vref at 80% */
17955 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17956 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17957 /* Line In pin: input */
17958 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17959 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17960 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17961 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17962 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17963 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
17964 /* CD pin widget for input */
17965 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17967 /* FIXME: use matrix-type input source selection */
17968 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17971 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17976 static const struct hda_verb alc662_eapd_init_verbs
[] = {
17977 /* always trun on EAPD */
17978 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17979 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17983 static const struct hda_verb alc662_sue_init_verbs
[] = {
17984 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
17985 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
17989 static const struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
17990 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17991 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17995 /* Set Unsolicited Event*/
17996 static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
17997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17998 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18002 static const struct hda_verb alc663_m51va_init_verbs
[] = {
18003 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18004 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18005 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18006 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18007 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18008 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18010 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18011 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18015 static const struct hda_verb alc663_21jd_amic_init_verbs
[] = {
18016 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18017 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18018 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18021 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18022 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18026 static const struct hda_verb alc662_1bjd_amic_init_verbs
[] = {
18027 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18028 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18029 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18030 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
18031 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18033 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18034 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18038 static const struct hda_verb alc663_15jd_amic_init_verbs
[] = {
18039 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18040 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18041 {0x15, 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(1)},
18044 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18045 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18049 static const struct hda_verb alc663_two_hp_amic_m1_init_verbs
[] = {
18050 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18051 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18052 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18053 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
18054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18056 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
18057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18059 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18060 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18061 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18065 static const struct hda_verb alc663_two_hp_amic_m2_init_verbs
[] = {
18066 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18067 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18068 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18069 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18070 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18071 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18072 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18074 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18075 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18076 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18077 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18081 static const struct hda_verb alc663_g71v_init_verbs
[] = {
18082 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18083 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18084 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18086 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18087 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18088 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
18090 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
18091 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
18092 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
18096 static const struct hda_verb alc663_g50v_init_verbs
[] = {
18097 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18098 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18099 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
18101 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18102 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18106 static const struct hda_verb alc662_ecs_init_verbs
[] = {
18107 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
18108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18109 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18110 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18114 static const struct hda_verb alc272_dell_zm1_init_verbs
[] = {
18115 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18116 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18118 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18119 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18120 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18121 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18124 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18125 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18129 static const struct hda_verb alc272_dell_init_verbs
[] = {
18130 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18131 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18132 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18133 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18134 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18135 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18136 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18137 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18138 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18139 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18140 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18144 static const struct hda_verb alc663_mode7_init_verbs
[] = {
18145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18146 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18147 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
18148 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18149 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18150 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18151 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
18152 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18153 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18154 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18157 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18158 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18159 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18163 static const struct hda_verb alc663_mode8_init_verbs
[] = {
18164 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18166 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18167 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
18168 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18169 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
18170 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18171 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18172 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18173 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18174 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18175 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18177 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18178 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18179 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18183 static const struct snd_kcontrol_new alc662_auto_capture_mixer
[] = {
18184 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
18185 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
18189 static const struct snd_kcontrol_new alc272_auto_capture_mixer
[] = {
18190 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
18191 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
18195 static void alc662_lenovo_101e_setup(struct hda_codec
*codec
)
18197 struct alc_spec
*spec
= codec
->spec
;
18199 spec
->autocfg
.hp_pins
[0] = 0x1b;
18200 spec
->autocfg
.line_out_pins
[0] = 0x14;
18201 spec
->autocfg
.speaker_pins
[0] = 0x15;
18202 spec
->automute
= 1;
18203 spec
->detect_line
= 1;
18204 spec
->automute_lines
= 1;
18205 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
18208 static void alc662_eeepc_setup(struct hda_codec
*codec
)
18210 struct alc_spec
*spec
= codec
->spec
;
18212 alc262_hippo1_setup(codec
);
18213 spec
->ext_mic
.pin
= 0x18;
18214 spec
->ext_mic
.mux_idx
= 0;
18215 spec
->int_mic
.pin
= 0x19;
18216 spec
->int_mic
.mux_idx
= 1;
18217 spec
->auto_mic
= 1;
18220 static void alc662_eeepc_ep20_setup(struct hda_codec
*codec
)
18222 struct alc_spec
*spec
= codec
->spec
;
18224 spec
->autocfg
.hp_pins
[0] = 0x14;
18225 spec
->autocfg
.speaker_pins
[0] = 0x1b;
18226 spec
->automute
= 1;
18227 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
18230 static void alc663_m51va_setup(struct hda_codec
*codec
)
18232 struct alc_spec
*spec
= codec
->spec
;
18233 spec
->autocfg
.hp_pins
[0] = 0x21;
18234 spec
->autocfg
.speaker_pins
[0] = 0x14;
18235 spec
->automute_mixer_nid
[0] = 0x0c;
18236 spec
->automute
= 1;
18237 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
18238 spec
->ext_mic
.pin
= 0x18;
18239 spec
->ext_mic
.mux_idx
= 0;
18240 spec
->int_mic
.pin
= 0x12;
18241 spec
->int_mic
.mux_idx
= 9;
18242 spec
->auto_mic
= 1;
18245 /* ***************** Mode1 ******************************/
18246 static void alc663_mode1_setup(struct hda_codec
*codec
)
18248 struct alc_spec
*spec
= codec
->spec
;
18249 spec
->autocfg
.hp_pins
[0] = 0x21;
18250 spec
->autocfg
.speaker_pins
[0] = 0x14;
18251 spec
->automute_mixer_nid
[0] = 0x0c;
18252 spec
->automute
= 1;
18253 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
18254 spec
->ext_mic
.pin
= 0x18;
18255 spec
->ext_mic
.mux_idx
= 0;
18256 spec
->int_mic
.pin
= 0x19;
18257 spec
->int_mic
.mux_idx
= 1;
18258 spec
->auto_mic
= 1;
18261 /* ***************** Mode2 ******************************/
18262 static void alc662_mode2_setup(struct hda_codec
*codec
)
18264 struct alc_spec
*spec
= codec
->spec
;
18265 spec
->autocfg
.hp_pins
[0] = 0x1b;
18266 spec
->autocfg
.speaker_pins
[0] = 0x14;
18267 spec
->automute
= 1;
18268 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
18269 spec
->ext_mic
.pin
= 0x18;
18270 spec
->ext_mic
.mux_idx
= 0;
18271 spec
->int_mic
.pin
= 0x19;
18272 spec
->int_mic
.mux_idx
= 1;
18273 spec
->auto_mic
= 1;
18276 /* ***************** Mode3 ******************************/
18277 static void alc663_mode3_setup(struct hda_codec
*codec
)
18279 struct alc_spec
*spec
= codec
->spec
;
18280 spec
->autocfg
.hp_pins
[0] = 0x21;
18281 spec
->autocfg
.hp_pins
[0] = 0x15;
18282 spec
->autocfg
.speaker_pins
[0] = 0x14;
18283 spec
->automute
= 1;
18284 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
18285 spec
->ext_mic
.pin
= 0x18;
18286 spec
->ext_mic
.mux_idx
= 0;
18287 spec
->int_mic
.pin
= 0x19;
18288 spec
->int_mic
.mux_idx
= 1;
18289 spec
->auto_mic
= 1;
18292 /* ***************** Mode4 ******************************/
18293 static void alc663_mode4_setup(struct hda_codec
*codec
)
18295 struct alc_spec
*spec
= codec
->spec
;
18296 spec
->autocfg
.hp_pins
[0] = 0x21;
18297 spec
->autocfg
.speaker_pins
[0] = 0x14;
18298 spec
->autocfg
.speaker_pins
[1] = 0x16;
18299 spec
->automute_mixer_nid
[0] = 0x0c;
18300 spec
->automute_mixer_nid
[1] = 0x0e;
18301 spec
->automute
= 1;
18302 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
18303 spec
->ext_mic
.pin
= 0x18;
18304 spec
->ext_mic
.mux_idx
= 0;
18305 spec
->int_mic
.pin
= 0x19;
18306 spec
->int_mic
.mux_idx
= 1;
18307 spec
->auto_mic
= 1;
18310 /* ***************** Mode5 ******************************/
18311 static void alc663_mode5_setup(struct hda_codec
*codec
)
18313 struct alc_spec
*spec
= codec
->spec
;
18314 spec
->autocfg
.hp_pins
[0] = 0x15;
18315 spec
->autocfg
.speaker_pins
[0] = 0x14;
18316 spec
->autocfg
.speaker_pins
[1] = 0x16;
18317 spec
->automute_mixer_nid
[0] = 0x0c;
18318 spec
->automute_mixer_nid
[1] = 0x0e;
18319 spec
->automute
= 1;
18320 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
18321 spec
->ext_mic
.pin
= 0x18;
18322 spec
->ext_mic
.mux_idx
= 0;
18323 spec
->int_mic
.pin
= 0x19;
18324 spec
->int_mic
.mux_idx
= 1;
18325 spec
->auto_mic
= 1;
18328 /* ***************** Mode6 ******************************/
18329 static void alc663_mode6_setup(struct hda_codec
*codec
)
18331 struct alc_spec
*spec
= codec
->spec
;
18332 spec
->autocfg
.hp_pins
[0] = 0x1b;
18333 spec
->autocfg
.hp_pins
[0] = 0x15;
18334 spec
->autocfg
.speaker_pins
[0] = 0x14;
18335 spec
->automute_mixer_nid
[0] = 0x0c;
18336 spec
->automute
= 1;
18337 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
18338 spec
->ext_mic
.pin
= 0x18;
18339 spec
->ext_mic
.mux_idx
= 0;
18340 spec
->int_mic
.pin
= 0x19;
18341 spec
->int_mic
.mux_idx
= 1;
18342 spec
->auto_mic
= 1;
18345 /* ***************** Mode7 ******************************/
18346 static void alc663_mode7_setup(struct hda_codec
*codec
)
18348 struct alc_spec
*spec
= codec
->spec
;
18349 spec
->autocfg
.hp_pins
[0] = 0x1b;
18350 spec
->autocfg
.hp_pins
[0] = 0x21;
18351 spec
->autocfg
.speaker_pins
[0] = 0x14;
18352 spec
->autocfg
.speaker_pins
[0] = 0x17;
18353 spec
->automute
= 1;
18354 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
18355 spec
->ext_mic
.pin
= 0x18;
18356 spec
->ext_mic
.mux_idx
= 0;
18357 spec
->int_mic
.pin
= 0x19;
18358 spec
->int_mic
.mux_idx
= 1;
18359 spec
->auto_mic
= 1;
18362 /* ***************** Mode8 ******************************/
18363 static void alc663_mode8_setup(struct hda_codec
*codec
)
18365 struct alc_spec
*spec
= codec
->spec
;
18366 spec
->autocfg
.hp_pins
[0] = 0x21;
18367 spec
->autocfg
.hp_pins
[1] = 0x15;
18368 spec
->autocfg
.speaker_pins
[0] = 0x14;
18369 spec
->autocfg
.speaker_pins
[0] = 0x17;
18370 spec
->automute
= 1;
18371 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
18372 spec
->ext_mic
.pin
= 0x18;
18373 spec
->ext_mic
.mux_idx
= 0;
18374 spec
->int_mic
.pin
= 0x12;
18375 spec
->int_mic
.mux_idx
= 9;
18376 spec
->auto_mic
= 1;
18379 static void alc663_g71v_setup(struct hda_codec
*codec
)
18381 struct alc_spec
*spec
= codec
->spec
;
18382 spec
->autocfg
.hp_pins
[0] = 0x21;
18383 spec
->autocfg
.line_out_pins
[0] = 0x15;
18384 spec
->autocfg
.speaker_pins
[0] = 0x14;
18385 spec
->automute
= 1;
18386 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
18387 spec
->detect_line
= 1;
18388 spec
->automute_lines
= 1;
18389 spec
->ext_mic
.pin
= 0x18;
18390 spec
->ext_mic
.mux_idx
= 0;
18391 spec
->int_mic
.pin
= 0x12;
18392 spec
->int_mic
.mux_idx
= 9;
18393 spec
->auto_mic
= 1;
18396 #define alc663_g50v_setup alc663_m51va_setup
18398 static const struct snd_kcontrol_new alc662_ecs_mixer
[] = {
18399 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
18400 ALC262_HIPPO_MASTER_SWITCH
,
18402 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT
),
18403 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT
),
18404 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT
),
18406 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
18407 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
18408 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
18412 static const struct snd_kcontrol_new alc272_nc10_mixer
[] = {
18413 /* Master Playback automatically created from Speaker and Headphone */
18414 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
18415 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
18416 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
18417 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
18419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
18420 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
18421 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
18423 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
18424 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
18425 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
18429 #ifdef CONFIG_SND_HDA_POWER_SAVE
18430 #define alc662_loopbacks alc880_loopbacks
18434 /* pcm configuration: identical with ALC880 */
18435 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18436 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18437 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18438 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18441 * configuration and preset
18443 static const char * const alc662_models
[ALC662_MODEL_LAST
] = {
18444 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
18445 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
18446 [ALC662_3ST_6ch
] = "3stack-6ch",
18447 [ALC662_5ST_DIG
] = "5stack-dig",
18448 [ALC662_LENOVO_101E
] = "lenovo-101e",
18449 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
18450 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
18451 [ALC662_ECS
] = "ecs",
18452 [ALC663_ASUS_M51VA
] = "m51va",
18453 [ALC663_ASUS_G71V
] = "g71v",
18454 [ALC663_ASUS_H13
] = "h13",
18455 [ALC663_ASUS_G50V
] = "g50v",
18456 [ALC663_ASUS_MODE1
] = "asus-mode1",
18457 [ALC662_ASUS_MODE2
] = "asus-mode2",
18458 [ALC663_ASUS_MODE3
] = "asus-mode3",
18459 [ALC663_ASUS_MODE4
] = "asus-mode4",
18460 [ALC663_ASUS_MODE5
] = "asus-mode5",
18461 [ALC663_ASUS_MODE6
] = "asus-mode6",
18462 [ALC663_ASUS_MODE7
] = "asus-mode7",
18463 [ALC663_ASUS_MODE8
] = "asus-mode8",
18464 [ALC272_DELL
] = "dell",
18465 [ALC272_DELL_ZM1
] = "dell-zm1",
18466 [ALC272_SAMSUNG_NC10
] = "samsung-nc10",
18467 [ALC662_AUTO
] = "auto",
18470 static const struct snd_pci_quirk alc662_cfg_tbl
[] = {
18471 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS
),
18472 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL
),
18473 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1
),
18474 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1
),
18475 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3
),
18476 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1
),
18477 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3
),
18478 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1
),
18479 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2
),
18480 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1
),
18481 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1
),
18482 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1
),
18483 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2
),
18484 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7
),
18485 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7
),
18486 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8
),
18487 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3
),
18488 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1
),
18489 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2
),
18490 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2
),
18491 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1
),
18492 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2
),
18493 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6
),
18494 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6
),
18495 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2
),
18496 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1
),
18497 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3
),
18498 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA
),
18499 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2
),
18500 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2
),
18501 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5
),
18502 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6
),
18503 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2
),
18504 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1
),
18505 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2
),
18506 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2
),
18507 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
18508 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18509 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3
),
18510 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3
),
18511 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1
),
18512 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1
),
18513 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1
),
18514 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1
),
18515 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1
),
18516 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2
),
18517 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2
),
18518 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1
),
18519 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1
),
18520 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3
),
18521 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1
),
18522 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1
),
18523 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V
),
18524 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18525 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1
),
18526 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2
),
18527 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA
),
18528 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1
),
18529 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4
),
18530 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
18531 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
18532 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
18533 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS
),
18534 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18535 ALC662_3ST_6ch_DIG
),
18536 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO
),
18537 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10
),
18538 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18539 ALC662_3ST_6ch_DIG
),
18540 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13
),
18541 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG
),
18542 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA
),
18543 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
18544 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18545 ALC662_3ST_6ch_DIG
),
18546 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18548 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E
),
18552 static const struct alc_config_preset alc662_presets
[] = {
18553 [ALC662_3ST_2ch_DIG
] = {
18554 .mixers
= { alc662_3ST_2ch_mixer
},
18555 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18556 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18557 .dac_nids
= alc662_dac_nids
,
18558 .dig_out_nid
= ALC662_DIGOUT_NID
,
18559 .dig_in_nid
= ALC662_DIGIN_NID
,
18560 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18561 .channel_mode
= alc662_3ST_2ch_modes
,
18562 .input_mux
= &alc662_capture_source
,
18564 [ALC662_3ST_6ch_DIG
] = {
18565 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18566 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18567 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18568 .dac_nids
= alc662_dac_nids
,
18569 .dig_out_nid
= ALC662_DIGOUT_NID
,
18570 .dig_in_nid
= ALC662_DIGIN_NID
,
18571 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18572 .channel_mode
= alc662_3ST_6ch_modes
,
18574 .input_mux
= &alc662_capture_source
,
18576 [ALC662_3ST_6ch
] = {
18577 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18578 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18579 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18580 .dac_nids
= alc662_dac_nids
,
18581 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18582 .channel_mode
= alc662_3ST_6ch_modes
,
18584 .input_mux
= &alc662_capture_source
,
18586 [ALC662_5ST_DIG
] = {
18587 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
},
18588 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18589 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18590 .dac_nids
= alc662_dac_nids
,
18591 .dig_out_nid
= ALC662_DIGOUT_NID
,
18592 .dig_in_nid
= ALC662_DIGIN_NID
,
18593 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
18594 .channel_mode
= alc662_5stack_modes
,
18595 .input_mux
= &alc662_capture_source
,
18597 [ALC662_LENOVO_101E
] = {
18598 .mixers
= { alc662_lenovo_101e_mixer
},
18599 .init_verbs
= { alc662_init_verbs
,
18600 alc662_eapd_init_verbs
,
18601 alc662_sue_init_verbs
},
18602 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18603 .dac_nids
= alc662_dac_nids
,
18604 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18605 .channel_mode
= alc662_3ST_2ch_modes
,
18606 .input_mux
= &alc662_lenovo_101e_capture_source
,
18607 .unsol_event
= alc_sku_unsol_event
,
18608 .setup
= alc662_lenovo_101e_setup
,
18609 .init_hook
= alc_inithook
,
18611 [ALC662_ASUS_EEEPC_P701
] = {
18612 .mixers
= { alc662_eeepc_p701_mixer
},
18613 .init_verbs
= { alc662_init_verbs
,
18614 alc662_eapd_init_verbs
,
18615 alc662_eeepc_sue_init_verbs
},
18616 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18617 .dac_nids
= alc662_dac_nids
,
18618 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18619 .channel_mode
= alc662_3ST_2ch_modes
,
18620 .unsol_event
= alc_sku_unsol_event
,
18621 .setup
= alc662_eeepc_setup
,
18622 .init_hook
= alc_inithook
,
18624 [ALC662_ASUS_EEEPC_EP20
] = {
18625 .mixers
= { alc662_eeepc_ep20_mixer
,
18626 alc662_chmode_mixer
},
18627 .init_verbs
= { alc662_init_verbs
,
18628 alc662_eapd_init_verbs
,
18629 alc662_eeepc_ep20_sue_init_verbs
},
18630 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18631 .dac_nids
= alc662_dac_nids
,
18632 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18633 .channel_mode
= alc662_3ST_6ch_modes
,
18634 .input_mux
= &alc662_lenovo_101e_capture_source
,
18635 .unsol_event
= alc_sku_unsol_event
,
18636 .setup
= alc662_eeepc_ep20_setup
,
18637 .init_hook
= alc_inithook
,
18640 .mixers
= { alc662_ecs_mixer
},
18641 .init_verbs
= { alc662_init_verbs
,
18642 alc662_eapd_init_verbs
,
18643 alc662_ecs_init_verbs
},
18644 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18645 .dac_nids
= alc662_dac_nids
,
18646 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18647 .channel_mode
= alc662_3ST_2ch_modes
,
18648 .unsol_event
= alc_sku_unsol_event
,
18649 .setup
= alc662_eeepc_setup
,
18650 .init_hook
= alc_inithook
,
18652 [ALC663_ASUS_M51VA
] = {
18653 .mixers
= { alc663_m51va_mixer
},
18654 .init_verbs
= { alc662_init_verbs
,
18655 alc662_eapd_init_verbs
,
18656 alc663_m51va_init_verbs
},
18657 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18658 .dac_nids
= alc662_dac_nids
,
18659 .dig_out_nid
= ALC662_DIGOUT_NID
,
18660 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18661 .channel_mode
= alc662_3ST_2ch_modes
,
18662 .unsol_event
= alc_sku_unsol_event
,
18663 .setup
= alc663_m51va_setup
,
18664 .init_hook
= alc_inithook
,
18666 [ALC663_ASUS_G71V
] = {
18667 .mixers
= { alc663_g71v_mixer
},
18668 .init_verbs
= { alc662_init_verbs
,
18669 alc662_eapd_init_verbs
,
18670 alc663_g71v_init_verbs
},
18671 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18672 .dac_nids
= alc662_dac_nids
,
18673 .dig_out_nid
= ALC662_DIGOUT_NID
,
18674 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18675 .channel_mode
= alc662_3ST_2ch_modes
,
18676 .unsol_event
= alc_sku_unsol_event
,
18677 .setup
= alc663_g71v_setup
,
18678 .init_hook
= alc_inithook
,
18680 [ALC663_ASUS_H13
] = {
18681 .mixers
= { alc663_m51va_mixer
},
18682 .init_verbs
= { alc662_init_verbs
,
18683 alc662_eapd_init_verbs
,
18684 alc663_m51va_init_verbs
},
18685 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18686 .dac_nids
= alc662_dac_nids
,
18687 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18688 .channel_mode
= alc662_3ST_2ch_modes
,
18689 .setup
= alc663_m51va_setup
,
18690 .unsol_event
= alc_sku_unsol_event
,
18691 .init_hook
= alc_inithook
,
18693 [ALC663_ASUS_G50V
] = {
18694 .mixers
= { alc663_g50v_mixer
},
18695 .init_verbs
= { alc662_init_verbs
,
18696 alc662_eapd_init_verbs
,
18697 alc663_g50v_init_verbs
},
18698 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18699 .dac_nids
= alc662_dac_nids
,
18700 .dig_out_nid
= ALC662_DIGOUT_NID
,
18701 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18702 .channel_mode
= alc662_3ST_6ch_modes
,
18703 .input_mux
= &alc663_capture_source
,
18704 .unsol_event
= alc_sku_unsol_event
,
18705 .setup
= alc663_g50v_setup
,
18706 .init_hook
= alc_inithook
,
18708 [ALC663_ASUS_MODE1
] = {
18709 .mixers
= { alc663_m51va_mixer
},
18710 .cap_mixer
= alc662_auto_capture_mixer
,
18711 .init_verbs
= { alc662_init_verbs
,
18712 alc662_eapd_init_verbs
,
18713 alc663_21jd_amic_init_verbs
},
18714 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18716 .dac_nids
= alc662_dac_nids
,
18717 .dig_out_nid
= ALC662_DIGOUT_NID
,
18718 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18719 .channel_mode
= alc662_3ST_2ch_modes
,
18720 .unsol_event
= alc_sku_unsol_event
,
18721 .setup
= alc663_mode1_setup
,
18722 .init_hook
= alc_inithook
,
18724 [ALC662_ASUS_MODE2
] = {
18725 .mixers
= { alc662_1bjd_mixer
},
18726 .cap_mixer
= alc662_auto_capture_mixer
,
18727 .init_verbs
= { alc662_init_verbs
,
18728 alc662_eapd_init_verbs
,
18729 alc662_1bjd_amic_init_verbs
},
18730 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18731 .dac_nids
= alc662_dac_nids
,
18732 .dig_out_nid
= ALC662_DIGOUT_NID
,
18733 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18734 .channel_mode
= alc662_3ST_2ch_modes
,
18735 .unsol_event
= alc_sku_unsol_event
,
18736 .setup
= alc662_mode2_setup
,
18737 .init_hook
= alc_inithook
,
18739 [ALC663_ASUS_MODE3
] = {
18740 .mixers
= { alc663_two_hp_m1_mixer
},
18741 .cap_mixer
= alc662_auto_capture_mixer
,
18742 .init_verbs
= { alc662_init_verbs
,
18743 alc662_eapd_init_verbs
,
18744 alc663_two_hp_amic_m1_init_verbs
},
18745 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18747 .dac_nids
= alc662_dac_nids
,
18748 .dig_out_nid
= ALC662_DIGOUT_NID
,
18749 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18750 .channel_mode
= alc662_3ST_2ch_modes
,
18751 .unsol_event
= alc_sku_unsol_event
,
18752 .setup
= alc663_mode3_setup
,
18753 .init_hook
= alc_inithook
,
18755 [ALC663_ASUS_MODE4
] = {
18756 .mixers
= { alc663_asus_21jd_clfe_mixer
},
18757 .cap_mixer
= alc662_auto_capture_mixer
,
18758 .init_verbs
= { alc662_init_verbs
,
18759 alc662_eapd_init_verbs
,
18760 alc663_21jd_amic_init_verbs
},
18761 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18763 .dac_nids
= alc662_dac_nids
,
18764 .dig_out_nid
= ALC662_DIGOUT_NID
,
18765 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18766 .channel_mode
= alc662_3ST_2ch_modes
,
18767 .unsol_event
= alc_sku_unsol_event
,
18768 .setup
= alc663_mode4_setup
,
18769 .init_hook
= alc_inithook
,
18771 [ALC663_ASUS_MODE5
] = {
18772 .mixers
= { alc663_asus_15jd_clfe_mixer
},
18773 .cap_mixer
= alc662_auto_capture_mixer
,
18774 .init_verbs
= { alc662_init_verbs
,
18775 alc662_eapd_init_verbs
,
18776 alc663_15jd_amic_init_verbs
},
18777 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18779 .dac_nids
= alc662_dac_nids
,
18780 .dig_out_nid
= ALC662_DIGOUT_NID
,
18781 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18782 .channel_mode
= alc662_3ST_2ch_modes
,
18783 .unsol_event
= alc_sku_unsol_event
,
18784 .setup
= alc663_mode5_setup
,
18785 .init_hook
= alc_inithook
,
18787 [ALC663_ASUS_MODE6
] = {
18788 .mixers
= { alc663_two_hp_m2_mixer
},
18789 .cap_mixer
= alc662_auto_capture_mixer
,
18790 .init_verbs
= { alc662_init_verbs
,
18791 alc662_eapd_init_verbs
,
18792 alc663_two_hp_amic_m2_init_verbs
},
18793 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18795 .dac_nids
= alc662_dac_nids
,
18796 .dig_out_nid
= ALC662_DIGOUT_NID
,
18797 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18798 .channel_mode
= alc662_3ST_2ch_modes
,
18799 .unsol_event
= alc_sku_unsol_event
,
18800 .setup
= alc663_mode6_setup
,
18801 .init_hook
= alc_inithook
,
18803 [ALC663_ASUS_MODE7
] = {
18804 .mixers
= { alc663_mode7_mixer
},
18805 .cap_mixer
= alc662_auto_capture_mixer
,
18806 .init_verbs
= { alc662_init_verbs
,
18807 alc662_eapd_init_verbs
,
18808 alc663_mode7_init_verbs
},
18809 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18811 .dac_nids
= alc662_dac_nids
,
18812 .dig_out_nid
= ALC662_DIGOUT_NID
,
18813 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18814 .channel_mode
= alc662_3ST_2ch_modes
,
18815 .unsol_event
= alc_sku_unsol_event
,
18816 .setup
= alc663_mode7_setup
,
18817 .init_hook
= alc_inithook
,
18819 [ALC663_ASUS_MODE8
] = {
18820 .mixers
= { alc663_mode8_mixer
},
18821 .cap_mixer
= alc662_auto_capture_mixer
,
18822 .init_verbs
= { alc662_init_verbs
,
18823 alc662_eapd_init_verbs
,
18824 alc663_mode8_init_verbs
},
18825 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18827 .dac_nids
= alc662_dac_nids
,
18828 .dig_out_nid
= ALC662_DIGOUT_NID
,
18829 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18830 .channel_mode
= alc662_3ST_2ch_modes
,
18831 .unsol_event
= alc_sku_unsol_event
,
18832 .setup
= alc663_mode8_setup
,
18833 .init_hook
= alc_inithook
,
18836 .mixers
= { alc663_m51va_mixer
},
18837 .cap_mixer
= alc272_auto_capture_mixer
,
18838 .init_verbs
= { alc662_init_verbs
,
18839 alc662_eapd_init_verbs
,
18840 alc272_dell_init_verbs
},
18841 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18842 .dac_nids
= alc272_dac_nids
,
18843 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18844 .adc_nids
= alc272_adc_nids
,
18845 .num_adc_nids
= ARRAY_SIZE(alc272_adc_nids
),
18846 .capsrc_nids
= alc272_capsrc_nids
,
18847 .channel_mode
= alc662_3ST_2ch_modes
,
18848 .unsol_event
= alc_sku_unsol_event
,
18849 .setup
= alc663_m51va_setup
,
18850 .init_hook
= alc_inithook
,
18852 [ALC272_DELL_ZM1
] = {
18853 .mixers
= { alc663_m51va_mixer
},
18854 .cap_mixer
= alc662_auto_capture_mixer
,
18855 .init_verbs
= { alc662_init_verbs
,
18856 alc662_eapd_init_verbs
,
18857 alc272_dell_zm1_init_verbs
},
18858 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18859 .dac_nids
= alc272_dac_nids
,
18860 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18861 .adc_nids
= alc662_adc_nids
,
18863 .capsrc_nids
= alc662_capsrc_nids
,
18864 .channel_mode
= alc662_3ST_2ch_modes
,
18865 .unsol_event
= alc_sku_unsol_event
,
18866 .setup
= alc663_m51va_setup
,
18867 .init_hook
= alc_inithook
,
18869 [ALC272_SAMSUNG_NC10
] = {
18870 .mixers
= { alc272_nc10_mixer
},
18871 .init_verbs
= { alc662_init_verbs
,
18872 alc662_eapd_init_verbs
,
18873 alc663_21jd_amic_init_verbs
},
18874 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18875 .dac_nids
= alc272_dac_nids
,
18876 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18877 .channel_mode
= alc662_3ST_2ch_modes
,
18878 /*.input_mux = &alc272_nc10_capture_source,*/
18879 .unsol_event
= alc_sku_unsol_event
,
18880 .setup
= alc663_mode4_setup
,
18881 .init_hook
= alc_inithook
,
18887 * BIOS auto configuration
18890 /* convert from MIX nid to DAC */
18891 static hda_nid_t
alc_auto_mix_to_dac(struct hda_codec
*codec
, hda_nid_t nid
)
18896 num
= snd_hda_get_connections(codec
, nid
, list
, ARRAY_SIZE(list
));
18897 for (i
= 0; i
< num
; i
++) {
18898 if (get_wcaps_type(get_wcaps(codec
, list
[i
])) == AC_WID_AUD_OUT
)
18904 /* go down to the selector widget before the mixer */
18905 static hda_nid_t
alc_go_down_to_selector(struct hda_codec
*codec
, hda_nid_t pin
)
18908 int num
= snd_hda_get_connections(codec
, pin
, srcs
,
18911 get_wcaps_type(get_wcaps(codec
, srcs
[0])) != AC_WID_AUD_SEL
)
18916 /* get MIX nid connected to the given pin targeted to DAC */
18917 static hda_nid_t
alc_auto_dac_to_mix(struct hda_codec
*codec
, hda_nid_t pin
,
18923 pin
= alc_go_down_to_selector(codec
, pin
);
18924 num
= snd_hda_get_connections(codec
, pin
, mix
, ARRAY_SIZE(mix
));
18925 for (i
= 0; i
< num
; i
++) {
18926 if (alc_auto_mix_to_dac(codec
, mix
[i
]) == dac
)
18932 /* select the connection from pin to DAC if needed */
18933 static int alc_auto_select_dac(struct hda_codec
*codec
, hda_nid_t pin
,
18939 pin
= alc_go_down_to_selector(codec
, pin
);
18940 num
= snd_hda_get_connections(codec
, pin
, mix
, ARRAY_SIZE(mix
));
18943 for (i
= 0; i
< num
; i
++) {
18944 if (alc_auto_mix_to_dac(codec
, mix
[i
]) == dac
) {
18945 snd_hda_codec_update_cache(codec
, pin
, 0,
18946 AC_VERB_SET_CONNECT_SEL
, i
);
18953 /* look for an empty DAC slot */
18954 static hda_nid_t
alc_auto_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
18956 struct alc_spec
*spec
= codec
->spec
;
18960 pin
= alc_go_down_to_selector(codec
, pin
);
18961 num
= snd_hda_get_connections(codec
, pin
, srcs
, ARRAY_SIZE(srcs
));
18962 for (i
= 0; i
< num
; i
++) {
18963 hda_nid_t nid
= alc_auto_mix_to_dac(codec
, srcs
[i
]);
18966 for (j
= 0; j
< spec
->multiout
.num_dacs
; j
++)
18967 if (spec
->multiout
.dac_nids
[j
] == nid
)
18969 if (j
>= spec
->multiout
.num_dacs
)
18975 /* fill in the dac_nids table from the parsed pin configuration */
18976 static int alc662_auto_fill_dac_nids(struct hda_codec
*codec
,
18977 const struct auto_pin_cfg
*cfg
)
18979 struct alc_spec
*spec
= codec
->spec
;
18983 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
18984 for (i
= 0; i
< cfg
->line_outs
; i
++) {
18985 dac
= alc_auto_look_for_dac(codec
, cfg
->line_out_pins
[i
]);
18988 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
18993 static inline int __alc662_add_vol_ctl(struct alc_spec
*spec
, const char *pfx
,
18994 hda_nid_t nid
, int idx
, unsigned int chs
)
18996 return __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, idx
,
18997 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
19000 static inline int __alc662_add_sw_ctl(struct alc_spec
*spec
, const char *pfx
,
19001 hda_nid_t nid
, int idx
, unsigned int chs
)
19003 return __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
,
19004 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_INPUT
));
19007 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19008 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19009 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19010 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19011 #define alc662_add_stereo_vol(spec, pfx, nid) \
19012 alc662_add_vol_ctl(spec, pfx, nid, 3)
19013 #define alc662_add_stereo_sw(spec, pfx, nid) \
19014 alc662_add_sw_ctl(spec, pfx, nid, 3)
19016 /* add playback controls from the parsed DAC table */
19017 static int alc662_auto_create_multi_out_ctls(struct hda_codec
*codec
,
19018 const struct auto_pin_cfg
*cfg
)
19020 struct alc_spec
*spec
= codec
->spec
;
19021 static const char * const chname
[4] = {
19022 "Front", "Surround", NULL
/*CLFE*/, "Side"
19024 const char *pfx
= alc_get_line_out_pfx(spec
, true);
19025 hda_nid_t nid
, mix
, pin
;
19026 int i
, err
, noutputs
;
19028 noutputs
= cfg
->line_outs
;
19029 if (spec
->multi_ios
> 0)
19030 noutputs
+= spec
->multi_ios
;
19032 for (i
= 0; i
< noutputs
; i
++) {
19033 nid
= spec
->multiout
.dac_nids
[i
];
19036 if (i
>= cfg
->line_outs
)
19037 pin
= spec
->multi_io
[i
- 1].pin
;
19039 pin
= cfg
->line_out_pins
[i
];
19040 mix
= alc_auto_dac_to_mix(codec
, pin
, nid
);
19043 if (!pfx
&& i
== 2) {
19045 err
= alc662_add_vol_ctl(spec
, "Center", nid
, 1);
19048 err
= alc662_add_vol_ctl(spec
, "LFE", nid
, 2);
19051 err
= alc662_add_sw_ctl(spec
, "Center", mix
, 1);
19054 err
= alc662_add_sw_ctl(spec
, "LFE", mix
, 2);
19058 const char *name
= pfx
;
19064 err
= __alc662_add_vol_ctl(spec
, name
, nid
, index
, 3);
19067 err
= __alc662_add_sw_ctl(spec
, name
, mix
, index
, 3);
19075 /* add playback controls for speaker and HP outputs */
19076 /* return DAC nid if any new DAC is assigned */
19077 static int alc662_auto_create_extra_out(struct hda_codec
*codec
, hda_nid_t pin
,
19080 struct alc_spec
*spec
= codec
->spec
;
19081 hda_nid_t nid
, mix
;
19086 nid
= alc_auto_look_for_dac(codec
, pin
);
19088 /* the corresponding DAC is already occupied */
19089 if (!(get_wcaps(codec
, pin
) & AC_WCAP_OUT_AMP
))
19090 return 0; /* no way */
19091 /* create a switch only */
19092 return add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
19093 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
19096 mix
= alc_auto_dac_to_mix(codec
, pin
, nid
);
19099 err
= alc662_add_vol_ctl(spec
, pfx
, nid
, 3);
19102 err
= alc662_add_sw_ctl(spec
, pfx
, mix
, 3);
19108 /* create playback/capture controls for input pins */
19109 #define alc662_auto_create_input_ctls \
19110 alc882_auto_create_input_ctls
19112 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
19113 hda_nid_t nid
, int pin_type
,
19117 hda_nid_t srcs
[HDA_MAX_CONNECTIONS
];
19119 alc_set_pin_output(codec
, nid
, pin_type
);
19120 num
= snd_hda_get_connections(codec
, nid
, srcs
, ARRAY_SIZE(srcs
));
19121 for (i
= 0; i
< num
; i
++) {
19122 if (alc_auto_mix_to_dac(codec
, srcs
[i
]) != dac
)
19124 /* need the manual connection? */
19126 snd_hda_codec_write(codec
, nid
, 0,
19127 AC_VERB_SET_CONNECT_SEL
, i
);
19128 /* unmute mixer widget inputs */
19129 snd_hda_codec_write(codec
, srcs
[i
], 0,
19130 AC_VERB_SET_AMP_GAIN_MUTE
,
19132 snd_hda_codec_write(codec
, srcs
[i
], 0,
19133 AC_VERB_SET_AMP_GAIN_MUTE
,
19139 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
19141 struct alc_spec
*spec
= codec
->spec
;
19142 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
19145 for (i
= 0; i
<= HDA_SIDE
; i
++) {
19146 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
19148 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
19149 spec
->multiout
.dac_nids
[i
]);
19153 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
19155 struct alc_spec
*spec
= codec
->spec
;
19158 pin
= spec
->autocfg
.hp_pins
[0];
19160 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
19161 spec
->multiout
.hp_nid
);
19162 pin
= spec
->autocfg
.speaker_pins
[0];
19164 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
,
19165 spec
->multiout
.extra_out_nid
[0]);
19168 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19170 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
19172 struct alc_spec
*spec
= codec
->spec
;
19173 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19176 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19177 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
19178 if (alc_is_input_pin(codec
, nid
)) {
19179 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
19180 if (nid
!= ALC662_PIN_CD_NID
&&
19181 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
19182 snd_hda_codec_write(codec
, nid
, 0,
19183 AC_VERB_SET_AMP_GAIN_MUTE
,
19189 #define alc662_auto_init_input_src alc882_auto_init_input_src
19194 static int alc_auto_fill_multi_ios(struct hda_codec
*codec
,
19195 unsigned int location
)
19197 struct alc_spec
*spec
= codec
->spec
;
19198 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19199 int type
, i
, num_pins
= 0;
19201 for (type
= AUTO_PIN_LINE_IN
; type
>= AUTO_PIN_MIC
; type
--) {
19202 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19203 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
19205 unsigned int defcfg
, caps
;
19206 if (cfg
->inputs
[i
].type
!= type
)
19208 defcfg
= snd_hda_codec_get_pincfg(codec
, nid
);
19209 if (get_defcfg_connect(defcfg
) != AC_JACK_PORT_COMPLEX
)
19211 if (location
&& get_defcfg_location(defcfg
) != location
)
19213 caps
= snd_hda_query_pin_caps(codec
, nid
);
19214 if (!(caps
& AC_PINCAP_OUT
))
19216 dac
= alc_auto_look_for_dac(codec
, nid
);
19219 spec
->multi_io
[num_pins
].pin
= nid
;
19220 spec
->multi_io
[num_pins
].dac
= dac
;
19222 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
19225 spec
->multiout
.num_dacs
= 1;
19231 static int alc_auto_ch_mode_info(struct snd_kcontrol
*kcontrol
,
19232 struct snd_ctl_elem_info
*uinfo
)
19234 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
19235 struct alc_spec
*spec
= codec
->spec
;
19237 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
19239 uinfo
->value
.enumerated
.items
= spec
->multi_ios
+ 1;
19240 if (uinfo
->value
.enumerated
.item
> spec
->multi_ios
)
19241 uinfo
->value
.enumerated
.item
= spec
->multi_ios
;
19242 sprintf(uinfo
->value
.enumerated
.name
, "%dch",
19243 (uinfo
->value
.enumerated
.item
+ 1) * 2);
19247 static int alc_auto_ch_mode_get(struct snd_kcontrol
*kcontrol
,
19248 struct snd_ctl_elem_value
*ucontrol
)
19250 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
19251 struct alc_spec
*spec
= codec
->spec
;
19252 ucontrol
->value
.enumerated
.item
[0] = (spec
->ext_channel_count
- 1) / 2;
19256 static int alc_set_multi_io(struct hda_codec
*codec
, int idx
, bool output
)
19258 struct alc_spec
*spec
= codec
->spec
;
19259 hda_nid_t nid
= spec
->multi_io
[idx
].pin
;
19261 if (!spec
->multi_io
[idx
].ctl_in
)
19262 spec
->multi_io
[idx
].ctl_in
=
19263 snd_hda_codec_read(codec
, nid
, 0,
19264 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
19266 snd_hda_codec_update_cache(codec
, nid
, 0,
19267 AC_VERB_SET_PIN_WIDGET_CONTROL
,
19269 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
19270 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
19272 alc_auto_select_dac(codec
, nid
, spec
->multi_io
[idx
].dac
);
19274 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
19275 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
19276 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
19277 snd_hda_codec_update_cache(codec
, nid
, 0,
19278 AC_VERB_SET_PIN_WIDGET_CONTROL
,
19279 spec
->multi_io
[idx
].ctl_in
);
19284 static int alc_auto_ch_mode_put(struct snd_kcontrol
*kcontrol
,
19285 struct snd_ctl_elem_value
*ucontrol
)
19287 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
19288 struct alc_spec
*spec
= codec
->spec
;
19291 ch
= ucontrol
->value
.enumerated
.item
[0];
19292 if (ch
< 0 || ch
> spec
->multi_ios
)
19294 if (ch
== (spec
->ext_channel_count
- 1) / 2)
19296 spec
->ext_channel_count
= (ch
+ 1) * 2;
19297 for (i
= 0; i
< spec
->multi_ios
; i
++)
19298 alc_set_multi_io(codec
, i
, i
< ch
);
19299 spec
->multiout
.max_channels
= spec
->ext_channel_count
;
19303 static const struct snd_kcontrol_new alc_auto_channel_mode_enum
= {
19304 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
19305 .name
= "Channel Mode",
19306 .info
= alc_auto_ch_mode_info
,
19307 .get
= alc_auto_ch_mode_get
,
19308 .put
= alc_auto_ch_mode_put
,
19311 static int alc_auto_add_multi_channel_mode(struct hda_codec
*codec
)
19313 struct alc_spec
*spec
= codec
->spec
;
19314 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19315 unsigned int location
, defcfg
;
19318 if (cfg
->line_outs
!= 1 ||
19319 cfg
->line_out_type
!= AUTO_PIN_LINE_OUT
)
19322 defcfg
= snd_hda_codec_get_pincfg(codec
, cfg
->line_out_pins
[0]);
19323 location
= get_defcfg_location(defcfg
);
19325 num_pins
= alc_auto_fill_multi_ios(codec
, location
);
19326 if (num_pins
> 0) {
19327 struct snd_kcontrol_new
*knew
;
19329 knew
= alc_kcontrol_new(spec
);
19332 *knew
= alc_auto_channel_mode_enum
;
19333 knew
->name
= kstrdup("Channel Mode", GFP_KERNEL
);
19337 spec
->multi_ios
= num_pins
;
19338 spec
->ext_channel_count
= 2;
19339 spec
->multiout
.num_dacs
= num_pins
+ 1;
19344 static int alc662_parse_auto_config(struct hda_codec
*codec
)
19346 struct alc_spec
*spec
= codec
->spec
;
19348 static const hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
19350 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
19354 if (!spec
->autocfg
.line_outs
)
19355 return 0; /* can't find valid BIOS pin config */
19357 err
= alc662_auto_fill_dac_nids(codec
, &spec
->autocfg
);
19360 err
= alc_auto_add_multi_channel_mode(codec
);
19363 err
= alc662_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
19366 err
= alc662_auto_create_extra_out(codec
,
19367 spec
->autocfg
.speaker_pins
[0],
19372 spec
->multiout
.extra_out_nid
[0] = err
;
19373 err
= alc662_auto_create_extra_out(codec
, spec
->autocfg
.hp_pins
[0],
19378 spec
->multiout
.hp_nid
= err
;
19379 err
= alc662_auto_create_input_ctls(codec
, &spec
->autocfg
);
19383 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
19385 alc_auto_parse_digital(codec
);
19387 if (spec
->kctls
.list
)
19388 add_mixer(spec
, spec
->kctls
.list
);
19390 spec
->num_mux_defs
= 1;
19391 spec
->input_mux
= &spec
->private_imux
[0];
19393 err
= alc_auto_add_mic_boost(codec
);
19397 if (codec
->vendor_id
== 0x10ec0272 || codec
->vendor_id
== 0x10ec0663 ||
19398 codec
->vendor_id
== 0x10ec0665 || codec
->vendor_id
== 0x10ec0670)
19399 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0x21);
19401 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
19406 /* additional initialization for auto-configuration model */
19407 static void alc662_auto_init(struct hda_codec
*codec
)
19409 struct alc_spec
*spec
= codec
->spec
;
19410 alc662_auto_init_multi_out(codec
);
19411 alc662_auto_init_hp_out(codec
);
19412 alc662_auto_init_analog_input(codec
);
19413 alc662_auto_init_input_src(codec
);
19414 alc_auto_init_digital(codec
);
19415 if (spec
->unsol_event
)
19416 alc_inithook(codec
);
19419 static void alc272_fixup_mario(struct hda_codec
*codec
,
19420 const struct alc_fixup
*fix
, int action
)
19422 if (action
!= ALC_FIXUP_ACT_PROBE
)
19424 if (snd_hda_override_amp_caps(codec
, 0x2, HDA_OUTPUT
,
19425 (0x3b << AC_AMPCAP_OFFSET_SHIFT
) |
19426 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT
) |
19427 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
19428 (0 << AC_AMPCAP_MUTE_SHIFT
)))
19429 printk(KERN_WARNING
19430 "hda_codec: failed to override amp caps for NID 0x2\n");
19434 ALC662_FIXUP_ASPIRE
,
19435 ALC662_FIXUP_IDEAPAD
,
19436 ALC272_FIXUP_MARIO
,
19437 ALC662_FIXUP_CZC_P10T
,
19438 ALC662_FIXUP_SKU_IGNORE
,
19441 static const struct alc_fixup alc662_fixups
[] = {
19442 [ALC662_FIXUP_ASPIRE
] = {
19443 .type
= ALC_FIXUP_PINS
,
19444 .v
.pins
= (const struct alc_pincfg
[]) {
19445 { 0x15, 0x99130112 }, /* subwoofer */
19449 [ALC662_FIXUP_IDEAPAD
] = {
19450 .type
= ALC_FIXUP_PINS
,
19451 .v
.pins
= (const struct alc_pincfg
[]) {
19452 { 0x17, 0x99130112 }, /* subwoofer */
19456 [ALC272_FIXUP_MARIO
] = {
19457 .type
= ALC_FIXUP_FUNC
,
19458 .v
.func
= alc272_fixup_mario
,
19460 [ALC662_FIXUP_CZC_P10T
] = {
19461 .type
= ALC_FIXUP_VERBS
,
19462 .v
.verbs
= (const struct hda_verb
[]) {
19463 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
19467 [ALC662_FIXUP_SKU_IGNORE
] = {
19468 .type
= ALC_FIXUP_SKU
,
19469 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
19473 static const struct snd_pci_quirk alc662_fixup_tbl
[] = {
19474 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE
),
19475 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE
),
19476 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE
),
19477 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD
),
19478 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD
),
19479 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD
),
19480 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T
),
19484 static const struct alc_model_fixup alc662_fixup_models
[] = {
19485 {.id
= ALC272_FIXUP_MARIO
, .name
= "mario"},
19490 static int patch_alc662(struct hda_codec
*codec
)
19492 struct alc_spec
*spec
;
19493 int err
, board_config
;
19496 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
19500 codec
->spec
= spec
;
19502 alc_auto_parse_customize_define(codec
);
19504 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
19506 coef
= alc_read_coef_idx(codec
, 0);
19507 if (coef
== 0x8020 || coef
== 0x8011)
19508 alc_codec_rename(codec
, "ALC661");
19509 else if (coef
& (1 << 14) &&
19510 codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
19511 spec
->cdefine
.platform_type
== 1)
19512 alc_codec_rename(codec
, "ALC272X");
19513 else if (coef
== 0x4011)
19514 alc_codec_rename(codec
, "ALC656");
19516 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
19519 if (board_config
< 0) {
19520 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
19522 board_config
= ALC662_AUTO
;
19525 if (board_config
== ALC662_AUTO
) {
19526 alc_pick_fixup(codec
, alc662_fixup_models
,
19527 alc662_fixup_tbl
, alc662_fixups
);
19528 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
19529 /* automatic parse from the BIOS config */
19530 err
= alc662_parse_auto_config(codec
);
19536 "hda_codec: Cannot set up configuration "
19537 "from BIOS. Using base mode...\n");
19538 board_config
= ALC662_3ST_2ch_DIG
;
19542 if (has_cdefine_beep(codec
)) {
19543 err
= snd_hda_attach_beep_device(codec
, 0x1);
19550 if (board_config
!= ALC662_AUTO
)
19551 setup_preset(codec
, &alc662_presets
[board_config
]);
19553 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
19554 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
19556 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
19557 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
19559 if (!spec
->adc_nids
) {
19560 spec
->adc_nids
= alc662_adc_nids
;
19561 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
19563 if (!spec
->capsrc_nids
)
19564 spec
->capsrc_nids
= alc662_capsrc_nids
;
19566 if (!spec
->cap_mixer
)
19567 set_capture_mixer(codec
);
19569 if (has_cdefine_beep(codec
)) {
19570 switch (codec
->vendor_id
) {
19572 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
19577 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
19580 set_beep_amp(spec
, 0x0b, 0x03, HDA_INPUT
);
19584 spec
->vmaster_nid
= 0x02;
19586 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
19588 codec
->patch_ops
= alc_patch_ops
;
19589 if (board_config
== ALC662_AUTO
)
19590 spec
->init_hook
= alc662_auto_init
;
19591 spec
->shutup
= alc_eapd_shutup
;
19593 alc_init_jacks(codec
);
19595 #ifdef CONFIG_SND_HDA_POWER_SAVE
19596 if (!spec
->loopback
.amplist
)
19597 spec
->loopback
.amplist
= alc662_loopbacks
;
19603 static int patch_alc888(struct hda_codec
*codec
)
19605 if ((alc_read_coef_idx(codec
, 0) & 0x00f0)==0x0030){
19606 kfree(codec
->chip_name
);
19607 if (codec
->vendor_id
== 0x10ec0887)
19608 codec
->chip_name
= kstrdup("ALC887-VD", GFP_KERNEL
);
19610 codec
->chip_name
= kstrdup("ALC888-VD", GFP_KERNEL
);
19611 if (!codec
->chip_name
) {
19615 return patch_alc662(codec
);
19617 return patch_alc882(codec
);
19620 static int patch_alc899(struct hda_codec
*codec
)
19622 if ((alc_read_coef_idx(codec
, 0) & 0x2000) != 0x2000) {
19623 kfree(codec
->chip_name
);
19624 codec
->chip_name
= kstrdup("ALC898", GFP_KERNEL
);
19626 return patch_alc882(codec
);
19632 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19633 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19634 #define alc680_modes alc260_modes
19636 static const hda_nid_t alc680_dac_nids
[3] = {
19637 /* Lout1, Lout2, hp */
19641 static const hda_nid_t alc680_adc_nids
[3] = {
19643 /* DMIC, MIC, Line-in*/
19648 * Analog capture ADC cgange
19650 static void alc680_rec_autoswitch(struct hda_codec
*codec
)
19652 struct alc_spec
*spec
= codec
->spec
;
19653 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19655 int type_found
= AUTO_PIN_LAST
;
19659 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19660 nid
= cfg
->inputs
[i
].pin
;
19661 if (!is_jack_detectable(codec
, nid
))
19663 if (snd_hda_jack_detect(codec
, nid
)) {
19664 if (cfg
->inputs
[i
].type
< type_found
) {
19665 type_found
= cfg
->inputs
[i
].type
;
19673 snd_hda_get_connections(codec
, pin_found
, &nid
, 1);
19675 if (nid
!= spec
->cur_adc
)
19676 __snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
, 1);
19677 spec
->cur_adc
= nid
;
19678 snd_hda_codec_setup_stream(codec
, nid
, spec
->cur_adc_stream_tag
, 0,
19679 spec
->cur_adc_format
);
19682 static int alc680_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
19683 struct hda_codec
*codec
,
19684 unsigned int stream_tag
,
19685 unsigned int format
,
19686 struct snd_pcm_substream
*substream
)
19688 struct alc_spec
*spec
= codec
->spec
;
19690 spec
->cur_adc
= 0x07;
19691 spec
->cur_adc_stream_tag
= stream_tag
;
19692 spec
->cur_adc_format
= format
;
19694 alc680_rec_autoswitch(codec
);
19698 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
19699 struct hda_codec
*codec
,
19700 struct snd_pcm_substream
*substream
)
19702 snd_hda_codec_cleanup_stream(codec
, 0x07);
19703 snd_hda_codec_cleanup_stream(codec
, 0x08);
19704 snd_hda_codec_cleanup_stream(codec
, 0x09);
19708 static const struct hda_pcm_stream alc680_pcm_analog_auto_capture
= {
19709 .substreams
= 1, /* can be overridden */
19712 /* NID is set in alc_build_pcms */
19714 .prepare
= alc680_capture_pcm_prepare
,
19715 .cleanup
= alc680_capture_pcm_cleanup
19719 static const struct snd_kcontrol_new alc680_base_mixer
[] = {
19720 /* output mixer control */
19721 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
19722 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
19723 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT
),
19724 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
19725 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT
),
19726 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
19727 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT
),
19731 static const struct hda_bind_ctls alc680_bind_cap_vol
= {
19732 .ops
= &snd_hda_bind_vol
,
19734 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT
),
19735 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
19736 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
19741 static const struct hda_bind_ctls alc680_bind_cap_switch
= {
19742 .ops
= &snd_hda_bind_sw
,
19744 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT
),
19745 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
19746 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
19751 static const struct snd_kcontrol_new alc680_master_capture_mixer
[] = {
19752 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol
),
19753 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch
),
19758 * generic initialization of ADC, input mixers and output mixers
19760 static const struct hda_verb alc680_init_verbs
[] = {
19761 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19762 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19763 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19765 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
19766 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
19767 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
19768 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
19769 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
19770 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
19772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19774 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19775 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19778 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
19779 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
19780 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
19785 /* toggle speaker-output according to the hp-jack state */
19786 static void alc680_base_setup(struct hda_codec
*codec
)
19788 struct alc_spec
*spec
= codec
->spec
;
19790 spec
->autocfg
.hp_pins
[0] = 0x16;
19791 spec
->autocfg
.speaker_pins
[0] = 0x14;
19792 spec
->autocfg
.speaker_pins
[1] = 0x15;
19793 spec
->autocfg
.num_inputs
= 2;
19794 spec
->autocfg
.inputs
[0].pin
= 0x18;
19795 spec
->autocfg
.inputs
[0].type
= AUTO_PIN_MIC
;
19796 spec
->autocfg
.inputs
[1].pin
= 0x19;
19797 spec
->autocfg
.inputs
[1].type
= AUTO_PIN_LINE_IN
;
19798 spec
->automute
= 1;
19799 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
19802 static void alc680_unsol_event(struct hda_codec
*codec
,
19805 if ((res
>> 26) == ALC880_HP_EVENT
)
19806 alc_hp_automute(codec
);
19807 if ((res
>> 26) == ALC880_MIC_EVENT
)
19808 alc680_rec_autoswitch(codec
);
19811 static void alc680_inithook(struct hda_codec
*codec
)
19813 alc_hp_automute(codec
);
19814 alc680_rec_autoswitch(codec
);
19817 /* create input playback/capture controls for the given pin */
19818 static int alc680_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
19819 const char *ctlname
, int idx
)
19837 if (spec
->multiout
.dac_nids
[0] != dac
&&
19838 spec
->multiout
.dac_nids
[1] != dac
) {
19839 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
19840 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
19845 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
19846 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
19850 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
19856 /* add playback controls from the parsed DAC table */
19857 static int alc680_auto_create_multi_out_ctls(struct alc_spec
*spec
,
19858 const struct auto_pin_cfg
*cfg
)
19863 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
19865 nid
= cfg
->line_out_pins
[0];
19868 if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
19872 err
= alc680_new_analog_output(spec
, nid
, name
, 0);
19877 nid
= cfg
->speaker_pins
[0];
19879 err
= alc680_new_analog_output(spec
, nid
, "Speaker", 0);
19883 nid
= cfg
->hp_pins
[0];
19885 err
= alc680_new_analog_output(spec
, nid
, "Headphone", 0);
19893 static void alc680_auto_set_output_and_unmute(struct hda_codec
*codec
,
19894 hda_nid_t nid
, int pin_type
)
19896 alc_set_pin_output(codec
, nid
, pin_type
);
19899 static void alc680_auto_init_multi_out(struct hda_codec
*codec
)
19901 struct alc_spec
*spec
= codec
->spec
;
19902 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[0];
19904 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
19905 alc680_auto_set_output_and_unmute(codec
, nid
, pin_type
);
19909 static void alc680_auto_init_hp_out(struct hda_codec
*codec
)
19911 struct alc_spec
*spec
= codec
->spec
;
19914 pin
= spec
->autocfg
.hp_pins
[0];
19916 alc680_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
19917 pin
= spec
->autocfg
.speaker_pins
[0];
19919 alc680_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
19922 /* pcm configuration: identical with ALC880 */
19923 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19924 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19925 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19926 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19927 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19930 * BIOS auto configuration
19932 static int alc680_parse_auto_config(struct hda_codec
*codec
)
19934 struct alc_spec
*spec
= codec
->spec
;
19936 static const hda_nid_t alc680_ignore
[] = { 0 };
19938 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
19943 if (!spec
->autocfg
.line_outs
) {
19944 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
19945 spec
->multiout
.max_channels
= 2;
19946 spec
->no_analog
= 1;
19949 return 0; /* can't find valid BIOS pin config */
19951 err
= alc680_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
19955 spec
->multiout
.max_channels
= 2;
19958 /* digital only support output */
19959 alc_auto_parse_digital(codec
);
19960 if (spec
->kctls
.list
)
19961 add_mixer(spec
, spec
->kctls
.list
);
19963 add_verb(spec
, alc680_init_verbs
);
19965 err
= alc_auto_add_mic_boost(codec
);
19972 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19974 /* init callback for auto-configuration model -- overriding the default init */
19975 static void alc680_auto_init(struct hda_codec
*codec
)
19977 struct alc_spec
*spec
= codec
->spec
;
19978 alc680_auto_init_multi_out(codec
);
19979 alc680_auto_init_hp_out(codec
);
19980 alc680_auto_init_analog_input(codec
);
19981 alc_auto_init_digital(codec
);
19982 if (spec
->unsol_event
)
19983 alc_inithook(codec
);
19987 * configuration and preset
19989 static const char * const alc680_models
[ALC680_MODEL_LAST
] = {
19990 [ALC680_BASE
] = "base",
19991 [ALC680_AUTO
] = "auto",
19994 static const struct snd_pci_quirk alc680_cfg_tbl
[] = {
19995 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE
),
19999 static const struct alc_config_preset alc680_presets
[] = {
20001 .mixers
= { alc680_base_mixer
},
20002 .cap_mixer
= alc680_master_capture_mixer
,
20003 .init_verbs
= { alc680_init_verbs
},
20004 .num_dacs
= ARRAY_SIZE(alc680_dac_nids
),
20005 .dac_nids
= alc680_dac_nids
,
20006 .dig_out_nid
= ALC680_DIGOUT_NID
,
20007 .num_channel_mode
= ARRAY_SIZE(alc680_modes
),
20008 .channel_mode
= alc680_modes
,
20009 .unsol_event
= alc680_unsol_event
,
20010 .setup
= alc680_base_setup
,
20011 .init_hook
= alc680_inithook
,
20016 static int patch_alc680(struct hda_codec
*codec
)
20018 struct alc_spec
*spec
;
20022 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
20026 codec
->spec
= spec
;
20028 board_config
= snd_hda_check_board_config(codec
, ALC680_MODEL_LAST
,
20032 if (board_config
< 0 || board_config
>= ALC680_MODEL_LAST
) {
20033 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
20035 board_config
= ALC680_AUTO
;
20038 if (board_config
== ALC680_AUTO
) {
20039 /* automatic parse from the BIOS config */
20040 err
= alc680_parse_auto_config(codec
);
20046 "hda_codec: Cannot set up configuration "
20047 "from BIOS. Using base mode...\n");
20048 board_config
= ALC680_BASE
;
20052 if (board_config
!= ALC680_AUTO
)
20053 setup_preset(codec
, &alc680_presets
[board_config
]);
20055 spec
->stream_analog_playback
= &alc680_pcm_analog_playback
;
20056 spec
->stream_analog_capture
= &alc680_pcm_analog_auto_capture
;
20057 spec
->stream_digital_playback
= &alc680_pcm_digital_playback
;
20058 spec
->stream_digital_capture
= &alc680_pcm_digital_capture
;
20060 if (!spec
->adc_nids
) {
20061 spec
->adc_nids
= alc680_adc_nids
;
20062 spec
->num_adc_nids
= ARRAY_SIZE(alc680_adc_nids
);
20065 if (!spec
->cap_mixer
)
20066 set_capture_mixer(codec
);
20068 spec
->vmaster_nid
= 0x02;
20070 codec
->patch_ops
= alc_patch_ops
;
20071 if (board_config
== ALC680_AUTO
)
20072 spec
->init_hook
= alc680_auto_init
;
20080 static const struct hda_codec_preset snd_hda_preset_realtek
[] = {
20081 { .id
= 0x10ec0221, .name
= "ALC221", .patch
= patch_alc269
},
20082 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
20083 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
20084 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
20085 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
20086 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
20087 { .id
= 0x10ec0270, .name
= "ALC270", .patch
= patch_alc269
},
20088 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
20089 { .id
= 0x10ec0275, .name
= "ALC275", .patch
= patch_alc269
},
20090 { .id
= 0x10ec0276, .name
= "ALC276", .patch
= patch_alc269
},
20091 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
20092 .patch
= patch_alc861
},
20093 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
20094 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
20095 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
20096 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
20097 .patch
= patch_alc882
},
20098 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
20099 .patch
= patch_alc662
},
20100 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
20101 { .id
= 0x10ec0665, .name
= "ALC665", .patch
= patch_alc662
},
20102 { .id
= 0x10ec0670, .name
= "ALC670", .patch
= patch_alc662
},
20103 { .id
= 0x10ec0680, .name
= "ALC680", .patch
= patch_alc680
},
20104 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
20105 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
20106 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc882
},
20107 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
20108 .patch
= patch_alc882
},
20109 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
20110 .patch
= patch_alc882
},
20111 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
20112 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc888
},
20113 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
20114 .patch
= patch_alc882
},
20115 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc888
},
20116 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc882
},
20117 { .id
= 0x10ec0892, .name
= "ALC892", .patch
= patch_alc662
},
20118 { .id
= 0x10ec0899, .name
= "ALC899", .patch
= patch_alc899
},
20119 {} /* terminator */
20122 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20124 MODULE_LICENSE("GPL");
20125 MODULE_DESCRIPTION("Realtek HD-audio codec");
20127 static struct hda_codec_preset_list realtek_list
= {
20128 .preset
= snd_hda_preset_realtek
,
20129 .owner
= THIS_MODULE
,
20132 static int __init
patch_realtek_init(void)
20134 return snd_hda_add_codec_preset(&realtek_list
);
20137 static void __exit
patch_realtek_exit(void)
20139 snd_hda_delete_codec_preset(&realtek_list
);
20142 module_init(patch_realtek_init
)
20143 module_exit(patch_realtek_exit
)