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 /* Control HP pins/amps depending on master_mute state;
1145 * in general, HP pins/amps control should be enabled in all cases,
1146 * but currently set only for master_mute, just to be safe
1148 do_automute(codec
, ARRAY_SIZE(spec
->autocfg
.hp_pins
),
1149 spec
->autocfg
.hp_pins
, spec
->master_mute
, true);
1151 if (!spec
->automute
)
1154 on
= spec
->jack_present
| spec
->line_jack_present
;
1155 on
|= spec
->master_mute
;
1156 do_automute(codec
, ARRAY_SIZE(spec
->autocfg
.speaker_pins
),
1157 spec
->autocfg
.speaker_pins
, on
, false);
1159 /* toggle line-out mutes if needed, too */
1160 /* if LO is a copy of either HP or Speaker, don't need to handle it */
1161 if (spec
->autocfg
.line_out_pins
[0] == spec
->autocfg
.hp_pins
[0] ||
1162 spec
->autocfg
.line_out_pins
[0] == spec
->autocfg
.speaker_pins
[0])
1164 if (!spec
->automute_lines
|| !spec
->automute
)
1167 on
= spec
->jack_present
;
1168 on
|= spec
->master_mute
;
1169 do_automute(codec
, ARRAY_SIZE(spec
->autocfg
.line_out_pins
),
1170 spec
->autocfg
.line_out_pins
, on
, false);
1173 static void alc_hp_automute(struct hda_codec
*codec
)
1175 struct alc_spec
*spec
= codec
->spec
;
1177 if (!spec
->automute
)
1179 spec
->jack_present
=
1180 detect_jacks(codec
, ARRAY_SIZE(spec
->autocfg
.hp_pins
),
1181 spec
->autocfg
.hp_pins
);
1182 update_speakers(codec
);
1185 static void alc_line_automute(struct hda_codec
*codec
)
1187 struct alc_spec
*spec
= codec
->spec
;
1189 if (!spec
->automute
|| !spec
->detect_line
)
1191 spec
->line_jack_present
=
1192 detect_jacks(codec
, ARRAY_SIZE(spec
->autocfg
.line_out_pins
),
1193 spec
->autocfg
.line_out_pins
);
1194 update_speakers(codec
);
1197 static int get_connection_index(struct hda_codec
*codec
, hda_nid_t mux
,
1200 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
1203 nums
= snd_hda_get_connections(codec
, mux
, conn
, ARRAY_SIZE(conn
));
1204 for (i
= 0; i
< nums
; i
++)
1210 /* switch the current ADC according to the jack state */
1211 static void alc_dual_mic_adc_auto_switch(struct hda_codec
*codec
)
1213 struct alc_spec
*spec
= codec
->spec
;
1214 unsigned int present
;
1217 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1219 spec
->cur_adc_idx
= 1;
1221 spec
->cur_adc_idx
= 0;
1222 new_adc
= spec
->adc_nids
[spec
->cur_adc_idx
];
1223 if (spec
->cur_adc
&& spec
->cur_adc
!= new_adc
) {
1224 /* stream is running, let's swap the current ADC */
1225 __snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
, 1);
1226 spec
->cur_adc
= new_adc
;
1227 snd_hda_codec_setup_stream(codec
, new_adc
,
1228 spec
->cur_adc_stream_tag
, 0,
1229 spec
->cur_adc_format
);
1233 static void alc_mic_automute(struct hda_codec
*codec
)
1235 struct alc_spec
*spec
= codec
->spec
;
1236 struct alc_mic_route
*dead1
, *dead2
, *alive
;
1237 unsigned int present
, type
;
1240 if (!spec
->auto_mic
)
1242 if (!spec
->int_mic
.pin
|| !spec
->ext_mic
.pin
)
1244 if (snd_BUG_ON(!spec
->adc_nids
))
1247 if (spec
->dual_adc_switch
) {
1248 alc_dual_mic_adc_auto_switch(codec
);
1252 cap_nid
= spec
->capsrc_nids
? spec
->capsrc_nids
[0] : spec
->adc_nids
[0];
1254 alive
= &spec
->int_mic
;
1255 dead1
= &spec
->ext_mic
;
1256 dead2
= &spec
->dock_mic
;
1258 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1260 alive
= &spec
->ext_mic
;
1261 dead1
= &spec
->int_mic
;
1262 dead2
= &spec
->dock_mic
;
1264 if (!present
&& spec
->dock_mic
.pin
> 0) {
1265 present
= snd_hda_jack_detect(codec
, spec
->dock_mic
.pin
);
1267 alive
= &spec
->dock_mic
;
1268 dead1
= &spec
->int_mic
;
1269 dead2
= &spec
->ext_mic
;
1271 snd_hda_input_jack_report(codec
, spec
->dock_mic
.pin
);
1274 type
= get_wcaps_type(get_wcaps(codec
, cap_nid
));
1275 if (type
== AC_WID_AUD_MIX
) {
1276 /* Matrix-mixer style (e.g. ALC882) */
1277 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1281 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1283 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
1285 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1287 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
1289 /* MUX style (e.g. ALC880) */
1290 snd_hda_codec_write_cache(codec
, cap_nid
, 0,
1291 AC_VERB_SET_CONNECT_SEL
,
1294 snd_hda_input_jack_report(codec
, spec
->ext_mic
.pin
);
1296 /* FIXME: analog mixer */
1299 /* unsolicited event for HP jack sensing */
1300 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1302 if (codec
->vendor_id
== 0x10ec0880)
1307 case ALC880_HP_EVENT
:
1308 alc_hp_automute(codec
);
1310 case ALC880_FRONT_EVENT
:
1311 alc_line_automute(codec
);
1313 case ALC880_MIC_EVENT
:
1314 alc_mic_automute(codec
);
1319 static void alc_inithook(struct hda_codec
*codec
)
1321 alc_hp_automute(codec
);
1322 alc_line_automute(codec
);
1323 alc_mic_automute(codec
);
1326 /* additional initialization for ALC888 variants */
1327 static void alc888_coef_init(struct hda_codec
*codec
)
1331 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
1332 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1333 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1334 if ((tmp
& 0xf0) == 0x20)
1336 snd_hda_codec_read(codec
, 0x20, 0,
1337 AC_VERB_SET_PROC_COEF
, 0x830);
1340 snd_hda_codec_read(codec
, 0x20, 0,
1341 AC_VERB_SET_PROC_COEF
, 0x3030);
1344 static void alc889_coef_init(struct hda_codec
*codec
)
1348 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1349 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1350 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1351 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
, tmp
|0x2010);
1354 /* turn on/off EAPD control (only if available) */
1355 static void set_eapd(struct hda_codec
*codec
, hda_nid_t nid
, int on
)
1357 if (get_wcaps_type(get_wcaps(codec
, nid
)) != AC_WID_PIN
)
1359 if (snd_hda_query_pin_caps(codec
, nid
) & AC_PINCAP_EAPD
)
1360 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
1364 /* turn on/off EAPD controls of the codec */
1365 static void alc_auto_setup_eapd(struct hda_codec
*codec
, bool on
)
1367 /* We currently only handle front, HP */
1368 switch (codec
->vendor_id
) {
1370 set_eapd(codec
, 0x0f, on
);
1371 set_eapd(codec
, 0x10, on
);
1386 set_eapd(codec
, 0x14, on
);
1387 set_eapd(codec
, 0x15, on
);
1392 /* generic shutup callback;
1393 * just turning off EPAD and a little pause for avoiding pop-noise
1395 static void alc_eapd_shutup(struct hda_codec
*codec
)
1397 alc_auto_setup_eapd(codec
, false);
1401 static void alc_auto_init_amp(struct hda_codec
*codec
, int type
)
1406 case ALC_INIT_GPIO1
:
1407 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
1409 case ALC_INIT_GPIO2
:
1410 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
1412 case ALC_INIT_GPIO3
:
1413 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
1415 case ALC_INIT_DEFAULT
:
1416 alc_auto_setup_eapd(codec
, true);
1417 switch (codec
->vendor_id
) {
1419 snd_hda_codec_write(codec
, 0x1a, 0,
1420 AC_VERB_SET_COEF_INDEX
, 7);
1421 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
1422 AC_VERB_GET_PROC_COEF
, 0);
1423 snd_hda_codec_write(codec
, 0x1a, 0,
1424 AC_VERB_SET_COEF_INDEX
, 7);
1425 snd_hda_codec_write(codec
, 0x1a, 0,
1426 AC_VERB_SET_PROC_COEF
,
1435 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
1436 alc889_coef_init(codec
);
1439 alc888_coef_init(codec
);
1441 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1444 snd_hda_codec_write(codec
, 0x20, 0,
1445 AC_VERB_SET_COEF_INDEX
, 7);
1446 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1447 AC_VERB_GET_PROC_COEF
, 0);
1448 snd_hda_codec_write(codec
, 0x20, 0,
1449 AC_VERB_SET_COEF_INDEX
, 7);
1450 snd_hda_codec_write(codec
, 0x20, 0,
1451 AC_VERB_SET_PROC_COEF
,
1460 static int alc_automute_mode_info(struct snd_kcontrol
*kcontrol
,
1461 struct snd_ctl_elem_info
*uinfo
)
1463 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1464 struct alc_spec
*spec
= codec
->spec
;
1465 static const char * const texts2
[] = {
1466 "Disabled", "Enabled"
1468 static const char * const texts3
[] = {
1469 "Disabled", "Speaker Only", "Line-Out+Speaker"
1471 const char * const *texts
;
1473 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
1475 if (spec
->automute_hp_lo
) {
1476 uinfo
->value
.enumerated
.items
= 3;
1479 uinfo
->value
.enumerated
.items
= 2;
1482 if (uinfo
->value
.enumerated
.item
>= uinfo
->value
.enumerated
.items
)
1483 uinfo
->value
.enumerated
.item
= uinfo
->value
.enumerated
.items
- 1;
1484 strcpy(uinfo
->value
.enumerated
.name
,
1485 texts
[uinfo
->value
.enumerated
.item
]);
1489 static int alc_automute_mode_get(struct snd_kcontrol
*kcontrol
,
1490 struct snd_ctl_elem_value
*ucontrol
)
1492 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1493 struct alc_spec
*spec
= codec
->spec
;
1495 if (!spec
->automute
)
1497 else if (!spec
->automute_lines
)
1501 ucontrol
->value
.enumerated
.item
[0] = val
;
1505 static int alc_automute_mode_put(struct snd_kcontrol
*kcontrol
,
1506 struct snd_ctl_elem_value
*ucontrol
)
1508 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1509 struct alc_spec
*spec
= codec
->spec
;
1511 switch (ucontrol
->value
.enumerated
.item
[0]) {
1513 if (!spec
->automute
)
1518 if (spec
->automute
&& !spec
->automute_lines
)
1521 spec
->automute_lines
= 0;
1524 if (!spec
->automute_hp_lo
)
1526 if (spec
->automute
&& spec
->automute_lines
)
1529 spec
->automute_lines
= 1;
1534 update_speakers(codec
);
1538 static const struct snd_kcontrol_new alc_automute_mode_enum
= {
1539 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1540 .name
= "Auto-Mute Mode",
1541 .info
= alc_automute_mode_info
,
1542 .get
= alc_automute_mode_get
,
1543 .put
= alc_automute_mode_put
,
1546 static struct snd_kcontrol_new
*alc_kcontrol_new(struct alc_spec
*spec
);
1548 static int alc_add_automute_mode_enum(struct hda_codec
*codec
)
1550 struct alc_spec
*spec
= codec
->spec
;
1551 struct snd_kcontrol_new
*knew
;
1553 knew
= alc_kcontrol_new(spec
);
1556 *knew
= alc_automute_mode_enum
;
1557 knew
->name
= kstrdup("Auto-Mute Mode", GFP_KERNEL
);
1563 static void alc_init_auto_hp(struct hda_codec
*codec
)
1565 struct alc_spec
*spec
= codec
->spec
;
1566 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1570 if (cfg
->hp_pins
[0])
1572 if (cfg
->line_out_pins
[0])
1574 if (cfg
->speaker_pins
[0])
1576 if (present
< 2) /* need two different output types */
1579 spec
->automute_hp_lo
= 1; /* both HP and LO automute */
1581 if (!cfg
->speaker_pins
[0]) {
1582 memcpy(cfg
->speaker_pins
, cfg
->line_out_pins
,
1583 sizeof(cfg
->speaker_pins
));
1584 cfg
->speaker_outs
= cfg
->line_outs
;
1587 if (!cfg
->hp_pins
[0]) {
1588 memcpy(cfg
->hp_pins
, cfg
->line_out_pins
,
1589 sizeof(cfg
->hp_pins
));
1590 cfg
->hp_outs
= cfg
->line_outs
;
1593 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
1594 hda_nid_t nid
= cfg
->hp_pins
[i
];
1595 if (!is_jack_detectable(codec
, nid
))
1597 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1599 snd_hda_codec_write_cache(codec
, nid
, 0,
1600 AC_VERB_SET_UNSOLICITED_ENABLE
,
1601 AC_USRSP_EN
| ALC880_HP_EVENT
);
1603 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
1605 if (spec
->automute
&& cfg
->line_out_pins
[0] &&
1606 cfg
->line_out_pins
[0] != cfg
->hp_pins
[0] &&
1607 cfg
->line_out_pins
[0] != cfg
->speaker_pins
[0]) {
1608 for (i
= 0; i
< cfg
->line_outs
; i
++) {
1609 hda_nid_t nid
= cfg
->line_out_pins
[i
];
1610 if (!is_jack_detectable(codec
, nid
))
1612 snd_printdd("realtek: Enable Line-Out auto-muting "
1613 "on NID 0x%x\n", nid
);
1614 snd_hda_codec_write_cache(codec
, nid
, 0,
1615 AC_VERB_SET_UNSOLICITED_ENABLE
,
1616 AC_USRSP_EN
| ALC880_FRONT_EVENT
);
1617 spec
->detect_line
= 1;
1619 spec
->automute_lines
= spec
->detect_line
;
1622 if (spec
->automute
) {
1623 /* create a control for automute mode */
1624 alc_add_automute_mode_enum(codec
);
1625 spec
->unsol_event
= alc_sku_unsol_event
;
1629 static void alc_init_auto_mic(struct hda_codec
*codec
)
1631 struct alc_spec
*spec
= codec
->spec
;
1632 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1633 hda_nid_t fixed
, ext
, dock
;
1636 fixed
= ext
= dock
= 0;
1637 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
1638 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
1639 unsigned int defcfg
;
1640 defcfg
= snd_hda_codec_get_pincfg(codec
, nid
);
1641 switch (snd_hda_get_input_pin_attr(defcfg
)) {
1642 case INPUT_PIN_ATTR_INT
:
1644 return; /* already occupied */
1645 if (cfg
->inputs
[i
].type
!= AUTO_PIN_MIC
)
1646 return; /* invalid type */
1649 case INPUT_PIN_ATTR_UNUSED
:
1650 return; /* invalid entry */
1651 case INPUT_PIN_ATTR_DOCK
:
1653 return; /* already occupied */
1654 if (cfg
->inputs
[i
].type
> AUTO_PIN_LINE_IN
)
1655 return; /* invalid type */
1660 return; /* already occupied */
1661 if (cfg
->inputs
[i
].type
!= AUTO_PIN_MIC
)
1662 return; /* invalid type */
1673 if (!is_jack_detectable(codec
, ext
))
1674 return; /* no unsol support */
1675 if (dock
&& !is_jack_detectable(codec
, dock
))
1676 return; /* no unsol support */
1677 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
1679 spec
->ext_mic
.pin
= ext
;
1680 spec
->dock_mic
.pin
= dock
;
1681 spec
->int_mic
.pin
= fixed
;
1682 spec
->ext_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1683 spec
->dock_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1684 spec
->int_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1686 snd_hda_codec_write_cache(codec
, spec
->ext_mic
.pin
, 0,
1687 AC_VERB_SET_UNSOLICITED_ENABLE
,
1688 AC_USRSP_EN
| ALC880_MIC_EVENT
);
1689 spec
->unsol_event
= alc_sku_unsol_event
;
1692 /* Could be any non-zero and even value. When used as fixup, tells
1693 * the driver to ignore any present sku defines.
1695 #define ALC_FIXUP_SKU_IGNORE (2)
1697 static int alc_auto_parse_customize_define(struct hda_codec
*codec
)
1699 unsigned int ass
, tmp
, i
;
1701 struct alc_spec
*spec
= codec
->spec
;
1703 spec
->cdefine
.enable_pcbeep
= 1; /* assume always enabled */
1705 if (spec
->cdefine
.fixup
) {
1706 ass
= spec
->cdefine
.sku_cfg
;
1707 if (ass
== ALC_FIXUP_SKU_IGNORE
)
1712 ass
= codec
->subsystem_id
& 0xffff;
1713 if (ass
!= codec
->bus
->pci
->subsystem_device
&& (ass
& 1))
1717 if (codec
->vendor_id
== 0x10ec0260)
1719 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1722 printk(KERN_INFO
"hda_codec: %s: SKU not ready 0x%08x\n",
1723 codec
->chip_name
, ass
);
1729 for (i
= 1; i
< 16; i
++) {
1733 if (((ass
>> 16) & 0xf) != tmp
)
1736 spec
->cdefine
.port_connectivity
= ass
>> 30;
1737 spec
->cdefine
.enable_pcbeep
= (ass
& 0x100000) >> 20;
1738 spec
->cdefine
.check_sum
= (ass
>> 16) & 0xf;
1739 spec
->cdefine
.customization
= ass
>> 8;
1741 spec
->cdefine
.sku_cfg
= ass
;
1742 spec
->cdefine
.external_amp
= (ass
& 0x38) >> 3;
1743 spec
->cdefine
.platform_type
= (ass
& 0x4) >> 2;
1744 spec
->cdefine
.swap
= (ass
& 0x2) >> 1;
1745 spec
->cdefine
.override
= ass
& 0x1;
1747 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1748 nid
, spec
->cdefine
.sku_cfg
);
1749 snd_printd("SKU: port_connectivity=0x%x\n",
1750 spec
->cdefine
.port_connectivity
);
1751 snd_printd("SKU: enable_pcbeep=0x%x\n", spec
->cdefine
.enable_pcbeep
);
1752 snd_printd("SKU: check_sum=0x%08x\n", spec
->cdefine
.check_sum
);
1753 snd_printd("SKU: customization=0x%08x\n", spec
->cdefine
.customization
);
1754 snd_printd("SKU: external_amp=0x%x\n", spec
->cdefine
.external_amp
);
1755 snd_printd("SKU: platform_type=0x%x\n", spec
->cdefine
.platform_type
);
1756 snd_printd("SKU: swap=0x%x\n", spec
->cdefine
.swap
);
1757 snd_printd("SKU: override=0x%x\n", spec
->cdefine
.override
);
1762 /* check subsystem ID and set up device-specific initialization;
1763 * return 1 if initialized, 0 if invalid SSID
1765 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1766 * 31 ~ 16 : Manufacture ID
1768 * 7 ~ 0 : Assembly ID
1769 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1771 static int alc_subsystem_id(struct hda_codec
*codec
,
1772 hda_nid_t porta
, hda_nid_t porte
,
1773 hda_nid_t portd
, hda_nid_t porti
)
1775 unsigned int ass
, tmp
, i
;
1777 struct alc_spec
*spec
= codec
->spec
;
1779 if (spec
->cdefine
.fixup
) {
1780 ass
= spec
->cdefine
.sku_cfg
;
1781 if (ass
== ALC_FIXUP_SKU_IGNORE
)
1786 ass
= codec
->subsystem_id
& 0xffff;
1787 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
1790 /* invalid SSID, check the special NID pin defcfg instead */
1792 * 31~30 : port connectivity
1795 * 19~16 : Check sum (15:1)
1800 if (codec
->vendor_id
== 0x10ec0260)
1802 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1803 snd_printd("realtek: No valid SSID, "
1804 "checking pincfg 0x%08x for NID 0x%x\n",
1808 if ((ass
>> 30) != 1) /* no physical connection */
1813 for (i
= 1; i
< 16; i
++) {
1817 if (((ass
>> 16) & 0xf) != tmp
)
1820 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1821 ass
& 0xffff, codec
->vendor_id
);
1825 * 2 : 0 --> Desktop, 1 --> Laptop
1826 * 3~5 : External Amplifier control
1829 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
1832 spec
->init_amp
= ALC_INIT_GPIO1
;
1835 spec
->init_amp
= ALC_INIT_GPIO2
;
1838 spec
->init_amp
= ALC_INIT_GPIO3
;
1842 spec
->init_amp
= ALC_INIT_DEFAULT
;
1846 /* is laptop or Desktop and enable the function "Mute internal speaker
1847 * when the external headphone out jack is plugged"
1849 if (!(ass
& 0x8000))
1852 * 10~8 : Jack location
1853 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1855 * 15 : 1 --> enable the function "Mute internal speaker
1856 * when the external headphone out jack is plugged"
1858 if (!spec
->autocfg
.hp_pins
[0]) {
1860 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
1871 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++)
1872 if (spec
->autocfg
.line_out_pins
[i
] == nid
)
1874 spec
->autocfg
.hp_pins
[0] = nid
;
1879 static void alc_ssid_check(struct hda_codec
*codec
,
1880 hda_nid_t porta
, hda_nid_t porte
,
1881 hda_nid_t portd
, hda_nid_t porti
)
1883 if (!alc_subsystem_id(codec
, porta
, porte
, portd
, porti
)) {
1884 struct alc_spec
*spec
= codec
->spec
;
1885 snd_printd("realtek: "
1886 "Enable default setup for auto mode as fallback\n");
1887 spec
->init_amp
= ALC_INIT_DEFAULT
;
1890 alc_init_auto_hp(codec
);
1891 alc_init_auto_mic(codec
);
1895 * Fix-up pin default configurations and add default verbs
1903 struct alc_model_fixup
{
1914 const struct alc_pincfg
*pins
;
1915 const struct hda_verb
*verbs
;
1916 void (*func
)(struct hda_codec
*codec
,
1917 const struct alc_fixup
*fix
,
1931 ALC_FIXUP_ACT_PRE_PROBE
,
1932 ALC_FIXUP_ACT_PROBE
,
1936 static void alc_apply_fixup(struct hda_codec
*codec
, int action
)
1938 struct alc_spec
*spec
= codec
->spec
;
1939 int id
= spec
->fixup_id
;
1940 #ifdef CONFIG_SND_DEBUG_VERBOSE
1941 const char *modelname
= spec
->fixup_name
;
1945 if (!spec
->fixup_list
)
1949 const struct alc_fixup
*fix
= spec
->fixup_list
+ id
;
1950 const struct alc_pincfg
*cfg
;
1952 switch (fix
->type
) {
1954 if (action
!= ALC_FIXUP_ACT_PRE_PROBE
|| !fix
->v
.sku
)
1956 snd_printdd(KERN_INFO
"hda_codec: %s: "
1957 "Apply sku override for %s\n",
1958 codec
->chip_name
, modelname
);
1959 spec
->cdefine
.sku_cfg
= fix
->v
.sku
;
1960 spec
->cdefine
.fixup
= 1;
1962 case ALC_FIXUP_PINS
:
1964 if (action
!= ALC_FIXUP_ACT_PRE_PROBE
|| !cfg
)
1966 snd_printdd(KERN_INFO
"hda_codec: %s: "
1967 "Apply pincfg for %s\n",
1968 codec
->chip_name
, modelname
);
1969 for (; cfg
->nid
; cfg
++)
1970 snd_hda_codec_set_pincfg(codec
, cfg
->nid
,
1973 case ALC_FIXUP_VERBS
:
1974 if (action
!= ALC_FIXUP_ACT_PROBE
|| !fix
->v
.verbs
)
1976 snd_printdd(KERN_INFO
"hda_codec: %s: "
1977 "Apply fix-verbs for %s\n",
1978 codec
->chip_name
, modelname
);
1979 add_verb(codec
->spec
, fix
->v
.verbs
);
1981 case ALC_FIXUP_FUNC
:
1984 snd_printdd(KERN_INFO
"hda_codec: %s: "
1985 "Apply fix-func for %s\n",
1986 codec
->chip_name
, modelname
);
1987 fix
->v
.func(codec
, fix
, action
);
1990 snd_printk(KERN_ERR
"hda_codec: %s: "
1991 "Invalid fixup type %d\n",
1992 codec
->chip_name
, fix
->type
);
2003 static void alc_pick_fixup(struct hda_codec
*codec
,
2004 const struct alc_model_fixup
*models
,
2005 const struct snd_pci_quirk
*quirk
,
2006 const struct alc_fixup
*fixlist
)
2008 struct alc_spec
*spec
= codec
->spec
;
2010 const char *name
= NULL
;
2012 if (codec
->modelname
&& models
) {
2013 while (models
->name
) {
2014 if (!strcmp(codec
->modelname
, models
->name
)) {
2016 name
= models
->name
;
2023 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
2026 #ifdef CONFIG_SND_DEBUG_VERBOSE
2032 spec
->fixup_id
= id
;
2034 spec
->fixup_list
= fixlist
;
2035 spec
->fixup_name
= name
;
2039 static int alc_read_coef_idx(struct hda_codec
*codec
,
2040 unsigned int coef_idx
)
2043 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
2045 val
= snd_hda_codec_read(codec
, 0x20, 0,
2046 AC_VERB_GET_PROC_COEF
, 0);
2050 static void alc_write_coef_idx(struct hda_codec
*codec
, unsigned int coef_idx
,
2051 unsigned int coef_val
)
2053 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
2055 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
,
2059 /* set right pin controls for digital I/O */
2060 static void alc_auto_init_digital(struct hda_codec
*codec
)
2062 struct alc_spec
*spec
= codec
->spec
;
2066 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
2067 pin
= spec
->autocfg
.dig_out_pins
[i
];
2069 snd_hda_codec_write(codec
, pin
, 0,
2070 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2074 pin
= spec
->autocfg
.dig_in_pin
;
2076 snd_hda_codec_write(codec
, pin
, 0,
2077 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2081 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
2082 static void alc_auto_parse_digital(struct hda_codec
*codec
)
2084 struct alc_spec
*spec
= codec
->spec
;
2088 /* support multiple SPDIFs; the secondary is set up as a slave */
2089 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
2090 err
= snd_hda_get_connections(codec
,
2091 spec
->autocfg
.dig_out_pins
[i
],
2096 spec
->multiout
.dig_out_nid
= dig_nid
;
2097 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
2099 spec
->multiout
.slave_dig_outs
= spec
->slave_dig_outs
;
2100 if (i
>= ARRAY_SIZE(spec
->slave_dig_outs
) - 1)
2102 spec
->slave_dig_outs
[i
- 1] = dig_nid
;
2106 if (spec
->autocfg
.dig_in_pin
) {
2107 dig_nid
= codec
->start_nid
;
2108 for (i
= 0; i
< codec
->num_nodes
; i
++, dig_nid
++) {
2109 unsigned int wcaps
= get_wcaps(codec
, dig_nid
);
2110 if (get_wcaps_type(wcaps
) != AC_WID_AUD_IN
)
2112 if (!(wcaps
& AC_WCAP_DIGITAL
))
2114 if (!(wcaps
& AC_WCAP_CONN_LIST
))
2116 err
= get_connection_index(codec
, dig_nid
,
2117 spec
->autocfg
.dig_in_pin
);
2119 spec
->dig_in_nid
= dig_nid
;
2133 static const struct hda_verb alc888_4ST_ch2_intel_init
[] = {
2134 /* Mic-in jack as mic in */
2135 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2136 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2137 /* Line-in jack as Line in */
2138 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2139 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2140 /* Line-Out as Front */
2141 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
2148 static const struct hda_verb alc888_4ST_ch4_intel_init
[] = {
2149 /* Mic-in jack as mic in */
2150 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2151 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2152 /* Line-in jack as Surround */
2153 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2154 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2155 /* Line-Out as Front */
2156 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
2163 static const struct hda_verb alc888_4ST_ch6_intel_init
[] = {
2164 /* Mic-in jack as CLFE */
2165 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2166 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2167 /* Line-in jack as Surround */
2168 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2169 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2170 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
2171 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
2178 static const struct hda_verb alc888_4ST_ch8_intel_init
[] = {
2179 /* Mic-in jack as CLFE */
2180 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2181 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2182 /* Line-in jack as Surround */
2183 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2184 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2185 /* Line-Out as Side */
2186 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
2190 static const struct hda_channel_mode alc888_4ST_8ch_intel_modes
[4] = {
2191 { 2, alc888_4ST_ch2_intel_init
},
2192 { 4, alc888_4ST_ch4_intel_init
},
2193 { 6, alc888_4ST_ch6_intel_init
},
2194 { 8, alc888_4ST_ch8_intel_init
},
2198 * ALC888 Fujitsu Siemens Amillo xa3530
2201 static const struct hda_verb alc888_fujitsu_xa3530_verbs
[] = {
2202 /* Front Mic: set to PIN_IN (empty by default) */
2203 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2204 /* Connect Internal HP to Front */
2205 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2206 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2207 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2208 /* Connect Bass HP to Front */
2209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2210 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2211 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2212 /* Connect Line-Out side jack (SPDIF) to Side */
2213 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2214 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2215 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
2216 /* Connect Mic jack to CLFE */
2217 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2218 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2219 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
2220 /* Connect Line-in jack to Surround */
2221 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2222 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2223 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
2224 /* Connect HP out jack to Front */
2225 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2226 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2227 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2228 /* Enable unsolicited event for HP jack and Line-out jack */
2229 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2230 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2234 static void alc889_automute_setup(struct hda_codec
*codec
)
2236 struct alc_spec
*spec
= codec
->spec
;
2238 spec
->autocfg
.hp_pins
[0] = 0x15;
2239 spec
->autocfg
.speaker_pins
[0] = 0x14;
2240 spec
->autocfg
.speaker_pins
[1] = 0x16;
2241 spec
->autocfg
.speaker_pins
[2] = 0x17;
2242 spec
->autocfg
.speaker_pins
[3] = 0x19;
2243 spec
->autocfg
.speaker_pins
[4] = 0x1a;
2245 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2248 static void alc889_intel_init_hook(struct hda_codec
*codec
)
2250 alc889_coef_init(codec
);
2251 alc_hp_automute(codec
);
2254 static void alc888_fujitsu_xa3530_setup(struct hda_codec
*codec
)
2256 struct alc_spec
*spec
= codec
->spec
;
2258 spec
->autocfg
.hp_pins
[0] = 0x17; /* line-out */
2259 spec
->autocfg
.hp_pins
[1] = 0x1b; /* hp */
2260 spec
->autocfg
.speaker_pins
[0] = 0x14; /* speaker */
2261 spec
->autocfg
.speaker_pins
[1] = 0x15; /* bass */
2263 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2267 * ALC888 Acer Aspire 4930G model
2270 static const struct hda_verb alc888_acer_aspire_4930g_verbs
[] = {
2271 /* Front Mic: set to PIN_IN (empty by default) */
2272 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2273 /* Unselect Front Mic by default in input mixer 3 */
2274 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2275 /* Enable unsolicited event for HP jack */
2276 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2277 /* Connect Internal HP to front */
2278 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2279 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2280 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2281 /* Connect HP out to front */
2282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2284 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2285 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2290 * ALC888 Acer Aspire 6530G model
2293 static const struct hda_verb alc888_acer_aspire_6530g_verbs
[] = {
2294 /* Route to built-in subwoofer as well as speakers */
2295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2297 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2298 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2299 /* Bias voltage on for external mic port */
2300 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
2301 /* Front Mic: set to PIN_IN (empty by default) */
2302 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2303 /* Unselect Front Mic by default in input mixer 3 */
2304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2305 /* Enable unsolicited event for HP jack */
2306 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2307 /* Enable speaker output */
2308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2310 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2311 /* Enable headphone output */
2312 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2313 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2314 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2315 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2320 *ALC888 Acer Aspire 7730G model
2323 static const struct hda_verb alc888_acer_aspire_7730G_verbs
[] = {
2324 /* Bias voltage on for external mic port */
2325 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
2326 /* Front Mic: set to PIN_IN (empty by default) */
2327 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2328 /* Unselect Front Mic by default in input mixer 3 */
2329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2330 /* Enable unsolicited event for HP jack */
2331 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2332 /* Enable speaker output */
2333 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2334 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2335 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2336 /* Enable headphone output */
2337 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2338 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2339 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2340 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2341 /*Enable internal subwoofer */
2342 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2343 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2344 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
2345 {0x17, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2350 * ALC889 Acer Aspire 8930G model
2353 static const struct hda_verb alc889_acer_aspire_8930g_verbs
[] = {
2354 /* Front Mic: set to PIN_IN (empty by default) */
2355 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2356 /* Unselect Front Mic by default in input mixer 3 */
2357 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2358 /* Enable unsolicited event for HP jack */
2359 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2360 /* Connect Internal Front to Front */
2361 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2362 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2363 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2364 /* Connect Internal Rear to Rear */
2365 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2366 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2367 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
2368 /* Connect Internal CLFE to CLFE */
2369 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2370 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2371 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
2372 /* Connect HP out to Front */
2373 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2374 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2375 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2376 /* Enable all DACs */
2377 /* DAC DISABLE/MUTE 1? */
2378 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2379 {0x20, AC_VERB_SET_COEF_INDEX
, 0x03},
2380 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
2381 /* DAC DISABLE/MUTE 2? */
2382 /* some bit here disables the other DACs. Init=0x4900 */
2383 {0x20, AC_VERB_SET_COEF_INDEX
, 0x08},
2384 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
2386 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2387 * which makes the stereo useless. However, either the mic or the ALC889
2388 * makes the signal become a difference/sum signal instead of standard
2389 * stereo, which is annoying. So instead we flip this bit which makes the
2390 * codec replicate the sum signal to both channels, turning it into a
2393 /* DMIC_CONTROL? Init value = 0x0001 */
2394 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
2395 {0x20, AC_VERB_SET_PROC_COEF
, 0x0003},
2399 static const struct hda_input_mux alc888_2_capture_sources
[2] = {
2400 /* Front mic only available on one ADC */
2407 { "Front Mic", 0xb },
2420 static const struct hda_input_mux alc888_acer_aspire_6530_sources
[2] = {
2421 /* Interal mic only available on one ADC */
2428 { "Input Mix", 0xa },
2429 { "Internal Mic", 0xb },
2438 { "Input Mix", 0xa },
2443 static const struct hda_input_mux alc889_capture_sources
[3] = {
2444 /* Digital mic only available on first "ADC" */
2451 { "Front Mic", 0xb },
2452 { "Input Mix", 0xa },
2461 { "Input Mix", 0xa },
2470 { "Input Mix", 0xa },
2475 static const struct snd_kcontrol_new alc888_base_mixer
[] = {
2476 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2477 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2478 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2479 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2480 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2482 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2483 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2484 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2485 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2486 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2487 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2488 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2489 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2490 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2491 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2492 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2493 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2497 static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer
[] = {
2498 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2499 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2500 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2501 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2502 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2504 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2505 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2506 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2507 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT
),
2508 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT
),
2509 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2510 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2511 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2512 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2513 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2514 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2519 static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer
[] = {
2520 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2521 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2522 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2523 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2524 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2526 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2527 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2528 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2529 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2530 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2532 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2533 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2538 static void alc888_acer_aspire_4930g_setup(struct hda_codec
*codec
)
2540 struct alc_spec
*spec
= codec
->spec
;
2542 spec
->autocfg
.hp_pins
[0] = 0x15;
2543 spec
->autocfg
.speaker_pins
[0] = 0x14;
2544 spec
->autocfg
.speaker_pins
[1] = 0x16;
2545 spec
->autocfg
.speaker_pins
[2] = 0x17;
2547 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2550 static void alc888_acer_aspire_6530g_setup(struct hda_codec
*codec
)
2552 struct alc_spec
*spec
= codec
->spec
;
2554 spec
->autocfg
.hp_pins
[0] = 0x15;
2555 spec
->autocfg
.speaker_pins
[0] = 0x14;
2556 spec
->autocfg
.speaker_pins
[1] = 0x16;
2557 spec
->autocfg
.speaker_pins
[2] = 0x17;
2559 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2562 static void alc888_acer_aspire_7730g_setup(struct hda_codec
*codec
)
2564 struct alc_spec
*spec
= codec
->spec
;
2566 spec
->autocfg
.hp_pins
[0] = 0x15;
2567 spec
->autocfg
.speaker_pins
[0] = 0x14;
2568 spec
->autocfg
.speaker_pins
[1] = 0x16;
2569 spec
->autocfg
.speaker_pins
[2] = 0x17;
2571 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2574 static void alc889_acer_aspire_8930g_setup(struct hda_codec
*codec
)
2576 struct alc_spec
*spec
= codec
->spec
;
2578 spec
->autocfg
.hp_pins
[0] = 0x15;
2579 spec
->autocfg
.speaker_pins
[0] = 0x14;
2580 spec
->autocfg
.speaker_pins
[1] = 0x16;
2581 spec
->autocfg
.speaker_pins
[2] = 0x1b;
2583 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2587 * ALC880 3-stack model
2589 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2590 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2591 * F-Mic = 0x1b, HP = 0x19
2594 static const hda_nid_t alc880_dac_nids
[4] = {
2595 /* front, rear, clfe, rear_surr */
2596 0x02, 0x05, 0x04, 0x03
2599 static const hda_nid_t alc880_adc_nids
[3] = {
2604 /* The datasheet says the node 0x07 is connected from inputs,
2605 * but it shows zero connection in the real implementation on some devices.
2606 * Note: this is a 915GAV bug, fixed on 915GLV
2608 static const hda_nid_t alc880_adc_nids_alt
[2] = {
2613 #define ALC880_DIGOUT_NID 0x06
2614 #define ALC880_DIGIN_NID 0x0a
2616 static const struct hda_input_mux alc880_capture_source
= {
2620 { "Front Mic", 0x3 },
2626 /* channel source setting (2/6 channel selection for 3-stack) */
2628 static const struct hda_verb alc880_threestack_ch2_init
[] = {
2629 /* set line-in to input, mute it */
2630 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2631 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2632 /* set mic-in to input vref 80%, mute it */
2633 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2634 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2639 static const struct hda_verb alc880_threestack_ch6_init
[] = {
2640 /* set line-in to output, unmute it */
2641 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2642 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2643 /* set mic-in to output, unmute it */
2644 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2645 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2649 static const struct hda_channel_mode alc880_threestack_modes
[2] = {
2650 { 2, alc880_threestack_ch2_init
},
2651 { 6, alc880_threestack_ch6_init
},
2654 static const struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
2655 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2656 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2657 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2658 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2659 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2660 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2661 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2662 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2663 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2664 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2665 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2666 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2669 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2670 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2671 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
2673 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2674 .name
= "Channel Mode",
2675 .info
= alc_ch_mode_info
,
2676 .get
= alc_ch_mode_get
,
2677 .put
= alc_ch_mode_put
,
2682 /* capture mixer elements */
2683 static int alc_cap_vol_info(struct snd_kcontrol
*kcontrol
,
2684 struct snd_ctl_elem_info
*uinfo
)
2686 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2687 struct alc_spec
*spec
= codec
->spec
;
2690 mutex_lock(&codec
->control_mutex
);
2691 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2693 err
= snd_hda_mixer_amp_volume_info(kcontrol
, uinfo
);
2694 mutex_unlock(&codec
->control_mutex
);
2698 static int alc_cap_vol_tlv(struct snd_kcontrol
*kcontrol
, int op_flag
,
2699 unsigned int size
, unsigned int __user
*tlv
)
2701 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2702 struct alc_spec
*spec
= codec
->spec
;
2705 mutex_lock(&codec
->control_mutex
);
2706 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2708 err
= snd_hda_mixer_amp_tlv(kcontrol
, op_flag
, size
, tlv
);
2709 mutex_unlock(&codec
->control_mutex
);
2713 typedef int (*getput_call_t
)(struct snd_kcontrol
*kcontrol
,
2714 struct snd_ctl_elem_value
*ucontrol
);
2716 static int alc_cap_getput_caller(struct snd_kcontrol
*kcontrol
,
2717 struct snd_ctl_elem_value
*ucontrol
,
2720 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2721 struct alc_spec
*spec
= codec
->spec
;
2722 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
2725 mutex_lock(&codec
->control_mutex
);
2726 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[adc_idx
],
2728 err
= func(kcontrol
, ucontrol
);
2729 mutex_unlock(&codec
->control_mutex
);
2733 static int alc_cap_vol_get(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_get
);
2740 static int alc_cap_vol_put(struct snd_kcontrol
*kcontrol
,
2741 struct snd_ctl_elem_value
*ucontrol
)
2743 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2744 snd_hda_mixer_amp_volume_put
);
2747 /* capture mixer elements */
2748 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2750 static int alc_cap_sw_get(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_get
);
2757 static int alc_cap_sw_put(struct snd_kcontrol
*kcontrol
,
2758 struct snd_ctl_elem_value
*ucontrol
)
2760 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2761 snd_hda_mixer_amp_switch_put
);
2764 #define _DEFINE_CAPMIX(num) \
2766 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2767 .name = "Capture Switch", \
2768 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2770 .info = alc_cap_sw_info, \
2771 .get = alc_cap_sw_get, \
2772 .put = alc_cap_sw_put, \
2775 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2776 .name = "Capture Volume", \
2777 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2778 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2779 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2781 .info = alc_cap_vol_info, \
2782 .get = alc_cap_vol_get, \
2783 .put = alc_cap_vol_put, \
2784 .tlv = { .c = alc_cap_vol_tlv }, \
2787 #define _DEFINE_CAPSRC(num) \
2789 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2790 /* .name = "Capture Source", */ \
2791 .name = "Input Source", \
2793 .info = alc_mux_enum_info, \
2794 .get = alc_mux_enum_get, \
2795 .put = alc_mux_enum_put, \
2798 #define DEFINE_CAPMIX(num) \
2799 static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2800 _DEFINE_CAPMIX(num), \
2801 _DEFINE_CAPSRC(num), \
2805 #define DEFINE_CAPMIX_NOSRC(num) \
2806 static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2807 _DEFINE_CAPMIX(num), \
2811 /* up to three ADCs */
2815 DEFINE_CAPMIX_NOSRC(1);
2816 DEFINE_CAPMIX_NOSRC(2);
2817 DEFINE_CAPMIX_NOSRC(3);
2820 * ALC880 5-stack model
2822 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2824 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2825 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2828 /* additional mixers to alc880_three_stack_mixer */
2829 static const struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
2830 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2831 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
2835 /* channel source setting (6/8 channel selection for 5-stack) */
2837 static const struct hda_verb alc880_fivestack_ch6_init
[] = {
2838 /* set line-in to input, mute it */
2839 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2840 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2845 static const struct hda_verb alc880_fivestack_ch8_init
[] = {
2846 /* set line-in to output, unmute it */
2847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2852 static const struct hda_channel_mode alc880_fivestack_modes
[2] = {
2853 { 6, alc880_fivestack_ch6_init
},
2854 { 8, alc880_fivestack_ch8_init
},
2859 * ALC880 6-stack model
2861 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2862 * Side = 0x05 (0x0f)
2863 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2864 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2867 static const hda_nid_t alc880_6st_dac_nids
[4] = {
2868 /* front, rear, clfe, rear_surr */
2869 0x02, 0x03, 0x04, 0x05
2872 static const struct hda_input_mux alc880_6stack_capture_source
= {
2876 { "Front Mic", 0x1 },
2882 /* fixed 8-channels */
2883 static const struct hda_channel_mode alc880_sixstack_modes
[1] = {
2887 static const struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
2888 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2889 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2890 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2891 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2892 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2893 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2894 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2895 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2896 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2897 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2898 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2899 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2900 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2901 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2904 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2905 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2907 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2908 .name
= "Channel Mode",
2909 .info
= alc_ch_mode_info
,
2910 .get
= alc_ch_mode_get
,
2911 .put
= alc_ch_mode_put
,
2920 * W810 has rear IO for:
2923 * Center/LFE (DAC 04)
2926 * The system also has a pair of internal speakers, and a headphone jack.
2927 * These are both connected to Line2 on the codec, hence to DAC 02.
2929 * There is a variable resistor to control the speaker or headphone
2930 * volume. This is a hardware-only device without a software API.
2932 * Plugging headphones in will disable the internal speakers. This is
2933 * implemented in hardware, not via the driver using jack sense. In
2934 * a similar fashion, plugging into the rear socket marked "front" will
2935 * disable both the speakers and headphones.
2937 * For input, there's a microphone jack, and an "audio in" jack.
2938 * These may not do anything useful with this driver yet, because I
2939 * haven't setup any initialization verbs for these yet...
2942 static const hda_nid_t alc880_w810_dac_nids
[3] = {
2943 /* front, rear/surround, clfe */
2947 /* fixed 6 channels */
2948 static const struct hda_channel_mode alc880_w810_modes
[1] = {
2952 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2953 static const struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
2954 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2955 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2956 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2957 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2958 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2959 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2960 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2961 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2962 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2970 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2971 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2975 static const hda_nid_t alc880_z71v_dac_nids
[1] = {
2978 #define ALC880_Z71V_HP_DAC 0x03
2980 /* fixed 2 channels */
2981 static const struct hda_channel_mode alc880_2_jack_modes
[1] = {
2985 static const struct snd_kcontrol_new alc880_z71v_mixer
[] = {
2986 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2987 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2988 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2989 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
2990 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2991 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2999 * ALC880 F1734 model
3001 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
3002 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
3005 static const hda_nid_t alc880_f1734_dac_nids
[1] = {
3008 #define ALC880_F1734_HP_DAC 0x02
3010 static const struct snd_kcontrol_new alc880_f1734_mixer
[] = {
3011 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3012 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3013 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3014 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3015 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3016 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3022 static const struct hda_input_mux alc880_f1734_capture_source
= {
3034 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3035 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3036 * Mic = 0x18, Line = 0x1a
3039 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
3040 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
3042 static const struct snd_kcontrol_new alc880_asus_mixer
[] = {
3043 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3044 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3045 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3046 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
3047 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3048 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3049 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3050 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3051 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3052 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3053 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3054 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3055 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3056 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3058 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3059 .name
= "Channel Mode",
3060 .info
= alc_ch_mode_info
,
3061 .get
= alc_ch_mode_get
,
3062 .put
= alc_ch_mode_put
,
3068 * ALC880 ASUS W1V model
3070 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3071 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3072 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
3075 /* additional mixers to alc880_asus_mixer */
3076 static const struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
3077 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
3078 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
3083 static const struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
3084 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3085 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
3086 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
3087 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
3088 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
3089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
3090 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
3091 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
3092 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
3097 static const struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
3098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3099 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3100 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3101 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3102 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3103 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3104 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3105 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3112 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3113 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3115 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3116 .name
= "Channel Mode",
3117 .info
= alc_ch_mode_info
,
3118 .get
= alc_ch_mode_get
,
3119 .put
= alc_ch_mode_put
,
3124 static const struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
3125 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3126 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3127 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3128 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3129 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3130 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3133 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3134 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3138 static const struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
3139 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3140 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3141 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3142 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3149 * virtual master controls
3153 * slave controls for virtual master
3155 static const char * const alc_slave_vols
[] = {
3156 "Front Playback Volume",
3157 "Surround Playback Volume",
3158 "Center Playback Volume",
3159 "LFE Playback Volume",
3160 "Side Playback Volume",
3161 "Headphone Playback Volume",
3162 "Speaker Playback Volume",
3163 "Mono Playback Volume",
3164 "Line-Out Playback Volume",
3168 static const char * const alc_slave_sws
[] = {
3169 "Front Playback Switch",
3170 "Surround Playback Switch",
3171 "Center Playback Switch",
3172 "LFE Playback Switch",
3173 "Side Playback Switch",
3174 "Headphone Playback Switch",
3175 "Speaker Playback Switch",
3176 "Mono Playback Switch",
3177 "IEC958 Playback Switch",
3178 "Line-Out Playback Switch",
3183 * build control elements
3186 #define NID_MAPPING (-1)
3188 #define SUBDEV_SPEAKER_ (0 << 6)
3189 #define SUBDEV_HP_ (1 << 6)
3190 #define SUBDEV_LINE_ (2 << 6)
3191 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
3192 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
3193 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
3195 static void alc_free_kctls(struct hda_codec
*codec
);
3197 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3198 /* additional beep mixers; the actual parameters are overwritten at build */
3199 static const struct snd_kcontrol_new alc_beep_mixer
[] = {
3200 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT
),
3201 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT
),
3206 static int alc_build_controls(struct hda_codec
*codec
)
3208 struct alc_spec
*spec
= codec
->spec
;
3209 struct snd_kcontrol
*kctl
= NULL
;
3210 const struct snd_kcontrol_new
*knew
;
3215 for (i
= 0; i
< spec
->num_mixers
; i
++) {
3216 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
3220 if (spec
->cap_mixer
) {
3221 err
= snd_hda_add_new_ctls(codec
, spec
->cap_mixer
);
3225 if (spec
->multiout
.dig_out_nid
) {
3226 err
= snd_hda_create_spdif_out_ctls(codec
,
3227 spec
->multiout
.dig_out_nid
);
3230 if (!spec
->no_analog
) {
3231 err
= snd_hda_create_spdif_share_sw(codec
,
3235 spec
->multiout
.share_spdif
= 1;
3238 if (spec
->dig_in_nid
) {
3239 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
3244 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3245 /* create beep controls if needed */
3246 if (spec
->beep_amp
) {
3247 const struct snd_kcontrol_new
*knew
;
3248 for (knew
= alc_beep_mixer
; knew
->name
; knew
++) {
3249 struct snd_kcontrol
*kctl
;
3250 kctl
= snd_ctl_new1(knew
, codec
);
3253 kctl
->private_value
= spec
->beep_amp
;
3254 err
= snd_hda_ctl_add(codec
, 0, kctl
);
3261 /* if we have no master control, let's create it */
3262 if (!spec
->no_analog
&&
3263 !snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
3264 unsigned int vmaster_tlv
[4];
3265 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
3266 HDA_OUTPUT
, vmaster_tlv
);
3267 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
3268 vmaster_tlv
, alc_slave_vols
);
3272 if (!spec
->no_analog
&&
3273 !snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
3274 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
3275 NULL
, alc_slave_sws
);
3280 /* assign Capture Source enums to NID */
3281 if (spec
->capsrc_nids
|| spec
->adc_nids
) {
3282 kctl
= snd_hda_find_mixer_ctl(codec
, "Capture Source");
3284 kctl
= snd_hda_find_mixer_ctl(codec
, "Input Source");
3285 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
3286 const hda_nid_t
*nids
= spec
->capsrc_nids
;
3288 nids
= spec
->adc_nids
;
3289 err
= snd_hda_add_nid(codec
, kctl
, i
, nids
[i
]);
3294 if (spec
->cap_mixer
) {
3295 const char *kname
= kctl
? kctl
->id
.name
: NULL
;
3296 for (knew
= spec
->cap_mixer
; knew
->name
; knew
++) {
3297 if (kname
&& strcmp(knew
->name
, kname
) == 0)
3299 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
3300 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
3301 err
= snd_hda_add_nid(codec
, kctl
, i
,
3309 /* other nid->control mapping */
3310 for (i
= 0; i
< spec
->num_mixers
; i
++) {
3311 for (knew
= spec
->mixers
[i
]; knew
->name
; knew
++) {
3312 if (knew
->iface
!= NID_MAPPING
)
3314 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
3317 u
= knew
->subdevice
;
3318 for (j
= 0; j
< 4; j
++, u
>>= 8) {
3323 case SUBDEV_SPEAKER_
:
3324 nid
= spec
->autocfg
.speaker_pins
[nid
];
3327 nid
= spec
->autocfg
.line_out_pins
[nid
];
3330 nid
= spec
->autocfg
.hp_pins
[nid
];
3335 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
3339 u
= knew
->private_value
;
3340 for (j
= 0; j
< 4; j
++, u
>>= 8) {
3344 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
3351 alc_free_kctls(codec
); /* no longer needed */
3358 * initialize the codec volumes, etc
3362 * generic initialization of ADC, input mixers and output mixers
3364 static const struct hda_verb alc880_volume_init_verbs
[] = {
3366 * Unmute ADC0-2 and set the default input to mic-in
3368 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
3369 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3370 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
3371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3372 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
3373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3375 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3377 * Note: PASD motherboards uses the Line In 2 as the input for front
3380 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3381 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3382 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3383 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3384 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3390 * Set up output mixers (0x0c - 0x0f)
3392 /* set vol=0 to output mixers */
3393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3395 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3396 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3397 /* set up input amps for analog loopback */
3398 /* Amp Indices: DAC = 0, mixer = 1 */
3399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3400 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3401 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3402 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3403 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3404 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3405 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3406 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3412 * 3-stack pin configuration:
3413 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3415 static const struct hda_verb alc880_pin_3stack_init_verbs
[] = {
3417 * preset connection lists of input pins
3418 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3420 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
3421 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3422 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
3425 * Set pin mode and muting
3427 /* set front pin widgets 0x14 for output */
3428 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3429 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3430 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3431 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3432 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3433 /* Mic2 (as headphone out) for HP output */
3434 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3435 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3436 /* Line In pin widget for input */
3437 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3438 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3439 /* Line2 (as front mic) pin widget for input and vref at 80% */
3440 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3441 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3442 /* CD pin widget for input */
3443 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3449 * 5-stack pin configuration:
3450 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3451 * line-in/side = 0x1a, f-mic = 0x1b
3453 static const struct hda_verb alc880_pin_5stack_init_verbs
[] = {
3455 * preset connection lists of input pins
3456 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3458 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3459 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
3462 * Set pin mode and muting
3464 /* set pin widgets 0x14-0x17 for output */
3465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3467 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3468 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3469 /* unmute pins for output (no gain on this amp) */
3470 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3472 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3473 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3475 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3476 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3477 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3478 /* Mic2 (as headphone out) for HP output */
3479 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3480 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3481 /* Line In pin widget for input */
3482 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3483 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3484 /* Line2 (as front mic) pin widget for input and vref at 80% */
3485 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3486 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3487 /* CD pin widget for input */
3488 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3494 * W810 pin configuration:
3495 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3497 static const struct hda_verb alc880_pin_w810_init_verbs
[] = {
3498 /* hphone/speaker input selector: front DAC */
3499 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
3501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3505 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3506 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3508 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3509 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3515 * Z71V pin configuration:
3516 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3518 static const struct hda_verb alc880_pin_z71v_init_verbs
[] = {
3519 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3520 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3521 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3522 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3524 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3525 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3526 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3527 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3533 * 6-stack pin configuration:
3534 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3535 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3537 static const struct hda_verb alc880_pin_6stack_init_verbs
[] = {
3538 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3541 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3542 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3543 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3544 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3545 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3546 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3547 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3549 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3551 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3552 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3553 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3554 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3555 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3556 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3557 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3563 * Uniwill pin configuration:
3564 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3567 static const struct hda_verb alc880_uniwill_init_verbs
[] = {
3568 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3571 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3572 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3573 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3574 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3575 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3576 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3577 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3578 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3579 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3580 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3581 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3582 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3583 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3585 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3586 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3587 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3588 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3589 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3590 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3591 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3592 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3593 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3595 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3596 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
3603 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3605 static const struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
3606 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3608 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3609 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3610 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3611 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3613 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3617 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3618 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3619 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3621 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3622 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3623 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3624 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3625 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3626 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3628 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3629 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
3634 static const struct hda_verb alc880_beep_init_verbs
[] = {
3635 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
3639 /* auto-toggle front mic */
3640 static void alc88x_simple_mic_automute(struct hda_codec
*codec
)
3642 unsigned int present
;
3645 present
= snd_hda_jack_detect(codec
, 0x18);
3646 bits
= present
? HDA_AMP_MUTE
: 0;
3647 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
3650 static void alc880_uniwill_setup(struct hda_codec
*codec
)
3652 struct alc_spec
*spec
= codec
->spec
;
3654 spec
->autocfg
.hp_pins
[0] = 0x14;
3655 spec
->autocfg
.speaker_pins
[0] = 0x15;
3656 spec
->autocfg
.speaker_pins
[0] = 0x16;
3658 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
3661 static void alc880_uniwill_init_hook(struct hda_codec
*codec
)
3663 alc_hp_automute(codec
);
3664 alc88x_simple_mic_automute(codec
);
3667 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
3670 /* Looks like the unsol event is incompatible with the standard
3671 * definition. 4bit tag is placed at 28 bit!
3673 switch (res
>> 28) {
3674 case ALC880_MIC_EVENT
:
3675 alc88x_simple_mic_automute(codec
);
3678 alc_sku_unsol_event(codec
, res
);
3683 static void alc880_uniwill_p53_setup(struct hda_codec
*codec
)
3685 struct alc_spec
*spec
= codec
->spec
;
3687 spec
->autocfg
.hp_pins
[0] = 0x14;
3688 spec
->autocfg
.speaker_pins
[0] = 0x15;
3690 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
3693 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
3695 unsigned int present
;
3697 present
= snd_hda_codec_read(codec
, 0x21, 0,
3698 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
3699 present
&= HDA_AMP_VOLMASK
;
3700 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
3701 HDA_AMP_VOLMASK
, present
);
3702 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
3703 HDA_AMP_VOLMASK
, present
);
3706 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
3709 /* Looks like the unsol event is incompatible with the standard
3710 * definition. 4bit tag is placed at 28 bit!
3712 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
3713 alc880_uniwill_p53_dcvol_automute(codec
);
3715 alc_sku_unsol_event(codec
, res
);
3719 * F1734 pin configuration:
3720 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3722 static const struct hda_verb alc880_pin_f1734_init_verbs
[] = {
3723 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
3724 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3725 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3726 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3727 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3730 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3734 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3735 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3736 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
3737 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3738 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3739 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3740 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3741 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3742 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3744 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
3745 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
3751 * ASUS pin configuration:
3752 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3754 static const struct hda_verb alc880_pin_asus_init_verbs
[] = {
3755 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3756 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3757 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3758 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3762 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3764 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3765 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3766 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3769 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3770 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3771 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3773 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3774 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3775 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3776 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3777 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3782 /* Enable GPIO mask and set output */
3783 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3784 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3785 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3787 /* Clevo m520g init */
3788 static const struct hda_verb alc880_pin_clevo_init_verbs
[] = {
3789 /* headphone output */
3790 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3792 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3793 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3795 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3796 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3798 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3799 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3800 /* Mic1 (rear panel) */
3801 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3802 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3803 /* Mic2 (front panel) */
3804 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3805 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3809 /* change to EAPD mode */
3810 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3811 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3816 static const struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
3817 /* change to EAPD mode */
3818 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3819 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3821 /* Headphone output */
3822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3825 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
3827 /* Line In pin widget for input */
3828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3829 /* CD pin widget for input */
3830 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3831 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3832 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3834 /* change to EAPD mode */
3835 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3836 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
3842 * LG m1 express dual
3845 * Rear Line-In/Out (blue): 0x14
3846 * Build-in Mic-In: 0x15
3848 * HP-Out (green): 0x1b
3849 * Mic-In/Out (red): 0x19
3853 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3854 static const hda_nid_t alc880_lg_dac_nids
[3] = {
3858 /* seems analog CD is not working */
3859 static const struct hda_input_mux alc880_lg_capture_source
= {
3864 { "Internal Mic", 0x6 },
3868 /* 2,4,6 channel modes */
3869 static const struct hda_verb alc880_lg_ch2_init
[] = {
3870 /* set line-in and mic-in to input */
3871 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3872 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3876 static const struct hda_verb alc880_lg_ch4_init
[] = {
3877 /* set line-in to out and mic-in to input */
3878 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3879 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3883 static const struct hda_verb alc880_lg_ch6_init
[] = {
3884 /* set line-in and mic-in to output */
3885 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3886 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3890 static const struct hda_channel_mode alc880_lg_ch_modes
[3] = {
3891 { 2, alc880_lg_ch2_init
},
3892 { 4, alc880_lg_ch4_init
},
3893 { 6, alc880_lg_ch6_init
},
3896 static const struct snd_kcontrol_new alc880_lg_mixer
[] = {
3897 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3898 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
3899 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3900 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
3901 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
3902 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
3903 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
3904 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
3905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3907 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
3908 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
3909 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
3910 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
3912 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3913 .name
= "Channel Mode",
3914 .info
= alc_ch_mode_info
,
3915 .get
= alc_ch_mode_get
,
3916 .put
= alc_ch_mode_put
,
3921 static const struct hda_verb alc880_lg_init_verbs
[] = {
3922 /* set capture source to mic-in */
3923 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3924 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3925 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3926 /* mute all amp mixer inputs */
3927 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
3928 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3929 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3930 /* line-in to input */
3931 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3932 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3934 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3937 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3938 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3939 /* mic-in to input */
3940 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3941 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3942 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3944 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
3945 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3946 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3948 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3952 /* toggle speaker-output according to the hp-jack state */
3953 static void alc880_lg_setup(struct hda_codec
*codec
)
3955 struct alc_spec
*spec
= codec
->spec
;
3957 spec
->autocfg
.hp_pins
[0] = 0x1b;
3958 spec
->autocfg
.speaker_pins
[0] = 0x17;
3960 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
3969 * Built-in Mic-In: 0x19
3975 static const struct hda_input_mux alc880_lg_lw_capture_source
= {
3979 { "Internal Mic", 0x1 },
3984 #define alc880_lg_lw_modes alc880_threestack_modes
3986 static const struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
3987 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3988 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3989 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3990 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
3991 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3992 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3993 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3994 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3995 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3996 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3999 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
4000 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
4002 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4003 .name
= "Channel Mode",
4004 .info
= alc_ch_mode_info
,
4005 .get
= alc_ch_mode_get
,
4006 .put
= alc_ch_mode_put
,
4011 static const struct hda_verb alc880_lg_lw_init_verbs
[] = {
4012 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
4013 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
4014 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
4016 /* set capture source to mic-in */
4017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4018 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4019 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
4022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4025 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4026 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4027 /* mic-in to input */
4028 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4029 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4031 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4032 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4034 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4038 /* toggle speaker-output according to the hp-jack state */
4039 static void alc880_lg_lw_setup(struct hda_codec
*codec
)
4041 struct alc_spec
*spec
= codec
->spec
;
4043 spec
->autocfg
.hp_pins
[0] = 0x1b;
4044 spec
->autocfg
.speaker_pins
[0] = 0x14;
4046 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
4049 static const struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
4050 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4051 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
4052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4054 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4055 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4059 static const struct hda_input_mux alc880_medion_rim_capture_source
= {
4063 { "Internal Mic", 0x1 },
4067 static const struct hda_verb alc880_medion_rim_init_verbs
[] = {
4068 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
4070 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4071 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4073 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4074 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4075 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4076 /* Mic2 (as headphone out) for HP output */
4077 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4078 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4079 /* Internal Speaker */
4080 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4081 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4083 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
4084 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
4086 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4090 /* toggle speaker-output according to the hp-jack state */
4091 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
4093 struct alc_spec
*spec
= codec
->spec
;
4094 alc_hp_automute(codec
);
4096 if (spec
->jack_present
)
4097 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
4099 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
4102 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
4105 /* Looks like the unsol event is incompatible with the standard
4106 * definition. 4bit tag is placed at 28 bit!
4108 if ((res
>> 28) == ALC880_HP_EVENT
)
4109 alc880_medion_rim_automute(codec
);
4112 static void alc880_medion_rim_setup(struct hda_codec
*codec
)
4114 struct alc_spec
*spec
= codec
->spec
;
4116 spec
->autocfg
.hp_pins
[0] = 0x14;
4117 spec
->autocfg
.speaker_pins
[0] = 0x1b;
4119 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
4122 #ifdef CONFIG_SND_HDA_POWER_SAVE
4123 static const struct hda_amp_list alc880_loopbacks
[] = {
4124 { 0x0b, HDA_INPUT
, 0 },
4125 { 0x0b, HDA_INPUT
, 1 },
4126 { 0x0b, HDA_INPUT
, 2 },
4127 { 0x0b, HDA_INPUT
, 3 },
4128 { 0x0b, HDA_INPUT
, 4 },
4132 static const struct hda_amp_list alc880_lg_loopbacks
[] = {
4133 { 0x0b, HDA_INPUT
, 1 },
4134 { 0x0b, HDA_INPUT
, 6 },
4135 { 0x0b, HDA_INPUT
, 7 },
4144 static void alc_init_special_input_src(struct hda_codec
*codec
);
4146 static int alc_init(struct hda_codec
*codec
)
4148 struct alc_spec
*spec
= codec
->spec
;
4152 alc_auto_init_amp(codec
, spec
->init_amp
);
4154 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
4155 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
4156 alc_init_special_input_src(codec
);
4158 if (spec
->init_hook
)
4159 spec
->init_hook(codec
);
4161 alc_apply_fixup(codec
, ALC_FIXUP_ACT_INIT
);
4163 hda_call_check_power_status(codec
, 0x01);
4167 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4169 struct alc_spec
*spec
= codec
->spec
;
4171 if (spec
->unsol_event
)
4172 spec
->unsol_event(codec
, res
);
4175 #ifdef CONFIG_SND_HDA_POWER_SAVE
4176 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
4178 struct alc_spec
*spec
= codec
->spec
;
4179 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
4184 * Analog playback callbacks
4186 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
4187 struct hda_codec
*codec
,
4188 struct snd_pcm_substream
*substream
)
4190 struct alc_spec
*spec
= codec
->spec
;
4191 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
4195 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4196 struct hda_codec
*codec
,
4197 unsigned int stream_tag
,
4198 unsigned int format
,
4199 struct snd_pcm_substream
*substream
)
4201 struct alc_spec
*spec
= codec
->spec
;
4202 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
4203 stream_tag
, format
, substream
);
4206 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4207 struct hda_codec
*codec
,
4208 struct snd_pcm_substream
*substream
)
4210 struct alc_spec
*spec
= codec
->spec
;
4211 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
4217 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
4218 struct hda_codec
*codec
,
4219 struct snd_pcm_substream
*substream
)
4221 struct alc_spec
*spec
= codec
->spec
;
4222 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
4225 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4226 struct hda_codec
*codec
,
4227 unsigned int stream_tag
,
4228 unsigned int format
,
4229 struct snd_pcm_substream
*substream
)
4231 struct alc_spec
*spec
= codec
->spec
;
4232 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
4233 stream_tag
, format
, substream
);
4236 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4237 struct hda_codec
*codec
,
4238 struct snd_pcm_substream
*substream
)
4240 struct alc_spec
*spec
= codec
->spec
;
4241 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
4244 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
4245 struct hda_codec
*codec
,
4246 struct snd_pcm_substream
*substream
)
4248 struct alc_spec
*spec
= codec
->spec
;
4249 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
4255 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4256 struct hda_codec
*codec
,
4257 unsigned int stream_tag
,
4258 unsigned int format
,
4259 struct snd_pcm_substream
*substream
)
4261 struct alc_spec
*spec
= codec
->spec
;
4263 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
4264 stream_tag
, 0, format
);
4268 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4269 struct hda_codec
*codec
,
4270 struct snd_pcm_substream
*substream
)
4272 struct alc_spec
*spec
= codec
->spec
;
4274 snd_hda_codec_cleanup_stream(codec
,
4275 spec
->adc_nids
[substream
->number
+ 1]);
4279 /* analog capture with dynamic dual-adc changes */
4280 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4281 struct hda_codec
*codec
,
4282 unsigned int stream_tag
,
4283 unsigned int format
,
4284 struct snd_pcm_substream
*substream
)
4286 struct alc_spec
*spec
= codec
->spec
;
4287 spec
->cur_adc
= spec
->adc_nids
[spec
->cur_adc_idx
];
4288 spec
->cur_adc_stream_tag
= stream_tag
;
4289 spec
->cur_adc_format
= format
;
4290 snd_hda_codec_setup_stream(codec
, spec
->cur_adc
, stream_tag
, 0, format
);
4294 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4295 struct hda_codec
*codec
,
4296 struct snd_pcm_substream
*substream
)
4298 struct alc_spec
*spec
= codec
->spec
;
4299 snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
);
4304 static const struct hda_pcm_stream dualmic_pcm_analog_capture
= {
4308 .nid
= 0, /* fill later */
4310 .prepare
= dualmic_capture_pcm_prepare
,
4311 .cleanup
= dualmic_capture_pcm_cleanup
4317 static const struct hda_pcm_stream alc880_pcm_analog_playback
= {
4321 /* NID is set in alc_build_pcms */
4323 .open
= alc880_playback_pcm_open
,
4324 .prepare
= alc880_playback_pcm_prepare
,
4325 .cleanup
= alc880_playback_pcm_cleanup
4329 static const struct hda_pcm_stream alc880_pcm_analog_capture
= {
4333 /* NID is set in alc_build_pcms */
4336 static const struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
4340 /* NID is set in alc_build_pcms */
4343 static const struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
4344 .substreams
= 2, /* can be overridden */
4347 /* NID is set in alc_build_pcms */
4349 .prepare
= alc880_alt_capture_pcm_prepare
,
4350 .cleanup
= alc880_alt_capture_pcm_cleanup
4354 static const struct hda_pcm_stream alc880_pcm_digital_playback
= {
4358 /* NID is set in alc_build_pcms */
4360 .open
= alc880_dig_playback_pcm_open
,
4361 .close
= alc880_dig_playback_pcm_close
,
4362 .prepare
= alc880_dig_playback_pcm_prepare
,
4363 .cleanup
= alc880_dig_playback_pcm_cleanup
4367 static const struct hda_pcm_stream alc880_pcm_digital_capture
= {
4371 /* NID is set in alc_build_pcms */
4374 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4375 static const struct hda_pcm_stream alc_pcm_null_stream
= {
4381 static int alc_build_pcms(struct hda_codec
*codec
)
4383 struct alc_spec
*spec
= codec
->spec
;
4384 struct hda_pcm
*info
= spec
->pcm_rec
;
4387 codec
->num_pcms
= 1;
4388 codec
->pcm_info
= info
;
4390 if (spec
->no_analog
)
4393 snprintf(spec
->stream_name_analog
, sizeof(spec
->stream_name_analog
),
4394 "%s Analog", codec
->chip_name
);
4395 info
->name
= spec
->stream_name_analog
;
4397 if (spec
->stream_analog_playback
) {
4398 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
4400 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
4401 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
4403 if (spec
->stream_analog_capture
) {
4404 if (snd_BUG_ON(!spec
->adc_nids
))
4406 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
4407 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
4410 if (spec
->channel_mode
) {
4411 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
4412 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
4413 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
4414 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
4420 /* SPDIF for stream index #1 */
4421 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
4422 snprintf(spec
->stream_name_digital
,
4423 sizeof(spec
->stream_name_digital
),
4424 "%s Digital", codec
->chip_name
);
4425 codec
->num_pcms
= 2;
4426 codec
->slave_dig_outs
= spec
->multiout
.slave_dig_outs
;
4427 info
= spec
->pcm_rec
+ 1;
4428 info
->name
= spec
->stream_name_digital
;
4429 if (spec
->dig_out_type
)
4430 info
->pcm_type
= spec
->dig_out_type
;
4432 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
4433 if (spec
->multiout
.dig_out_nid
&&
4434 spec
->stream_digital_playback
) {
4435 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
4436 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
4438 if (spec
->dig_in_nid
&&
4439 spec
->stream_digital_capture
) {
4440 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
4441 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
4443 /* FIXME: do we need this for all Realtek codec models? */
4444 codec
->spdif_status_reset
= 1;
4447 if (spec
->no_analog
)
4450 /* If the use of more than one ADC is requested for the current
4451 * model, configure a second analog capture-only PCM.
4453 /* Additional Analaog capture for index #2 */
4454 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
4455 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
4456 codec
->num_pcms
= 3;
4457 info
= spec
->pcm_rec
+ 2;
4458 info
->name
= spec
->stream_name_analog
;
4459 if (spec
->alt_dac_nid
) {
4460 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
4461 *spec
->stream_analog_alt_playback
;
4462 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
4465 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
4466 alc_pcm_null_stream
;
4467 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
4469 if (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
) {
4470 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
4471 *spec
->stream_analog_alt_capture
;
4472 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
4474 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
4475 spec
->num_adc_nids
- 1;
4477 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
4478 alc_pcm_null_stream
;
4479 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
4486 static inline void alc_shutup(struct hda_codec
*codec
)
4488 struct alc_spec
*spec
= codec
->spec
;
4490 if (spec
&& spec
->shutup
)
4491 spec
->shutup(codec
);
4492 snd_hda_shutup_pins(codec
);
4495 static void alc_free_kctls(struct hda_codec
*codec
)
4497 struct alc_spec
*spec
= codec
->spec
;
4499 if (spec
->kctls
.list
) {
4500 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
4502 for (i
= 0; i
< spec
->kctls
.used
; i
++)
4503 kfree(kctl
[i
].name
);
4505 snd_array_free(&spec
->kctls
);
4508 static void alc_free(struct hda_codec
*codec
)
4510 struct alc_spec
*spec
= codec
->spec
;
4516 snd_hda_input_jack_free(codec
);
4517 alc_free_kctls(codec
);
4519 snd_hda_detach_beep_device(codec
);
4522 #ifdef CONFIG_SND_HDA_POWER_SAVE
4523 static void alc_power_eapd(struct hda_codec
*codec
)
4525 alc_auto_setup_eapd(codec
, false);
4528 static int alc_suspend(struct hda_codec
*codec
, pm_message_t state
)
4530 struct alc_spec
*spec
= codec
->spec
;
4532 if (spec
&& spec
->power_hook
)
4533 spec
->power_hook(codec
);
4538 #ifdef SND_HDA_NEEDS_RESUME
4539 static int alc_resume(struct hda_codec
*codec
)
4541 msleep(150); /* to avoid pop noise */
4542 codec
->patch_ops
.init(codec
);
4543 snd_hda_codec_resume_amp(codec
);
4544 snd_hda_codec_resume_cache(codec
);
4545 hda_call_check_power_status(codec
, 0x01);
4552 static const struct hda_codec_ops alc_patch_ops
= {
4553 .build_controls
= alc_build_controls
,
4554 .build_pcms
= alc_build_pcms
,
4557 .unsol_event
= alc_unsol_event
,
4558 #ifdef SND_HDA_NEEDS_RESUME
4559 .resume
= alc_resume
,
4561 #ifdef CONFIG_SND_HDA_POWER_SAVE
4562 .suspend
= alc_suspend
,
4563 .check_power_status
= alc_check_power_status
,
4565 .reboot_notify
= alc_shutup
,
4568 /* replace the codec chip_name with the given string */
4569 static int alc_codec_rename(struct hda_codec
*codec
, const char *name
)
4571 kfree(codec
->chip_name
);
4572 codec
->chip_name
= kstrdup(name
, GFP_KERNEL
);
4573 if (!codec
->chip_name
) {
4581 * Test configuration for debugging
4583 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4586 #ifdef CONFIG_SND_DEBUG
4587 static const hda_nid_t alc880_test_dac_nids
[4] = {
4588 0x02, 0x03, 0x04, 0x05
4591 static const struct hda_input_mux alc880_test_capture_source
= {
4600 { "Surround", 0x6 },
4604 static const struct hda_channel_mode alc880_test_modes
[4] = {
4611 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
4612 struct snd_ctl_elem_info
*uinfo
)
4614 static const char * const texts
[] = {
4615 "N/A", "Line Out", "HP Out",
4616 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4618 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4620 uinfo
->value
.enumerated
.items
= 8;
4621 if (uinfo
->value
.enumerated
.item
>= 8)
4622 uinfo
->value
.enumerated
.item
= 7;
4623 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4627 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
4628 struct snd_ctl_elem_value
*ucontrol
)
4630 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4631 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4632 unsigned int pin_ctl
, item
= 0;
4634 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
4635 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4636 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
4637 if (pin_ctl
& AC_PINCTL_HP_EN
)
4641 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
4642 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
4643 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
4644 case AC_PINCTL_VREF_50
: item
= 4; break;
4645 case AC_PINCTL_VREF_GRD
: item
= 5; break;
4646 case AC_PINCTL_VREF_80
: item
= 6; break;
4647 case AC_PINCTL_VREF_100
: item
= 7; break;
4650 ucontrol
->value
.enumerated
.item
[0] = item
;
4654 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
4655 struct snd_ctl_elem_value
*ucontrol
)
4657 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4658 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4659 static const unsigned int ctls
[] = {
4660 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
4661 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
4662 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
4663 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
4664 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
4665 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
4667 unsigned int old_ctl
, new_ctl
;
4669 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
4670 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4671 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
4672 if (old_ctl
!= new_ctl
) {
4674 snd_hda_codec_write_cache(codec
, nid
, 0,
4675 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4677 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
4679 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
4686 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
4687 struct snd_ctl_elem_info
*uinfo
)
4689 static const char * const texts
[] = {
4690 "Front", "Surround", "CLFE", "Side"
4692 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4694 uinfo
->value
.enumerated
.items
= 4;
4695 if (uinfo
->value
.enumerated
.item
>= 4)
4696 uinfo
->value
.enumerated
.item
= 3;
4697 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4701 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
4702 struct snd_ctl_elem_value
*ucontrol
)
4704 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4705 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4708 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
4709 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
4713 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
4714 struct snd_ctl_elem_value
*ucontrol
)
4716 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4717 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4720 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
4721 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
4722 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
4723 snd_hda_codec_write_cache(codec
, nid
, 0,
4724 AC_VERB_SET_CONNECT_SEL
, sel
);
4730 #define PIN_CTL_TEST(xname,nid) { \
4731 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4733 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4734 .info = alc_test_pin_ctl_info, \
4735 .get = alc_test_pin_ctl_get, \
4736 .put = alc_test_pin_ctl_put, \
4737 .private_value = nid \
4740 #define PIN_SRC_TEST(xname,nid) { \
4741 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4743 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4744 .info = alc_test_pin_src_info, \
4745 .get = alc_test_pin_src_get, \
4746 .put = alc_test_pin_src_put, \
4747 .private_value = nid \
4750 static const struct snd_kcontrol_new alc880_test_mixer
[] = {
4751 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4752 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4753 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
4754 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
4755 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4756 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4757 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
4758 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
4759 PIN_CTL_TEST("Front Pin Mode", 0x14),
4760 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4761 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4762 PIN_CTL_TEST("Side Pin Mode", 0x17),
4763 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4764 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4765 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4766 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4767 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4768 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4769 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4770 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4771 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4772 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4773 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4774 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4775 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
4776 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
4777 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
4778 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
4779 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
4780 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
4782 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4783 .name
= "Channel Mode",
4784 .info
= alc_ch_mode_info
,
4785 .get
= alc_ch_mode_get
,
4786 .put
= alc_ch_mode_put
,
4791 static const struct hda_verb alc880_test_init_verbs
[] = {
4792 /* Unmute inputs of 0x0c - 0x0f */
4793 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4794 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4795 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4796 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4797 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4798 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4799 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4800 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4801 /* Vol output for 0x0c-0x0f */
4802 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4804 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4805 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4806 /* Set output pins 0x14-0x17 */
4807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4808 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4809 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4810 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4811 /* Unmute output pins 0x14-0x17 */
4812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4814 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4815 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4816 /* Set input pins 0x18-0x1c */
4817 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4819 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4820 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4821 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4822 /* Mute input pins 0x18-0x1b */
4823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4824 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4825 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4828 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4829 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4830 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4831 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4832 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4833 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4834 /* Analog input/passthru */
4835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4847 static const char * const alc880_models
[ALC880_MODEL_LAST
] = {
4848 [ALC880_3ST
] = "3stack",
4849 [ALC880_TCL_S700
] = "tcl",
4850 [ALC880_3ST_DIG
] = "3stack-digout",
4851 [ALC880_CLEVO
] = "clevo",
4852 [ALC880_5ST
] = "5stack",
4853 [ALC880_5ST_DIG
] = "5stack-digout",
4854 [ALC880_W810
] = "w810",
4855 [ALC880_Z71V
] = "z71v",
4856 [ALC880_6ST
] = "6stack",
4857 [ALC880_6ST_DIG
] = "6stack-digout",
4858 [ALC880_ASUS
] = "asus",
4859 [ALC880_ASUS_W1V
] = "asus-w1v",
4860 [ALC880_ASUS_DIG
] = "asus-dig",
4861 [ALC880_ASUS_DIG2
] = "asus-dig2",
4862 [ALC880_UNIWILL_DIG
] = "uniwill",
4863 [ALC880_UNIWILL_P53
] = "uniwill-p53",
4864 [ALC880_FUJITSU
] = "fujitsu",
4865 [ALC880_F1734
] = "F1734",
4867 [ALC880_LG_LW
] = "lg-lw",
4868 [ALC880_MEDION_RIM
] = "medion",
4869 #ifdef CONFIG_SND_DEBUG
4870 [ALC880_TEST
] = "test",
4872 [ALC880_AUTO
] = "auto",
4875 static const struct snd_pci_quirk alc880_cfg_tbl
[] = {
4876 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
4877 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
4878 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
4879 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
4880 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
4881 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
4882 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
4883 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
4884 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
4885 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
4886 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
4887 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
4888 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
4889 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
4890 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
4891 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
4892 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
4893 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4894 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
4895 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
4896 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
4897 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
4898 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
4899 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
4900 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS
), /* default ASUS */
4901 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
4902 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
4903 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
4904 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
4905 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
4906 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
4907 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
4908 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
4909 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
4910 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
4911 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
4912 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
4913 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
4914 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
4915 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734
),
4916 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
4917 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
4918 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
4919 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
4920 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
4921 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
4922 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
4923 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
4924 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734
),
4925 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
4926 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
4927 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
4928 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG
),
4929 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
4930 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
4931 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
4932 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
4933 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
4934 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
4935 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
4936 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
4937 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
4938 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
4939 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
4940 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
4941 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
4942 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
4943 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
4945 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST
),
4946 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
4947 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
4952 * ALC880 codec presets
4954 static const struct alc_config_preset alc880_presets
[] = {
4956 .mixers
= { alc880_three_stack_mixer
},
4957 .init_verbs
= { alc880_volume_init_verbs
,
4958 alc880_pin_3stack_init_verbs
},
4959 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4960 .dac_nids
= alc880_dac_nids
,
4961 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4962 .channel_mode
= alc880_threestack_modes
,
4964 .input_mux
= &alc880_capture_source
,
4966 [ALC880_3ST_DIG
] = {
4967 .mixers
= { alc880_three_stack_mixer
},
4968 .init_verbs
= { alc880_volume_init_verbs
,
4969 alc880_pin_3stack_init_verbs
},
4970 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4971 .dac_nids
= alc880_dac_nids
,
4972 .dig_out_nid
= ALC880_DIGOUT_NID
,
4973 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4974 .channel_mode
= alc880_threestack_modes
,
4976 .input_mux
= &alc880_capture_source
,
4978 [ALC880_TCL_S700
] = {
4979 .mixers
= { alc880_tcl_s700_mixer
},
4980 .init_verbs
= { alc880_volume_init_verbs
,
4981 alc880_pin_tcl_S700_init_verbs
,
4982 alc880_gpio2_init_verbs
},
4983 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4984 .dac_nids
= alc880_dac_nids
,
4985 .adc_nids
= alc880_adc_nids_alt
, /* FIXME: correct? */
4986 .num_adc_nids
= 1, /* single ADC */
4988 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4989 .channel_mode
= alc880_2_jack_modes
,
4990 .input_mux
= &alc880_capture_source
,
4993 .mixers
= { alc880_three_stack_mixer
,
4994 alc880_five_stack_mixer
},
4995 .init_verbs
= { alc880_volume_init_verbs
,
4996 alc880_pin_5stack_init_verbs
},
4997 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4998 .dac_nids
= alc880_dac_nids
,
4999 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
5000 .channel_mode
= alc880_fivestack_modes
,
5001 .input_mux
= &alc880_capture_source
,
5003 [ALC880_5ST_DIG
] = {
5004 .mixers
= { alc880_three_stack_mixer
,
5005 alc880_five_stack_mixer
},
5006 .init_verbs
= { alc880_volume_init_verbs
,
5007 alc880_pin_5stack_init_verbs
},
5008 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5009 .dac_nids
= alc880_dac_nids
,
5010 .dig_out_nid
= ALC880_DIGOUT_NID
,
5011 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
5012 .channel_mode
= alc880_fivestack_modes
,
5013 .input_mux
= &alc880_capture_source
,
5016 .mixers
= { alc880_six_stack_mixer
},
5017 .init_verbs
= { alc880_volume_init_verbs
,
5018 alc880_pin_6stack_init_verbs
},
5019 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
5020 .dac_nids
= alc880_6st_dac_nids
,
5021 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
5022 .channel_mode
= alc880_sixstack_modes
,
5023 .input_mux
= &alc880_6stack_capture_source
,
5025 [ALC880_6ST_DIG
] = {
5026 .mixers
= { alc880_six_stack_mixer
},
5027 .init_verbs
= { alc880_volume_init_verbs
,
5028 alc880_pin_6stack_init_verbs
},
5029 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
5030 .dac_nids
= alc880_6st_dac_nids
,
5031 .dig_out_nid
= ALC880_DIGOUT_NID
,
5032 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
5033 .channel_mode
= alc880_sixstack_modes
,
5034 .input_mux
= &alc880_6stack_capture_source
,
5037 .mixers
= { alc880_w810_base_mixer
},
5038 .init_verbs
= { alc880_volume_init_verbs
,
5039 alc880_pin_w810_init_verbs
,
5040 alc880_gpio2_init_verbs
},
5041 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
5042 .dac_nids
= alc880_w810_dac_nids
,
5043 .dig_out_nid
= ALC880_DIGOUT_NID
,
5044 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
5045 .channel_mode
= alc880_w810_modes
,
5046 .input_mux
= &alc880_capture_source
,
5049 .mixers
= { alc880_z71v_mixer
},
5050 .init_verbs
= { alc880_volume_init_verbs
,
5051 alc880_pin_z71v_init_verbs
},
5052 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
5053 .dac_nids
= alc880_z71v_dac_nids
,
5054 .dig_out_nid
= ALC880_DIGOUT_NID
,
5056 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5057 .channel_mode
= alc880_2_jack_modes
,
5058 .input_mux
= &alc880_capture_source
,
5061 .mixers
= { alc880_f1734_mixer
},
5062 .init_verbs
= { alc880_volume_init_verbs
,
5063 alc880_pin_f1734_init_verbs
},
5064 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
5065 .dac_nids
= alc880_f1734_dac_nids
,
5067 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5068 .channel_mode
= alc880_2_jack_modes
,
5069 .input_mux
= &alc880_f1734_capture_source
,
5070 .unsol_event
= alc880_uniwill_p53_unsol_event
,
5071 .setup
= alc880_uniwill_p53_setup
,
5072 .init_hook
= alc_hp_automute
,
5075 .mixers
= { alc880_asus_mixer
},
5076 .init_verbs
= { alc880_volume_init_verbs
,
5077 alc880_pin_asus_init_verbs
,
5078 alc880_gpio1_init_verbs
},
5079 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5080 .dac_nids
= alc880_asus_dac_nids
,
5081 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5082 .channel_mode
= alc880_asus_modes
,
5084 .input_mux
= &alc880_capture_source
,
5086 [ALC880_ASUS_DIG
] = {
5087 .mixers
= { alc880_asus_mixer
},
5088 .init_verbs
= { alc880_volume_init_verbs
,
5089 alc880_pin_asus_init_verbs
,
5090 alc880_gpio1_init_verbs
},
5091 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5092 .dac_nids
= alc880_asus_dac_nids
,
5093 .dig_out_nid
= ALC880_DIGOUT_NID
,
5094 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5095 .channel_mode
= alc880_asus_modes
,
5097 .input_mux
= &alc880_capture_source
,
5099 [ALC880_ASUS_DIG2
] = {
5100 .mixers
= { alc880_asus_mixer
},
5101 .init_verbs
= { alc880_volume_init_verbs
,
5102 alc880_pin_asus_init_verbs
,
5103 alc880_gpio2_init_verbs
}, /* use GPIO2 */
5104 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5105 .dac_nids
= alc880_asus_dac_nids
,
5106 .dig_out_nid
= ALC880_DIGOUT_NID
,
5107 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5108 .channel_mode
= alc880_asus_modes
,
5110 .input_mux
= &alc880_capture_source
,
5112 [ALC880_ASUS_W1V
] = {
5113 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
5114 .init_verbs
= { alc880_volume_init_verbs
,
5115 alc880_pin_asus_init_verbs
,
5116 alc880_gpio1_init_verbs
},
5117 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5118 .dac_nids
= alc880_asus_dac_nids
,
5119 .dig_out_nid
= ALC880_DIGOUT_NID
,
5120 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5121 .channel_mode
= alc880_asus_modes
,
5123 .input_mux
= &alc880_capture_source
,
5125 [ALC880_UNIWILL_DIG
] = {
5126 .mixers
= { alc880_asus_mixer
},
5127 .init_verbs
= { alc880_volume_init_verbs
,
5128 alc880_pin_asus_init_verbs
},
5129 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5130 .dac_nids
= alc880_asus_dac_nids
,
5131 .dig_out_nid
= ALC880_DIGOUT_NID
,
5132 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5133 .channel_mode
= alc880_asus_modes
,
5135 .input_mux
= &alc880_capture_source
,
5137 [ALC880_UNIWILL
] = {
5138 .mixers
= { alc880_uniwill_mixer
},
5139 .init_verbs
= { alc880_volume_init_verbs
,
5140 alc880_uniwill_init_verbs
},
5141 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5142 .dac_nids
= alc880_asus_dac_nids
,
5143 .dig_out_nid
= ALC880_DIGOUT_NID
,
5144 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
5145 .channel_mode
= alc880_threestack_modes
,
5147 .input_mux
= &alc880_capture_source
,
5148 .unsol_event
= alc880_uniwill_unsol_event
,
5149 .setup
= alc880_uniwill_setup
,
5150 .init_hook
= alc880_uniwill_init_hook
,
5152 [ALC880_UNIWILL_P53
] = {
5153 .mixers
= { alc880_uniwill_p53_mixer
},
5154 .init_verbs
= { alc880_volume_init_verbs
,
5155 alc880_uniwill_p53_init_verbs
},
5156 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5157 .dac_nids
= alc880_asus_dac_nids
,
5158 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
5159 .channel_mode
= alc880_threestack_modes
,
5160 .input_mux
= &alc880_capture_source
,
5161 .unsol_event
= alc880_uniwill_p53_unsol_event
,
5162 .setup
= alc880_uniwill_p53_setup
,
5163 .init_hook
= alc_hp_automute
,
5165 [ALC880_FUJITSU
] = {
5166 .mixers
= { alc880_fujitsu_mixer
},
5167 .init_verbs
= { alc880_volume_init_verbs
,
5168 alc880_uniwill_p53_init_verbs
,
5169 alc880_beep_init_verbs
},
5170 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5171 .dac_nids
= alc880_dac_nids
,
5172 .dig_out_nid
= ALC880_DIGOUT_NID
,
5173 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5174 .channel_mode
= alc880_2_jack_modes
,
5175 .input_mux
= &alc880_capture_source
,
5176 .unsol_event
= alc880_uniwill_p53_unsol_event
,
5177 .setup
= alc880_uniwill_p53_setup
,
5178 .init_hook
= alc_hp_automute
,
5181 .mixers
= { alc880_three_stack_mixer
},
5182 .init_verbs
= { alc880_volume_init_verbs
,
5183 alc880_pin_clevo_init_verbs
},
5184 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5185 .dac_nids
= alc880_dac_nids
,
5187 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
5188 .channel_mode
= alc880_threestack_modes
,
5190 .input_mux
= &alc880_capture_source
,
5193 .mixers
= { alc880_lg_mixer
},
5194 .init_verbs
= { alc880_volume_init_verbs
,
5195 alc880_lg_init_verbs
},
5196 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
5197 .dac_nids
= alc880_lg_dac_nids
,
5198 .dig_out_nid
= ALC880_DIGOUT_NID
,
5199 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
5200 .channel_mode
= alc880_lg_ch_modes
,
5202 .input_mux
= &alc880_lg_capture_source
,
5203 .unsol_event
= alc_sku_unsol_event
,
5204 .setup
= alc880_lg_setup
,
5205 .init_hook
= alc_hp_automute
,
5206 #ifdef CONFIG_SND_HDA_POWER_SAVE
5207 .loopbacks
= alc880_lg_loopbacks
,
5211 .mixers
= { alc880_lg_lw_mixer
},
5212 .init_verbs
= { alc880_volume_init_verbs
,
5213 alc880_lg_lw_init_verbs
},
5214 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5215 .dac_nids
= alc880_dac_nids
,
5216 .dig_out_nid
= ALC880_DIGOUT_NID
,
5217 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
5218 .channel_mode
= alc880_lg_lw_modes
,
5219 .input_mux
= &alc880_lg_lw_capture_source
,
5220 .unsol_event
= alc_sku_unsol_event
,
5221 .setup
= alc880_lg_lw_setup
,
5222 .init_hook
= alc_hp_automute
,
5224 [ALC880_MEDION_RIM
] = {
5225 .mixers
= { alc880_medion_rim_mixer
},
5226 .init_verbs
= { alc880_volume_init_verbs
,
5227 alc880_medion_rim_init_verbs
,
5228 alc_gpio2_init_verbs
},
5229 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5230 .dac_nids
= alc880_dac_nids
,
5231 .dig_out_nid
= ALC880_DIGOUT_NID
,
5232 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5233 .channel_mode
= alc880_2_jack_modes
,
5234 .input_mux
= &alc880_medion_rim_capture_source
,
5235 .unsol_event
= alc880_medion_rim_unsol_event
,
5236 .setup
= alc880_medion_rim_setup
,
5237 .init_hook
= alc880_medion_rim_automute
,
5239 #ifdef CONFIG_SND_DEBUG
5241 .mixers
= { alc880_test_mixer
},
5242 .init_verbs
= { alc880_test_init_verbs
},
5243 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
5244 .dac_nids
= alc880_test_dac_nids
,
5245 .dig_out_nid
= ALC880_DIGOUT_NID
,
5246 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
5247 .channel_mode
= alc880_test_modes
,
5248 .input_mux
= &alc880_test_capture_source
,
5254 * Automatic parse of I/O pins from the BIOS configuration
5259 ALC_CTL_WIDGET_MUTE
,
5262 static const struct snd_kcontrol_new alc880_control_templates
[] = {
5263 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
5264 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
5265 HDA_BIND_MUTE(NULL
, 0, 0, 0),
5268 static struct snd_kcontrol_new
*alc_kcontrol_new(struct alc_spec
*spec
)
5270 snd_array_init(&spec
->kctls
, sizeof(struct snd_kcontrol_new
), 32);
5271 return snd_array_new(&spec
->kctls
);
5274 /* add dynamic controls */
5275 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
5276 int cidx
, unsigned long val
)
5278 struct snd_kcontrol_new
*knew
;
5280 knew
= alc_kcontrol_new(spec
);
5283 *knew
= alc880_control_templates
[type
];
5284 knew
->name
= kstrdup(name
, GFP_KERNEL
);
5288 if (get_amp_nid_(val
))
5289 knew
->subdevice
= HDA_SUBDEV_AMP_FLAG
;
5290 knew
->private_value
= val
;
5294 static int add_control_with_pfx(struct alc_spec
*spec
, int type
,
5295 const char *pfx
, const char *dir
,
5296 const char *sfx
, int cidx
, unsigned long val
)
5299 snprintf(name
, sizeof(name
), "%s %s %s", pfx
, dir
, sfx
);
5300 return add_control(spec
, type
, name
, cidx
, val
);
5303 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5304 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5305 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5306 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5307 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5308 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5309 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5310 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5312 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5313 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5314 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5315 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5316 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5317 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5318 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5319 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5320 #define ALC880_PIN_CD_NID 0x1c
5322 /* fill in the dac_nids table from the parsed pin configuration */
5323 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
5324 const struct auto_pin_cfg
*cfg
)
5330 memset(assigned
, 0, sizeof(assigned
));
5331 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
5333 /* check the pins hardwired to audio widget */
5334 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5335 nid
= cfg
->line_out_pins
[i
];
5336 if (alc880_is_fixed_pin(nid
)) {
5337 int idx
= alc880_fixed_pin_idx(nid
);
5338 spec
->private_dac_nids
[i
] = alc880_idx_to_dac(idx
);
5342 /* left pins can be connect to any audio widget */
5343 for (i
= 0; i
< cfg
->line_outs
; i
++) {
5344 nid
= cfg
->line_out_pins
[i
];
5345 if (alc880_is_fixed_pin(nid
))
5347 /* search for an empty channel */
5348 for (j
= 0; j
< cfg
->line_outs
; j
++) {
5350 spec
->private_dac_nids
[i
] =
5351 alc880_idx_to_dac(j
);
5357 spec
->multiout
.num_dacs
= cfg
->line_outs
;
5361 static const char *alc_get_line_out_pfx(struct alc_spec
*spec
,
5364 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5366 if (cfg
->line_outs
== 1 && !spec
->multi_ios
&&
5367 !cfg
->hp_outs
&& !cfg
->speaker_outs
&& can_be_master
)
5370 switch (cfg
->line_out_type
) {
5371 case AUTO_PIN_SPEAKER_OUT
:
5372 if (cfg
->line_outs
== 1)
5375 case AUTO_PIN_HP_OUT
:
5378 if (cfg
->line_outs
== 1 && !spec
->multi_ios
)
5385 /* add playback controls from the parsed DAC table */
5386 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
5387 const struct auto_pin_cfg
*cfg
)
5389 static const char * const chname
[4] = {
5390 "Front", "Surround", NULL
/*CLFE*/, "Side"
5392 const char *pfx
= alc_get_line_out_pfx(spec
, false);
5394 int i
, err
, noutputs
;
5396 noutputs
= cfg
->line_outs
;
5397 if (spec
->multi_ios
> 0)
5398 noutputs
+= spec
->multi_ios
;
5400 for (i
= 0; i
< noutputs
; i
++) {
5401 if (!spec
->multiout
.dac_nids
[i
])
5403 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
5404 if (!pfx
&& i
== 2) {
5406 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5408 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
5412 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5414 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
5418 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5420 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
5424 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5426 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
5431 const char *name
= pfx
;
5437 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
5439 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
5443 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
5445 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
5454 /* add playback controls for speaker and HP outputs */
5455 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
5464 if (alc880_is_fixed_pin(pin
)) {
5465 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
5466 /* specify the DAC as the extra output */
5467 if (!spec
->multiout
.hp_nid
)
5468 spec
->multiout
.hp_nid
= nid
;
5470 spec
->multiout
.extra_out_nid
[0] = nid
;
5471 /* control HP volume/switch on the output mixer amp */
5472 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
5473 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
5474 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
5477 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
5478 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
5481 } else if (alc880_is_multi_pin(pin
)) {
5482 /* set manual connection */
5483 /* we have only a switch on HP-out PIN */
5484 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
5485 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
5492 /* create input playback/capture controls for the given pin */
5493 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
5494 const char *ctlname
, int ctlidx
,
5495 int idx
, hda_nid_t mix_nid
)
5499 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
, ctlidx
,
5500 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
5503 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
, ctlidx
,
5504 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
5510 static int alc_is_input_pin(struct hda_codec
*codec
, hda_nid_t nid
)
5512 unsigned int pincap
= snd_hda_query_pin_caps(codec
, nid
);
5513 return (pincap
& AC_PINCAP_IN
) != 0;
5516 /* create playback/capture controls for input pins */
5517 static int alc_auto_create_input_ctls(struct hda_codec
*codec
,
5518 const struct auto_pin_cfg
*cfg
,
5520 hda_nid_t cap1
, hda_nid_t cap2
)
5522 struct alc_spec
*spec
= codec
->spec
;
5523 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
5524 int i
, err
, idx
, type_idx
= 0;
5525 const char *prev_label
= NULL
;
5527 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5531 pin
= cfg
->inputs
[i
].pin
;
5532 if (!alc_is_input_pin(codec
, pin
))
5535 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
5536 if (prev_label
&& !strcmp(label
, prev_label
))
5543 idx
= get_connection_index(codec
, mixer
, pin
);
5545 err
= new_analog_input(spec
, pin
,
5555 idx
= get_connection_index(codec
, cap1
, pin
);
5556 if (idx
< 0 && cap2
)
5557 idx
= get_connection_index(codec
, cap2
, pin
);
5559 snd_hda_add_imux_item(imux
, label
, idx
, NULL
);
5564 static int alc880_auto_create_input_ctls(struct hda_codec
*codec
,
5565 const struct auto_pin_cfg
*cfg
)
5567 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x08, 0x09);
5570 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
5571 unsigned int pin_type
)
5573 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5576 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5580 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
5581 hda_nid_t nid
, int pin_type
,
5584 alc_set_pin_output(codec
, nid
, pin_type
);
5585 /* need the manual connection? */
5586 if (alc880_is_multi_pin(nid
)) {
5587 struct alc_spec
*spec
= codec
->spec
;
5588 int idx
= alc880_multi_pin_idx(nid
);
5589 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
5590 AC_VERB_SET_CONNECT_SEL
,
5591 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
5595 static int get_pin_type(int line_out_type
)
5597 if (line_out_type
== AUTO_PIN_HP_OUT
)
5603 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
5605 struct alc_spec
*spec
= codec
->spec
;
5608 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
5609 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
5610 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5611 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
5615 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
5617 struct alc_spec
*spec
= codec
->spec
;
5620 pin
= spec
->autocfg
.speaker_pins
[0];
5621 if (pin
) /* connect to front */
5622 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
5623 pin
= spec
->autocfg
.hp_pins
[0];
5624 if (pin
) /* connect to front */
5625 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
5628 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
5630 struct alc_spec
*spec
= codec
->spec
;
5631 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5634 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5635 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5636 if (alc_is_input_pin(codec
, nid
)) {
5637 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
5638 if (nid
!= ALC880_PIN_CD_NID
&&
5639 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
5640 snd_hda_codec_write(codec
, nid
, 0,
5641 AC_VERB_SET_AMP_GAIN_MUTE
,
5647 static void alc880_auto_init_input_src(struct hda_codec
*codec
)
5649 struct alc_spec
*spec
= codec
->spec
;
5652 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
5653 unsigned int mux_idx
;
5654 const struct hda_input_mux
*imux
;
5655 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
5656 imux
= &spec
->input_mux
[mux_idx
];
5657 if (!imux
->num_items
&& mux_idx
> 0)
5658 imux
= &spec
->input_mux
[0];
5660 snd_hda_codec_write(codec
, spec
->adc_nids
[c
], 0,
5661 AC_VERB_SET_CONNECT_SEL
,
5662 imux
->items
[0].index
);
5666 static int alc_auto_add_multi_channel_mode(struct hda_codec
*codec
);
5668 /* parse the BIOS configuration and set up the alc_spec */
5669 /* return 1 if successful, 0 if the proper config is not found,
5670 * or a negative error code
5672 static int alc880_parse_auto_config(struct hda_codec
*codec
)
5674 struct alc_spec
*spec
= codec
->spec
;
5676 static const hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
5678 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5682 if (!spec
->autocfg
.line_outs
)
5683 return 0; /* can't find valid BIOS pin config */
5685 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
5688 err
= alc_auto_add_multi_channel_mode(codec
);
5691 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5694 err
= alc880_auto_create_extra_out(spec
,
5695 spec
->autocfg
.speaker_pins
[0],
5699 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
5703 err
= alc880_auto_create_input_ctls(codec
, &spec
->autocfg
);
5707 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
5709 alc_auto_parse_digital(codec
);
5711 if (spec
->kctls
.list
)
5712 add_mixer(spec
, spec
->kctls
.list
);
5714 add_verb(spec
, alc880_volume_init_verbs
);
5716 spec
->num_mux_defs
= 1;
5717 spec
->input_mux
= &spec
->private_imux
[0];
5719 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
5724 /* additional initialization for auto-configuration model */
5725 static void alc880_auto_init(struct hda_codec
*codec
)
5727 struct alc_spec
*spec
= codec
->spec
;
5728 alc880_auto_init_multi_out(codec
);
5729 alc880_auto_init_extra_out(codec
);
5730 alc880_auto_init_analog_input(codec
);
5731 alc880_auto_init_input_src(codec
);
5732 alc_auto_init_digital(codec
);
5733 if (spec
->unsol_event
)
5734 alc_inithook(codec
);
5737 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5738 * one of two digital mic pins, e.g. on ALC272
5740 static void fixup_automic_adc(struct hda_codec
*codec
)
5742 struct alc_spec
*spec
= codec
->spec
;
5745 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5746 hda_nid_t cap
= spec
->capsrc_nids
?
5747 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5750 iidx
= get_connection_index(codec
, cap
, spec
->int_mic
.pin
);
5753 eidx
= get_connection_index(codec
, cap
, spec
->ext_mic
.pin
);
5756 spec
->int_mic
.mux_idx
= iidx
;
5757 spec
->ext_mic
.mux_idx
= eidx
;
5758 if (spec
->capsrc_nids
)
5759 spec
->capsrc_nids
+= i
;
5760 spec
->adc_nids
+= i
;
5761 spec
->num_adc_nids
= 1;
5762 /* optional dock-mic */
5763 eidx
= get_connection_index(codec
, cap
, spec
->dock_mic
.pin
);
5765 spec
->dock_mic
.pin
= 0;
5767 spec
->dock_mic
.mux_idx
= eidx
;
5770 snd_printd(KERN_INFO
"hda_codec: %s: "
5771 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5772 codec
->chip_name
, spec
->int_mic
.pin
, spec
->ext_mic
.pin
);
5773 spec
->auto_mic
= 0; /* disable auto-mic to be sure */
5776 /* select or unmute the given capsrc route */
5777 static void select_or_unmute_capsrc(struct hda_codec
*codec
, hda_nid_t cap
,
5780 if (get_wcaps_type(get_wcaps(codec
, cap
)) == AC_WID_AUD_MIX
) {
5781 snd_hda_codec_amp_stereo(codec
, cap
, HDA_INPUT
, idx
,
5784 snd_hda_codec_write_cache(codec
, cap
, 0,
5785 AC_VERB_SET_CONNECT_SEL
, idx
);
5789 /* set the default connection to that pin */
5790 static int init_capsrc_for_pin(struct hda_codec
*codec
, hda_nid_t pin
)
5792 struct alc_spec
*spec
= codec
->spec
;
5797 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5798 hda_nid_t cap
= spec
->capsrc_nids
?
5799 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5802 idx
= get_connection_index(codec
, cap
, pin
);
5805 select_or_unmute_capsrc(codec
, cap
, idx
);
5806 return i
; /* return the found index */
5808 return -1; /* not found */
5811 /* choose the ADC/MUX containing the input pin and initialize the setup */
5812 static void fixup_single_adc(struct hda_codec
*codec
)
5814 struct alc_spec
*spec
= codec
->spec
;
5815 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5818 /* search for the input pin; there must be only one */
5819 if (cfg
->num_inputs
!= 1)
5821 i
= init_capsrc_for_pin(codec
, cfg
->inputs
[0].pin
);
5823 /* use only this ADC */
5824 if (spec
->capsrc_nids
)
5825 spec
->capsrc_nids
+= i
;
5826 spec
->adc_nids
+= i
;
5827 spec
->num_adc_nids
= 1;
5828 spec
->single_input_src
= 1;
5832 /* initialize dual adcs */
5833 static void fixup_dual_adc_switch(struct hda_codec
*codec
)
5835 struct alc_spec
*spec
= codec
->spec
;
5836 init_capsrc_for_pin(codec
, spec
->ext_mic
.pin
);
5837 init_capsrc_for_pin(codec
, spec
->dock_mic
.pin
);
5838 init_capsrc_for_pin(codec
, spec
->int_mic
.pin
);
5841 /* initialize some special cases for input sources */
5842 static void alc_init_special_input_src(struct hda_codec
*codec
)
5844 struct alc_spec
*spec
= codec
->spec
;
5845 if (spec
->dual_adc_switch
)
5846 fixup_dual_adc_switch(codec
);
5847 else if (spec
->single_input_src
)
5848 init_capsrc_for_pin(codec
, spec
->autocfg
.inputs
[0].pin
);
5851 static void set_capture_mixer(struct hda_codec
*codec
)
5853 struct alc_spec
*spec
= codec
->spec
;
5854 static const struct snd_kcontrol_new
*caps
[2][3] = {
5855 { alc_capture_mixer_nosrc1
,
5856 alc_capture_mixer_nosrc2
,
5857 alc_capture_mixer_nosrc3
},
5858 { alc_capture_mixer1
,
5860 alc_capture_mixer3
},
5862 if (spec
->num_adc_nids
> 0 && spec
->num_adc_nids
<= 3) {
5864 int num_adcs
= spec
->num_adc_nids
;
5865 if (spec
->dual_adc_switch
)
5867 else if (spec
->auto_mic
)
5868 fixup_automic_adc(codec
);
5869 else if (spec
->input_mux
) {
5870 if (spec
->input_mux
->num_items
> 1)
5872 else if (spec
->input_mux
->num_items
== 1)
5873 fixup_single_adc(codec
);
5875 spec
->cap_mixer
= caps
[mux
][num_adcs
- 1];
5879 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5880 static void fillup_priv_adc_nids(struct hda_codec
*codec
, const hda_nid_t
*nids
,
5883 struct alc_spec
*spec
= codec
->spec
;
5884 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5886 hda_nid_t fallback_adc
= 0, fallback_cap
= 0;
5888 for (n
= 0; n
< num_nids
; n
++) {
5890 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
5894 if (get_wcaps_type(get_wcaps(codec
, adc
)) != AC_WID_AUD_IN
)
5897 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5901 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5906 if (!fallback_adc
) {
5910 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5911 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5912 for (j
= 0; j
< nconns
; j
++) {
5919 if (i
>= cfg
->num_inputs
) {
5920 int num_adcs
= spec
->num_adc_nids
;
5921 spec
->private_adc_nids
[num_adcs
] = adc
;
5922 spec
->private_capsrc_nids
[num_adcs
] = cap
;
5923 spec
->num_adc_nids
++;
5924 spec
->adc_nids
= spec
->private_adc_nids
;
5926 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
5929 if (!spec
->num_adc_nids
) {
5930 printk(KERN_WARNING
"hda_codec: %s: no valid ADC found;"
5931 " using fallback 0x%x\n",
5932 codec
->chip_name
, fallback_adc
);
5933 spec
->private_adc_nids
[0] = fallback_adc
;
5934 spec
->adc_nids
= spec
->private_adc_nids
;
5935 if (fallback_adc
!= fallback_cap
) {
5936 spec
->private_capsrc_nids
[0] = fallback_cap
;
5937 spec
->capsrc_nids
= spec
->private_adc_nids
;
5942 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5943 #define set_beep_amp(spec, nid, idx, dir) \
5944 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5946 static const struct snd_pci_quirk beep_white_list
[] = {
5947 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5948 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5949 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
5950 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
5951 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5955 static inline int has_cdefine_beep(struct hda_codec
*codec
)
5957 struct alc_spec
*spec
= codec
->spec
;
5958 const struct snd_pci_quirk
*q
;
5959 q
= snd_pci_quirk_lookup(codec
->bus
->pci
, beep_white_list
);
5962 return spec
->cdefine
.enable_pcbeep
;
5965 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5966 #define has_cdefine_beep(codec) 0
5970 * OK, here we have finally the patch for ALC880
5973 static int patch_alc880(struct hda_codec
*codec
)
5975 struct alc_spec
*spec
;
5979 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5985 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
5988 if (board_config
< 0) {
5989 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5991 board_config
= ALC880_AUTO
;
5994 if (board_config
== ALC880_AUTO
) {
5995 /* automatic parse from the BIOS config */
5996 err
= alc880_parse_auto_config(codec
);
6002 "hda_codec: Cannot set up configuration "
6003 "from BIOS. Using 3-stack mode...\n");
6004 board_config
= ALC880_3ST
;
6008 err
= snd_hda_attach_beep_device(codec
, 0x1);
6014 if (board_config
!= ALC880_AUTO
)
6015 setup_preset(codec
, &alc880_presets
[board_config
]);
6017 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
6018 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
6019 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
6021 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
6022 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
6024 if (!spec
->adc_nids
&& spec
->input_mux
) {
6025 /* check whether NID 0x07 is valid */
6026 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
6028 wcap
= get_wcaps_type(wcap
);
6029 if (wcap
!= AC_WID_AUD_IN
) {
6030 spec
->adc_nids
= alc880_adc_nids_alt
;
6031 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
6033 spec
->adc_nids
= alc880_adc_nids
;
6034 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
6037 set_capture_mixer(codec
);
6038 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
6040 spec
->vmaster_nid
= 0x0c;
6042 codec
->patch_ops
= alc_patch_ops
;
6043 if (board_config
== ALC880_AUTO
)
6044 spec
->init_hook
= alc880_auto_init
;
6045 #ifdef CONFIG_SND_HDA_POWER_SAVE
6046 if (!spec
->loopback
.amplist
)
6047 spec
->loopback
.amplist
= alc880_loopbacks
;
6058 static const hda_nid_t alc260_dac_nids
[1] = {
6063 static const hda_nid_t alc260_adc_nids
[1] = {
6068 static const hda_nid_t alc260_adc_nids_alt
[1] = {
6073 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
6074 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
6076 static const hda_nid_t alc260_dual_adc_nids
[2] = {
6081 #define ALC260_DIGOUT_NID 0x03
6082 #define ALC260_DIGIN_NID 0x06
6084 static const struct hda_input_mux alc260_capture_source
= {
6088 { "Front Mic", 0x1 },
6094 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
6095 * headphone jack and the internal CD lines since these are the only pins at
6096 * which audio can appear. For flexibility, also allow the option of
6097 * recording the mixer output on the second ADC (ADC0 doesn't have a
6098 * connection to the mixer output).
6100 static const struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
6104 { "Mic/Line", 0x0 },
6106 { "Headphone", 0x2 },
6112 { "Mic/Line", 0x0 },
6114 { "Headphone", 0x2 },
6121 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
6122 * the Fujitsu S702x, but jacks are marked differently.
6124 static const struct hda_input_mux alc260_acer_capture_sources
[2] = {
6131 { "Headphone", 0x5 },
6140 { "Headphone", 0x6 },
6146 /* Maxdata Favorit 100XS */
6147 static const struct hda_input_mux alc260_favorit100_capture_sources
[2] = {
6151 { "Line/Mic", 0x0 },
6158 { "Line/Mic", 0x0 },
6166 * This is just place-holder, so there's something for alc_build_pcms to look
6167 * at when it calculates the maximum number of channels. ALC260 has no mixer
6168 * element which allows changing the channel mode, so the verb list is
6171 static const struct hda_channel_mode alc260_modes
[1] = {
6176 /* Mixer combinations
6178 * basic: base_output + input + pc_beep + capture
6179 * HP: base_output + input + capture_alt
6180 * HP_3013: hp_3013 + input + capture
6181 * fujitsu: fujitsu + capture
6182 * acer: acer + capture
6185 static const struct snd_kcontrol_new alc260_base_output_mixer
[] = {
6186 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6187 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
6188 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6189 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
6190 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6191 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6195 static const struct snd_kcontrol_new alc260_input_mixer
[] = {
6196 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6197 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6198 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6199 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6201 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6202 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
6203 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
6207 /* update HP, line and mono out pins according to the master switch */
6208 static void alc260_hp_master_update(struct hda_codec
*codec
)
6210 update_speakers(codec
);
6213 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
6214 struct snd_ctl_elem_value
*ucontrol
)
6216 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6217 struct alc_spec
*spec
= codec
->spec
;
6218 *ucontrol
->value
.integer
.value
= !spec
->master_mute
;
6222 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
6223 struct snd_ctl_elem_value
*ucontrol
)
6225 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6226 struct alc_spec
*spec
= codec
->spec
;
6227 int val
= !*ucontrol
->value
.integer
.value
;
6229 if (val
== spec
->master_mute
)
6231 spec
->master_mute
= val
;
6232 alc260_hp_master_update(codec
);
6236 static const struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
6238 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6239 .name
= "Master Playback Switch",
6240 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
6241 .info
= snd_ctl_boolean_mono_info
,
6242 .get
= alc260_hp_master_sw_get
,
6243 .put
= alc260_hp_master_sw_put
,
6245 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6246 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
6247 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6248 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
6249 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6251 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6255 static const struct hda_verb alc260_hp_unsol_verbs
[] = {
6256 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6260 static void alc260_hp_setup(struct hda_codec
*codec
)
6262 struct alc_spec
*spec
= codec
->spec
;
6264 spec
->autocfg
.hp_pins
[0] = 0x0f;
6265 spec
->autocfg
.speaker_pins
[0] = 0x10;
6266 spec
->autocfg
.speaker_pins
[1] = 0x11;
6268 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
6271 static const struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
6273 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6274 .name
= "Master Playback Switch",
6275 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
6276 .info
= snd_ctl_boolean_mono_info
,
6277 .get
= alc260_hp_master_sw_get
,
6278 .put
= alc260_hp_master_sw_put
,
6280 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6281 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
6282 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
6283 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
6284 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6285 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6286 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6287 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
6291 static void alc260_hp_3013_setup(struct hda_codec
*codec
)
6293 struct alc_spec
*spec
= codec
->spec
;
6295 spec
->autocfg
.hp_pins
[0] = 0x15;
6296 spec
->autocfg
.speaker_pins
[0] = 0x10;
6297 spec
->autocfg
.speaker_pins
[1] = 0x11;
6299 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
6302 static const struct hda_bind_ctls alc260_dc7600_bind_master_vol
= {
6303 .ops
= &snd_hda_bind_vol
,
6305 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT
),
6306 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
6307 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT
),
6312 static const struct hda_bind_ctls alc260_dc7600_bind_switch
= {
6313 .ops
= &snd_hda_bind_sw
,
6315 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT
),
6316 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
6321 static const struct snd_kcontrol_new alc260_hp_dc7600_mixer
[] = {
6322 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol
),
6323 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch
),
6324 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT
),
6325 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
6329 static const struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
6330 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6334 static void alc260_hp_3012_setup(struct hda_codec
*codec
)
6336 struct alc_spec
*spec
= codec
->spec
;
6338 spec
->autocfg
.hp_pins
[0] = 0x10;
6339 spec
->autocfg
.speaker_pins
[0] = 0x0f;
6340 spec
->autocfg
.speaker_pins
[1] = 0x11;
6341 spec
->autocfg
.speaker_pins
[2] = 0x15;
6343 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
6346 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6347 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6349 static const struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
6350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6351 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
6352 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6353 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6354 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6355 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
6356 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
6357 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6358 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6359 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
6363 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6364 * versions of the ALC260 don't act on requests to enable mic bias from NID
6365 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6366 * datasheet doesn't mention this restriction. At this stage it's not clear
6367 * whether this behaviour is intentional or is a hardware bug in chip
6368 * revisions available in early 2006. Therefore for now allow the
6369 * "Headphone Jack Mode" control to span all choices, but if it turns out
6370 * that the lack of mic bias for this NID is intentional we could change the
6371 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6373 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6374 * don't appear to make the mic bias available from the "line" jack, even
6375 * though the NID used for this jack (0x14) can supply it. The theory is
6376 * that perhaps Acer have included blocking capacitors between the ALC260
6377 * and the output jack. If this turns out to be the case for all such
6378 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6379 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6381 * The C20x Tablet series have a mono internal speaker which is controlled
6382 * via the chip's Mono sum widget and pin complex, so include the necessary
6383 * controls for such models. On models without a "mono speaker" the control
6384 * won't do anything.
6386 static const struct snd_kcontrol_new alc260_acer_mixer
[] = {
6387 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6388 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
6389 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
6390 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6392 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6394 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6395 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6397 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6398 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6399 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6400 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6401 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6405 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6407 static const struct snd_kcontrol_new alc260_favorit100_mixer
[] = {
6408 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6409 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
6410 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
6411 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6412 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6413 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6417 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6418 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6420 static const struct snd_kcontrol_new alc260_will_mixer
[] = {
6421 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6422 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
6423 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6424 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6425 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6426 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6427 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6428 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6429 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6430 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6434 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6435 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6437 static const struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
6438 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6439 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
6440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6441 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6442 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6443 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
6444 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
6445 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6446 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6447 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6452 * initialization verbs
6454 static const struct hda_verb alc260_init_verbs
[] = {
6455 /* Line In pin widget for input */
6456 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6457 /* CD pin widget for input */
6458 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6459 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6460 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6461 /* Mic2 (front panel) pin widget for input and vref at 80% */
6462 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6463 /* LINE-2 is used for line-out in rear */
6464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6465 /* select line-out */
6466 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
6468 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6470 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6472 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6473 /* mute capture amp left and right */
6474 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6475 /* set connection select to line in (default select for this ADC) */
6476 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6477 /* mute capture amp left and right */
6478 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6479 /* set connection select to line in (default select for this ADC) */
6480 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
6481 /* set vol=0 Line-Out mixer amp left and right */
6482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6483 /* unmute pin widget amp left and right (no gain on this amp) */
6484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6485 /* set vol=0 HP mixer amp left and right */
6486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6487 /* unmute pin widget amp left and right (no gain on this amp) */
6488 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6489 /* set vol=0 Mono mixer amp left and right */
6490 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6491 /* unmute pin widget amp left and right (no gain on this amp) */
6492 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6493 /* unmute LINE-2 out pin */
6494 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6495 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6498 /* mute analog inputs */
6499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6503 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6504 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6505 /* mute Front out path */
6506 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6507 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6508 /* mute Headphone out path */
6509 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6511 /* mute Mono out path */
6512 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6513 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6517 #if 0 /* should be identical with alc260_init_verbs? */
6518 static const struct hda_verb alc260_hp_init_verbs
[] = {
6519 /* Headphone and output */
6520 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6522 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6523 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6524 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6525 /* Mic2 (front panel) pin widget for input and vref at 80% */
6526 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6527 /* Line In pin widget for input */
6528 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6529 /* Line-2 pin widget for output */
6530 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6531 /* CD pin widget for input */
6532 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6533 /* unmute amp left and right */
6534 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
6535 /* set connection select to line in (default select for this ADC) */
6536 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6537 /* unmute Line-Out mixer amp left and right (volume = 0) */
6538 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6539 /* mute pin widget amp left and right (no gain on this amp) */
6540 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6541 /* unmute HP mixer amp left and right (volume = 0) */
6542 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6543 /* mute pin widget amp left and right (no gain on this amp) */
6544 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6545 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6548 /* mute analog inputs */
6549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6554 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6555 /* Unmute Front out path */
6556 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6557 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6558 /* Unmute Headphone out path */
6559 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6560 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6561 /* Unmute Mono out path */
6562 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6563 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6568 static const struct hda_verb alc260_hp_3013_init_verbs
[] = {
6569 /* Line out and output */
6570 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6572 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6573 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6574 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6575 /* Mic2 (front panel) pin widget for input and vref at 80% */
6576 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6577 /* Line In pin widget for input */
6578 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6579 /* Headphone pin widget for output */
6580 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6581 /* CD pin widget for input */
6582 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6583 /* unmute amp left and right */
6584 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
6585 /* set connection select to line in (default select for this ADC) */
6586 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6587 /* unmute Line-Out mixer amp left and right (volume = 0) */
6588 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6589 /* mute pin widget amp left and right (no gain on this amp) */
6590 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6591 /* unmute HP mixer amp left and right (volume = 0) */
6592 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6593 /* mute pin widget amp left and right (no gain on this amp) */
6594 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6595 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6598 /* mute analog inputs */
6599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6603 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6604 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6605 /* Unmute Front out path */
6606 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6607 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6608 /* Unmute Headphone out path */
6609 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6610 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6611 /* Unmute Mono out path */
6612 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6613 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6617 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6618 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6619 * audio = 0x16, internal speaker = 0x10.
6621 static const struct hda_verb alc260_fujitsu_init_verbs
[] = {
6622 /* Disable all GPIOs */
6623 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
6624 /* Internal speaker is connected to headphone pin */
6625 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6626 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6628 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6629 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6630 /* Ensure all other unused pins are disabled and muted. */
6631 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6632 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6633 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6634 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6635 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6636 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6637 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6640 /* Disable digital (SPDIF) pins */
6641 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6642 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6644 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6645 * when acting as an output.
6647 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6649 /* Start with output sum widgets muted and their output gains at min */
6650 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6651 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6652 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6653 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6654 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6655 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6656 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6657 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6658 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6660 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6661 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6662 /* Unmute Line1 pin widget output buffer since it starts as an output.
6663 * If the pin mode is changed by the user the pin mode control will
6664 * take care of enabling the pin's input/output buffers as needed.
6665 * Therefore there's no need to enable the input buffer at this
6668 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6669 /* Unmute input buffer of pin widget used for Line-in (no equiv
6672 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6674 /* Mute capture amp left and right */
6675 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6676 /* Set ADC connection select to match default mixer setting - line
6679 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6681 /* Do the same for the second ADC: mute capture input amp and
6682 * set ADC connection to line in (on mic1 pin)
6684 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6685 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6687 /* Mute all inputs to mixer widget (even unconnected ones) */
6688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6700 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6701 * similar laptops (adapted from Fujitsu init verbs).
6703 static const struct hda_verb alc260_acer_init_verbs
[] = {
6704 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6705 * the headphone jack. Turn this on and rely on the standard mute
6706 * methods whenever the user wants to turn these outputs off.
6708 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6709 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6710 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6711 /* Internal speaker/Headphone jack is connected to Line-out pin */
6712 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6713 /* Internal microphone/Mic jack is connected to Mic1 pin */
6714 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6715 /* Line In jack is connected to Line1 pin */
6716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6717 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6718 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6719 /* Ensure all other unused pins are disabled and muted. */
6720 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6721 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6722 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6723 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6725 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6726 /* Disable digital (SPDIF) pins */
6727 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6728 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6730 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6731 * bus when acting as outputs.
6733 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6734 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6736 /* Start with output sum widgets muted and their output gains at min */
6737 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6738 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6739 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6740 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6741 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6742 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6743 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6744 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6745 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6747 /* Unmute Line-out pin widget amp left and right
6748 * (no equiv mixer ctrl)
6750 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6751 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6752 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6753 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6754 * inputs. If the pin mode is changed by the user the pin mode control
6755 * will take care of enabling the pin's input/output buffers as needed.
6756 * Therefore there's no need to enable the input buffer at this
6759 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6760 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6762 /* Mute capture amp left and right */
6763 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6764 /* Set ADC connection select to match default mixer setting - mic
6767 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6769 /* Do similar with the second ADC: mute capture input amp and
6770 * set ADC connection to mic to match ALSA's default state.
6772 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6773 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6775 /* Mute all inputs to mixer widget (even unconnected ones) */
6776 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6777 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6778 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6779 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6780 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6781 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6783 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6788 /* Initialisation sequence for Maxdata Favorit 100XS
6789 * (adapted from Acer init verbs).
6791 static const struct hda_verb alc260_favorit100_init_verbs
[] = {
6792 /* GPIO 0 enables the output jack.
6793 * Turn this on and rely on the standard mute
6794 * methods whenever the user wants to turn these outputs off.
6796 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6797 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6798 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6799 /* Line/Mic input jack is connected to Mic1 pin */
6800 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6801 /* Ensure all other unused pins are disabled and muted. */
6802 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6803 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6804 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6805 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6806 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6807 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6808 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6810 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6811 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6812 /* Disable digital (SPDIF) pins */
6813 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6814 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6816 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6817 * bus when acting as outputs.
6819 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6820 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6822 /* Start with output sum widgets muted and their output gains at min */
6823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6824 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6825 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6826 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6829 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6830 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6831 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6833 /* Unmute Line-out pin widget amp left and right
6834 * (no equiv mixer ctrl)
6836 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6837 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6838 * inputs. If the pin mode is changed by the user the pin mode control
6839 * will take care of enabling the pin's input/output buffers as needed.
6840 * Therefore there's no need to enable the input buffer at this
6843 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6845 /* Mute capture amp left and right */
6846 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6847 /* Set ADC connection select to match default mixer setting - mic
6850 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6852 /* Do similar with the second ADC: mute capture input amp and
6853 * set ADC connection to mic to match ALSA's default state.
6855 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6856 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6858 /* Mute all inputs to mixer widget (even unconnected ones) */
6859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6863 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6865 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6866 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6871 static const struct hda_verb alc260_will_verbs
[] = {
6872 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6873 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6874 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
6875 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6876 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6877 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
6881 static const struct hda_verb alc260_replacer_672v_verbs
[] = {
6882 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6883 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6884 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
6886 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6887 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6888 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
6890 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6894 /* toggle speaker-output according to the hp-jack state */
6895 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
6897 unsigned int present
;
6899 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6900 present
= snd_hda_jack_detect(codec
, 0x0f);
6902 snd_hda_codec_write_cache(codec
, 0x01, 0,
6903 AC_VERB_SET_GPIO_DATA
, 1);
6904 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6905 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6908 snd_hda_codec_write_cache(codec
, 0x01, 0,
6909 AC_VERB_SET_GPIO_DATA
, 0);
6910 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6911 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6916 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
6919 if ((res
>> 26) == ALC880_HP_EVENT
)
6920 alc260_replacer_672v_automute(codec
);
6923 static const struct hda_verb alc260_hp_dc7600_verbs
[] = {
6924 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x01},
6925 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6926 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6927 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6928 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6929 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6930 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6931 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6932 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6933 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6937 /* Test configuration for debugging, modelled after the ALC880 test
6940 #ifdef CONFIG_SND_DEBUG
6941 static const hda_nid_t alc260_test_dac_nids
[1] = {
6944 static const hda_nid_t alc260_test_adc_nids
[2] = {
6947 /* For testing the ALC260, each input MUX needs its own definition since
6948 * the signal assignments are different. This assumes that the first ADC
6951 static const struct hda_input_mux alc260_test_capture_sources
[2] = {
6955 { "MIC1 pin", 0x0 },
6956 { "MIC2 pin", 0x1 },
6957 { "LINE1 pin", 0x2 },
6958 { "LINE2 pin", 0x3 },
6960 { "LINE-OUT pin", 0x5 },
6961 { "HP-OUT pin", 0x6 },
6967 { "MIC1 pin", 0x0 },
6968 { "MIC2 pin", 0x1 },
6969 { "LINE1 pin", 0x2 },
6970 { "LINE2 pin", 0x3 },
6973 { "LINE-OUT pin", 0x6 },
6974 { "HP-OUT pin", 0x7 },
6978 static const struct snd_kcontrol_new alc260_test_mixer
[] = {
6979 /* Output driver widgets */
6980 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6981 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6982 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6983 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
6984 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6985 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
6987 /* Modes for retasking pin widgets
6988 * Note: the ALC260 doesn't seem to act on requests to enable mic
6989 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6990 * mention this restriction. At this stage it's not clear whether
6991 * this behaviour is intentional or is a hardware bug in chip
6992 * revisions available at least up until early 2006. Therefore for
6993 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6994 * choices, but if it turns out that the lack of mic bias for these
6995 * NIDs is intentional we could change their modes from
6996 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6998 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
6999 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
7000 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
7001 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
7002 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
7003 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
7005 /* Loopback mixer controls */
7006 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
7007 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
7008 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
7009 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
7010 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
7011 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
7012 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
7013 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
7014 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
7015 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
7016 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
7017 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
7018 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
7019 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
7021 /* Controls for GPIO pins, assuming they are configured as outputs */
7022 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
7023 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
7024 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
7025 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
7027 /* Switches to allow the digital IO pins to be enabled. The datasheet
7028 * is ambigious as to which NID is which; testing on laptops which
7029 * make this output available should provide clarification.
7031 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
7032 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
7034 /* A switch allowing EAPD to be enabled. Some laptops seem to use
7035 * this output to turn on an external amplifier.
7037 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
7038 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
7042 static const struct hda_verb alc260_test_init_verbs
[] = {
7043 /* Enable all GPIOs as outputs with an initial value of 0 */
7044 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
7045 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
7046 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
7048 /* Enable retasking pins as output, initially without power amp */
7049 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7050 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7051 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7052 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7053 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7054 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7056 /* Disable digital (SPDIF) pins initially, but users can enable
7057 * them via a mixer switch. In the case of SPDIF-out, this initverb
7058 * payload also sets the generation to 0, output to be in "consumer"
7059 * PCM format, copyright asserted, no pre-emphasis and no validity
7062 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
7063 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
7065 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
7066 * OUT1 sum bus when acting as an output.
7068 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
7069 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
7070 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
7071 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
7073 /* Start with output sum widgets muted and their output gains at min */
7074 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7075 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7076 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7077 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7078 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7079 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7080 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7081 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7082 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7084 /* Unmute retasking pin widget output buffers since the default
7085 * state appears to be output. As the pin mode is changed by the
7086 * user the pin mode control will take care of enabling the pin's
7087 * input/output buffers as needed.
7089 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7092 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7093 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7094 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7095 /* Also unmute the mono-out pin widget */
7096 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7098 /* Mute capture amp left and right */
7099 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7100 /* Set ADC connection select to match default mixer setting (mic1
7103 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
7105 /* Do the same for the second ADC: mute capture input amp and
7106 * set ADC connection to mic1 pin
7108 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7109 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
7111 /* Mute all inputs to mixer widget (even unconnected ones) */
7112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
7113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
7114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
7115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
7116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
7117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
7118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
7119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
7125 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
7126 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
7128 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
7129 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
7132 * for BIOS auto-configuration
7135 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
7136 const char *pfx
, int *vol_bits
)
7139 unsigned long vol_val
, sw_val
;
7142 if (nid
>= 0x0f && nid
< 0x11) {
7143 nid_vol
= nid
- 0x7;
7144 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
7145 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
7146 } else if (nid
== 0x11) {
7147 nid_vol
= nid
- 0x7;
7148 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
7149 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
7150 } else if (nid
>= 0x12 && nid
<= 0x15) {
7152 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
7153 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
7157 if (!(*vol_bits
& (1 << nid_vol
))) {
7158 /* first control for the volume widget */
7159 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, vol_val
);
7162 *vol_bits
|= (1 << nid_vol
);
7164 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, sw_val
);
7170 /* add playback controls from the parsed DAC table */
7171 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
7172 const struct auto_pin_cfg
*cfg
)
7178 spec
->multiout
.num_dacs
= 1;
7179 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
7180 spec
->private_dac_nids
[0] = 0x02;
7182 nid
= cfg
->line_out_pins
[0];
7185 if (!cfg
->speaker_pins
[0] && !cfg
->hp_pins
[0])
7187 else if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
7191 err
= alc260_add_playback_controls(spec
, nid
, pfx
, &vols
);
7196 nid
= cfg
->speaker_pins
[0];
7198 err
= alc260_add_playback_controls(spec
, nid
, "Speaker", &vols
);
7203 nid
= cfg
->hp_pins
[0];
7205 err
= alc260_add_playback_controls(spec
, nid
, "Headphone",
7213 /* create playback/capture controls for input pins */
7214 static int alc260_auto_create_input_ctls(struct hda_codec
*codec
,
7215 const struct auto_pin_cfg
*cfg
)
7217 return alc_auto_create_input_ctls(codec
, cfg
, 0x07, 0x04, 0x05);
7220 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
7221 hda_nid_t nid
, int pin_type
,
7224 alc_set_pin_output(codec
, nid
, pin_type
);
7225 /* need the manual connection? */
7227 int idx
= nid
- 0x12;
7228 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
7229 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
7233 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
7235 struct alc_spec
*spec
= codec
->spec
;
7238 nid
= spec
->autocfg
.line_out_pins
[0];
7240 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
7241 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
7244 nid
= spec
->autocfg
.speaker_pins
[0];
7246 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
7248 nid
= spec
->autocfg
.hp_pins
[0];
7250 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
7253 #define ALC260_PIN_CD_NID 0x16
7254 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
7256 struct alc_spec
*spec
= codec
->spec
;
7257 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
7260 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
7261 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
7263 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
7264 if (nid
!= ALC260_PIN_CD_NID
&&
7265 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
7266 snd_hda_codec_write(codec
, nid
, 0,
7267 AC_VERB_SET_AMP_GAIN_MUTE
,
7273 #define alc260_auto_init_input_src alc880_auto_init_input_src
7276 * generic initialization of ADC, input mixers and output mixers
7278 static const struct hda_verb alc260_volume_init_verbs
[] = {
7280 * Unmute ADC0-1 and set the default input to mic-in
7282 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
7283 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7284 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
7285 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7287 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7289 * Note: PASD motherboards uses the Line In 2 as the input for
7290 * front panel mic (mic 2)
7292 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7293 /* mute analog inputs */
7294 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7295 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7296 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7298 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7301 * Set up output mixers (0x08 - 0x0a)
7303 /* set vol=0 to output mixers */
7304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7306 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7307 /* set up input amps for analog loopback */
7308 /* Amp Indices: DAC = 0, mixer = 1 */
7309 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7310 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7311 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7312 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7313 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7314 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7319 static int alc260_parse_auto_config(struct hda_codec
*codec
)
7321 struct alc_spec
*spec
= codec
->spec
;
7323 static const hda_nid_t alc260_ignore
[] = { 0x17, 0 };
7325 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
7329 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
7332 if (!spec
->kctls
.list
)
7333 return 0; /* can't find valid BIOS pin config */
7334 err
= alc260_auto_create_input_ctls(codec
, &spec
->autocfg
);
7338 spec
->multiout
.max_channels
= 2;
7340 if (spec
->autocfg
.dig_outs
)
7341 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
7342 if (spec
->kctls
.list
)
7343 add_mixer(spec
, spec
->kctls
.list
);
7345 add_verb(spec
, alc260_volume_init_verbs
);
7347 spec
->num_mux_defs
= 1;
7348 spec
->input_mux
= &spec
->private_imux
[0];
7350 alc_ssid_check(codec
, 0x10, 0x15, 0x0f, 0);
7355 /* additional initialization for auto-configuration model */
7356 static void alc260_auto_init(struct hda_codec
*codec
)
7358 struct alc_spec
*spec
= codec
->spec
;
7359 alc260_auto_init_multi_out(codec
);
7360 alc260_auto_init_analog_input(codec
);
7361 alc260_auto_init_input_src(codec
);
7362 alc_auto_init_digital(codec
);
7363 if (spec
->unsol_event
)
7364 alc_inithook(codec
);
7367 #ifdef CONFIG_SND_HDA_POWER_SAVE
7368 static const struct hda_amp_list alc260_loopbacks
[] = {
7369 { 0x07, HDA_INPUT
, 0 },
7370 { 0x07, HDA_INPUT
, 1 },
7371 { 0x07, HDA_INPUT
, 2 },
7372 { 0x07, HDA_INPUT
, 3 },
7373 { 0x07, HDA_INPUT
, 4 },
7385 static const struct alc_fixup alc260_fixups
[] = {
7386 [PINFIX_HP_DC5750
] = {
7387 .type
= ALC_FIXUP_PINS
,
7388 .v
.pins
= (const struct alc_pincfg
[]) {
7389 { 0x11, 0x90130110 }, /* speaker */
7395 static const struct snd_pci_quirk alc260_fixup_tbl
[] = {
7396 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750
),
7401 * ALC260 configurations
7403 static const char * const alc260_models
[ALC260_MODEL_LAST
] = {
7404 [ALC260_BASIC
] = "basic",
7406 [ALC260_HP_3013
] = "hp-3013",
7407 [ALC260_HP_DC7600
] = "hp-dc7600",
7408 [ALC260_FUJITSU_S702X
] = "fujitsu",
7409 [ALC260_ACER
] = "acer",
7410 [ALC260_WILL
] = "will",
7411 [ALC260_REPLACER_672V
] = "replacer",
7412 [ALC260_FAVORIT100
] = "favorit100",
7413 #ifdef CONFIG_SND_DEBUG
7414 [ALC260_TEST
] = "test",
7416 [ALC260_AUTO
] = "auto",
7419 static const struct snd_pci_quirk alc260_cfg_tbl
[] = {
7420 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
7421 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL
),
7422 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
7423 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100
),
7424 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
7425 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO
), /* no quirk */
7426 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
7427 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
7428 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600
),
7429 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
7430 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
7431 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
7432 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
7433 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
7434 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
7435 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
7436 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
7437 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
7438 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
7439 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
7443 static const struct alc_config_preset alc260_presets
[] = {
7445 .mixers
= { alc260_base_output_mixer
,
7446 alc260_input_mixer
},
7447 .init_verbs
= { alc260_init_verbs
},
7448 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7449 .dac_nids
= alc260_dac_nids
,
7450 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7451 .adc_nids
= alc260_dual_adc_nids
,
7452 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7453 .channel_mode
= alc260_modes
,
7454 .input_mux
= &alc260_capture_source
,
7457 .mixers
= { alc260_hp_output_mixer
,
7458 alc260_input_mixer
},
7459 .init_verbs
= { alc260_init_verbs
,
7460 alc260_hp_unsol_verbs
},
7461 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7462 .dac_nids
= alc260_dac_nids
,
7463 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7464 .adc_nids
= alc260_adc_nids_alt
,
7465 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7466 .channel_mode
= alc260_modes
,
7467 .input_mux
= &alc260_capture_source
,
7468 .unsol_event
= alc_sku_unsol_event
,
7469 .setup
= alc260_hp_setup
,
7470 .init_hook
= alc_inithook
,
7472 [ALC260_HP_DC7600
] = {
7473 .mixers
= { alc260_hp_dc7600_mixer
,
7474 alc260_input_mixer
},
7475 .init_verbs
= { alc260_init_verbs
,
7476 alc260_hp_dc7600_verbs
},
7477 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7478 .dac_nids
= alc260_dac_nids
,
7479 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7480 .adc_nids
= alc260_adc_nids_alt
,
7481 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7482 .channel_mode
= alc260_modes
,
7483 .input_mux
= &alc260_capture_source
,
7484 .unsol_event
= alc_sku_unsol_event
,
7485 .setup
= alc260_hp_3012_setup
,
7486 .init_hook
= alc_inithook
,
7488 [ALC260_HP_3013
] = {
7489 .mixers
= { alc260_hp_3013_mixer
,
7490 alc260_input_mixer
},
7491 .init_verbs
= { alc260_hp_3013_init_verbs
,
7492 alc260_hp_3013_unsol_verbs
},
7493 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7494 .dac_nids
= alc260_dac_nids
,
7495 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7496 .adc_nids
= alc260_adc_nids_alt
,
7497 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7498 .channel_mode
= alc260_modes
,
7499 .input_mux
= &alc260_capture_source
,
7500 .unsol_event
= alc_sku_unsol_event
,
7501 .setup
= alc260_hp_3013_setup
,
7502 .init_hook
= alc_inithook
,
7504 [ALC260_FUJITSU_S702X
] = {
7505 .mixers
= { alc260_fujitsu_mixer
},
7506 .init_verbs
= { alc260_fujitsu_init_verbs
},
7507 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7508 .dac_nids
= alc260_dac_nids
,
7509 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7510 .adc_nids
= alc260_dual_adc_nids
,
7511 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7512 .channel_mode
= alc260_modes
,
7513 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
7514 .input_mux
= alc260_fujitsu_capture_sources
,
7517 .mixers
= { alc260_acer_mixer
},
7518 .init_verbs
= { alc260_acer_init_verbs
},
7519 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7520 .dac_nids
= alc260_dac_nids
,
7521 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7522 .adc_nids
= alc260_dual_adc_nids
,
7523 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7524 .channel_mode
= alc260_modes
,
7525 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
7526 .input_mux
= alc260_acer_capture_sources
,
7528 [ALC260_FAVORIT100
] = {
7529 .mixers
= { alc260_favorit100_mixer
},
7530 .init_verbs
= { alc260_favorit100_init_verbs
},
7531 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7532 .dac_nids
= alc260_dac_nids
,
7533 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7534 .adc_nids
= alc260_dual_adc_nids
,
7535 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7536 .channel_mode
= alc260_modes
,
7537 .num_mux_defs
= ARRAY_SIZE(alc260_favorit100_capture_sources
),
7538 .input_mux
= alc260_favorit100_capture_sources
,
7541 .mixers
= { alc260_will_mixer
},
7542 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
7543 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7544 .dac_nids
= alc260_dac_nids
,
7545 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
7546 .adc_nids
= alc260_adc_nids
,
7547 .dig_out_nid
= ALC260_DIGOUT_NID
,
7548 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7549 .channel_mode
= alc260_modes
,
7550 .input_mux
= &alc260_capture_source
,
7552 [ALC260_REPLACER_672V
] = {
7553 .mixers
= { alc260_replacer_672v_mixer
},
7554 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
7555 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7556 .dac_nids
= alc260_dac_nids
,
7557 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
7558 .adc_nids
= alc260_adc_nids
,
7559 .dig_out_nid
= ALC260_DIGOUT_NID
,
7560 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7561 .channel_mode
= alc260_modes
,
7562 .input_mux
= &alc260_capture_source
,
7563 .unsol_event
= alc260_replacer_672v_unsol_event
,
7564 .init_hook
= alc260_replacer_672v_automute
,
7566 #ifdef CONFIG_SND_DEBUG
7568 .mixers
= { alc260_test_mixer
},
7569 .init_verbs
= { alc260_test_init_verbs
},
7570 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
7571 .dac_nids
= alc260_test_dac_nids
,
7572 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
7573 .adc_nids
= alc260_test_adc_nids
,
7574 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7575 .channel_mode
= alc260_modes
,
7576 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
7577 .input_mux
= alc260_test_capture_sources
,
7582 static int patch_alc260(struct hda_codec
*codec
)
7584 struct alc_spec
*spec
;
7585 int err
, board_config
;
7587 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
7593 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
7596 if (board_config
< 0) {
7597 snd_printd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
7599 board_config
= ALC260_AUTO
;
7602 if (board_config
== ALC260_AUTO
) {
7603 alc_pick_fixup(codec
, NULL
, alc260_fixup_tbl
, alc260_fixups
);
7604 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
7607 if (board_config
== ALC260_AUTO
) {
7608 /* automatic parse from the BIOS config */
7609 err
= alc260_parse_auto_config(codec
);
7615 "hda_codec: Cannot set up configuration "
7616 "from BIOS. Using base mode...\n");
7617 board_config
= ALC260_BASIC
;
7621 err
= snd_hda_attach_beep_device(codec
, 0x1);
7627 if (board_config
!= ALC260_AUTO
)
7628 setup_preset(codec
, &alc260_presets
[board_config
]);
7630 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
7631 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
7632 spec
->stream_analog_alt_capture
= &alc260_pcm_analog_capture
;
7634 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
7635 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
7637 if (!spec
->adc_nids
&& spec
->input_mux
) {
7638 /* check whether NID 0x04 is valid */
7639 unsigned int wcap
= get_wcaps(codec
, 0x04);
7640 wcap
= get_wcaps_type(wcap
);
7642 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
7643 spec
->adc_nids
= alc260_adc_nids_alt
;
7644 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
7646 spec
->adc_nids
= alc260_adc_nids
;
7647 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
7650 set_capture_mixer(codec
);
7651 set_beep_amp(spec
, 0x07, 0x05, HDA_INPUT
);
7653 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
7655 spec
->vmaster_nid
= 0x08;
7657 codec
->patch_ops
= alc_patch_ops
;
7658 if (board_config
== ALC260_AUTO
)
7659 spec
->init_hook
= alc260_auto_init
;
7660 spec
->shutup
= alc_eapd_shutup
;
7661 #ifdef CONFIG_SND_HDA_POWER_SAVE
7662 if (!spec
->loopback
.amplist
)
7663 spec
->loopback
.amplist
= alc260_loopbacks
;
7671 * ALC882/883/885/888/889 support
7673 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7674 * configuration. Each pin widget can choose any input DACs and a mixer.
7675 * Each ADC is connected from a mixer of all inputs. This makes possible
7676 * 6-channel independent captures.
7678 * In addition, an independent DAC for the multi-playback (not used in this
7681 #define ALC882_DIGOUT_NID 0x06
7682 #define ALC882_DIGIN_NID 0x0a
7683 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7684 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7685 #define ALC1200_DIGOUT_NID 0x10
7688 static const struct hda_channel_mode alc882_ch_modes
[1] = {
7693 static const hda_nid_t alc882_dac_nids
[4] = {
7694 /* front, rear, clfe, rear_surr */
7695 0x02, 0x03, 0x04, 0x05
7697 #define alc883_dac_nids alc882_dac_nids
7700 #define alc882_adc_nids alc880_adc_nids
7701 #define alc882_adc_nids_alt alc880_adc_nids_alt
7702 #define alc883_adc_nids alc882_adc_nids_alt
7703 static const hda_nid_t alc883_adc_nids_alt
[1] = { 0x08 };
7704 static const hda_nid_t alc883_adc_nids_rev
[2] = { 0x09, 0x08 };
7705 #define alc889_adc_nids alc880_adc_nids
7707 static const hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
7708 static const hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
7709 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7710 static const hda_nid_t alc883_capsrc_nids_rev
[2] = { 0x22, 0x23 };
7711 #define alc889_capsrc_nids alc882_capsrc_nids
7714 /* FIXME: should be a matrix-type input source selection */
7716 static const struct hda_input_mux alc882_capture_source
= {
7720 { "Front Mic", 0x1 },
7726 #define alc883_capture_source alc882_capture_source
7728 static const struct hda_input_mux alc889_capture_source
= {
7731 { "Front Mic", 0x0 },
7737 static const struct hda_input_mux mb5_capture_source
= {
7746 static const struct hda_input_mux macmini3_capture_source
= {
7754 static const struct hda_input_mux alc883_3stack_6ch_intel
= {
7758 { "Front Mic", 0x0 },
7764 static const struct hda_input_mux alc883_lenovo_101e_capture_source
= {
7772 static const struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
7776 { "Internal Mic", 0x1 },
7782 static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
7786 { "Internal Mic", 0x1 },
7790 static const struct hda_input_mux alc883_lenovo_sky_capture_source
= {
7794 { "Front Mic", 0x1 },
7799 static const struct hda_input_mux alc883_asus_eee1601_capture_source
= {
7807 static const struct hda_input_mux alc889A_mb31_capture_source
= {
7811 /* Front Mic (0x01) unused */
7813 /* Line 2 (0x03) unused */
7814 /* CD (0x04) unused? */
7818 static const struct hda_input_mux alc889A_imac91_capture_source
= {
7822 { "Line", 0x2 }, /* Not sure! */
7829 static const struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
7836 static const struct hda_verb alc882_3ST_ch2_init
[] = {
7837 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7838 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7839 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7840 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7847 static const struct hda_verb alc882_3ST_ch4_init
[] = {
7848 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7849 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7850 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7851 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7852 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7859 static const struct hda_verb alc882_3ST_ch6_init
[] = {
7860 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7861 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7862 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7863 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7864 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7865 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7869 static const struct hda_channel_mode alc882_3ST_6ch_modes
[3] = {
7870 { 2, alc882_3ST_ch2_init
},
7871 { 4, alc882_3ST_ch4_init
},
7872 { 6, alc882_3ST_ch6_init
},
7875 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7880 static const struct hda_verb alc883_3ST_ch2_clevo_init
[] = {
7881 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7882 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7883 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7884 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7885 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7892 static const struct hda_verb alc883_3ST_ch4_clevo_init
[] = {
7893 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7894 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7895 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7896 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7897 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7898 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7905 static const struct hda_verb alc883_3ST_ch6_clevo_init
[] = {
7906 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7907 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7908 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7909 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7910 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7911 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7912 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7916 static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes
[3] = {
7917 { 2, alc883_3ST_ch2_clevo_init
},
7918 { 4, alc883_3ST_ch4_clevo_init
},
7919 { 6, alc883_3ST_ch6_clevo_init
},
7926 static const struct hda_verb alc882_sixstack_ch6_init
[] = {
7927 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7928 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7929 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7930 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7937 static const struct hda_verb alc882_sixstack_ch8_init
[] = {
7938 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7939 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7940 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7941 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7945 static const struct hda_channel_mode alc882_sixstack_modes
[2] = {
7946 { 6, alc882_sixstack_ch6_init
},
7947 { 8, alc882_sixstack_ch8_init
},
7951 /* Macbook Air 2,1 */
7953 static const struct hda_channel_mode alc885_mba21_ch_modes
[1] = {
7958 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7964 static const struct hda_verb alc885_mbp_ch2_init
[] = {
7965 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7966 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7967 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7974 static const struct hda_verb alc885_mbp_ch4_init
[] = {
7975 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7976 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7977 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7978 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7979 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7983 static const struct hda_channel_mode alc885_mbp_4ch_modes
[2] = {
7984 { 2, alc885_mbp_ch2_init
},
7985 { 4, alc885_mbp_ch4_init
},
7990 * Speakers/Woofer/HP = Front
7993 static const struct hda_verb alc885_mb5_ch2_init
[] = {
7994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8001 * Speakers/HP = Front
8005 static const struct hda_verb alc885_mb5_ch6_init
[] = {
8006 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8008 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8012 static const struct hda_channel_mode alc885_mb5_6ch_modes
[2] = {
8013 { 2, alc885_mb5_ch2_init
},
8014 { 6, alc885_mb5_ch6_init
},
8017 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
8022 static const struct hda_verb alc883_4ST_ch2_init
[] = {
8023 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8024 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8025 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8026 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8027 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8028 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8035 static const struct hda_verb alc883_4ST_ch4_init
[] = {
8036 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8037 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8038 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8039 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8040 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8041 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8042 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8049 static const struct hda_verb alc883_4ST_ch6_init
[] = {
8050 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8051 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8052 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8053 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8054 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8055 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8056 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8057 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8064 static const struct hda_verb alc883_4ST_ch8_init
[] = {
8065 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8066 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8067 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
8068 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8069 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8070 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8071 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8072 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8073 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8077 static const struct hda_channel_mode alc883_4ST_8ch_modes
[4] = {
8078 { 2, alc883_4ST_ch2_init
},
8079 { 4, alc883_4ST_ch4_init
},
8080 { 6, alc883_4ST_ch6_init
},
8081 { 8, alc883_4ST_ch8_init
},
8088 static const struct hda_verb alc883_3ST_ch2_intel_init
[] = {
8089 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8090 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8091 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8092 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8099 static const struct hda_verb alc883_3ST_ch4_intel_init
[] = {
8100 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8101 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8102 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8103 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8104 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8111 static const struct hda_verb alc883_3ST_ch6_intel_init
[] = {
8112 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8113 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8114 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8115 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8116 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8117 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8121 static const struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
8122 { 2, alc883_3ST_ch2_intel_init
},
8123 { 4, alc883_3ST_ch4_intel_init
},
8124 { 6, alc883_3ST_ch6_intel_init
},
8130 static const struct hda_verb alc889_ch2_intel_init
[] = {
8131 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8132 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8133 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8134 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8135 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8136 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8143 static const struct hda_verb alc889_ch6_intel_init
[] = {
8144 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8145 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8146 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8147 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
8148 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8149 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8156 static const struct hda_verb alc889_ch8_intel_init
[] = {
8157 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
8158 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8159 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8160 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
8161 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x03 },
8162 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8163 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8167 static const struct hda_channel_mode alc889_8ch_intel_modes
[3] = {
8168 { 2, alc889_ch2_intel_init
},
8169 { 6, alc889_ch6_intel_init
},
8170 { 8, alc889_ch8_intel_init
},
8176 static const struct hda_verb alc883_sixstack_ch6_init
[] = {
8177 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
8178 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8179 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8180 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8187 static const struct hda_verb alc883_sixstack_ch8_init
[] = {
8188 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8189 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8190 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8191 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8195 static const struct hda_channel_mode alc883_sixstack_modes
[2] = {
8196 { 6, alc883_sixstack_ch6_init
},
8197 { 8, alc883_sixstack_ch8_init
},
8201 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
8202 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
8204 static const struct snd_kcontrol_new alc882_base_mixer
[] = {
8205 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8206 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8207 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8208 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8209 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8210 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8211 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8212 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8213 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8214 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
8215 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8216 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8217 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8218 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8219 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8221 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8223 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8224 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8225 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8229 /* Macbook Air 2,1 same control for HP and internal Speaker */
8231 static const struct snd_kcontrol_new alc885_mba21_mixer
[] = {
8232 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8233 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT
),
8238 static const struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
8239 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8240 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8241 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
8242 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT
),
8243 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8244 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8245 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
8247 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
8248 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT
),
8249 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT
),
8253 static const struct snd_kcontrol_new alc885_mb5_mixer
[] = {
8254 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8255 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8256 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8257 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
8258 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
8259 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
8260 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
8261 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
8262 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
8263 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
8264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8265 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8266 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT
),
8267 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT
),
8271 static const struct snd_kcontrol_new alc885_macmini3_mixer
[] = {
8272 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8273 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8274 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8275 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
8276 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
8277 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
8278 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
8279 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
8280 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
8281 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
8282 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT
),
8286 static const struct snd_kcontrol_new alc885_imac91_mixer
[] = {
8287 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8288 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8293 static const struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
8294 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8295 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8296 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8297 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8298 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8299 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8301 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8302 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8306 static const struct snd_kcontrol_new alc882_targa_mixer
[] = {
8307 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8308 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8309 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8310 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8311 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8312 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8313 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8315 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8316 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8317 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8318 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8319 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8323 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8324 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8326 static const struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
8327 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8328 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8329 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8330 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
8331 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8332 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8333 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8334 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8335 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
8336 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
8337 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8338 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8339 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8343 static const struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
8344 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8345 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8346 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8347 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8348 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8350 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8352 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8357 static const struct snd_kcontrol_new alc882_chmode_mixer
[] = {
8359 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8360 .name
= "Channel Mode",
8361 .info
= alc_ch_mode_info
,
8362 .get
= alc_ch_mode_get
,
8363 .put
= alc_ch_mode_put
,
8368 static const struct hda_verb alc882_base_init_verbs
[] = {
8369 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8376 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8377 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8379 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8380 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8382 /* Front Pin: output 0 (0x0c) */
8383 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8384 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8385 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8386 /* Rear Pin: output 1 (0x0d) */
8387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8389 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8390 /* CLFE Pin: output 2 (0x0e) */
8391 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8392 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8393 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8394 /* Side Pin: output 3 (0x0f) */
8395 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8396 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8397 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8398 /* Mic (rear) pin: input vref at 80% */
8399 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8400 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8401 /* Front Mic pin: input vref at 80% */
8402 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8403 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8404 /* Line In pin: input */
8405 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8406 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8407 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8408 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8409 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8410 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8411 /* CD pin widget for input */
8412 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8414 /* FIXME: use matrix-type input source selection */
8415 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8420 /* ADC2: mute amp left and right */
8421 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8422 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8423 /* ADC3: mute amp left and right */
8424 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8425 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8430 static const struct hda_verb alc882_adc1_init_verbs
[] = {
8431 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8432 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8433 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8434 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8436 /* ADC1: mute amp left and right */
8437 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8438 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8442 static const struct hda_verb alc882_eapd_verbs
[] = {
8443 /* change to EAPD mode */
8444 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8445 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
8449 static const struct hda_verb alc889_eapd_verbs
[] = {
8450 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8451 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8455 static const struct hda_verb alc_hp15_unsol_verbs
[] = {
8456 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8457 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8461 static const struct hda_verb alc885_init_verbs
[] = {
8462 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8467 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8469 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8472 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8473 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8475 /* Front HP Pin: output 0 (0x0c) */
8476 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8477 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8478 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8479 /* Front Pin: output 0 (0x0c) */
8480 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8481 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8482 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8483 /* Rear Pin: output 1 (0x0d) */
8484 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8485 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8486 {0x19, AC_VERB_SET_CONNECT_SEL
, 0x01},
8487 /* CLFE Pin: output 2 (0x0e) */
8488 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8489 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8490 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8491 /* Side Pin: output 3 (0x0f) */
8492 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8493 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8494 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8495 /* Mic (rear) pin: input vref at 80% */
8496 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8497 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8498 /* Front Mic pin: input vref at 80% */
8499 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8500 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8501 /* Line In pin: input */
8502 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8503 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8505 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8507 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8512 /* ADC2: mute amp left and right */
8513 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8514 /* ADC3: mute amp left and right */
8515 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8520 static const struct hda_verb alc885_init_input_verbs
[] = {
8521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8523 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
8528 /* Unmute Selector 24h and set the default input to front mic */
8529 static const struct hda_verb alc889_init_input_verbs
[] = {
8530 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
8531 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8536 #define alc883_init_verbs alc882_base_init_verbs
8539 static const struct snd_kcontrol_new alc882_macpro_mixer
[] = {
8540 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8541 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8542 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
8543 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8544 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8545 /* FIXME: this looks suspicious...
8546 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8547 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8552 static const struct hda_verb alc882_macpro_init_verbs
[] = {
8553 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8556 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8557 /* Front Pin: output 0 (0x0c) */
8558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8560 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8561 /* Front Mic pin: input vref at 80% */
8562 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8563 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8564 /* Speaker: output */
8565 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8566 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8567 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
8568 /* Headphone output (output 0 - 0x0c) */
8569 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8570 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8571 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8573 /* FIXME: use matrix-type input source selection */
8574 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8575 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8577 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8578 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8579 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8581 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8582 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8583 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8584 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8589 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8590 /* ADC1: mute amp left and right */
8591 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8592 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8593 /* ADC2: mute amp left and right */
8594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8595 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8596 /* ADC3: mute amp left and right */
8597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8598 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8604 static const struct hda_verb alc885_mb5_init_verbs
[] = {
8606 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8607 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8608 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8609 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8611 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8614 /* Surround mixer */
8615 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8617 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8619 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8620 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8623 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8624 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8625 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8626 /* Front Pin (0x0c) */
8627 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8628 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8629 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8630 /* LFE Pin (0x0e) */
8631 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8632 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8633 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
8635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8636 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8637 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
8638 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8639 /* Front Mic pin: input vref at 80% */
8640 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8641 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8643 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0x1)},
8647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x7)},
8648 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x4)},
8653 static const struct hda_verb alc885_macmini3_init_verbs
[] = {
8655 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8656 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8657 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8658 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8663 /* Surround mixer */
8664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8665 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8666 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8668 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8669 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8670 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8672 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8673 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8674 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8675 /* Front Pin (0x0c) */
8676 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8677 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8678 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8679 /* LFE Pin (0x0e) */
8680 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8681 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8682 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
8684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8685 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8686 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
8687 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8689 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8692 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8693 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8694 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8695 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8700 static const struct hda_verb alc885_mba21_init_verbs
[] = {
8701 /*Internal and HP Speaker Mixer*/
8702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8704 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8705 /*Internal Speaker Pin (0x0c)*/
8706 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8707 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8708 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8709 /* HP Pin: output 0 (0x0e) */
8710 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
8711 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8712 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8713 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8714 /* Line in (is hp when jack connected)*/
8715 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8716 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8722 /* Macbook Pro rev3 */
8723 static const struct hda_verb alc885_mbp3_init_verbs
[] = {
8724 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8726 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8729 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8730 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8731 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8733 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8735 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8736 /* Front Pin: output 0 (0x0c) */
8737 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8738 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8739 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8740 /* HP Pin: output 0 (0x0e) */
8741 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
8742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8743 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x02},
8744 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8745 /* Mic (rear) pin: input vref at 80% */
8746 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8747 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8748 /* Front Mic pin: input vref at 80% */
8749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8751 /* Line In pin: use output 1 when in LineOut mode */
8752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8754 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
8756 /* FIXME: use matrix-type input source selection */
8757 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8758 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8764 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8765 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8773 /* ADC1: mute amp left and right */
8774 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8775 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8776 /* ADC2: mute amp left and right */
8777 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8778 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8779 /* ADC3: mute amp left and right */
8780 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8781 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8787 static const struct hda_verb alc885_imac91_init_verbs
[] = {
8788 /* Internal Speaker Pin (0x0c) */
8789 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8790 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8791 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8793 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8794 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8797 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8798 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8799 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8803 /* Front Mic pin: input vref at 80% */
8804 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8805 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8810 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8814 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8815 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8816 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8817 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8818 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8819 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8820 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8821 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8822 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8823 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8824 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8825 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8826 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8827 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8829 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8830 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8831 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8832 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8833 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8834 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8835 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8836 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8837 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8841 /* iMac 24 mixer. */
8842 static const struct snd_kcontrol_new alc885_imac24_mixer
[] = {
8843 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8844 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
8848 /* iMac 24 init verbs. */
8849 static const struct hda_verb alc885_imac24_init_verbs
[] = {
8850 /* Internal speakers: output 0 (0x0c) */
8851 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8852 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8853 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8854 /* Internal speakers: output 0 (0x0c) */
8855 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8856 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8857 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8858 /* Headphone: output 0 (0x0c) */
8859 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8860 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8861 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8862 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8863 /* Front Mic: input vref at 80% */
8864 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8865 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8869 /* Toggle speaker-output according to the hp-jack state */
8870 static void alc885_imac24_setup(struct hda_codec
*codec
)
8872 struct alc_spec
*spec
= codec
->spec
;
8874 spec
->autocfg
.hp_pins
[0] = 0x14;
8875 spec
->autocfg
.speaker_pins
[0] = 0x18;
8876 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8878 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8881 #define alc885_mb5_setup alc885_imac24_setup
8882 #define alc885_macmini3_setup alc885_imac24_setup
8884 /* Macbook Air 2,1 */
8885 static void alc885_mba21_setup(struct hda_codec
*codec
)
8887 struct alc_spec
*spec
= codec
->spec
;
8889 spec
->autocfg
.hp_pins
[0] = 0x14;
8890 spec
->autocfg
.speaker_pins
[0] = 0x18;
8892 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8897 static void alc885_mbp3_setup(struct hda_codec
*codec
)
8899 struct alc_spec
*spec
= codec
->spec
;
8901 spec
->autocfg
.hp_pins
[0] = 0x15;
8902 spec
->autocfg
.speaker_pins
[0] = 0x14;
8904 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8907 static void alc885_imac91_setup(struct hda_codec
*codec
)
8909 struct alc_spec
*spec
= codec
->spec
;
8911 spec
->autocfg
.hp_pins
[0] = 0x14;
8912 spec
->autocfg
.speaker_pins
[0] = 0x18;
8913 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8915 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8918 static const struct hda_verb alc882_targa_verbs
[] = {
8919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8920 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8922 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8923 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8925 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8926 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8927 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8929 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8933 /* toggle speaker-output according to the hp-jack state */
8934 static void alc882_targa_automute(struct hda_codec
*codec
)
8936 struct alc_spec
*spec
= codec
->spec
;
8937 alc_hp_automute(codec
);
8938 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
8939 spec
->jack_present
? 1 : 3);
8942 static void alc882_targa_setup(struct hda_codec
*codec
)
8944 struct alc_spec
*spec
= codec
->spec
;
8946 spec
->autocfg
.hp_pins
[0] = 0x14;
8947 spec
->autocfg
.speaker_pins
[0] = 0x1b;
8949 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8952 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8954 if ((res
>> 26) == ALC880_HP_EVENT
)
8955 alc882_targa_automute(codec
);
8958 static const struct hda_verb alc882_asus_a7j_verbs
[] = {
8959 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8960 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8962 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8963 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8964 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8966 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8967 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8968 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8970 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8971 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8972 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8976 static const struct hda_verb alc882_asus_a7m_verbs
[] = {
8977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8980 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8981 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8982 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8984 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8985 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8986 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8988 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8989 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8990 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8994 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
8996 unsigned int gpiostate
, gpiomask
, gpiodir
;
8998 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8999 AC_VERB_GET_GPIO_DATA
, 0);
9002 gpiostate
|= (1 << pin
);
9004 gpiostate
&= ~(1 << pin
);
9006 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
9007 AC_VERB_GET_GPIO_MASK
, 0);
9008 gpiomask
|= (1 << pin
);
9010 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
9011 AC_VERB_GET_GPIO_DIRECTION
, 0);
9012 gpiodir
|= (1 << pin
);
9015 snd_hda_codec_write(codec
, codec
->afg
, 0,
9016 AC_VERB_SET_GPIO_MASK
, gpiomask
);
9017 snd_hda_codec_write(codec
, codec
->afg
, 0,
9018 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
9022 snd_hda_codec_write(codec
, codec
->afg
, 0,
9023 AC_VERB_SET_GPIO_DATA
, gpiostate
);
9026 /* set up GPIO at initialization */
9027 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
9029 alc882_gpio_mute(codec
, 0, 0);
9030 alc882_gpio_mute(codec
, 1, 0);
9033 /* set up GPIO and update auto-muting at initialization */
9034 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
9036 alc885_macpro_init_hook(codec
);
9037 alc_hp_automute(codec
);
9041 * generic initialization of ADC, input mixers and output mixers
9043 static const struct hda_verb alc883_auto_init_verbs
[] = {
9045 * Unmute ADC0-2 and set the default input to mic-in
9047 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9048 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9049 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9050 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9053 * Set up output mixers (0x0c - 0x0f)
9055 /* set vol=0 to output mixers */
9056 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9057 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9058 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9059 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9060 /* set up input amps for analog loopback */
9061 /* Amp Indices: DAC = 0, mixer = 1 */
9062 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9063 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9064 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9065 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9066 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9067 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9068 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9069 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9070 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9071 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9073 /* FIXME: use matrix-type input source selection */
9074 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9076 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9082 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
9083 static const struct hda_verb alc889A_mb31_ch2_init
[] = {
9084 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
9085 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
9086 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
9087 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
9091 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
9092 static const struct hda_verb alc889A_mb31_ch4_init
[] = {
9093 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
9094 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
9095 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
9096 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
9100 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
9101 static const struct hda_verb alc889A_mb31_ch5_init
[] = {
9102 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as rear */
9103 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
9104 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
9105 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
9109 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
9110 static const struct hda_verb alc889A_mb31_ch6_init
[] = {
9111 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as front */
9112 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Subwoofer off */
9113 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
9114 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
9118 static const struct hda_channel_mode alc889A_mb31_6ch_modes
[4] = {
9119 { 2, alc889A_mb31_ch2_init
},
9120 { 4, alc889A_mb31_ch4_init
},
9121 { 5, alc889A_mb31_ch5_init
},
9122 { 6, alc889A_mb31_ch6_init
},
9125 static const struct hda_verb alc883_medion_eapd_verbs
[] = {
9126 /* eanable EAPD on medion laptop */
9127 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9128 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
9132 #define alc883_base_mixer alc882_base_mixer
9134 static const struct snd_kcontrol_new alc883_mitac_mixer
[] = {
9135 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9136 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9137 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9138 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9139 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9140 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9141 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9143 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9145 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9146 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9151 static const struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
9152 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9153 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
9154 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9155 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
9156 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9157 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9158 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9159 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9160 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9161 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9165 static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
9166 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9167 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
9168 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9169 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
9170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9171 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9173 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9174 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9175 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9179 static const struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
9180 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9181 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9182 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9183 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9184 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9185 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9186 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9188 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9190 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9191 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9192 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9196 static const struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
9197 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9198 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9199 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9200 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9201 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9202 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9203 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9204 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9205 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9206 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9207 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9208 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9209 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9210 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9211 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9213 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9214 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9215 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9219 static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
9220 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9221 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9222 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9223 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9224 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9226 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9227 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9228 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9229 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9230 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9231 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9232 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9233 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9235 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9237 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9238 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9239 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9243 static const struct snd_kcontrol_new alc885_8ch_intel_mixer
[] = {
9244 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9245 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9246 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9247 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9248 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9250 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9251 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9252 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9253 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9254 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT
),
9255 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9256 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9257 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
9259 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT
),
9260 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
9261 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9262 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9263 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9267 static const struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
9268 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9269 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9270 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9271 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9272 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9273 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9274 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9275 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9276 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9277 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9279 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9280 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9282 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9284 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9285 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9286 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9290 static const struct snd_kcontrol_new alc883_targa_mixer
[] = {
9291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9292 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9293 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9294 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9295 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9296 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9297 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9298 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9299 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9300 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9301 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9302 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9303 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9304 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9306 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9307 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9311 static const struct snd_kcontrol_new alc883_targa_2ch_mixer
[] = {
9312 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9313 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9314 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9315 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9316 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9317 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9319 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9321 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9322 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9323 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9327 static const struct snd_kcontrol_new alc883_targa_8ch_mixer
[] = {
9328 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9329 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
9330 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9331 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9332 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9336 static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
9337 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9338 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9339 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9340 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
9341 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9343 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9344 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9348 static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
9349 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9350 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
9351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9352 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9353 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9354 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9356 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9357 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9361 static const struct snd_kcontrol_new alc883_medion_wim2160_mixer
[] = {
9362 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9363 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9364 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9365 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT
),
9366 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT
),
9367 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT
),
9371 static const struct hda_verb alc883_medion_wim2160_verbs
[] = {
9372 /* Unmute front mixer */
9373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9374 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9376 /* Set speaker pin to front mixer */
9377 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9379 /* Init headphone pin */
9380 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9381 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9382 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
9383 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9388 /* toggle speaker-output according to the hp-jack state */
9389 static void alc883_medion_wim2160_setup(struct hda_codec
*codec
)
9391 struct alc_spec
*spec
= codec
->spec
;
9393 spec
->autocfg
.hp_pins
[0] = 0x1a;
9394 spec
->autocfg
.speaker_pins
[0] = 0x15;
9396 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9399 static const struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
9400 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9401 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9402 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9403 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9404 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9405 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9406 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9407 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9411 static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer
[] = {
9412 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9413 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9414 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9415 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9416 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9417 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9419 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9420 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9424 static const struct snd_kcontrol_new alc888_lenovo_sky_mixer
[] = {
9425 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9426 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9427 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
9428 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
9429 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9430 0x0d, 1, 0x0, HDA_OUTPUT
),
9431 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
9432 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
9433 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
9434 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9435 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
9436 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9437 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9438 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9439 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9441 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9442 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9443 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9444 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9445 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9449 static const struct snd_kcontrol_new alc889A_mb31_mixer
[] = {
9451 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
9452 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
9453 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
9454 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
9455 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9457 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT
),
9458 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT
),
9459 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT
),
9460 /* Output switches */
9461 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT
),
9462 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT
),
9463 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT
),
9465 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT
),
9466 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT
),
9468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
9469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
9470 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9471 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9475 static const struct snd_kcontrol_new alc883_vaiott_mixer
[] = {
9476 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9477 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9478 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9479 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9480 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9481 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9485 static const struct hda_bind_ctls alc883_bind_cap_vol
= {
9486 .ops
= &snd_hda_bind_vol
,
9488 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
9489 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
9494 static const struct hda_bind_ctls alc883_bind_cap_switch
= {
9495 .ops
= &snd_hda_bind_sw
,
9497 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
9498 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
9503 static const struct snd_kcontrol_new alc883_asus_eee1601_mixer
[] = {
9504 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9505 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9506 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9507 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9508 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9510 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9511 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9515 static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer
[] = {
9516 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol
),
9517 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch
),
9519 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9520 /* .name = "Capture Source", */
9521 .name
= "Input Source",
9523 .info
= alc_mux_enum_info
,
9524 .get
= alc_mux_enum_get
,
9525 .put
= alc_mux_enum_put
,
9530 static const struct snd_kcontrol_new alc883_chmode_mixer
[] = {
9532 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9533 .name
= "Channel Mode",
9534 .info
= alc_ch_mode_info
,
9535 .get
= alc_ch_mode_get
,
9536 .put
= alc_ch_mode_put
,
9541 /* toggle speaker-output according to the hp-jack state */
9542 static void alc883_mitac_setup(struct hda_codec
*codec
)
9544 struct alc_spec
*spec
= codec
->spec
;
9546 spec
->autocfg
.hp_pins
[0] = 0x15;
9547 spec
->autocfg
.speaker_pins
[0] = 0x14;
9548 spec
->autocfg
.speaker_pins
[1] = 0x17;
9550 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9553 static const struct hda_verb alc883_mitac_verbs
[] = {
9555 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9558 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
9559 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9561 /* enable unsolicited event */
9562 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9563 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9568 static const struct hda_verb alc883_clevo_m540r_verbs
[] = {
9570 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9571 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9573 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9575 /* enable unsolicited event */
9577 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9578 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9584 static const struct hda_verb alc883_clevo_m720_verbs
[] = {
9586 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9587 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9589 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
9590 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9592 /* enable unsolicited event */
9593 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9594 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9599 static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
9601 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9602 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9604 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9605 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9607 /* enable unsolicited event */
9608 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9613 static const struct hda_verb alc883_targa_verbs
[] = {
9614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9617 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9618 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9620 /* Connect Line-Out side jack (SPDIF) to Side */
9621 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9622 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9623 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
9624 /* Connect Mic jack to CLFE */
9625 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9626 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9627 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
9628 /* Connect Line-in jack to Surround */
9629 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9630 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9631 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
9632 /* Connect HP out jack to Front */
9633 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9634 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9635 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9637 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9642 static const struct hda_verb alc883_lenovo_101e_verbs
[] = {
9643 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9644 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
9645 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
9649 static const struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
9650 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9651 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9652 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9657 static const struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
9658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9660 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9661 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
9662 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9666 static const struct hda_verb alc883_haier_w66_verbs
[] = {
9667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9670 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9672 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9673 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9674 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9675 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9679 static const struct hda_verb alc888_lenovo_sky_verbs
[] = {
9680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9681 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9682 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9683 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9684 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9685 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9686 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
9687 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9691 static const struct hda_verb alc888_6st_dell_verbs
[] = {
9692 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9696 static const struct hda_verb alc883_vaiott_verbs
[] = {
9698 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9699 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9701 /* enable unsolicited event */
9702 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9707 static void alc888_3st_hp_setup(struct hda_codec
*codec
)
9709 struct alc_spec
*spec
= codec
->spec
;
9711 spec
->autocfg
.hp_pins
[0] = 0x1b;
9712 spec
->autocfg
.speaker_pins
[0] = 0x14;
9713 spec
->autocfg
.speaker_pins
[1] = 0x16;
9714 spec
->autocfg
.speaker_pins
[2] = 0x18;
9716 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9719 static const struct hda_verb alc888_3st_hp_verbs
[] = {
9720 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
9721 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
9722 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
9723 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9730 static const struct hda_verb alc888_3st_hp_2ch_init
[] = {
9731 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9732 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9733 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
9734 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9741 static const struct hda_verb alc888_3st_hp_4ch_init
[] = {
9742 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9743 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9744 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9745 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9746 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9753 static const struct hda_verb alc888_3st_hp_6ch_init
[] = {
9754 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9755 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9756 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
9757 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9758 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9759 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9763 static const struct hda_channel_mode alc888_3st_hp_modes
[3] = {
9764 { 2, alc888_3st_hp_2ch_init
},
9765 { 4, alc888_3st_hp_4ch_init
},
9766 { 6, alc888_3st_hp_6ch_init
},
9769 static void alc888_lenovo_ms7195_setup(struct hda_codec
*codec
)
9771 struct alc_spec
*spec
= codec
->spec
;
9773 spec
->autocfg
.hp_pins
[0] = 0x1b;
9774 spec
->autocfg
.line_out_pins
[0] = 0x14;
9775 spec
->autocfg
.speaker_pins
[0] = 0x15;
9777 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9780 /* toggle speaker-output according to the hp-jack state */
9781 static void alc883_lenovo_nb0763_setup(struct hda_codec
*codec
)
9783 struct alc_spec
*spec
= codec
->spec
;
9785 spec
->autocfg
.hp_pins
[0] = 0x14;
9786 spec
->autocfg
.speaker_pins
[0] = 0x15;
9788 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9791 /* toggle speaker-output according to the hp-jack state */
9792 #define alc883_targa_init_hook alc882_targa_init_hook
9793 #define alc883_targa_unsol_event alc882_targa_unsol_event
9795 static void alc883_clevo_m720_setup(struct hda_codec
*codec
)
9797 struct alc_spec
*spec
= codec
->spec
;
9799 spec
->autocfg
.hp_pins
[0] = 0x15;
9800 spec
->autocfg
.speaker_pins
[0] = 0x14;
9802 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9805 static void alc883_clevo_m720_init_hook(struct hda_codec
*codec
)
9807 alc_hp_automute(codec
);
9808 alc88x_simple_mic_automute(codec
);
9811 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
9814 switch (res
>> 26) {
9815 case ALC880_MIC_EVENT
:
9816 alc88x_simple_mic_automute(codec
);
9819 alc_sku_unsol_event(codec
, res
);
9824 /* toggle speaker-output according to the hp-jack state */
9825 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec
*codec
)
9827 struct alc_spec
*spec
= codec
->spec
;
9829 spec
->autocfg
.hp_pins
[0] = 0x14;
9830 spec
->autocfg
.speaker_pins
[0] = 0x15;
9832 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9835 static void alc883_haier_w66_setup(struct hda_codec
*codec
)
9837 struct alc_spec
*spec
= codec
->spec
;
9839 spec
->autocfg
.hp_pins
[0] = 0x1b;
9840 spec
->autocfg
.speaker_pins
[0] = 0x14;
9842 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9845 static void alc883_lenovo_101e_setup(struct hda_codec
*codec
)
9847 struct alc_spec
*spec
= codec
->spec
;
9849 spec
->autocfg
.hp_pins
[0] = 0x1b;
9850 spec
->autocfg
.line_out_pins
[0] = 0x14;
9851 spec
->autocfg
.speaker_pins
[0] = 0x15;
9853 spec
->detect_line
= 1;
9854 spec
->automute_lines
= 1;
9855 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9858 /* toggle speaker-output according to the hp-jack state */
9859 static void alc883_acer_aspire_setup(struct hda_codec
*codec
)
9861 struct alc_spec
*spec
= codec
->spec
;
9863 spec
->autocfg
.hp_pins
[0] = 0x14;
9864 spec
->autocfg
.speaker_pins
[0] = 0x15;
9865 spec
->autocfg
.speaker_pins
[1] = 0x16;
9867 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9870 static const struct hda_verb alc883_acer_eapd_verbs
[] = {
9871 /* HP Pin: output 0 (0x0c) */
9872 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9873 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9874 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9875 /* Front Pin: output 0 (0x0c) */
9876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9877 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9878 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9879 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
9880 /* eanable EAPD on medion laptop */
9881 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9882 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9883 /* enable unsolicited event */
9884 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9888 static void alc888_6st_dell_setup(struct hda_codec
*codec
)
9890 struct alc_spec
*spec
= codec
->spec
;
9892 spec
->autocfg
.hp_pins
[0] = 0x1b;
9893 spec
->autocfg
.speaker_pins
[0] = 0x14;
9894 spec
->autocfg
.speaker_pins
[1] = 0x15;
9895 spec
->autocfg
.speaker_pins
[2] = 0x16;
9896 spec
->autocfg
.speaker_pins
[3] = 0x17;
9898 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9901 static void alc888_lenovo_sky_setup(struct hda_codec
*codec
)
9903 struct alc_spec
*spec
= codec
->spec
;
9905 spec
->autocfg
.hp_pins
[0] = 0x1b;
9906 spec
->autocfg
.speaker_pins
[0] = 0x14;
9907 spec
->autocfg
.speaker_pins
[1] = 0x15;
9908 spec
->autocfg
.speaker_pins
[2] = 0x16;
9909 spec
->autocfg
.speaker_pins
[3] = 0x17;
9910 spec
->autocfg
.speaker_pins
[4] = 0x1a;
9912 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9915 static void alc883_vaiott_setup(struct hda_codec
*codec
)
9917 struct alc_spec
*spec
= codec
->spec
;
9919 spec
->autocfg
.hp_pins
[0] = 0x15;
9920 spec
->autocfg
.speaker_pins
[0] = 0x14;
9921 spec
->autocfg
.speaker_pins
[1] = 0x17;
9923 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9926 static const struct hda_verb alc888_asus_m90v_verbs
[] = {
9927 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9928 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9929 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9930 /* enable unsolicited event */
9931 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9932 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9936 static void alc883_mode2_setup(struct hda_codec
*codec
)
9938 struct alc_spec
*spec
= codec
->spec
;
9940 spec
->autocfg
.hp_pins
[0] = 0x1b;
9941 spec
->autocfg
.speaker_pins
[0] = 0x14;
9942 spec
->autocfg
.speaker_pins
[1] = 0x15;
9943 spec
->autocfg
.speaker_pins
[2] = 0x16;
9944 spec
->ext_mic
.pin
= 0x18;
9945 spec
->int_mic
.pin
= 0x19;
9946 spec
->ext_mic
.mux_idx
= 0;
9947 spec
->int_mic
.mux_idx
= 1;
9950 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9953 static const struct hda_verb alc888_asus_eee1601_verbs
[] = {
9954 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9955 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9957 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9958 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9959 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
9960 {0x20, AC_VERB_SET_PROC_COEF
, 0x0838},
9961 /* enable unsolicited event */
9962 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9966 static void alc883_eee1601_inithook(struct hda_codec
*codec
)
9968 struct alc_spec
*spec
= codec
->spec
;
9970 spec
->autocfg
.hp_pins
[0] = 0x14;
9971 spec
->autocfg
.speaker_pins
[0] = 0x1b;
9972 alc_hp_automute(codec
);
9975 static const struct hda_verb alc889A_mb31_verbs
[] = {
9976 /* Init rear pin (used as headphone output) */
9977 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4}, /* Apple Headphones */
9978 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Connect to front */
9979 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9980 /* Init line pin (used as output in 4ch and 6ch mode) */
9981 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Connect to CLFE */
9982 /* Init line 2 pin (used as headphone out by default) */
9983 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Use as input */
9984 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Mute output */
9988 /* Mute speakers according to the headphone jack state */
9989 static void alc889A_mb31_automute(struct hda_codec
*codec
)
9991 unsigned int present
;
9993 /* Mute only in 2ch or 4ch mode */
9994 if (snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_CONNECT_SEL
, 0)
9996 present
= snd_hda_jack_detect(codec
, 0x15);
9997 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9998 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9999 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
10000 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
10004 static void alc889A_mb31_unsol_event(struct hda_codec
*codec
, unsigned int res
)
10006 if ((res
>> 26) == ALC880_HP_EVENT
)
10007 alc889A_mb31_automute(codec
);
10011 #ifdef CONFIG_SND_HDA_POWER_SAVE
10012 #define alc882_loopbacks alc880_loopbacks
10015 /* pcm configuration: identical with ALC880 */
10016 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
10017 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
10018 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
10019 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
10021 static const hda_nid_t alc883_slave_dig_outs
[] = {
10022 ALC1200_DIGOUT_NID
, 0,
10025 static const hda_nid_t alc1200_slave_dig_outs
[] = {
10026 ALC883_DIGOUT_NID
, 0,
10030 * configuration and preset
10032 static const char * const alc882_models
[ALC882_MODEL_LAST
] = {
10033 [ALC882_3ST_DIG
] = "3stack-dig",
10034 [ALC882_6ST_DIG
] = "6stack-dig",
10035 [ALC882_ARIMA
] = "arima",
10036 [ALC882_W2JC
] = "w2jc",
10037 [ALC882_TARGA
] = "targa",
10038 [ALC882_ASUS_A7J
] = "asus-a7j",
10039 [ALC882_ASUS_A7M
] = "asus-a7m",
10040 [ALC885_MACPRO
] = "macpro",
10041 [ALC885_MB5
] = "mb5",
10042 [ALC885_MACMINI3
] = "macmini3",
10043 [ALC885_MBA21
] = "mba21",
10044 [ALC885_MBP3
] = "mbp3",
10045 [ALC885_IMAC24
] = "imac24",
10046 [ALC885_IMAC91
] = "imac91",
10047 [ALC883_3ST_2ch_DIG
] = "3stack-2ch-dig",
10048 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
10049 [ALC883_3ST_6ch
] = "3stack-6ch",
10050 [ALC883_6ST_DIG
] = "alc883-6stack-dig",
10051 [ALC883_TARGA_DIG
] = "targa-dig",
10052 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
10053 [ALC883_TARGA_8ch_DIG
] = "targa-8ch-dig",
10054 [ALC883_ACER
] = "acer",
10055 [ALC883_ACER_ASPIRE
] = "acer-aspire",
10056 [ALC888_ACER_ASPIRE_4930G
] = "acer-aspire-4930g",
10057 [ALC888_ACER_ASPIRE_6530G
] = "acer-aspire-6530g",
10058 [ALC888_ACER_ASPIRE_8930G
] = "acer-aspire-8930g",
10059 [ALC888_ACER_ASPIRE_7730G
] = "acer-aspire-7730g",
10060 [ALC883_MEDION
] = "medion",
10061 [ALC883_MEDION_WIM2160
] = "medion-wim2160",
10062 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
10063 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
10064 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
10065 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
10066 [ALC888_LENOVO_SKY
] = "lenovo-sky",
10067 [ALC883_HAIER_W66
] = "haier-w66",
10068 [ALC888_3ST_HP
] = "3stack-hp",
10069 [ALC888_6ST_DELL
] = "6stack-dell",
10070 [ALC883_MITAC
] = "mitac",
10071 [ALC883_CLEVO_M540R
] = "clevo-m540r",
10072 [ALC883_CLEVO_M720
] = "clevo-m720",
10073 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
10074 [ALC888_FUJITSU_XA3530
] = "fujitsu-xa3530",
10075 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
10076 [ALC889A_INTEL
] = "intel-alc889a",
10077 [ALC889_INTEL
] = "intel-x58",
10078 [ALC1200_ASUS_P5Q
] = "asus-p5q",
10079 [ALC889A_MB31
] = "mb31",
10080 [ALC883_SONY_VAIO_TT
] = "sony-vaio-tt",
10081 [ALC882_AUTO
] = "auto",
10084 static const struct snd_pci_quirk alc882_cfg_tbl
[] = {
10085 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
10087 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
10088 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE
),
10089 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE
),
10090 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
10091 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
10092 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
10093 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
10094 ALC888_ACER_ASPIRE_4930G
),
10095 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
10096 ALC888_ACER_ASPIRE_4930G
),
10097 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
10098 ALC888_ACER_ASPIRE_8930G
),
10099 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
10100 ALC888_ACER_ASPIRE_8930G
),
10101 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO
),
10102 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO
),
10103 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
10104 ALC888_ACER_ASPIRE_6530G
),
10105 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
10106 ALC888_ACER_ASPIRE_6530G
),
10107 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
10108 ALC888_ACER_ASPIRE_7730G
),
10109 /* default Acer -- disabled as it causes more problems.
10110 * model=auto should work fine now
10112 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
10114 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
10116 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG
),
10117 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
10118 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
10119 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
10120 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP
),
10121 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP
),
10123 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
10124 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
10125 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
10126 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V
),
10127 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
10128 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
10129 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
10130 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
10131 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG
),
10132 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q
),
10133 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601
),
10135 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT
),
10136 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
10137 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
10138 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC
),
10139 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
10140 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
10141 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL
),
10142 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
10143 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
10145 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
10146 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
10147 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
10148 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
10149 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO
),
10150 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
10151 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
10152 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
10153 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
10154 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
10155 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
10156 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
10157 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
10158 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
10159 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG
),
10160 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
10161 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
10162 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
10163 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG
),
10164 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG
),
10165 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
10166 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
10167 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
10168 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG
),
10169 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
10170 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
10171 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
10172 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG
),
10173 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG
),
10174 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
10175 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG
),
10177 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
10178 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG
),
10179 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
10180 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
10181 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R
),
10182 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD
),
10183 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
10184 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
10185 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
10186 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
10187 ALC883_FUJITSU_PI2515
),
10188 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
10189 ALC888_FUJITSU_XA3530
),
10190 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
10191 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
10192 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
10193 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
10194 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY
),
10195 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG
),
10196 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
10197 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
10199 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
10200 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
10201 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC
),
10202 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL
),
10203 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL
),
10204 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL
),
10205 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG
),
10210 /* codec SSID table for Intel Mac */
10211 static const struct snd_pci_quirk alc882_ssid_cfg_tbl
[] = {
10212 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3
),
10213 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3
),
10214 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3
),
10215 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO
),
10216 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24
),
10217 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24
),
10218 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3
),
10219 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31
),
10220 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M
),
10221 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3
),
10222 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21
),
10223 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31
),
10224 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3
),
10225 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24
),
10226 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91
),
10227 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5
),
10228 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5
),
10229 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10230 * so apparently no perfect solution yet
10232 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5
),
10233 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5
),
10234 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3
),
10235 {} /* terminator */
10238 static const struct alc_config_preset alc882_presets
[] = {
10239 [ALC882_3ST_DIG
] = {
10240 .mixers
= { alc882_base_mixer
},
10241 .init_verbs
= { alc882_base_init_verbs
,
10242 alc882_adc1_init_verbs
},
10243 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10244 .dac_nids
= alc882_dac_nids
,
10245 .dig_out_nid
= ALC882_DIGOUT_NID
,
10246 .dig_in_nid
= ALC882_DIGIN_NID
,
10247 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10248 .channel_mode
= alc882_ch_modes
,
10250 .input_mux
= &alc882_capture_source
,
10252 [ALC882_6ST_DIG
] = {
10253 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
10254 .init_verbs
= { alc882_base_init_verbs
,
10255 alc882_adc1_init_verbs
},
10256 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10257 .dac_nids
= alc882_dac_nids
,
10258 .dig_out_nid
= ALC882_DIGOUT_NID
,
10259 .dig_in_nid
= ALC882_DIGIN_NID
,
10260 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
10261 .channel_mode
= alc882_sixstack_modes
,
10262 .input_mux
= &alc882_capture_source
,
10265 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
10266 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10267 alc882_eapd_verbs
},
10268 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10269 .dac_nids
= alc882_dac_nids
,
10270 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
10271 .channel_mode
= alc882_sixstack_modes
,
10272 .input_mux
= &alc882_capture_source
,
10275 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
10276 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10277 alc882_eapd_verbs
, alc880_gpio1_init_verbs
},
10278 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10279 .dac_nids
= alc882_dac_nids
,
10280 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
10281 .channel_mode
= alc880_threestack_modes
,
10283 .input_mux
= &alc882_capture_source
,
10284 .dig_out_nid
= ALC882_DIGOUT_NID
,
10287 .mixers
= { alc885_mba21_mixer
},
10288 .init_verbs
= { alc885_mba21_init_verbs
, alc880_gpio1_init_verbs
},
10290 .dac_nids
= alc882_dac_nids
,
10291 .channel_mode
= alc885_mba21_ch_modes
,
10292 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
10293 .input_mux
= &alc882_capture_source
,
10294 .unsol_event
= alc_sku_unsol_event
,
10295 .setup
= alc885_mba21_setup
,
10296 .init_hook
= alc_hp_automute
,
10299 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
10300 .init_verbs
= { alc885_mbp3_init_verbs
,
10301 alc880_gpio1_init_verbs
},
10303 .dac_nids
= alc882_dac_nids
,
10305 .channel_mode
= alc885_mbp_4ch_modes
,
10306 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_4ch_modes
),
10307 .input_mux
= &alc882_capture_source
,
10308 .dig_out_nid
= ALC882_DIGOUT_NID
,
10309 .dig_in_nid
= ALC882_DIGIN_NID
,
10310 .unsol_event
= alc_sku_unsol_event
,
10311 .setup
= alc885_mbp3_setup
,
10312 .init_hook
= alc_hp_automute
,
10315 .mixers
= { alc885_mb5_mixer
, alc882_chmode_mixer
},
10316 .init_verbs
= { alc885_mb5_init_verbs
,
10317 alc880_gpio1_init_verbs
},
10318 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10319 .dac_nids
= alc882_dac_nids
,
10320 .channel_mode
= alc885_mb5_6ch_modes
,
10321 .num_channel_mode
= ARRAY_SIZE(alc885_mb5_6ch_modes
),
10322 .input_mux
= &mb5_capture_source
,
10323 .dig_out_nid
= ALC882_DIGOUT_NID
,
10324 .dig_in_nid
= ALC882_DIGIN_NID
,
10325 .unsol_event
= alc_sku_unsol_event
,
10326 .setup
= alc885_mb5_setup
,
10327 .init_hook
= alc_hp_automute
,
10329 [ALC885_MACMINI3
] = {
10330 .mixers
= { alc885_macmini3_mixer
, alc882_chmode_mixer
},
10331 .init_verbs
= { alc885_macmini3_init_verbs
,
10332 alc880_gpio1_init_verbs
},
10333 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10334 .dac_nids
= alc882_dac_nids
,
10335 .channel_mode
= alc885_macmini3_6ch_modes
,
10336 .num_channel_mode
= ARRAY_SIZE(alc885_macmini3_6ch_modes
),
10337 .input_mux
= &macmini3_capture_source
,
10338 .dig_out_nid
= ALC882_DIGOUT_NID
,
10339 .dig_in_nid
= ALC882_DIGIN_NID
,
10340 .unsol_event
= alc_sku_unsol_event
,
10341 .setup
= alc885_macmini3_setup
,
10342 .init_hook
= alc_hp_automute
,
10344 [ALC885_MACPRO
] = {
10345 .mixers
= { alc882_macpro_mixer
},
10346 .init_verbs
= { alc882_macpro_init_verbs
},
10347 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10348 .dac_nids
= alc882_dac_nids
,
10349 .dig_out_nid
= ALC882_DIGOUT_NID
,
10350 .dig_in_nid
= ALC882_DIGIN_NID
,
10351 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10352 .channel_mode
= alc882_ch_modes
,
10353 .input_mux
= &alc882_capture_source
,
10354 .init_hook
= alc885_macpro_init_hook
,
10356 [ALC885_IMAC24
] = {
10357 .mixers
= { alc885_imac24_mixer
},
10358 .init_verbs
= { alc885_imac24_init_verbs
},
10359 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10360 .dac_nids
= alc882_dac_nids
,
10361 .dig_out_nid
= ALC882_DIGOUT_NID
,
10362 .dig_in_nid
= ALC882_DIGIN_NID
,
10363 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10364 .channel_mode
= alc882_ch_modes
,
10365 .input_mux
= &alc882_capture_source
,
10366 .unsol_event
= alc_sku_unsol_event
,
10367 .setup
= alc885_imac24_setup
,
10368 .init_hook
= alc885_imac24_init_hook
,
10370 [ALC885_IMAC91
] = {
10371 .mixers
= {alc885_imac91_mixer
},
10372 .init_verbs
= { alc885_imac91_init_verbs
,
10373 alc880_gpio1_init_verbs
},
10374 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10375 .dac_nids
= alc882_dac_nids
,
10376 .channel_mode
= alc885_mba21_ch_modes
,
10377 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
10378 .input_mux
= &alc889A_imac91_capture_source
,
10379 .dig_out_nid
= ALC882_DIGOUT_NID
,
10380 .dig_in_nid
= ALC882_DIGIN_NID
,
10381 .unsol_event
= alc_sku_unsol_event
,
10382 .setup
= alc885_imac91_setup
,
10383 .init_hook
= alc_hp_automute
,
10386 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
},
10387 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10388 alc880_gpio3_init_verbs
, alc882_targa_verbs
},
10389 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10390 .dac_nids
= alc882_dac_nids
,
10391 .dig_out_nid
= ALC882_DIGOUT_NID
,
10392 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
10393 .adc_nids
= alc882_adc_nids
,
10394 .capsrc_nids
= alc882_capsrc_nids
,
10395 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
10396 .channel_mode
= alc882_3ST_6ch_modes
,
10398 .input_mux
= &alc882_capture_source
,
10399 .unsol_event
= alc_sku_unsol_event
,
10400 .setup
= alc882_targa_setup
,
10401 .init_hook
= alc882_targa_automute
,
10403 [ALC882_ASUS_A7J
] = {
10404 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
},
10405 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10406 alc882_asus_a7j_verbs
},
10407 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10408 .dac_nids
= alc882_dac_nids
,
10409 .dig_out_nid
= ALC882_DIGOUT_NID
,
10410 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
10411 .adc_nids
= alc882_adc_nids
,
10412 .capsrc_nids
= alc882_capsrc_nids
,
10413 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
10414 .channel_mode
= alc882_3ST_6ch_modes
,
10416 .input_mux
= &alc882_capture_source
,
10418 [ALC882_ASUS_A7M
] = {
10419 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
10420 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10421 alc882_eapd_verbs
, alc880_gpio1_init_verbs
,
10422 alc882_asus_a7m_verbs
},
10423 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10424 .dac_nids
= alc882_dac_nids
,
10425 .dig_out_nid
= ALC882_DIGOUT_NID
,
10426 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
10427 .channel_mode
= alc880_threestack_modes
,
10429 .input_mux
= &alc882_capture_source
,
10431 [ALC883_3ST_2ch_DIG
] = {
10432 .mixers
= { alc883_3ST_2ch_mixer
},
10433 .init_verbs
= { alc883_init_verbs
},
10434 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10435 .dac_nids
= alc883_dac_nids
,
10436 .dig_out_nid
= ALC883_DIGOUT_NID
,
10437 .dig_in_nid
= ALC883_DIGIN_NID
,
10438 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10439 .channel_mode
= alc883_3ST_2ch_modes
,
10440 .input_mux
= &alc883_capture_source
,
10442 [ALC883_3ST_6ch_DIG
] = {
10443 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10444 .init_verbs
= { alc883_init_verbs
},
10445 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10446 .dac_nids
= alc883_dac_nids
,
10447 .dig_out_nid
= ALC883_DIGOUT_NID
,
10448 .dig_in_nid
= ALC883_DIGIN_NID
,
10449 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10450 .channel_mode
= alc883_3ST_6ch_modes
,
10452 .input_mux
= &alc883_capture_source
,
10454 [ALC883_3ST_6ch
] = {
10455 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10456 .init_verbs
= { alc883_init_verbs
},
10457 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10458 .dac_nids
= alc883_dac_nids
,
10459 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10460 .channel_mode
= alc883_3ST_6ch_modes
,
10462 .input_mux
= &alc883_capture_source
,
10464 [ALC883_3ST_6ch_INTEL
] = {
10465 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
10466 .init_verbs
= { alc883_init_verbs
},
10467 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10468 .dac_nids
= alc883_dac_nids
,
10469 .dig_out_nid
= ALC883_DIGOUT_NID
,
10470 .dig_in_nid
= ALC883_DIGIN_NID
,
10471 .slave_dig_outs
= alc883_slave_dig_outs
,
10472 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
10473 .channel_mode
= alc883_3ST_6ch_intel_modes
,
10475 .input_mux
= &alc883_3stack_6ch_intel
,
10477 [ALC889A_INTEL
] = {
10478 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
10479 .init_verbs
= { alc885_init_verbs
, alc885_init_input_verbs
,
10480 alc_hp15_unsol_verbs
},
10481 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10482 .dac_nids
= alc883_dac_nids
,
10483 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10484 .adc_nids
= alc889_adc_nids
,
10485 .dig_out_nid
= ALC883_DIGOUT_NID
,
10486 .dig_in_nid
= ALC883_DIGIN_NID
,
10487 .slave_dig_outs
= alc883_slave_dig_outs
,
10488 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
10489 .channel_mode
= alc889_8ch_intel_modes
,
10490 .capsrc_nids
= alc889_capsrc_nids
,
10491 .input_mux
= &alc889_capture_source
,
10492 .setup
= alc889_automute_setup
,
10493 .init_hook
= alc_hp_automute
,
10494 .unsol_event
= alc_sku_unsol_event
,
10498 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
10499 .init_verbs
= { alc885_init_verbs
, alc889_init_input_verbs
,
10500 alc889_eapd_verbs
, alc_hp15_unsol_verbs
},
10501 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10502 .dac_nids
= alc883_dac_nids
,
10503 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10504 .adc_nids
= alc889_adc_nids
,
10505 .dig_out_nid
= ALC883_DIGOUT_NID
,
10506 .dig_in_nid
= ALC883_DIGIN_NID
,
10507 .slave_dig_outs
= alc883_slave_dig_outs
,
10508 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
10509 .channel_mode
= alc889_8ch_intel_modes
,
10510 .capsrc_nids
= alc889_capsrc_nids
,
10511 .input_mux
= &alc889_capture_source
,
10512 .setup
= alc889_automute_setup
,
10513 .init_hook
= alc889_intel_init_hook
,
10514 .unsol_event
= alc_sku_unsol_event
,
10517 [ALC883_6ST_DIG
] = {
10518 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10519 .init_verbs
= { alc883_init_verbs
},
10520 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10521 .dac_nids
= alc883_dac_nids
,
10522 .dig_out_nid
= ALC883_DIGOUT_NID
,
10523 .dig_in_nid
= ALC883_DIGIN_NID
,
10524 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10525 .channel_mode
= alc883_sixstack_modes
,
10526 .input_mux
= &alc883_capture_source
,
10528 [ALC883_TARGA_DIG
] = {
10529 .mixers
= { alc883_targa_mixer
, alc883_chmode_mixer
},
10530 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10531 alc883_targa_verbs
},
10532 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10533 .dac_nids
= alc883_dac_nids
,
10534 .dig_out_nid
= ALC883_DIGOUT_NID
,
10535 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10536 .channel_mode
= alc883_3ST_6ch_modes
,
10538 .input_mux
= &alc883_capture_source
,
10539 .unsol_event
= alc883_targa_unsol_event
,
10540 .setup
= alc882_targa_setup
,
10541 .init_hook
= alc882_targa_automute
,
10543 [ALC883_TARGA_2ch_DIG
] = {
10544 .mixers
= { alc883_targa_2ch_mixer
},
10545 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10546 alc883_targa_verbs
},
10547 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10548 .dac_nids
= alc883_dac_nids
,
10549 .adc_nids
= alc883_adc_nids_alt
,
10550 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10551 .capsrc_nids
= alc883_capsrc_nids
,
10552 .dig_out_nid
= ALC883_DIGOUT_NID
,
10553 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10554 .channel_mode
= alc883_3ST_2ch_modes
,
10555 .input_mux
= &alc883_capture_source
,
10556 .unsol_event
= alc883_targa_unsol_event
,
10557 .setup
= alc882_targa_setup
,
10558 .init_hook
= alc882_targa_automute
,
10560 [ALC883_TARGA_8ch_DIG
] = {
10561 .mixers
= { alc883_targa_mixer
, alc883_targa_8ch_mixer
,
10562 alc883_chmode_mixer
},
10563 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10564 alc883_targa_verbs
},
10565 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10566 .dac_nids
= alc883_dac_nids
,
10567 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10568 .adc_nids
= alc883_adc_nids_rev
,
10569 .capsrc_nids
= alc883_capsrc_nids_rev
,
10570 .dig_out_nid
= ALC883_DIGOUT_NID
,
10571 .dig_in_nid
= ALC883_DIGIN_NID
,
10572 .num_channel_mode
= ARRAY_SIZE(alc883_4ST_8ch_modes
),
10573 .channel_mode
= alc883_4ST_8ch_modes
,
10575 .input_mux
= &alc883_capture_source
,
10576 .unsol_event
= alc883_targa_unsol_event
,
10577 .setup
= alc882_targa_setup
,
10578 .init_hook
= alc882_targa_automute
,
10581 .mixers
= { alc883_base_mixer
},
10582 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10583 * and the headphone jack. Turn this on and rely on the
10584 * standard mute methods whenever the user wants to turn
10585 * these outputs off.
10587 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
10588 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10589 .dac_nids
= alc883_dac_nids
,
10590 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10591 .channel_mode
= alc883_3ST_2ch_modes
,
10592 .input_mux
= &alc883_capture_source
,
10594 [ALC883_ACER_ASPIRE
] = {
10595 .mixers
= { alc883_acer_aspire_mixer
},
10596 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
10597 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10598 .dac_nids
= alc883_dac_nids
,
10599 .dig_out_nid
= ALC883_DIGOUT_NID
,
10600 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10601 .channel_mode
= alc883_3ST_2ch_modes
,
10602 .input_mux
= &alc883_capture_source
,
10603 .unsol_event
= alc_sku_unsol_event
,
10604 .setup
= alc883_acer_aspire_setup
,
10605 .init_hook
= alc_hp_automute
,
10607 [ALC888_ACER_ASPIRE_4930G
] = {
10608 .mixers
= { alc888_acer_aspire_4930g_mixer
,
10609 alc883_chmode_mixer
},
10610 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10611 alc888_acer_aspire_4930g_verbs
},
10612 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10613 .dac_nids
= alc883_dac_nids
,
10614 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10615 .adc_nids
= alc883_adc_nids_rev
,
10616 .capsrc_nids
= alc883_capsrc_nids_rev
,
10617 .dig_out_nid
= ALC883_DIGOUT_NID
,
10618 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10619 .channel_mode
= alc883_3ST_6ch_modes
,
10621 .const_channel_count
= 6,
10623 ARRAY_SIZE(alc888_2_capture_sources
),
10624 .input_mux
= alc888_2_capture_sources
,
10625 .unsol_event
= alc_sku_unsol_event
,
10626 .setup
= alc888_acer_aspire_4930g_setup
,
10627 .init_hook
= alc_hp_automute
,
10629 [ALC888_ACER_ASPIRE_6530G
] = {
10630 .mixers
= { alc888_acer_aspire_6530_mixer
},
10631 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10632 alc888_acer_aspire_6530g_verbs
},
10633 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10634 .dac_nids
= alc883_dac_nids
,
10635 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10636 .adc_nids
= alc883_adc_nids_rev
,
10637 .capsrc_nids
= alc883_capsrc_nids_rev
,
10638 .dig_out_nid
= ALC883_DIGOUT_NID
,
10639 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10640 .channel_mode
= alc883_3ST_2ch_modes
,
10642 ARRAY_SIZE(alc888_2_capture_sources
),
10643 .input_mux
= alc888_acer_aspire_6530_sources
,
10644 .unsol_event
= alc_sku_unsol_event
,
10645 .setup
= alc888_acer_aspire_6530g_setup
,
10646 .init_hook
= alc_hp_automute
,
10648 [ALC888_ACER_ASPIRE_8930G
] = {
10649 .mixers
= { alc889_acer_aspire_8930g_mixer
,
10650 alc883_chmode_mixer
},
10651 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10652 alc889_acer_aspire_8930g_verbs
,
10653 alc889_eapd_verbs
},
10654 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10655 .dac_nids
= alc883_dac_nids
,
10656 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10657 .adc_nids
= alc889_adc_nids
,
10658 .capsrc_nids
= alc889_capsrc_nids
,
10659 .dig_out_nid
= ALC883_DIGOUT_NID
,
10660 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10661 .channel_mode
= alc883_3ST_6ch_modes
,
10663 .const_channel_count
= 6,
10665 ARRAY_SIZE(alc889_capture_sources
),
10666 .input_mux
= alc889_capture_sources
,
10667 .unsol_event
= alc_sku_unsol_event
,
10668 .setup
= alc889_acer_aspire_8930g_setup
,
10669 .init_hook
= alc_hp_automute
,
10670 #ifdef CONFIG_SND_HDA_POWER_SAVE
10671 .power_hook
= alc_power_eapd
,
10674 [ALC888_ACER_ASPIRE_7730G
] = {
10675 .mixers
= { alc883_3ST_6ch_mixer
,
10676 alc883_chmode_mixer
},
10677 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10678 alc888_acer_aspire_7730G_verbs
},
10679 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10680 .dac_nids
= alc883_dac_nids
,
10681 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10682 .adc_nids
= alc883_adc_nids_rev
,
10683 .capsrc_nids
= alc883_capsrc_nids_rev
,
10684 .dig_out_nid
= ALC883_DIGOUT_NID
,
10685 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10686 .channel_mode
= alc883_3ST_6ch_modes
,
10688 .const_channel_count
= 6,
10689 .input_mux
= &alc883_capture_source
,
10690 .unsol_event
= alc_sku_unsol_event
,
10691 .setup
= alc888_acer_aspire_7730g_setup
,
10692 .init_hook
= alc_hp_automute
,
10694 [ALC883_MEDION
] = {
10695 .mixers
= { alc883_fivestack_mixer
,
10696 alc883_chmode_mixer
},
10697 .init_verbs
= { alc883_init_verbs
,
10698 alc883_medion_eapd_verbs
},
10699 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10700 .dac_nids
= alc883_dac_nids
,
10701 .adc_nids
= alc883_adc_nids_alt
,
10702 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10703 .capsrc_nids
= alc883_capsrc_nids
,
10704 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10705 .channel_mode
= alc883_sixstack_modes
,
10706 .input_mux
= &alc883_capture_source
,
10708 [ALC883_MEDION_WIM2160
] = {
10709 .mixers
= { alc883_medion_wim2160_mixer
},
10710 .init_verbs
= { alc883_init_verbs
, alc883_medion_wim2160_verbs
},
10711 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10712 .dac_nids
= alc883_dac_nids
,
10713 .dig_out_nid
= ALC883_DIGOUT_NID
,
10714 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10715 .adc_nids
= alc883_adc_nids
,
10716 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10717 .channel_mode
= alc883_3ST_2ch_modes
,
10718 .input_mux
= &alc883_capture_source
,
10719 .unsol_event
= alc_sku_unsol_event
,
10720 .setup
= alc883_medion_wim2160_setup
,
10721 .init_hook
= alc_hp_automute
,
10723 [ALC883_LAPTOP_EAPD
] = {
10724 .mixers
= { alc883_base_mixer
},
10725 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
10726 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10727 .dac_nids
= alc883_dac_nids
,
10728 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10729 .channel_mode
= alc883_3ST_2ch_modes
,
10730 .input_mux
= &alc883_capture_source
,
10732 [ALC883_CLEVO_M540R
] = {
10733 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10734 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m540r_verbs
},
10735 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10736 .dac_nids
= alc883_dac_nids
,
10737 .dig_out_nid
= ALC883_DIGOUT_NID
,
10738 .dig_in_nid
= ALC883_DIGIN_NID
,
10739 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_clevo_modes
),
10740 .channel_mode
= alc883_3ST_6ch_clevo_modes
,
10742 .input_mux
= &alc883_capture_source
,
10743 /* This machine has the hardware HP auto-muting, thus
10744 * we need no software mute via unsol event
10747 [ALC883_CLEVO_M720
] = {
10748 .mixers
= { alc883_clevo_m720_mixer
},
10749 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
10750 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10751 .dac_nids
= alc883_dac_nids
,
10752 .dig_out_nid
= ALC883_DIGOUT_NID
,
10753 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10754 .channel_mode
= alc883_3ST_2ch_modes
,
10755 .input_mux
= &alc883_capture_source
,
10756 .unsol_event
= alc883_clevo_m720_unsol_event
,
10757 .setup
= alc883_clevo_m720_setup
,
10758 .init_hook
= alc883_clevo_m720_init_hook
,
10760 [ALC883_LENOVO_101E_2ch
] = {
10761 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
10762 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
10763 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10764 .dac_nids
= alc883_dac_nids
,
10765 .adc_nids
= alc883_adc_nids_alt
,
10766 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10767 .capsrc_nids
= alc883_capsrc_nids
,
10768 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10769 .channel_mode
= alc883_3ST_2ch_modes
,
10770 .input_mux
= &alc883_lenovo_101e_capture_source
,
10771 .setup
= alc883_lenovo_101e_setup
,
10772 .unsol_event
= alc_sku_unsol_event
,
10773 .init_hook
= alc_inithook
,
10775 [ALC883_LENOVO_NB0763
] = {
10776 .mixers
= { alc883_lenovo_nb0763_mixer
},
10777 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
10778 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10779 .dac_nids
= alc883_dac_nids
,
10780 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10781 .channel_mode
= alc883_3ST_2ch_modes
,
10783 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
10784 .unsol_event
= alc_sku_unsol_event
,
10785 .setup
= alc883_lenovo_nb0763_setup
,
10786 .init_hook
= alc_hp_automute
,
10788 [ALC888_LENOVO_MS7195_DIG
] = {
10789 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10790 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
10791 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10792 .dac_nids
= alc883_dac_nids
,
10793 .dig_out_nid
= ALC883_DIGOUT_NID
,
10794 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10795 .channel_mode
= alc883_3ST_6ch_modes
,
10797 .input_mux
= &alc883_capture_source
,
10798 .unsol_event
= alc_sku_unsol_event
,
10799 .setup
= alc888_lenovo_ms7195_setup
,
10800 .init_hook
= alc_inithook
,
10802 [ALC883_HAIER_W66
] = {
10803 .mixers
= { alc883_targa_2ch_mixer
},
10804 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
10805 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10806 .dac_nids
= alc883_dac_nids
,
10807 .dig_out_nid
= ALC883_DIGOUT_NID
,
10808 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10809 .channel_mode
= alc883_3ST_2ch_modes
,
10810 .input_mux
= &alc883_capture_source
,
10811 .unsol_event
= alc_sku_unsol_event
,
10812 .setup
= alc883_haier_w66_setup
,
10813 .init_hook
= alc_hp_automute
,
10815 [ALC888_3ST_HP
] = {
10816 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10817 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
10818 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10819 .dac_nids
= alc883_dac_nids
,
10820 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
10821 .channel_mode
= alc888_3st_hp_modes
,
10823 .input_mux
= &alc883_capture_source
,
10824 .unsol_event
= alc_sku_unsol_event
,
10825 .setup
= alc888_3st_hp_setup
,
10826 .init_hook
= alc_hp_automute
,
10828 [ALC888_6ST_DELL
] = {
10829 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10830 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
10831 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10832 .dac_nids
= alc883_dac_nids
,
10833 .dig_out_nid
= ALC883_DIGOUT_NID
,
10834 .dig_in_nid
= ALC883_DIGIN_NID
,
10835 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10836 .channel_mode
= alc883_sixstack_modes
,
10837 .input_mux
= &alc883_capture_source
,
10838 .unsol_event
= alc_sku_unsol_event
,
10839 .setup
= alc888_6st_dell_setup
,
10840 .init_hook
= alc_hp_automute
,
10843 .mixers
= { alc883_mitac_mixer
},
10844 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
10845 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10846 .dac_nids
= alc883_dac_nids
,
10847 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10848 .channel_mode
= alc883_3ST_2ch_modes
,
10849 .input_mux
= &alc883_capture_source
,
10850 .unsol_event
= alc_sku_unsol_event
,
10851 .setup
= alc883_mitac_setup
,
10852 .init_hook
= alc_hp_automute
,
10854 [ALC883_FUJITSU_PI2515
] = {
10855 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
10856 .init_verbs
= { alc883_init_verbs
,
10857 alc883_2ch_fujitsu_pi2515_verbs
},
10858 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10859 .dac_nids
= alc883_dac_nids
,
10860 .dig_out_nid
= ALC883_DIGOUT_NID
,
10861 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10862 .channel_mode
= alc883_3ST_2ch_modes
,
10863 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10864 .unsol_event
= alc_sku_unsol_event
,
10865 .setup
= alc883_2ch_fujitsu_pi2515_setup
,
10866 .init_hook
= alc_hp_automute
,
10868 [ALC888_FUJITSU_XA3530
] = {
10869 .mixers
= { alc888_base_mixer
, alc883_chmode_mixer
},
10870 .init_verbs
= { alc883_init_verbs
,
10871 alc888_fujitsu_xa3530_verbs
},
10872 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10873 .dac_nids
= alc883_dac_nids
,
10874 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10875 .adc_nids
= alc883_adc_nids_rev
,
10876 .capsrc_nids
= alc883_capsrc_nids_rev
,
10877 .dig_out_nid
= ALC883_DIGOUT_NID
,
10878 .num_channel_mode
= ARRAY_SIZE(alc888_4ST_8ch_intel_modes
),
10879 .channel_mode
= alc888_4ST_8ch_intel_modes
,
10881 ARRAY_SIZE(alc888_2_capture_sources
),
10882 .input_mux
= alc888_2_capture_sources
,
10883 .unsol_event
= alc_sku_unsol_event
,
10884 .setup
= alc888_fujitsu_xa3530_setup
,
10885 .init_hook
= alc_hp_automute
,
10887 [ALC888_LENOVO_SKY
] = {
10888 .mixers
= { alc888_lenovo_sky_mixer
, alc883_chmode_mixer
},
10889 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_sky_verbs
},
10890 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10891 .dac_nids
= alc883_dac_nids
,
10892 .dig_out_nid
= ALC883_DIGOUT_NID
,
10893 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10894 .channel_mode
= alc883_sixstack_modes
,
10896 .input_mux
= &alc883_lenovo_sky_capture_source
,
10897 .unsol_event
= alc_sku_unsol_event
,
10898 .setup
= alc888_lenovo_sky_setup
,
10899 .init_hook
= alc_hp_automute
,
10901 [ALC888_ASUS_M90V
] = {
10902 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10903 .init_verbs
= { alc883_init_verbs
, alc888_asus_m90v_verbs
},
10904 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10905 .dac_nids
= alc883_dac_nids
,
10906 .dig_out_nid
= ALC883_DIGOUT_NID
,
10907 .dig_in_nid
= ALC883_DIGIN_NID
,
10908 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10909 .channel_mode
= alc883_3ST_6ch_modes
,
10911 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10912 .unsol_event
= alc_sku_unsol_event
,
10913 .setup
= alc883_mode2_setup
,
10914 .init_hook
= alc_inithook
,
10916 [ALC888_ASUS_EEE1601
] = {
10917 .mixers
= { alc883_asus_eee1601_mixer
},
10918 .cap_mixer
= alc883_asus_eee1601_cap_mixer
,
10919 .init_verbs
= { alc883_init_verbs
, alc888_asus_eee1601_verbs
},
10920 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10921 .dac_nids
= alc883_dac_nids
,
10922 .dig_out_nid
= ALC883_DIGOUT_NID
,
10923 .dig_in_nid
= ALC883_DIGIN_NID
,
10924 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10925 .channel_mode
= alc883_3ST_2ch_modes
,
10927 .input_mux
= &alc883_asus_eee1601_capture_source
,
10928 .unsol_event
= alc_sku_unsol_event
,
10929 .init_hook
= alc883_eee1601_inithook
,
10931 [ALC1200_ASUS_P5Q
] = {
10932 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10933 .init_verbs
= { alc883_init_verbs
},
10934 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10935 .dac_nids
= alc883_dac_nids
,
10936 .dig_out_nid
= ALC1200_DIGOUT_NID
,
10937 .dig_in_nid
= ALC883_DIGIN_NID
,
10938 .slave_dig_outs
= alc1200_slave_dig_outs
,
10939 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10940 .channel_mode
= alc883_sixstack_modes
,
10941 .input_mux
= &alc883_capture_source
,
10944 .mixers
= { alc889A_mb31_mixer
, alc883_chmode_mixer
},
10945 .init_verbs
= { alc883_init_verbs
, alc889A_mb31_verbs
,
10946 alc880_gpio1_init_verbs
},
10947 .adc_nids
= alc883_adc_nids
,
10948 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10949 .capsrc_nids
= alc883_capsrc_nids
,
10950 .dac_nids
= alc883_dac_nids
,
10951 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10952 .channel_mode
= alc889A_mb31_6ch_modes
,
10953 .num_channel_mode
= ARRAY_SIZE(alc889A_mb31_6ch_modes
),
10954 .input_mux
= &alc889A_mb31_capture_source
,
10955 .dig_out_nid
= ALC883_DIGOUT_NID
,
10956 .unsol_event
= alc889A_mb31_unsol_event
,
10957 .init_hook
= alc889A_mb31_automute
,
10959 [ALC883_SONY_VAIO_TT
] = {
10960 .mixers
= { alc883_vaiott_mixer
},
10961 .init_verbs
= { alc883_init_verbs
, alc883_vaiott_verbs
},
10962 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10963 .dac_nids
= alc883_dac_nids
,
10964 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10965 .channel_mode
= alc883_3ST_2ch_modes
,
10966 .input_mux
= &alc883_capture_source
,
10967 .unsol_event
= alc_sku_unsol_event
,
10968 .setup
= alc883_vaiott_setup
,
10969 .init_hook
= alc_hp_automute
,
10978 PINFIX_ABIT_AW9D_MAX
,
10979 PINFIX_LENOVO_Y530
,
10981 PINFIX_ACER_ASPIRE_7736
,
10984 static const struct alc_fixup alc882_fixups
[] = {
10985 [PINFIX_ABIT_AW9D_MAX
] = {
10986 .type
= ALC_FIXUP_PINS
,
10987 .v
.pins
= (const struct alc_pincfg
[]) {
10988 { 0x15, 0x01080104 }, /* side */
10989 { 0x16, 0x01011012 }, /* rear */
10990 { 0x17, 0x01016011 }, /* clfe */
10994 [PINFIX_LENOVO_Y530
] = {
10995 .type
= ALC_FIXUP_PINS
,
10996 .v
.pins
= (const struct alc_pincfg
[]) {
10997 { 0x15, 0x99130112 }, /* rear int speakers */
10998 { 0x16, 0x99130111 }, /* subwoofer */
11002 [PINFIX_PB_M5210
] = {
11003 .type
= ALC_FIXUP_VERBS
,
11004 .v
.verbs
= (const struct hda_verb
[]) {
11005 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11009 [PINFIX_ACER_ASPIRE_7736
] = {
11010 .type
= ALC_FIXUP_SKU
,
11011 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
11015 static const struct snd_pci_quirk alc882_fixup_tbl
[] = {
11016 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210
),
11017 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530
),
11018 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
11019 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736
),
11024 * BIOS auto configuration
11026 static int alc882_auto_create_input_ctls(struct hda_codec
*codec
,
11027 const struct auto_pin_cfg
*cfg
)
11029 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x23, 0x22);
11032 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
11033 hda_nid_t nid
, int pin_type
,
11038 /* set as output */
11039 alc_set_pin_output(codec
, nid
, pin_type
);
11043 else if (dac
>= 0x02 && dac
<= 0x05)
11047 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
11050 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
11052 struct alc_spec
*spec
= codec
->spec
;
11055 for (i
= 0; i
<= HDA_SIDE
; i
++) {
11056 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
11057 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
11059 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
11060 spec
->multiout
.dac_nids
[i
]);
11064 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
11066 struct alc_spec
*spec
= codec
->spec
;
11067 hda_nid_t pin
, dac
;
11070 if (spec
->autocfg
.line_out_type
!= AUTO_PIN_HP_OUT
) {
11071 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.hp_pins
); i
++) {
11072 pin
= spec
->autocfg
.hp_pins
[i
];
11075 dac
= spec
->multiout
.hp_nid
;
11077 dac
= spec
->multiout
.dac_nids
[0]; /* to front */
11078 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, dac
);
11082 if (spec
->autocfg
.line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
11083 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
11084 pin
= spec
->autocfg
.speaker_pins
[i
];
11087 dac
= spec
->multiout
.extra_out_nid
[0];
11089 dac
= spec
->multiout
.dac_nids
[0]; /* to front */
11090 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, dac
);
11095 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
11097 struct alc_spec
*spec
= codec
->spec
;
11098 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
11101 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
11102 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
11103 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
11104 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
11105 snd_hda_codec_write(codec
, nid
, 0,
11106 AC_VERB_SET_AMP_GAIN_MUTE
,
11111 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
11113 struct alc_spec
*spec
= codec
->spec
;
11116 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
11117 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
11118 hda_nid_t nid
= spec
->capsrc_nids
[c
];
11119 unsigned int mux_idx
;
11120 const struct hda_input_mux
*imux
;
11121 int conns
, mute
, idx
, item
;
11124 snd_hda_codec_write(codec
, spec
->adc_nids
[c
], 0,
11125 AC_VERB_SET_AMP_GAIN_MUTE
,
11128 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
11129 ARRAY_SIZE(conn_list
));
11132 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
11133 imux
= &spec
->input_mux
[mux_idx
];
11134 if (!imux
->num_items
&& mux_idx
> 0)
11135 imux
= &spec
->input_mux
[0];
11136 for (idx
= 0; idx
< conns
; idx
++) {
11137 /* if the current connection is the selected one,
11138 * unmute it as default - otherwise mute it
11140 mute
= AMP_IN_MUTE(idx
);
11141 for (item
= 0; item
< imux
->num_items
; item
++) {
11142 if (imux
->items
[item
].index
== idx
) {
11143 if (spec
->cur_mux
[c
] == item
)
11144 mute
= AMP_IN_UNMUTE(idx
);
11148 /* check if we have a selector or mixer
11149 * we could check for the widget type instead, but
11150 * just check for Amp-In presence (in case of mixer
11151 * without amp-in there is something wrong, this
11152 * function shouldn't be used or capsrc nid is wrong)
11154 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)
11155 snd_hda_codec_write(codec
, nid
, 0,
11156 AC_VERB_SET_AMP_GAIN_MUTE
,
11158 else if (mute
!= AMP_IN_MUTE(idx
))
11159 snd_hda_codec_write(codec
, nid
, 0,
11160 AC_VERB_SET_CONNECT_SEL
,
11166 /* add mic boosts if needed */
11167 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
11169 struct alc_spec
*spec
= codec
->spec
;
11170 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
11174 const char *prev_label
= NULL
;
11176 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
11177 if (cfg
->inputs
[i
].type
> AUTO_PIN_MIC
)
11179 nid
= cfg
->inputs
[i
].pin
;
11180 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
) {
11182 char boost_label
[32];
11184 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
11185 if (prev_label
&& !strcmp(label
, prev_label
))
11189 prev_label
= label
;
11191 snprintf(boost_label
, sizeof(boost_label
),
11192 "%s Boost Volume", label
);
11193 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11194 boost_label
, type_idx
,
11195 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
11203 /* almost identical with ALC880 parser... */
11204 static int alc882_parse_auto_config(struct hda_codec
*codec
)
11206 struct alc_spec
*spec
= codec
->spec
;
11207 static const hda_nid_t alc882_ignore
[] = { 0x1d, 0 };
11210 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11214 if (!spec
->autocfg
.line_outs
)
11215 return 0; /* can't find valid BIOS pin config */
11217 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
11220 err
= alc_auto_add_multi_channel_mode(codec
);
11223 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11226 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
11230 err
= alc880_auto_create_extra_out(spec
,
11231 spec
->autocfg
.speaker_pins
[0],
11235 err
= alc882_auto_create_input_ctls(codec
, &spec
->autocfg
);
11239 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
11241 alc_auto_parse_digital(codec
);
11243 if (spec
->kctls
.list
)
11244 add_mixer(spec
, spec
->kctls
.list
);
11246 add_verb(spec
, alc883_auto_init_verbs
);
11247 /* if ADC 0x07 is available, initialize it, too */
11248 if (get_wcaps_type(get_wcaps(codec
, 0x07)) == AC_WID_AUD_IN
)
11249 add_verb(spec
, alc882_adc1_init_verbs
);
11251 spec
->num_mux_defs
= 1;
11252 spec
->input_mux
= &spec
->private_imux
[0];
11254 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
11256 err
= alc_auto_add_mic_boost(codec
);
11260 return 1; /* config found */
11263 /* additional initialization for auto-configuration model */
11264 static void alc882_auto_init(struct hda_codec
*codec
)
11266 struct alc_spec
*spec
= codec
->spec
;
11267 alc882_auto_init_multi_out(codec
);
11268 alc882_auto_init_hp_out(codec
);
11269 alc882_auto_init_analog_input(codec
);
11270 alc882_auto_init_input_src(codec
);
11271 alc_auto_init_digital(codec
);
11272 if (spec
->unsol_event
)
11273 alc_inithook(codec
);
11276 static int patch_alc882(struct hda_codec
*codec
)
11278 struct alc_spec
*spec
;
11279 int err
, board_config
;
11281 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
11285 codec
->spec
= spec
;
11287 switch (codec
->vendor_id
) {
11292 /* ALC883 and variants */
11293 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
11297 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
11301 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
)
11302 board_config
= snd_hda_check_board_codec_sid_config(codec
,
11303 ALC882_MODEL_LAST
, alc882_models
, alc882_ssid_cfg_tbl
);
11305 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
11306 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
11308 board_config
= ALC882_AUTO
;
11311 if (board_config
== ALC882_AUTO
) {
11312 alc_pick_fixup(codec
, NULL
, alc882_fixup_tbl
, alc882_fixups
);
11313 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
11316 alc_auto_parse_customize_define(codec
);
11318 if (board_config
== ALC882_AUTO
) {
11319 /* automatic parse from the BIOS config */
11320 err
= alc882_parse_auto_config(codec
);
11326 "hda_codec: Cannot set up configuration "
11327 "from BIOS. Using base mode...\n");
11328 board_config
= ALC882_3ST_DIG
;
11332 if (has_cdefine_beep(codec
)) {
11333 err
= snd_hda_attach_beep_device(codec
, 0x1);
11340 if (board_config
!= ALC882_AUTO
)
11341 setup_preset(codec
, &alc882_presets
[board_config
]);
11343 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
11344 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
11345 /* FIXME: setup DAC5 */
11346 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11347 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
11349 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
11350 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
11352 if (!spec
->adc_nids
&& spec
->input_mux
) {
11354 spec
->num_adc_nids
= 0;
11355 for (i
= 0; i
< ARRAY_SIZE(alc882_adc_nids
); i
++) {
11356 const struct hda_input_mux
*imux
= spec
->input_mux
;
11358 hda_nid_t items
[16];
11359 hda_nid_t nid
= alc882_adc_nids
[i
];
11360 unsigned int wcap
= get_wcaps(codec
, nid
);
11362 wcap
= get_wcaps_type(wcap
);
11363 if (wcap
!= AC_WID_AUD_IN
)
11365 spec
->private_adc_nids
[spec
->num_adc_nids
] = nid
;
11366 err
= snd_hda_get_connections(codec
, nid
, &cap
, 1);
11369 err
= snd_hda_get_connections(codec
, cap
, items
,
11370 ARRAY_SIZE(items
));
11373 for (j
= 0; j
< imux
->num_items
; j
++)
11374 if (imux
->items
[j
].index
>= err
)
11376 if (j
< imux
->num_items
)
11378 spec
->private_capsrc_nids
[spec
->num_adc_nids
] = cap
;
11379 spec
->num_adc_nids
++;
11381 spec
->adc_nids
= spec
->private_adc_nids
;
11382 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
11385 set_capture_mixer(codec
);
11387 if (has_cdefine_beep(codec
))
11388 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
11390 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
11392 spec
->vmaster_nid
= 0x0c;
11394 codec
->patch_ops
= alc_patch_ops
;
11395 if (board_config
== ALC882_AUTO
)
11396 spec
->init_hook
= alc882_auto_init
;
11398 alc_init_jacks(codec
);
11399 #ifdef CONFIG_SND_HDA_POWER_SAVE
11400 if (!spec
->loopback
.amplist
)
11401 spec
->loopback
.amplist
= alc882_loopbacks
;
11412 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11413 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11415 #define alc262_dac_nids alc260_dac_nids
11416 #define alc262_adc_nids alc882_adc_nids
11417 #define alc262_adc_nids_alt alc882_adc_nids_alt
11418 #define alc262_capsrc_nids alc882_capsrc_nids
11419 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11421 #define alc262_modes alc260_modes
11422 #define alc262_capture_source alc882_capture_source
11424 static const hda_nid_t alc262_dmic_adc_nids
[1] = {
11429 static const hda_nid_t alc262_dmic_capsrc_nids
[1] = { 0x22 };
11431 static const struct snd_kcontrol_new alc262_base_mixer
[] = {
11432 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11433 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11434 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11435 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11436 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11437 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11438 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11439 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11440 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11441 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11442 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11443 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11444 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
11445 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11446 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
11447 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
11451 /* update HP, line and mono-out pins according to the master switch */
11452 #define alc262_hp_master_update alc260_hp_master_update
11454 static void alc262_hp_bpc_setup(struct hda_codec
*codec
)
11456 struct alc_spec
*spec
= codec
->spec
;
11458 spec
->autocfg
.hp_pins
[0] = 0x1b;
11459 spec
->autocfg
.speaker_pins
[0] = 0x16;
11460 spec
->automute
= 1;
11461 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11464 static void alc262_hp_wildwest_setup(struct hda_codec
*codec
)
11466 struct alc_spec
*spec
= codec
->spec
;
11468 spec
->autocfg
.hp_pins
[0] = 0x15;
11469 spec
->autocfg
.speaker_pins
[0] = 0x16;
11470 spec
->automute
= 1;
11471 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11474 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11475 #define alc262_hp_master_sw_put alc260_hp_master_sw_put
11477 #define ALC262_HP_MASTER_SWITCH \
11479 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11480 .name = "Master Playback Switch", \
11481 .info = snd_ctl_boolean_mono_info, \
11482 .get = alc262_hp_master_sw_get, \
11483 .put = alc262_hp_master_sw_put, \
11486 .iface = NID_MAPPING, \
11487 .name = "Master Playback Switch", \
11488 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11492 static const struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
11493 ALC262_HP_MASTER_SWITCH
,
11494 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11495 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11496 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11497 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11499 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11502 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11503 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11504 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11505 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11506 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11507 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11508 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11509 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11510 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11511 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11512 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11516 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
11517 ALC262_HP_MASTER_SWITCH
,
11518 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11519 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11520 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11521 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11522 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11524 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11526 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11527 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11528 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT
),
11529 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11530 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11531 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11532 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11536 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
11537 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11538 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11539 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11543 /* mute/unmute internal speaker according to the hp jack and mute state */
11544 static void alc262_hp_t5735_setup(struct hda_codec
*codec
)
11546 struct alc_spec
*spec
= codec
->spec
;
11548 spec
->autocfg
.hp_pins
[0] = 0x15;
11549 spec
->autocfg
.speaker_pins
[0] = 0x14;
11550 spec
->automute
= 1;
11551 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11554 static const struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
11555 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11556 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11557 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11558 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11560 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11561 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11565 static const struct hda_verb alc262_hp_t5735_verbs
[] = {
11566 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11567 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11569 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11573 static const struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
11574 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11575 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11576 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
11577 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
11578 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11579 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11583 static const struct hda_verb alc262_hp_rp5700_verbs
[] = {
11584 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11585 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11586 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11587 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11588 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11589 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11590 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11591 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11592 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
11593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
11597 static const struct hda_input_mux alc262_hp_rp5700_capture_source
= {
11604 /* bind hp and internal speaker mute (with plug check) as master switch */
11605 #define alc262_hippo_master_update alc262_hp_master_update
11606 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11607 #define alc262_hippo_master_sw_put alc262_hp_master_sw_put
11609 #define ALC262_HIPPO_MASTER_SWITCH \
11611 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11612 .name = "Master Playback Switch", \
11613 .info = snd_ctl_boolean_mono_info, \
11614 .get = alc262_hippo_master_sw_get, \
11615 .put = alc262_hippo_master_sw_put, \
11618 .iface = NID_MAPPING, \
11619 .name = "Master Playback Switch", \
11620 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11621 (SUBDEV_SPEAKER(0) << 16), \
11624 static const struct snd_kcontrol_new alc262_hippo_mixer
[] = {
11625 ALC262_HIPPO_MASTER_SWITCH
,
11626 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11627 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11628 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11629 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11630 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11633 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11634 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11635 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11636 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11637 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11641 static const struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
11642 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11643 ALC262_HIPPO_MASTER_SWITCH
,
11644 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11645 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11646 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11647 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11648 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11649 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11650 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11651 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11653 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11657 /* mute/unmute internal speaker according to the hp jack and mute state */
11658 static void alc262_hippo_setup(struct hda_codec
*codec
)
11660 struct alc_spec
*spec
= codec
->spec
;
11662 spec
->autocfg
.hp_pins
[0] = 0x15;
11663 spec
->autocfg
.speaker_pins
[0] = 0x14;
11664 spec
->automute
= 1;
11665 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11668 static void alc262_hippo1_setup(struct hda_codec
*codec
)
11670 struct alc_spec
*spec
= codec
->spec
;
11672 spec
->autocfg
.hp_pins
[0] = 0x1b;
11673 spec
->autocfg
.speaker_pins
[0] = 0x14;
11674 spec
->automute
= 1;
11675 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11679 static const struct snd_kcontrol_new alc262_sony_mixer
[] = {
11680 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11681 ALC262_HIPPO_MASTER_SWITCH
,
11682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11683 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11684 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11685 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11689 static const struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
11690 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11691 ALC262_HIPPO_MASTER_SWITCH
,
11692 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11693 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11694 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11695 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11696 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11700 static const struct snd_kcontrol_new alc262_tyan_mixer
[] = {
11701 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11702 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
11703 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11704 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11706 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11709 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11710 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11711 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11712 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11716 static const struct hda_verb alc262_tyan_verbs
[] = {
11717 /* Headphone automute */
11718 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11719 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11720 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11722 /* P11 AUX_IN, white 4-pin connector */
11723 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11724 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
, 0xe1},
11725 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
, 0x93},
11726 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
, 0x19},
11731 /* unsolicited event for HP jack sensing */
11732 static void alc262_tyan_setup(struct hda_codec
*codec
)
11734 struct alc_spec
*spec
= codec
->spec
;
11736 spec
->autocfg
.hp_pins
[0] = 0x1b;
11737 spec
->autocfg
.speaker_pins
[0] = 0x15;
11738 spec
->automute
= 1;
11739 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11743 #define alc262_capture_mixer alc882_capture_mixer
11744 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11747 * generic initialization of ADC, input mixers and output mixers
11749 static const struct hda_verb alc262_init_verbs
[] = {
11751 * Unmute ADC0-2 and set the default input to mic-in
11753 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11755 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11756 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11757 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11760 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11762 * Note: PASD motherboards uses the Line In 2 as the input for
11763 * front panel mic (mic 2)
11765 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11767 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11768 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11769 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11770 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11773 * Set up output mixers (0x0c - 0x0e)
11775 /* set vol=0 to output mixers */
11776 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11778 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11779 /* set up input amps for analog loopback */
11780 /* Amp Indices: DAC = 0, mixer = 1 */
11781 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11782 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11783 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11784 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11785 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11786 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11788 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11790 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11791 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11793 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11795 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11796 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11797 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11798 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11799 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11801 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11802 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11804 /* FIXME: use matrix-type input source selection */
11805 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11806 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11807 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11808 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11809 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11810 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11812 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11813 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11814 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11815 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11819 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11820 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11825 static const struct hda_verb alc262_eapd_verbs
[] = {
11826 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11827 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11831 static const struct hda_verb alc262_hippo1_unsol_verbs
[] = {
11832 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11833 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11834 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11836 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11837 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11841 static const struct hda_verb alc262_sony_unsol_verbs
[] = {
11842 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11843 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11844 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
11846 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11851 static const struct snd_kcontrol_new alc262_toshiba_s06_mixer
[] = {
11852 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11853 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11855 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11856 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11860 static const struct hda_verb alc262_toshiba_s06_verbs
[] = {
11861 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11862 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11864 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11865 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x09},
11866 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11867 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11868 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11872 static void alc262_toshiba_s06_setup(struct hda_codec
*codec
)
11874 struct alc_spec
*spec
= codec
->spec
;
11876 spec
->autocfg
.hp_pins
[0] = 0x15;
11877 spec
->autocfg
.speaker_pins
[0] = 0x14;
11878 spec
->ext_mic
.pin
= 0x18;
11879 spec
->ext_mic
.mux_idx
= 0;
11880 spec
->int_mic
.pin
= 0x12;
11881 spec
->int_mic
.mux_idx
= 9;
11882 spec
->auto_mic
= 1;
11883 spec
->automute
= 1;
11884 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11890 * 0x16 = internal speaker
11891 * 0x18 = external mic
11894 static const struct snd_kcontrol_new alc262_nec_mixer
[] = {
11895 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
11896 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
11898 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11899 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11900 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11902 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11903 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11907 static const struct hda_verb alc262_nec_verbs
[] = {
11908 /* Unmute Speaker */
11909 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11912 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11913 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11915 /* External mic to headphone */
11916 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11917 /* External mic to speaker */
11918 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11924 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11925 * 0x1b = port replicator headphone out
11928 #define ALC_HP_EVENT ALC880_HP_EVENT
11930 static const struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
11931 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11932 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11933 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11934 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11938 static const struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
11939 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11940 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11944 static const struct hda_verb alc262_lenovo_3000_init_verbs
[] = {
11945 /* Front Mic pin: input vref at 50% */
11946 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11947 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11951 static const struct hda_input_mux alc262_fujitsu_capture_source
= {
11955 { "Internal Mic", 0x1 },
11960 static const struct hda_input_mux alc262_HP_capture_source
= {
11964 { "Front Mic", 0x1 },
11971 static const struct hda_input_mux alc262_HP_D7000_capture_source
= {
11975 { "Front Mic", 0x2 },
11981 static void alc262_fujitsu_setup(struct hda_codec
*codec
)
11983 struct alc_spec
*spec
= codec
->spec
;
11985 spec
->autocfg
.hp_pins
[0] = 0x14;
11986 spec
->autocfg
.hp_pins
[1] = 0x1b;
11987 spec
->autocfg
.speaker_pins
[0] = 0x15;
11988 spec
->automute
= 1;
11989 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11992 /* bind volumes of both NID 0x0c and 0x0d */
11993 static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
11994 .ops
= &snd_hda_bind_vol
,
11996 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
11997 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
12002 static const struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
12003 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
12005 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12006 .name
= "Master Playback Switch",
12007 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x14,
12008 .info
= snd_ctl_boolean_mono_info
,
12009 .get
= alc262_hp_master_sw_get
,
12010 .put
= alc262_hp_master_sw_put
,
12013 .iface
= NID_MAPPING
,
12014 .name
= "Master Playback Switch",
12015 .private_value
= 0x1b,
12017 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12018 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12019 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12022 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12023 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12024 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12028 static void alc262_lenovo_3000_setup(struct hda_codec
*codec
)
12030 struct alc_spec
*spec
= codec
->spec
;
12032 spec
->autocfg
.hp_pins
[0] = 0x1b;
12033 spec
->autocfg
.speaker_pins
[0] = 0x14;
12034 spec
->autocfg
.speaker_pins
[1] = 0x16;
12035 spec
->automute
= 1;
12036 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
12039 static const struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
12040 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
12042 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12043 .name
= "Master Playback Switch",
12044 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x1b,
12045 .info
= snd_ctl_boolean_mono_info
,
12046 .get
= alc262_hp_master_sw_get
,
12047 .put
= alc262_hp_master_sw_put
,
12049 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12050 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12051 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12054 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12055 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12056 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12060 static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer
[] = {
12061 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
12062 ALC262_HIPPO_MASTER_SWITCH
,
12063 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12065 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12066 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12067 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12068 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12072 /* additional init verbs for Benq laptops */
12073 static const struct hda_verb alc262_EAPD_verbs
[] = {
12074 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
12075 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
12079 static const struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
12080 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12081 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12083 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
12084 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
12088 /* Samsung Q1 Ultra Vista model setup */
12089 static const struct snd_kcontrol_new alc262_ultra_mixer
[] = {
12090 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
12091 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
12092 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12093 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12094 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12095 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT
),
12099 static const struct hda_verb alc262_ultra_verbs
[] = {
12101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12103 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12105 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12106 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12108 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
12110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12112 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12113 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12114 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12116 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12118 /* ADC, choose mic */
12119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12120 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12121 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12122 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12123 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12124 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12125 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12126 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12127 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
12128 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
12132 /* mute/unmute internal speaker according to the hp jack and mute state */
12133 static void alc262_ultra_automute(struct hda_codec
*codec
)
12135 struct alc_spec
*spec
= codec
->spec
;
12139 /* auto-mute only when HP is used as HP */
12140 if (!spec
->cur_mux
[0]) {
12141 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
12142 if (spec
->jack_present
)
12143 mute
= HDA_AMP_MUTE
;
12145 /* mute/unmute internal speaker */
12146 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
12147 HDA_AMP_MUTE
, mute
);
12148 /* mute/unmute HP */
12149 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
12150 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
12153 /* unsolicited event for HP jack sensing */
12154 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
12157 if ((res
>> 26) != ALC880_HP_EVENT
)
12159 alc262_ultra_automute(codec
);
12162 static const struct hda_input_mux alc262_ultra_capture_source
= {
12166 { "Headphone", 0x7 },
12170 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
12171 struct snd_ctl_elem_value
*ucontrol
)
12173 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
12174 struct alc_spec
*spec
= codec
->spec
;
12177 ret
= alc_mux_enum_put(kcontrol
, ucontrol
);
12180 /* reprogram the HP pin as mic or HP according to the input source */
12181 snd_hda_codec_write_cache(codec
, 0x15, 0,
12182 AC_VERB_SET_PIN_WIDGET_CONTROL
,
12183 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
12184 alc262_ultra_automute(codec
); /* mute/unmute HP */
12188 static const struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
12189 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
12190 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
12192 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12193 .name
= "Capture Source",
12194 .info
= alc_mux_enum_info
,
12195 .get
= alc_mux_enum_get
,
12196 .put
= alc262_ultra_mux_enum_put
,
12199 .iface
= NID_MAPPING
,
12200 .name
= "Capture Source",
12201 .private_value
= 0x15,
12206 /* We use two mixers depending on the output pin; 0x16 is a mono output
12207 * and thus it's bound with a different mixer.
12208 * This function returns which mixer amp should be used.
12210 static int alc262_check_volbit(hda_nid_t nid
)
12214 else if (nid
== 0x16)
12220 static int alc262_add_out_vol_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
12221 const char *pfx
, int *vbits
, int idx
)
12226 vbit
= alc262_check_volbit(nid
);
12229 if (*vbits
& vbit
) /* a volume control for this mixer already there */
12233 val
= HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
);
12235 val
= HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
);
12236 return __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, idx
, val
);
12239 static int alc262_add_out_sw_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
12240 const char *pfx
, int idx
)
12247 val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
12249 val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
12250 return __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
, val
);
12253 /* add playback controls from the parsed DAC table */
12254 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12255 const struct auto_pin_cfg
*cfg
)
12261 spec
->multiout
.num_dacs
= 1; /* only use one dac */
12262 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
12263 spec
->private_dac_nids
[0] = 2;
12265 pfx
= alc_get_line_out_pfx(spec
, true);
12268 for (i
= 0; i
< 2; i
++) {
12269 err
= alc262_add_out_sw_ctl(spec
, cfg
->line_out_pins
[i
], pfx
, i
);
12272 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
12273 err
= alc262_add_out_sw_ctl(spec
, cfg
->speaker_pins
[i
],
12278 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
) {
12279 err
= alc262_add_out_sw_ctl(spec
, cfg
->hp_pins
[i
],
12286 vbits
= alc262_check_volbit(cfg
->line_out_pins
[0]) |
12287 alc262_check_volbit(cfg
->speaker_pins
[0]) |
12288 alc262_check_volbit(cfg
->hp_pins
[0]);
12289 if (vbits
== 1 || vbits
== 2)
12290 pfx
= "Master"; /* only one mixer is used */
12292 for (i
= 0; i
< 2; i
++) {
12293 err
= alc262_add_out_vol_ctl(spec
, cfg
->line_out_pins
[i
], pfx
,
12297 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
12298 err
= alc262_add_out_vol_ctl(spec
, cfg
->speaker_pins
[i
],
12299 "Speaker", &vbits
, i
);
12303 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
) {
12304 err
= alc262_add_out_vol_ctl(spec
, cfg
->hp_pins
[i
],
12305 "Headphone", &vbits
, i
);
12313 #define alc262_auto_create_input_ctls \
12314 alc882_auto_create_input_ctls
12317 * generic initialization of ADC, input mixers and output mixers
12319 static const struct hda_verb alc262_volume_init_verbs
[] = {
12321 * Unmute ADC0-2 and set the default input to mic-in
12323 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12324 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12325 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12326 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12327 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12328 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12330 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12332 * Note: PASD motherboards uses the Line In 2 as the input for
12333 * front panel mic (mic 2)
12335 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12343 * Set up output mixers (0x0c - 0x0f)
12345 /* set vol=0 to output mixers */
12346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12350 /* set up input amps for analog loopback */
12351 /* Amp Indices: DAC = 0, mixer = 1 */
12352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12359 /* FIXME: use matrix-type input source selection */
12360 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12361 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12369 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12370 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12380 static const struct hda_verb alc262_HP_BPC_init_verbs
[] = {
12382 * Unmute ADC0-2 and set the default input to mic-in
12384 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12386 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12387 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12388 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12389 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12391 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12393 * Note: PASD motherboards uses the Line In 2 as the input for
12394 * front panel mic (mic 2)
12396 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12406 * Set up output mixers (0x0c - 0x0e)
12408 /* set vol=0 to output mixers */
12409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12410 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12411 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12413 /* set up input amps for analog loopback */
12414 /* Amp Indices: DAC = 0, mixer = 1 */
12415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12417 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12418 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12419 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12420 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12422 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12423 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12424 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12426 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12427 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12429 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12430 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12432 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12433 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12434 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12435 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12436 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12439 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12440 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12441 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12442 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12443 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12446 /* FIXME: use matrix-type input source selection */
12447 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12448 /* Input mixer1: only unmute Mic */
12449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12473 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12474 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12475 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12476 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12479 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12484 static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
12486 * Unmute ADC0-2 and set the default input to mic-in
12488 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12490 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12491 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12492 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12495 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12497 * Note: PASD motherboards uses the Line In 2 as the input for front
12498 * panel mic (mic 2)
12500 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
12510 * Set up output mixers (0x0c - 0x0e)
12512 /* set vol=0 to output mixers */
12513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12514 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12517 /* set up input amps for analog loopback */
12518 /* Amp Indices: DAC = 0, mixer = 1 */
12519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12522 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12523 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12524 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
12528 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
12529 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
12530 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
12531 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
12532 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
12533 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
12535 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12536 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12538 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12539 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12541 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12542 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12543 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12544 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
12545 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12546 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12548 /* FIXME: use matrix-type input source selection */
12549 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12550 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
12553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
12554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
12555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
12556 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12557 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
12559 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12560 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
12561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
12562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
12563 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
12564 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
12567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
12569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
12570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
12571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
12572 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
12575 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12580 static const struct hda_verb alc262_toshiba_rx1_unsol_verbs
[] = {
12582 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Front Speaker */
12583 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12584 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
12586 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* MIC jack */
12587 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
12588 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
12589 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
12591 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP jack */
12592 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12593 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12605 static const struct alc_fixup alc262_fixups
[] = {
12606 [PINFIX_FSC_H270
] = {
12607 .type
= ALC_FIXUP_PINS
,
12608 .v
.pins
= (const struct alc_pincfg
[]) {
12609 { 0x14, 0x99130110 }, /* speaker */
12610 { 0x15, 0x0221142f }, /* front HP */
12611 { 0x1b, 0x0121141f }, /* rear HP */
12615 [PINFIX_HP_Z200
] = {
12616 .type
= ALC_FIXUP_PINS
,
12617 .v
.pins
= (const struct alc_pincfg
[]) {
12618 { 0x16, 0x99130120 }, /* internal speaker */
12624 static const struct snd_pci_quirk alc262_fixup_tbl
[] = {
12625 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", PINFIX_HP_Z200
),
12626 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270
),
12631 #ifdef CONFIG_SND_HDA_POWER_SAVE
12632 #define alc262_loopbacks alc880_loopbacks
12635 /* pcm configuration: identical with ALC880 */
12636 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12637 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12638 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12639 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12642 * BIOS auto configuration
12644 static int alc262_parse_auto_config(struct hda_codec
*codec
)
12646 struct alc_spec
*spec
= codec
->spec
;
12648 static const hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
12650 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12654 if (!spec
->autocfg
.line_outs
) {
12655 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
12656 spec
->multiout
.max_channels
= 2;
12657 spec
->no_analog
= 1;
12660 return 0; /* can't find valid BIOS pin config */
12662 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12665 err
= alc262_auto_create_input_ctls(codec
, &spec
->autocfg
);
12669 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12672 alc_auto_parse_digital(codec
);
12674 if (spec
->kctls
.list
)
12675 add_mixer(spec
, spec
->kctls
.list
);
12677 add_verb(spec
, alc262_volume_init_verbs
);
12678 spec
->num_mux_defs
= 1;
12679 spec
->input_mux
= &spec
->private_imux
[0];
12681 err
= alc_auto_add_mic_boost(codec
);
12685 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
12690 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12691 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12692 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12693 #define alc262_auto_init_input_src alc882_auto_init_input_src
12696 /* init callback for auto-configuration model -- overriding the default init */
12697 static void alc262_auto_init(struct hda_codec
*codec
)
12699 struct alc_spec
*spec
= codec
->spec
;
12700 alc262_auto_init_multi_out(codec
);
12701 alc262_auto_init_hp_out(codec
);
12702 alc262_auto_init_analog_input(codec
);
12703 alc262_auto_init_input_src(codec
);
12704 alc_auto_init_digital(codec
);
12705 if (spec
->unsol_event
)
12706 alc_inithook(codec
);
12710 * configuration and preset
12712 static const char * const alc262_models
[ALC262_MODEL_LAST
] = {
12713 [ALC262_BASIC
] = "basic",
12714 [ALC262_HIPPO
] = "hippo",
12715 [ALC262_HIPPO_1
] = "hippo_1",
12716 [ALC262_FUJITSU
] = "fujitsu",
12717 [ALC262_HP_BPC
] = "hp-bpc",
12718 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
12719 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
12720 [ALC262_HP_RP5700
] = "hp-rp5700",
12721 [ALC262_BENQ_ED8
] = "benq",
12722 [ALC262_BENQ_T31
] = "benq-t31",
12723 [ALC262_SONY_ASSAMD
] = "sony-assamd",
12724 [ALC262_TOSHIBA_S06
] = "toshiba-s06",
12725 [ALC262_TOSHIBA_RX1
] = "toshiba-rx1",
12726 [ALC262_ULTRA
] = "ultra",
12727 [ALC262_LENOVO_3000
] = "lenovo-3000",
12728 [ALC262_NEC
] = "nec",
12729 [ALC262_TYAN
] = "tyan",
12730 [ALC262_AUTO
] = "auto",
12733 static const struct snd_pci_quirk alc262_cfg_tbl
[] = {
12734 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
12735 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
12736 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12738 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12740 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12742 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200",
12744 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12746 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12747 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12748 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12749 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12750 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12751 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12752 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12753 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12754 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
12755 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
12756 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
12757 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12758 ALC262_HP_TC_T5735
),
12759 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
12760 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12761 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
12762 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12763 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO
), /* dig-only */
12764 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06
),
12765 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO
),
12766 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO
),
12767 #if 0 /* disable the quirk since model=auto works better in recent versions */
12768 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12769 ALC262_SONY_ASSAMD
),
12771 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12772 ALC262_TOSHIBA_RX1
),
12773 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06
),
12774 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
12775 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
12776 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN
),
12777 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12779 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO
),
12780 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
12781 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
12782 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
12783 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
12787 static const struct alc_config_preset alc262_presets
[] = {
12789 .mixers
= { alc262_base_mixer
},
12790 .init_verbs
= { alc262_init_verbs
},
12791 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12792 .dac_nids
= alc262_dac_nids
,
12794 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12795 .channel_mode
= alc262_modes
,
12796 .input_mux
= &alc262_capture_source
,
12799 .mixers
= { alc262_hippo_mixer
},
12800 .init_verbs
= { alc262_init_verbs
, alc_hp15_unsol_verbs
},
12801 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12802 .dac_nids
= alc262_dac_nids
,
12804 .dig_out_nid
= ALC262_DIGOUT_NID
,
12805 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12806 .channel_mode
= alc262_modes
,
12807 .input_mux
= &alc262_capture_source
,
12808 .unsol_event
= alc_sku_unsol_event
,
12809 .setup
= alc262_hippo_setup
,
12810 .init_hook
= alc_inithook
,
12812 [ALC262_HIPPO_1
] = {
12813 .mixers
= { alc262_hippo1_mixer
},
12814 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
12815 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12816 .dac_nids
= alc262_dac_nids
,
12818 .dig_out_nid
= ALC262_DIGOUT_NID
,
12819 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12820 .channel_mode
= alc262_modes
,
12821 .input_mux
= &alc262_capture_source
,
12822 .unsol_event
= alc_sku_unsol_event
,
12823 .setup
= alc262_hippo1_setup
,
12824 .init_hook
= alc_inithook
,
12826 [ALC262_FUJITSU
] = {
12827 .mixers
= { alc262_fujitsu_mixer
},
12828 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12829 alc262_fujitsu_unsol_verbs
},
12830 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12831 .dac_nids
= alc262_dac_nids
,
12833 .dig_out_nid
= ALC262_DIGOUT_NID
,
12834 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12835 .channel_mode
= alc262_modes
,
12836 .input_mux
= &alc262_fujitsu_capture_source
,
12837 .unsol_event
= alc_sku_unsol_event
,
12838 .setup
= alc262_fujitsu_setup
,
12839 .init_hook
= alc_inithook
,
12841 [ALC262_HP_BPC
] = {
12842 .mixers
= { alc262_HP_BPC_mixer
},
12843 .init_verbs
= { alc262_HP_BPC_init_verbs
},
12844 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12845 .dac_nids
= alc262_dac_nids
,
12847 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12848 .channel_mode
= alc262_modes
,
12849 .input_mux
= &alc262_HP_capture_source
,
12850 .unsol_event
= alc_sku_unsol_event
,
12851 .setup
= alc262_hp_bpc_setup
,
12852 .init_hook
= alc_inithook
,
12854 [ALC262_HP_BPC_D7000_WF
] = {
12855 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
12856 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12857 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12858 .dac_nids
= alc262_dac_nids
,
12860 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12861 .channel_mode
= alc262_modes
,
12862 .input_mux
= &alc262_HP_D7000_capture_source
,
12863 .unsol_event
= alc_sku_unsol_event
,
12864 .setup
= alc262_hp_wildwest_setup
,
12865 .init_hook
= alc_inithook
,
12867 [ALC262_HP_BPC_D7000_WL
] = {
12868 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
12869 alc262_HP_BPC_WildWest_option_mixer
},
12870 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12871 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12872 .dac_nids
= alc262_dac_nids
,
12874 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12875 .channel_mode
= alc262_modes
,
12876 .input_mux
= &alc262_HP_D7000_capture_source
,
12877 .unsol_event
= alc_sku_unsol_event
,
12878 .setup
= alc262_hp_wildwest_setup
,
12879 .init_hook
= alc_inithook
,
12881 [ALC262_HP_TC_T5735
] = {
12882 .mixers
= { alc262_hp_t5735_mixer
},
12883 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
12884 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12885 .dac_nids
= alc262_dac_nids
,
12887 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12888 .channel_mode
= alc262_modes
,
12889 .input_mux
= &alc262_capture_source
,
12890 .unsol_event
= alc_sku_unsol_event
,
12891 .setup
= alc262_hp_t5735_setup
,
12892 .init_hook
= alc_inithook
,
12894 [ALC262_HP_RP5700
] = {
12895 .mixers
= { alc262_hp_rp5700_mixer
},
12896 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
12897 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12898 .dac_nids
= alc262_dac_nids
,
12899 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12900 .channel_mode
= alc262_modes
,
12901 .input_mux
= &alc262_hp_rp5700_capture_source
,
12903 [ALC262_BENQ_ED8
] = {
12904 .mixers
= { alc262_base_mixer
},
12905 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
12906 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12907 .dac_nids
= alc262_dac_nids
,
12909 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12910 .channel_mode
= alc262_modes
,
12911 .input_mux
= &alc262_capture_source
,
12913 [ALC262_SONY_ASSAMD
] = {
12914 .mixers
= { alc262_sony_mixer
},
12915 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
12916 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12917 .dac_nids
= alc262_dac_nids
,
12919 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12920 .channel_mode
= alc262_modes
,
12921 .input_mux
= &alc262_capture_source
,
12922 .unsol_event
= alc_sku_unsol_event
,
12923 .setup
= alc262_hippo_setup
,
12924 .init_hook
= alc_inithook
,
12926 [ALC262_BENQ_T31
] = {
12927 .mixers
= { alc262_benq_t31_mixer
},
12928 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
,
12929 alc_hp15_unsol_verbs
},
12930 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12931 .dac_nids
= alc262_dac_nids
,
12933 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12934 .channel_mode
= alc262_modes
,
12935 .input_mux
= &alc262_capture_source
,
12936 .unsol_event
= alc_sku_unsol_event
,
12937 .setup
= alc262_hippo_setup
,
12938 .init_hook
= alc_inithook
,
12941 .mixers
= { alc262_ultra_mixer
},
12942 .cap_mixer
= alc262_ultra_capture_mixer
,
12943 .init_verbs
= { alc262_ultra_verbs
},
12944 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12945 .dac_nids
= alc262_dac_nids
,
12946 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12947 .channel_mode
= alc262_modes
,
12948 .input_mux
= &alc262_ultra_capture_source
,
12949 .adc_nids
= alc262_adc_nids
, /* ADC0 */
12950 .capsrc_nids
= alc262_capsrc_nids
,
12951 .num_adc_nids
= 1, /* single ADC */
12952 .unsol_event
= alc262_ultra_unsol_event
,
12953 .init_hook
= alc262_ultra_automute
,
12955 [ALC262_LENOVO_3000
] = {
12956 .mixers
= { alc262_lenovo_3000_mixer
},
12957 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12958 alc262_lenovo_3000_unsol_verbs
,
12959 alc262_lenovo_3000_init_verbs
},
12960 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12961 .dac_nids
= alc262_dac_nids
,
12963 .dig_out_nid
= ALC262_DIGOUT_NID
,
12964 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12965 .channel_mode
= alc262_modes
,
12966 .input_mux
= &alc262_fujitsu_capture_source
,
12967 .unsol_event
= alc_sku_unsol_event
,
12968 .setup
= alc262_lenovo_3000_setup
,
12969 .init_hook
= alc_inithook
,
12972 .mixers
= { alc262_nec_mixer
},
12973 .init_verbs
= { alc262_nec_verbs
},
12974 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12975 .dac_nids
= alc262_dac_nids
,
12977 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12978 .channel_mode
= alc262_modes
,
12979 .input_mux
= &alc262_capture_source
,
12981 [ALC262_TOSHIBA_S06
] = {
12982 .mixers
= { alc262_toshiba_s06_mixer
},
12983 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_s06_verbs
,
12984 alc262_eapd_verbs
},
12985 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12986 .capsrc_nids
= alc262_dmic_capsrc_nids
,
12987 .dac_nids
= alc262_dac_nids
,
12988 .adc_nids
= alc262_dmic_adc_nids
, /* ADC0 */
12989 .num_adc_nids
= 1, /* single ADC */
12990 .dig_out_nid
= ALC262_DIGOUT_NID
,
12991 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12992 .channel_mode
= alc262_modes
,
12993 .unsol_event
= alc_sku_unsol_event
,
12994 .setup
= alc262_toshiba_s06_setup
,
12995 .init_hook
= alc_inithook
,
12997 [ALC262_TOSHIBA_RX1
] = {
12998 .mixers
= { alc262_toshiba_rx1_mixer
},
12999 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_rx1_unsol_verbs
},
13000 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
13001 .dac_nids
= alc262_dac_nids
,
13003 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
13004 .channel_mode
= alc262_modes
,
13005 .input_mux
= &alc262_capture_source
,
13006 .unsol_event
= alc_sku_unsol_event
,
13007 .setup
= alc262_hippo_setup
,
13008 .init_hook
= alc_inithook
,
13011 .mixers
= { alc262_tyan_mixer
},
13012 .init_verbs
= { alc262_init_verbs
, alc262_tyan_verbs
},
13013 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
13014 .dac_nids
= alc262_dac_nids
,
13016 .dig_out_nid
= ALC262_DIGOUT_NID
,
13017 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
13018 .channel_mode
= alc262_modes
,
13019 .input_mux
= &alc262_capture_source
,
13020 .unsol_event
= alc_sku_unsol_event
,
13021 .setup
= alc262_tyan_setup
,
13022 .init_hook
= alc_hp_automute
,
13026 static int patch_alc262(struct hda_codec
*codec
)
13028 struct alc_spec
*spec
;
13032 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13036 codec
->spec
= spec
;
13038 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
13043 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
13044 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
13045 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
13046 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
13049 alc_auto_parse_customize_define(codec
);
13051 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
13053 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
13057 if (board_config
< 0) {
13058 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
13060 board_config
= ALC262_AUTO
;
13063 if (board_config
== ALC262_AUTO
) {
13064 alc_pick_fixup(codec
, NULL
, alc262_fixup_tbl
, alc262_fixups
);
13065 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
13068 if (board_config
== ALC262_AUTO
) {
13069 /* automatic parse from the BIOS config */
13070 err
= alc262_parse_auto_config(codec
);
13076 "hda_codec: Cannot set up configuration "
13077 "from BIOS. Using base mode...\n");
13078 board_config
= ALC262_BASIC
;
13082 if (!spec
->no_analog
&& has_cdefine_beep(codec
)) {
13083 err
= snd_hda_attach_beep_device(codec
, 0x1);
13090 if (board_config
!= ALC262_AUTO
)
13091 setup_preset(codec
, &alc262_presets
[board_config
]);
13093 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
13094 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
13096 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
13097 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
13099 if (!spec
->adc_nids
&& spec
->input_mux
) {
13101 /* check whether the digital-mic has to be supported */
13102 for (i
= 0; i
< spec
->input_mux
->num_items
; i
++) {
13103 if (spec
->input_mux
->items
[i
].index
>= 9)
13106 if (i
< spec
->input_mux
->num_items
) {
13107 /* use only ADC0 */
13108 spec
->adc_nids
= alc262_dmic_adc_nids
;
13109 spec
->num_adc_nids
= 1;
13110 spec
->capsrc_nids
= alc262_dmic_capsrc_nids
;
13112 /* all analog inputs */
13113 /* check whether NID 0x07 is valid */
13114 unsigned int wcap
= get_wcaps(codec
, 0x07);
13117 wcap
= get_wcaps_type(wcap
);
13118 if (wcap
!= AC_WID_AUD_IN
) {
13119 spec
->adc_nids
= alc262_adc_nids_alt
;
13120 spec
->num_adc_nids
=
13121 ARRAY_SIZE(alc262_adc_nids_alt
);
13122 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
13124 spec
->adc_nids
= alc262_adc_nids
;
13125 spec
->num_adc_nids
=
13126 ARRAY_SIZE(alc262_adc_nids
);
13127 spec
->capsrc_nids
= alc262_capsrc_nids
;
13131 if (!spec
->cap_mixer
&& !spec
->no_analog
)
13132 set_capture_mixer(codec
);
13133 if (!spec
->no_analog
&& has_cdefine_beep(codec
))
13134 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
13136 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
13138 spec
->vmaster_nid
= 0x0c;
13140 codec
->patch_ops
= alc_patch_ops
;
13141 if (board_config
== ALC262_AUTO
)
13142 spec
->init_hook
= alc262_auto_init
;
13143 spec
->shutup
= alc_eapd_shutup
;
13145 alc_init_jacks(codec
);
13146 #ifdef CONFIG_SND_HDA_POWER_SAVE
13147 if (!spec
->loopback
.amplist
)
13148 spec
->loopback
.amplist
= alc262_loopbacks
;
13155 * ALC268 channel source setting (2 channel)
13157 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13158 #define alc268_modes alc260_modes
13160 static const hda_nid_t alc268_dac_nids
[2] = {
13165 static const hda_nid_t alc268_adc_nids
[2] = {
13170 static const hda_nid_t alc268_adc_nids_alt
[1] = {
13175 static const hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
13177 static const struct snd_kcontrol_new alc268_base_mixer
[] = {
13178 /* output mixer control */
13179 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13180 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13181 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13182 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13183 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13184 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13185 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13189 static const struct snd_kcontrol_new alc268_toshiba_mixer
[] = {
13190 /* output mixer control */
13191 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13192 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13193 ALC262_HIPPO_MASTER_SWITCH
,
13194 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13195 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13196 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13200 /* bind Beep switches of both NID 0x0f and 0x10 */
13201 static const struct hda_bind_ctls alc268_bind_beep_sw
= {
13202 .ops
= &snd_hda_bind_sw
,
13204 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
13205 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
13210 static const struct snd_kcontrol_new alc268_beep_mixer
[] = {
13211 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
13212 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
13216 static const struct hda_verb alc268_eapd_verbs
[] = {
13217 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13218 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13222 /* Toshiba specific */
13223 static const struct hda_verb alc268_toshiba_verbs
[] = {
13224 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13228 /* Acer specific */
13229 /* bind volumes of both NID 0x02 and 0x03 */
13230 static const struct hda_bind_ctls alc268_acer_bind_master_vol
= {
13231 .ops
= &snd_hda_bind_vol
,
13233 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
13234 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
13239 static void alc268_acer_setup(struct hda_codec
*codec
)
13241 struct alc_spec
*spec
= codec
->spec
;
13243 spec
->autocfg
.hp_pins
[0] = 0x14;
13244 spec
->autocfg
.speaker_pins
[0] = 0x15;
13245 spec
->automute
= 1;
13246 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
13249 #define alc268_acer_master_sw_get alc262_hp_master_sw_get
13250 #define alc268_acer_master_sw_put alc262_hp_master_sw_put
13252 static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer
[] = {
13253 /* output mixer control */
13254 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13256 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13257 .name
= "Master Playback Switch",
13258 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x15,
13259 .info
= snd_ctl_boolean_mono_info
,
13260 .get
= alc268_acer_master_sw_get
,
13261 .put
= alc268_acer_master_sw_put
,
13263 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT
),
13267 static const struct snd_kcontrol_new alc268_acer_mixer
[] = {
13268 /* output mixer control */
13269 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13271 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13272 .name
= "Master Playback Switch",
13273 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x14,
13274 .info
= snd_ctl_boolean_mono_info
,
13275 .get
= alc268_acer_master_sw_get
,
13276 .put
= alc268_acer_master_sw_put
,
13278 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13279 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13280 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13284 static const struct snd_kcontrol_new alc268_acer_dmic_mixer
[] = {
13285 /* output mixer control */
13286 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13288 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13289 .name
= "Master Playback Switch",
13290 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x14,
13291 .info
= snd_ctl_boolean_mono_info
,
13292 .get
= alc268_acer_master_sw_get
,
13293 .put
= alc268_acer_master_sw_put
,
13295 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13296 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
13300 static const struct hda_verb alc268_acer_aspire_one_verbs
[] = {
13301 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13302 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13303 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13304 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13305 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x06},
13306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, 0xa017},
13310 static const struct hda_verb alc268_acer_verbs
[] = {
13311 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
13312 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13314 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13315 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13316 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13317 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13321 /* unsolicited event for HP jack sensing */
13322 #define alc268_toshiba_setup alc262_hippo_setup
13324 static void alc268_acer_lc_setup(struct hda_codec
*codec
)
13326 struct alc_spec
*spec
= codec
->spec
;
13327 spec
->autocfg
.hp_pins
[0] = 0x15;
13328 spec
->autocfg
.speaker_pins
[0] = 0x14;
13329 spec
->automute
= 1;
13330 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
13331 spec
->ext_mic
.pin
= 0x18;
13332 spec
->ext_mic
.mux_idx
= 0;
13333 spec
->int_mic
.pin
= 0x12;
13334 spec
->int_mic
.mux_idx
= 6;
13335 spec
->auto_mic
= 1;
13338 static const struct snd_kcontrol_new alc268_dell_mixer
[] = {
13339 /* output mixer control */
13340 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13341 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13342 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13343 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13344 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13345 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13349 static const struct hda_verb alc268_dell_verbs
[] = {
13350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13352 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13353 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
13357 /* mute/unmute internal speaker according to the hp jack and mute state */
13358 static void alc268_dell_setup(struct hda_codec
*codec
)
13360 struct alc_spec
*spec
= codec
->spec
;
13362 spec
->autocfg
.hp_pins
[0] = 0x15;
13363 spec
->autocfg
.speaker_pins
[0] = 0x14;
13364 spec
->ext_mic
.pin
= 0x18;
13365 spec
->ext_mic
.mux_idx
= 0;
13366 spec
->int_mic
.pin
= 0x19;
13367 spec
->int_mic
.mux_idx
= 1;
13368 spec
->auto_mic
= 1;
13369 spec
->automute
= 1;
13370 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
13373 static const struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
13374 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13375 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13376 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13377 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13378 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13379 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
13380 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13381 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13385 static const struct hda_verb alc267_quanta_il1_verbs
[] = {
13386 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13387 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
13391 static void alc267_quanta_il1_setup(struct hda_codec
*codec
)
13393 struct alc_spec
*spec
= codec
->spec
;
13394 spec
->autocfg
.hp_pins
[0] = 0x15;
13395 spec
->autocfg
.speaker_pins
[0] = 0x14;
13396 spec
->ext_mic
.pin
= 0x18;
13397 spec
->ext_mic
.mux_idx
= 0;
13398 spec
->int_mic
.pin
= 0x19;
13399 spec
->int_mic
.mux_idx
= 1;
13400 spec
->auto_mic
= 1;
13401 spec
->automute
= 1;
13402 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
13406 * generic initialization of ADC, input mixers and output mixers
13408 static const struct hda_verb alc268_base_init_verbs
[] = {
13409 /* Unmute DAC0-1 and set vol = 0 */
13410 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13411 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13414 * Set up output mixers (0x0c - 0x0e)
13416 /* set vol=0 to output mixers */
13417 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13418 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
13420 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13421 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13423 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
13424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
13425 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
13426 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13427 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13428 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13429 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13430 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13432 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13433 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13434 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13435 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13436 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13438 /* set PCBEEP vol = 0, mute connections */
13439 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13440 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13441 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13443 /* Unmute Selector 23h,24h and set the default input to mic-in */
13445 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
13446 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13447 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
13448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13454 * generic initialization of ADC, input mixers and output mixers
13456 static const struct hda_verb alc268_volume_init_verbs
[] = {
13457 /* set output DAC */
13458 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13459 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13461 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13462 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13463 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13464 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13465 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13468 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13469 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13471 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13472 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13474 /* set PCBEEP vol = 0, mute connections */
13475 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13476 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13477 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13482 static const struct snd_kcontrol_new alc268_capture_nosrc_mixer
[] = {
13483 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13484 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13488 static const struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
13489 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13490 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13495 static const struct snd_kcontrol_new alc268_capture_mixer
[] = {
13496 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13497 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13498 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
13499 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
13504 static const struct hda_input_mux alc268_capture_source
= {
13508 { "Front Mic", 0x1 },
13514 static const struct hda_input_mux alc268_acer_capture_source
= {
13518 { "Internal Mic", 0x1 },
13523 static const struct hda_input_mux alc268_acer_dmic_capture_source
= {
13527 { "Internal Mic", 0x6 },
13532 #ifdef CONFIG_SND_DEBUG
13533 static const struct snd_kcontrol_new alc268_test_mixer
[] = {
13534 /* Volume widgets */
13535 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13536 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13537 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
13538 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
13539 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
13540 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
13541 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
13542 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
13543 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
13544 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
13545 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
13546 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
13547 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
13548 /* The below appears problematic on some hardwares */
13549 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13550 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13551 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
13552 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
13553 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
13555 /* Modes for retasking pin widgets */
13556 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
13557 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
13558 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
13559 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
13561 /* Controls for GPIO pins, assuming they are configured as outputs */
13562 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13563 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13564 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13565 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13567 /* Switches to allow the digital SPDIF output pin to be enabled.
13568 * The ALC268 does not have an SPDIF input.
13570 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13572 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13573 * this output to turn on an external amplifier.
13575 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13576 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13582 /* create input playback/capture controls for the given pin */
13583 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
13584 const char *ctlname
, int idx
)
13595 case 0x1a: /* ALC259/269 only */
13596 case 0x1b: /* ALC259/269 only */
13597 case 0x21: /* ALC269vb has this pin, too */
13601 snd_printd(KERN_WARNING
"hda_codec: "
13602 "ignoring pin 0x%x as unknown\n", nid
);
13605 if (spec
->multiout
.dac_nids
[0] != dac
&&
13606 spec
->multiout
.dac_nids
[1] != dac
) {
13607 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
13608 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
13612 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
13616 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13617 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
13619 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13620 HDA_COMPOSE_AMP_VAL(nid
, 2, idx
, HDA_OUTPUT
));
13626 /* add playback controls from the parsed DAC table */
13627 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13628 const struct auto_pin_cfg
*cfg
)
13633 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
13635 nid
= cfg
->line_out_pins
[0];
13638 if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
13642 err
= alc268_new_analog_output(spec
, nid
, name
, 0);
13647 nid
= cfg
->speaker_pins
[0];
13649 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, "Speaker",
13650 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
13654 err
= alc268_new_analog_output(spec
, nid
, "Speaker", 0);
13658 nid
= cfg
->hp_pins
[0];
13660 err
= alc268_new_analog_output(spec
, nid
, "Headphone", 0);
13665 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
13667 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, "Mono",
13668 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
));
13675 /* create playback/capture controls for input pins */
13676 static int alc268_auto_create_input_ctls(struct hda_codec
*codec
,
13677 const struct auto_pin_cfg
*cfg
)
13679 return alc_auto_create_input_ctls(codec
, cfg
, 0, 0x23, 0x24);
13682 static void alc268_auto_set_output_and_unmute(struct hda_codec
*codec
,
13683 hda_nid_t nid
, int pin_type
)
13687 alc_set_pin_output(codec
, nid
, pin_type
);
13688 if (nid
== 0x14 || nid
== 0x16)
13692 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
13695 static void alc268_auto_init_multi_out(struct hda_codec
*codec
)
13697 struct alc_spec
*spec
= codec
->spec
;
13700 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
13701 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13702 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13703 alc268_auto_set_output_and_unmute(codec
, nid
, pin_type
);
13707 static void alc268_auto_init_hp_out(struct hda_codec
*codec
)
13709 struct alc_spec
*spec
= codec
->spec
;
13713 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
13714 pin
= spec
->autocfg
.hp_pins
[i
];
13715 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
13717 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
13718 pin
= spec
->autocfg
.speaker_pins
[i
];
13719 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
13721 if (spec
->autocfg
.mono_out_pin
)
13722 snd_hda_codec_write(codec
, spec
->autocfg
.mono_out_pin
, 0,
13723 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13726 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
13728 struct alc_spec
*spec
= codec
->spec
;
13729 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
13730 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
13731 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
13732 unsigned int dac_vol1
, dac_vol2
;
13734 if (line_nid
== 0x1d || speaker_nid
== 0x1d) {
13735 snd_hda_codec_write(codec
, speaker_nid
, 0,
13736 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13737 /* mute mixer inputs from 0x1d */
13738 snd_hda_codec_write(codec
, 0x0f, 0,
13739 AC_VERB_SET_AMP_GAIN_MUTE
,
13741 snd_hda_codec_write(codec
, 0x10, 0,
13742 AC_VERB_SET_AMP_GAIN_MUTE
,
13745 /* unmute mixer inputs from 0x1d */
13746 snd_hda_codec_write(codec
, 0x0f, 0,
13747 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13748 snd_hda_codec_write(codec
, 0x10, 0,
13749 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13752 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
13753 if (line_nid
== 0x14)
13754 dac_vol2
= AMP_OUT_ZERO
;
13755 else if (line_nid
== 0x15)
13756 dac_vol1
= AMP_OUT_ZERO
;
13757 if (hp_nid
== 0x14)
13758 dac_vol2
= AMP_OUT_ZERO
;
13759 else if (hp_nid
== 0x15)
13760 dac_vol1
= AMP_OUT_ZERO
;
13761 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
13762 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
13763 spec
->autocfg
.line_out_pins
[2] != 0x16)
13764 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
13766 snd_hda_codec_write(codec
, 0x02, 0,
13767 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
13768 snd_hda_codec_write(codec
, 0x03, 0,
13769 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
13772 /* pcm configuration: identical with ALC880 */
13773 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13774 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13775 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13776 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13779 * BIOS auto configuration
13781 static int alc268_parse_auto_config(struct hda_codec
*codec
)
13783 struct alc_spec
*spec
= codec
->spec
;
13785 static const hda_nid_t alc268_ignore
[] = { 0 };
13787 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13791 if (!spec
->autocfg
.line_outs
) {
13792 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
13793 spec
->multiout
.max_channels
= 2;
13794 spec
->no_analog
= 1;
13797 return 0; /* can't find valid BIOS pin config */
13799 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13802 err
= alc268_auto_create_input_ctls(codec
, &spec
->autocfg
);
13806 spec
->multiout
.max_channels
= 2;
13809 /* digital only support output */
13810 alc_auto_parse_digital(codec
);
13811 if (spec
->kctls
.list
)
13812 add_mixer(spec
, spec
->kctls
.list
);
13814 if (!spec
->no_analog
&& spec
->autocfg
.speaker_pins
[0] != 0x1d)
13815 add_mixer(spec
, alc268_beep_mixer
);
13817 add_verb(spec
, alc268_volume_init_verbs
);
13818 spec
->num_mux_defs
= 2;
13819 spec
->input_mux
= &spec
->private_imux
[0];
13821 err
= alc_auto_add_mic_boost(codec
);
13825 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
13830 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13831 #define alc268_auto_init_input_src alc882_auto_init_input_src
13833 /* init callback for auto-configuration model -- overriding the default init */
13834 static void alc268_auto_init(struct hda_codec
*codec
)
13836 struct alc_spec
*spec
= codec
->spec
;
13837 alc268_auto_init_multi_out(codec
);
13838 alc268_auto_init_hp_out(codec
);
13839 alc268_auto_init_mono_speaker_out(codec
);
13840 alc268_auto_init_analog_input(codec
);
13841 alc268_auto_init_input_src(codec
);
13842 alc_auto_init_digital(codec
);
13843 if (spec
->unsol_event
)
13844 alc_inithook(codec
);
13848 * configuration and preset
13850 static const char * const alc268_models
[ALC268_MODEL_LAST
] = {
13851 [ALC267_QUANTA_IL1
] = "quanta-il1",
13852 [ALC268_3ST
] = "3stack",
13853 [ALC268_TOSHIBA
] = "toshiba",
13854 [ALC268_ACER
] = "acer",
13855 [ALC268_ACER_DMIC
] = "acer-dmic",
13856 [ALC268_ACER_ASPIRE_ONE
] = "acer-aspire",
13857 [ALC268_DELL
] = "dell",
13858 [ALC268_ZEPTO
] = "zepto",
13859 #ifdef CONFIG_SND_DEBUG
13860 [ALC268_TEST
] = "test",
13862 [ALC268_AUTO
] = "auto",
13865 static const struct snd_pci_quirk alc268_cfg_tbl
[] = {
13866 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
13867 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
13868 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
13869 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
13870 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
13871 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13872 ALC268_ACER_ASPIRE_ONE
),
13873 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
13874 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO
),
13875 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13876 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL
),
13877 /* almost compatible with toshiba but with optional digital outs;
13878 * auto-probing seems working fine
13880 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13882 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
13883 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
13884 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
13885 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
13889 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13890 static const struct snd_pci_quirk alc268_ssid_cfg_tbl
[] = {
13891 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO
),
13892 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO
),
13893 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13898 static const struct alc_config_preset alc268_presets
[] = {
13899 [ALC267_QUANTA_IL1
] = {
13900 .mixers
= { alc267_quanta_il1_mixer
, alc268_beep_mixer
,
13901 alc268_capture_nosrc_mixer
},
13902 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13903 alc267_quanta_il1_verbs
},
13904 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13905 .dac_nids
= alc268_dac_nids
,
13906 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13907 .adc_nids
= alc268_adc_nids_alt
,
13909 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13910 .channel_mode
= alc268_modes
,
13911 .unsol_event
= alc_sku_unsol_event
,
13912 .setup
= alc267_quanta_il1_setup
,
13913 .init_hook
= alc_inithook
,
13916 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
13917 alc268_beep_mixer
},
13918 .init_verbs
= { alc268_base_init_verbs
},
13919 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13920 .dac_nids
= alc268_dac_nids
,
13921 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13922 .adc_nids
= alc268_adc_nids_alt
,
13923 .capsrc_nids
= alc268_capsrc_nids
,
13925 .dig_out_nid
= ALC268_DIGOUT_NID
,
13926 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13927 .channel_mode
= alc268_modes
,
13928 .input_mux
= &alc268_capture_source
,
13930 [ALC268_TOSHIBA
] = {
13931 .mixers
= { alc268_toshiba_mixer
, alc268_capture_alt_mixer
,
13932 alc268_beep_mixer
},
13933 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13934 alc268_toshiba_verbs
},
13935 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13936 .dac_nids
= alc268_dac_nids
,
13937 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13938 .adc_nids
= alc268_adc_nids_alt
,
13939 .capsrc_nids
= alc268_capsrc_nids
,
13941 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13942 .channel_mode
= alc268_modes
,
13943 .input_mux
= &alc268_capture_source
,
13944 .unsol_event
= alc_sku_unsol_event
,
13945 .setup
= alc268_toshiba_setup
,
13946 .init_hook
= alc_inithook
,
13949 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
13950 alc268_beep_mixer
},
13951 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13952 alc268_acer_verbs
},
13953 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13954 .dac_nids
= alc268_dac_nids
,
13955 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13956 .adc_nids
= alc268_adc_nids_alt
,
13957 .capsrc_nids
= alc268_capsrc_nids
,
13959 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13960 .channel_mode
= alc268_modes
,
13961 .input_mux
= &alc268_acer_capture_source
,
13962 .unsol_event
= alc_sku_unsol_event
,
13963 .setup
= alc268_acer_setup
,
13964 .init_hook
= alc_inithook
,
13966 [ALC268_ACER_DMIC
] = {
13967 .mixers
= { alc268_acer_dmic_mixer
, alc268_capture_alt_mixer
,
13968 alc268_beep_mixer
},
13969 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13970 alc268_acer_verbs
},
13971 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13972 .dac_nids
= alc268_dac_nids
,
13973 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13974 .adc_nids
= alc268_adc_nids_alt
,
13975 .capsrc_nids
= alc268_capsrc_nids
,
13977 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13978 .channel_mode
= alc268_modes
,
13979 .input_mux
= &alc268_acer_dmic_capture_source
,
13980 .unsol_event
= alc_sku_unsol_event
,
13981 .setup
= alc268_acer_setup
,
13982 .init_hook
= alc_inithook
,
13984 [ALC268_ACER_ASPIRE_ONE
] = {
13985 .mixers
= { alc268_acer_aspire_one_mixer
,
13987 alc268_capture_nosrc_mixer
},
13988 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13989 alc268_acer_aspire_one_verbs
},
13990 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13991 .dac_nids
= alc268_dac_nids
,
13992 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13993 .adc_nids
= alc268_adc_nids_alt
,
13994 .capsrc_nids
= alc268_capsrc_nids
,
13996 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13997 .channel_mode
= alc268_modes
,
13998 .unsol_event
= alc_sku_unsol_event
,
13999 .setup
= alc268_acer_lc_setup
,
14000 .init_hook
= alc_inithook
,
14003 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
,
14004 alc268_capture_nosrc_mixer
},
14005 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
14006 alc268_dell_verbs
},
14007 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
14008 .dac_nids
= alc268_dac_nids
,
14009 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
14010 .adc_nids
= alc268_adc_nids_alt
,
14011 .capsrc_nids
= alc268_capsrc_nids
,
14013 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
14014 .channel_mode
= alc268_modes
,
14015 .unsol_event
= alc_sku_unsol_event
,
14016 .setup
= alc268_dell_setup
,
14017 .init_hook
= alc_inithook
,
14020 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
14021 alc268_beep_mixer
},
14022 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
14023 alc268_toshiba_verbs
},
14024 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
14025 .dac_nids
= alc268_dac_nids
,
14026 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
14027 .adc_nids
= alc268_adc_nids_alt
,
14028 .capsrc_nids
= alc268_capsrc_nids
,
14030 .dig_out_nid
= ALC268_DIGOUT_NID
,
14031 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
14032 .channel_mode
= alc268_modes
,
14033 .input_mux
= &alc268_capture_source
,
14034 .unsol_event
= alc_sku_unsol_event
,
14035 .setup
= alc268_toshiba_setup
,
14036 .init_hook
= alc_inithook
,
14038 #ifdef CONFIG_SND_DEBUG
14040 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
14041 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
14042 alc268_volume_init_verbs
},
14043 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
14044 .dac_nids
= alc268_dac_nids
,
14045 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
14046 .adc_nids
= alc268_adc_nids_alt
,
14047 .capsrc_nids
= alc268_capsrc_nids
,
14049 .dig_out_nid
= ALC268_DIGOUT_NID
,
14050 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
14051 .channel_mode
= alc268_modes
,
14052 .input_mux
= &alc268_capture_source
,
14057 static int patch_alc268(struct hda_codec
*codec
)
14059 struct alc_spec
*spec
;
14061 int i
, has_beep
, err
;
14063 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14067 codec
->spec
= spec
;
14069 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
14073 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
)
14074 board_config
= snd_hda_check_board_codec_sid_config(codec
,
14075 ALC268_MODEL_LAST
, alc268_models
, alc268_ssid_cfg_tbl
);
14077 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
14078 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
14080 board_config
= ALC268_AUTO
;
14083 if (board_config
== ALC268_AUTO
) {
14084 /* automatic parse from the BIOS config */
14085 err
= alc268_parse_auto_config(codec
);
14091 "hda_codec: Cannot set up configuration "
14092 "from BIOS. Using base mode...\n");
14093 board_config
= ALC268_3ST
;
14097 if (board_config
!= ALC268_AUTO
)
14098 setup_preset(codec
, &alc268_presets
[board_config
]);
14100 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
14101 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
14102 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
14104 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
14107 for (i
= 0; i
< spec
->num_mixers
; i
++) {
14108 if (spec
->mixers
[i
] == alc268_beep_mixer
) {
14115 err
= snd_hda_attach_beep_device(codec
, 0x1);
14120 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
14121 /* override the amp caps for beep generator */
14122 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
14123 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
14124 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
14125 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
14126 (0 << AC_AMPCAP_MUTE_SHIFT
));
14129 if (!spec
->no_analog
&& !spec
->adc_nids
&& spec
->input_mux
) {
14130 /* check whether NID 0x07 is valid */
14131 unsigned int wcap
= get_wcaps(codec
, 0x07);
14133 spec
->capsrc_nids
= alc268_capsrc_nids
;
14135 wcap
= get_wcaps_type(wcap
);
14136 if (spec
->auto_mic
||
14137 wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
14138 spec
->adc_nids
= alc268_adc_nids_alt
;
14139 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
14140 if (spec
->auto_mic
)
14141 fixup_automic_adc(codec
);
14142 if (spec
->auto_mic
|| spec
->input_mux
->num_items
== 1)
14143 add_mixer(spec
, alc268_capture_nosrc_mixer
);
14145 add_mixer(spec
, alc268_capture_alt_mixer
);
14147 spec
->adc_nids
= alc268_adc_nids
;
14148 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
14149 add_mixer(spec
, alc268_capture_mixer
);
14153 spec
->vmaster_nid
= 0x02;
14155 codec
->patch_ops
= alc_patch_ops
;
14156 if (board_config
== ALC268_AUTO
)
14157 spec
->init_hook
= alc268_auto_init
;
14158 spec
->shutup
= alc_eapd_shutup
;
14160 alc_init_jacks(codec
);
14166 * ALC269 channel source setting (2 channel)
14168 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14170 #define alc269_dac_nids alc260_dac_nids
14172 static const hda_nid_t alc269_adc_nids
[1] = {
14177 static const hda_nid_t alc269_capsrc_nids
[1] = {
14181 static const hda_nid_t alc269vb_adc_nids
[1] = {
14186 static const hda_nid_t alc269vb_capsrc_nids
[1] = {
14190 static const hda_nid_t alc269_adc_candidates
[] = {
14191 0x08, 0x09, 0x07, 0x11,
14194 #define alc269_modes alc260_modes
14195 #define alc269_capture_source alc880_lg_lw_capture_source
14197 static const struct snd_kcontrol_new alc269_base_mixer
[] = {
14198 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14199 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14200 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14201 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14204 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14205 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14206 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14207 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14208 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14209 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
14213 static const struct snd_kcontrol_new alc269_quanta_fl1_mixer
[] = {
14214 /* output mixer control */
14215 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
14217 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14218 .name
= "Master Playback Switch",
14219 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
14220 .info
= snd_hda_mixer_amp_switch_info
,
14221 .get
= snd_hda_mixer_amp_switch_get
,
14222 .put
= alc268_acer_master_sw_put
,
14223 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14226 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14227 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14228 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14229 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14230 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14234 static const struct snd_kcontrol_new alc269_lifebook_mixer
[] = {
14235 /* output mixer control */
14236 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
14238 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14239 .name
= "Master Playback Switch",
14240 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
14241 .info
= snd_hda_mixer_amp_switch_info
,
14242 .get
= snd_hda_mixer_amp_switch_get
,
14243 .put
= alc268_acer_master_sw_put
,
14244 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14248 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14249 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
14250 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
14251 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14252 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT
),
14253 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT
),
14254 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT
),
14258 static const struct snd_kcontrol_new alc269_laptop_mixer
[] = {
14259 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14260 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14261 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14262 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14266 static const struct snd_kcontrol_new alc269vb_laptop_mixer
[] = {
14267 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14268 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14269 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
14270 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14274 static const struct snd_kcontrol_new alc269_asus_mixer
[] = {
14275 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14276 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT
),
14280 /* capture mixer elements */
14281 static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer
[] = {
14282 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
14283 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
14284 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14285 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14289 static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer
[] = {
14290 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
14291 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
14292 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14296 static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer
[] = {
14297 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
14298 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
14299 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14300 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
14304 static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer
[] = {
14305 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
14306 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
14307 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
14312 #define alc269_fujitsu_mixer alc269_laptop_mixer
14314 static const struct hda_verb alc269_quanta_fl1_verbs
[] = {
14315 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14316 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14318 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14319 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14320 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14324 static const struct hda_verb alc269_lifebook_verbs
[] = {
14325 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14326 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
14327 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14329 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14330 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14331 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14332 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
14333 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14334 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14338 /* toggle speaker-output according to the hp-jack state */
14339 static void alc269_quanta_fl1_speaker_automute(struct hda_codec
*codec
)
14341 alc_hp_automute(codec
);
14343 snd_hda_codec_write(codec
, 0x20, 0,
14344 AC_VERB_SET_COEF_INDEX
, 0x0c);
14345 snd_hda_codec_write(codec
, 0x20, 0,
14346 AC_VERB_SET_PROC_COEF
, 0x680);
14348 snd_hda_codec_write(codec
, 0x20, 0,
14349 AC_VERB_SET_COEF_INDEX
, 0x0c);
14350 snd_hda_codec_write(codec
, 0x20, 0,
14351 AC_VERB_SET_PROC_COEF
, 0x480);
14354 #define alc269_lifebook_speaker_automute \
14355 alc269_quanta_fl1_speaker_automute
14357 static void alc269_lifebook_mic_autoswitch(struct hda_codec
*codec
)
14359 unsigned int present_laptop
;
14360 unsigned int present_dock
;
14362 present_laptop
= snd_hda_jack_detect(codec
, 0x18);
14363 present_dock
= snd_hda_jack_detect(codec
, 0x1b);
14365 /* Laptop mic port overrides dock mic port, design decision */
14367 snd_hda_codec_write(codec
, 0x23, 0,
14368 AC_VERB_SET_CONNECT_SEL
, 0x3);
14369 if (present_laptop
)
14370 snd_hda_codec_write(codec
, 0x23, 0,
14371 AC_VERB_SET_CONNECT_SEL
, 0x0);
14372 if (!present_dock
&& !present_laptop
)
14373 snd_hda_codec_write(codec
, 0x23, 0,
14374 AC_VERB_SET_CONNECT_SEL
, 0x1);
14377 static void alc269_quanta_fl1_unsol_event(struct hda_codec
*codec
,
14380 switch (res
>> 26) {
14381 case ALC880_HP_EVENT
:
14382 alc269_quanta_fl1_speaker_automute(codec
);
14384 case ALC880_MIC_EVENT
:
14385 alc_mic_automute(codec
);
14390 static void alc269_lifebook_unsol_event(struct hda_codec
*codec
,
14393 if ((res
>> 26) == ALC880_HP_EVENT
)
14394 alc269_lifebook_speaker_automute(codec
);
14395 if ((res
>> 26) == ALC880_MIC_EVENT
)
14396 alc269_lifebook_mic_autoswitch(codec
);
14399 static void alc269_quanta_fl1_setup(struct hda_codec
*codec
)
14401 struct alc_spec
*spec
= codec
->spec
;
14402 spec
->autocfg
.hp_pins
[0] = 0x15;
14403 spec
->autocfg
.speaker_pins
[0] = 0x14;
14404 spec
->automute_mixer_nid
[0] = 0x0c;
14405 spec
->automute
= 1;
14406 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14407 spec
->ext_mic
.pin
= 0x18;
14408 spec
->ext_mic
.mux_idx
= 0;
14409 spec
->int_mic
.pin
= 0x19;
14410 spec
->int_mic
.mux_idx
= 1;
14411 spec
->auto_mic
= 1;
14414 static void alc269_quanta_fl1_init_hook(struct hda_codec
*codec
)
14416 alc269_quanta_fl1_speaker_automute(codec
);
14417 alc_mic_automute(codec
);
14420 static void alc269_lifebook_setup(struct hda_codec
*codec
)
14422 struct alc_spec
*spec
= codec
->spec
;
14423 spec
->autocfg
.hp_pins
[0] = 0x15;
14424 spec
->autocfg
.hp_pins
[1] = 0x1a;
14425 spec
->autocfg
.speaker_pins
[0] = 0x14;
14426 spec
->automute_mixer_nid
[0] = 0x0c;
14427 spec
->automute
= 1;
14428 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14431 static void alc269_lifebook_init_hook(struct hda_codec
*codec
)
14433 alc269_lifebook_speaker_automute(codec
);
14434 alc269_lifebook_mic_autoswitch(codec
);
14437 static const struct hda_verb alc269_laptop_dmic_init_verbs
[] = {
14438 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14439 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
14440 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14441 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14442 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
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 alc269_laptop_amic_init_verbs
[] = {
14449 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14450 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
14451 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14452 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
14453 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14454 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14458 static const struct hda_verb alc269vb_laptop_dmic_init_verbs
[] = {
14459 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
14460 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x06},
14461 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14462 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14463 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14464 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14465 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14469 static const struct hda_verb alc269vb_laptop_amic_init_verbs
[] = {
14470 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
14471 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x01},
14472 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14473 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14474 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14475 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14476 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14480 static const struct hda_verb alc271_acer_dmic_verbs
[] = {
14481 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0d},
14482 {0x20, AC_VERB_SET_PROC_COEF
, 0x4000},
14483 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14485 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14486 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14487 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00},
14488 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14489 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14490 {0x22, AC_VERB_SET_CONNECT_SEL
, 6},
14494 static void alc269_laptop_amic_setup(struct hda_codec
*codec
)
14496 struct alc_spec
*spec
= codec
->spec
;
14497 spec
->autocfg
.hp_pins
[0] = 0x15;
14498 spec
->autocfg
.speaker_pins
[0] = 0x14;
14499 spec
->automute_mixer_nid
[0] = 0x0c;
14500 spec
->automute
= 1;
14501 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14502 spec
->ext_mic
.pin
= 0x18;
14503 spec
->ext_mic
.mux_idx
= 0;
14504 spec
->int_mic
.pin
= 0x19;
14505 spec
->int_mic
.mux_idx
= 1;
14506 spec
->auto_mic
= 1;
14509 static void alc269_laptop_dmic_setup(struct hda_codec
*codec
)
14511 struct alc_spec
*spec
= codec
->spec
;
14512 spec
->autocfg
.hp_pins
[0] = 0x15;
14513 spec
->autocfg
.speaker_pins
[0] = 0x14;
14514 spec
->automute_mixer_nid
[0] = 0x0c;
14515 spec
->automute
= 1;
14516 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14517 spec
->ext_mic
.pin
= 0x18;
14518 spec
->ext_mic
.mux_idx
= 0;
14519 spec
->int_mic
.pin
= 0x12;
14520 spec
->int_mic
.mux_idx
= 5;
14521 spec
->auto_mic
= 1;
14524 static void alc269vb_laptop_amic_setup(struct hda_codec
*codec
)
14526 struct alc_spec
*spec
= codec
->spec
;
14527 spec
->autocfg
.hp_pins
[0] = 0x21;
14528 spec
->autocfg
.speaker_pins
[0] = 0x14;
14529 spec
->automute_mixer_nid
[0] = 0x0c;
14530 spec
->automute
= 1;
14531 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14532 spec
->ext_mic
.pin
= 0x18;
14533 spec
->ext_mic
.mux_idx
= 0;
14534 spec
->int_mic
.pin
= 0x19;
14535 spec
->int_mic
.mux_idx
= 1;
14536 spec
->auto_mic
= 1;
14539 static void alc269vb_laptop_dmic_setup(struct hda_codec
*codec
)
14541 struct alc_spec
*spec
= codec
->spec
;
14542 spec
->autocfg
.hp_pins
[0] = 0x21;
14543 spec
->autocfg
.speaker_pins
[0] = 0x14;
14544 spec
->automute_mixer_nid
[0] = 0x0c;
14545 spec
->automute
= 1;
14546 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14547 spec
->ext_mic
.pin
= 0x18;
14548 spec
->ext_mic
.mux_idx
= 0;
14549 spec
->int_mic
.pin
= 0x12;
14550 spec
->int_mic
.mux_idx
= 6;
14551 spec
->auto_mic
= 1;
14555 * generic initialization of ADC, input mixers and output mixers
14557 static const struct hda_verb alc269_init_verbs
[] = {
14559 * Unmute ADC0 and set the default input to mic-in
14561 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14564 * Set up output mixers (0x02 - 0x03)
14566 /* set vol=0 to output mixers */
14567 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14568 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14570 /* set up input amps for analog loopback */
14571 /* Amp Indices: DAC = 0, mixer = 1 */
14572 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14573 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14574 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14575 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14576 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14577 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14580 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14581 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14582 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14583 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14584 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14585 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14587 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14588 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14590 /* FIXME: use Mux-type input source selection */
14591 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14592 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14593 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
14596 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14600 static const struct hda_verb alc269vb_init_verbs
[] = {
14602 * Unmute ADC0 and set the default input to mic-in
14604 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14607 * Set up output mixers (0x02 - 0x03)
14609 /* set vol=0 to output mixers */
14610 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14611 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14613 /* set up input amps for analog loopback */
14614 /* Amp Indices: DAC = 0, mixer = 1 */
14615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14617 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14618 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14619 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14620 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14622 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14623 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14624 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14625 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14626 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14627 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14628 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14630 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14631 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14633 /* FIXME: use Mux-type input source selection */
14634 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14635 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14636 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x00},
14639 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14643 #define alc269_auto_create_multi_out_ctls \
14644 alc268_auto_create_multi_out_ctls
14645 #define alc269_auto_create_input_ctls \
14646 alc268_auto_create_input_ctls
14648 #ifdef CONFIG_SND_HDA_POWER_SAVE
14649 #define alc269_loopbacks alc880_loopbacks
14652 /* pcm configuration: identical with ALC880 */
14653 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14654 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14655 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14656 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14658 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback
= {
14662 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14663 /* NID is set in alc_build_pcms */
14665 .open
= alc880_playback_pcm_open
,
14666 .prepare
= alc880_playback_pcm_prepare
,
14667 .cleanup
= alc880_playback_pcm_cleanup
14671 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture
= {
14675 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14676 /* NID is set in alc_build_pcms */
14679 #ifdef CONFIG_SND_HDA_POWER_SAVE
14680 static int alc269_mic2_for_mute_led(struct hda_codec
*codec
)
14682 switch (codec
->subsystem_id
) {
14689 static int alc269_mic2_mute_check_ps(struct hda_codec
*codec
, hda_nid_t nid
)
14691 /* update mute-LED according to the speaker mute state */
14692 if (nid
== 0x01 || nid
== 0x14) {
14694 if (snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0) &
14699 /* mic2 vref pin is used for mute LED control */
14700 snd_hda_codec_update_cache(codec
, 0x19, 0,
14701 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14704 return alc_check_power_status(codec
, nid
);
14706 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14708 static int alc275_setup_dual_adc(struct hda_codec
*codec
)
14710 struct alc_spec
*spec
= codec
->spec
;
14712 if (codec
->vendor_id
!= 0x10ec0275 || !spec
->auto_mic
)
14714 if ((spec
->ext_mic
.pin
>= 0x18 && spec
->int_mic
.pin
<= 0x13) ||
14715 (spec
->ext_mic
.pin
<= 0x12 && spec
->int_mic
.pin
>= 0x18)) {
14716 if (spec
->ext_mic
.pin
<= 0x12) {
14717 spec
->private_adc_nids
[0] = 0x08;
14718 spec
->private_adc_nids
[1] = 0x11;
14719 spec
->private_capsrc_nids
[0] = 0x23;
14720 spec
->private_capsrc_nids
[1] = 0x22;
14722 spec
->private_adc_nids
[0] = 0x11;
14723 spec
->private_adc_nids
[1] = 0x08;
14724 spec
->private_capsrc_nids
[0] = 0x22;
14725 spec
->private_capsrc_nids
[1] = 0x23;
14727 spec
->adc_nids
= spec
->private_adc_nids
;
14728 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
14729 spec
->num_adc_nids
= 2;
14730 spec
->dual_adc_switch
= 1;
14731 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14732 spec
->adc_nids
[0], spec
->adc_nids
[1]);
14738 /* different alc269-variants */
14740 ALC269_TYPE_NORMAL
,
14741 ALC269_TYPE_ALC258
,
14742 ALC269_TYPE_ALC259
,
14743 ALC269_TYPE_ALC269VB
,
14744 ALC269_TYPE_ALC270
,
14745 ALC269_TYPE_ALC271X
,
14749 * BIOS auto configuration
14751 static int alc269_parse_auto_config(struct hda_codec
*codec
)
14753 struct alc_spec
*spec
= codec
->spec
;
14755 static const hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
14757 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14762 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14765 if (spec
->codec_variant
== ALC269_TYPE_NORMAL
)
14766 err
= alc269_auto_create_input_ctls(codec
, &spec
->autocfg
);
14768 err
= alc_auto_create_input_ctls(codec
, &spec
->autocfg
, 0,
14773 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14775 alc_auto_parse_digital(codec
);
14777 if (spec
->kctls
.list
)
14778 add_mixer(spec
, spec
->kctls
.list
);
14780 if (spec
->codec_variant
!= ALC269_TYPE_NORMAL
) {
14781 add_verb(spec
, alc269vb_init_verbs
);
14782 alc_ssid_check(codec
, 0, 0x1b, 0x14, 0x21);
14784 add_verb(spec
, alc269_init_verbs
);
14785 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
14788 spec
->num_mux_defs
= 1;
14789 spec
->input_mux
= &spec
->private_imux
[0];
14791 if (!alc275_setup_dual_adc(codec
))
14792 fillup_priv_adc_nids(codec
, alc269_adc_candidates
,
14793 sizeof(alc269_adc_candidates
));
14795 err
= alc_auto_add_mic_boost(codec
);
14799 if (!spec
->cap_mixer
&& !spec
->no_analog
)
14800 set_capture_mixer(codec
);
14805 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14806 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14807 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14808 #define alc269_auto_init_input_src alc882_auto_init_input_src
14811 /* init callback for auto-configuration model -- overriding the default init */
14812 static void alc269_auto_init(struct hda_codec
*codec
)
14814 struct alc_spec
*spec
= codec
->spec
;
14815 alc269_auto_init_multi_out(codec
);
14816 alc269_auto_init_hp_out(codec
);
14817 alc269_auto_init_analog_input(codec
);
14818 if (!spec
->dual_adc_switch
)
14819 alc269_auto_init_input_src(codec
);
14820 alc_auto_init_digital(codec
);
14821 if (spec
->unsol_event
)
14822 alc_inithook(codec
);
14825 static void alc269_toggle_power_output(struct hda_codec
*codec
, int power_up
)
14827 int val
= alc_read_coef_idx(codec
, 0x04);
14832 alc_write_coef_idx(codec
, 0x04, val
);
14835 static void alc269_shutup(struct hda_codec
*codec
)
14837 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017)
14838 alc269_toggle_power_output(codec
, 0);
14839 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14840 alc269_toggle_power_output(codec
, 0);
14845 #ifdef SND_HDA_NEEDS_RESUME
14846 static int alc269_resume(struct hda_codec
*codec
)
14848 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14849 alc269_toggle_power_output(codec
, 0);
14853 codec
->patch_ops
.init(codec
);
14855 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017) {
14856 alc269_toggle_power_output(codec
, 1);
14860 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018)
14861 alc269_toggle_power_output(codec
, 1);
14863 snd_hda_codec_resume_amp(codec
);
14864 snd_hda_codec_resume_cache(codec
);
14865 hda_call_check_power_status(codec
, 0x01);
14868 #endif /* SND_HDA_NEEDS_RESUME */
14870 static void alc269_fixup_hweq(struct hda_codec
*codec
,
14871 const struct alc_fixup
*fix
, int action
)
14875 if (action
!= ALC_FIXUP_ACT_INIT
)
14877 coef
= alc_read_coef_idx(codec
, 0x1e);
14878 alc_write_coef_idx(codec
, 0x1e, coef
| 0x80);
14881 static void alc271_fixup_dmic(struct hda_codec
*codec
,
14882 const struct alc_fixup
*fix
, int action
)
14884 static const struct hda_verb verbs
[] = {
14885 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0d},
14886 {0x20, AC_VERB_SET_PROC_COEF
, 0x4000},
14891 if (strcmp(codec
->chip_name
, "ALC271X"))
14893 cfg
= snd_hda_codec_get_pincfg(codec
, 0x12);
14894 if (get_defcfg_connect(cfg
) == AC_JACK_PORT_FIXED
)
14895 snd_hda_sequence_write(codec
, verbs
);
14899 ALC269_FIXUP_SONY_VAIO
,
14900 ALC275_FIXUP_SONY_VAIO_GPIO2
,
14901 ALC269_FIXUP_DELL_M101Z
,
14902 ALC269_FIXUP_SKU_IGNORE
,
14903 ALC269_FIXUP_ASUS_G73JW
,
14904 ALC269_FIXUP_LENOVO_EAPD
,
14905 ALC275_FIXUP_SONY_HWEQ
,
14909 static const struct alc_fixup alc269_fixups
[] = {
14910 [ALC269_FIXUP_SONY_VAIO
] = {
14911 .type
= ALC_FIXUP_VERBS
,
14912 .v
.verbs
= (const struct hda_verb
[]) {
14913 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREFGRD
},
14917 [ALC275_FIXUP_SONY_VAIO_GPIO2
] = {
14918 .type
= ALC_FIXUP_VERBS
,
14919 .v
.verbs
= (const struct hda_verb
[]) {
14920 {0x01, AC_VERB_SET_GPIO_MASK
, 0x04},
14921 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x04},
14922 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
14926 .chain_id
= ALC269_FIXUP_SONY_VAIO
14928 [ALC269_FIXUP_DELL_M101Z
] = {
14929 .type
= ALC_FIXUP_VERBS
,
14930 .v
.verbs
= (const struct hda_verb
[]) {
14931 /* Enables internal speaker */
14932 {0x20, AC_VERB_SET_COEF_INDEX
, 13},
14933 {0x20, AC_VERB_SET_PROC_COEF
, 0x4040},
14937 [ALC269_FIXUP_SKU_IGNORE
] = {
14938 .type
= ALC_FIXUP_SKU
,
14939 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
14941 [ALC269_FIXUP_ASUS_G73JW
] = {
14942 .type
= ALC_FIXUP_PINS
,
14943 .v
.pins
= (const struct alc_pincfg
[]) {
14944 { 0x17, 0x99130111 }, /* subwoofer */
14948 [ALC269_FIXUP_LENOVO_EAPD
] = {
14949 .type
= ALC_FIXUP_VERBS
,
14950 .v
.verbs
= (const struct hda_verb
[]) {
14951 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
14955 [ALC275_FIXUP_SONY_HWEQ
] = {
14956 .type
= ALC_FIXUP_FUNC
,
14957 .v
.func
= alc269_fixup_hweq
,
14959 .chain_id
= ALC275_FIXUP_SONY_VAIO_GPIO2
14961 [ALC271_FIXUP_DMIC
] = {
14962 .type
= ALC_FIXUP_FUNC
,
14963 .v
.func
= alc271_fixup_dmic
,
14967 static const struct snd_pci_quirk alc269_fixup_tbl
[] = {
14968 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2
),
14969 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ
),
14970 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ
),
14971 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO
),
14972 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z
),
14973 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC
),
14974 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE
),
14975 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE
),
14976 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE
),
14977 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE
),
14978 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE
),
14979 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW
),
14980 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD
),
14986 * configuration and preset
14988 static const char * const alc269_models
[ALC269_MODEL_LAST
] = {
14989 [ALC269_BASIC
] = "basic",
14990 [ALC269_QUANTA_FL1
] = "quanta",
14991 [ALC269_AMIC
] = "laptop-amic",
14992 [ALC269_DMIC
] = "laptop-dmic",
14993 [ALC269_FUJITSU
] = "fujitsu",
14994 [ALC269_LIFEBOOK
] = "lifebook",
14995 [ALC269_AUTO
] = "auto",
14998 static const struct snd_pci_quirk alc269_cfg_tbl
[] = {
14999 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1
),
15000 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER
),
15001 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
15003 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC
),
15004 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC
),
15005 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC
),
15006 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC
),
15007 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC
),
15008 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC
),
15009 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC
),
15010 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC
),
15011 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC
),
15012 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC
),
15013 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC
),
15014 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC
),
15015 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC
),
15016 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC
),
15017 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC
),
15018 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC
),
15019 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC
),
15020 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC
),
15021 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC
),
15022 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC
),
15023 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC
),
15024 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC
),
15025 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC
),
15026 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC
),
15027 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC
),
15028 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC
),
15029 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC
),
15030 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC
),
15031 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC
),
15032 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC
),
15033 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC
),
15034 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC
),
15035 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC
),
15036 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC
),
15037 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC
),
15038 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC
),
15039 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
15041 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15043 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC
),
15044 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC
),
15045 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO
),
15046 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK
),
15047 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC
),
15048 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU
),
15049 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC
),
15050 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC
),
15051 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC
),
15052 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC
),
15056 static const struct alc_config_preset alc269_presets
[] = {
15058 .mixers
= { alc269_base_mixer
},
15059 .init_verbs
= { alc269_init_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
,
15067 [ALC269_QUANTA_FL1
] = {
15068 .mixers
= { alc269_quanta_fl1_mixer
},
15069 .init_verbs
= { alc269_init_verbs
, alc269_quanta_fl1_verbs
},
15070 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15071 .dac_nids
= alc269_dac_nids
,
15073 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15074 .channel_mode
= alc269_modes
,
15075 .input_mux
= &alc269_capture_source
,
15076 .unsol_event
= alc269_quanta_fl1_unsol_event
,
15077 .setup
= alc269_quanta_fl1_setup
,
15078 .init_hook
= alc269_quanta_fl1_init_hook
,
15081 .mixers
= { alc269_laptop_mixer
},
15082 .cap_mixer
= alc269_laptop_analog_capture_mixer
,
15083 .init_verbs
= { alc269_init_verbs
,
15084 alc269_laptop_amic_init_verbs
},
15085 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15086 .dac_nids
= alc269_dac_nids
,
15088 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15089 .channel_mode
= alc269_modes
,
15090 .unsol_event
= alc_sku_unsol_event
,
15091 .setup
= alc269_laptop_amic_setup
,
15092 .init_hook
= alc_inithook
,
15095 .mixers
= { alc269_laptop_mixer
},
15096 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
15097 .init_verbs
= { alc269_init_verbs
,
15098 alc269_laptop_dmic_init_verbs
},
15099 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15100 .dac_nids
= alc269_dac_nids
,
15102 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15103 .channel_mode
= alc269_modes
,
15104 .unsol_event
= alc_sku_unsol_event
,
15105 .setup
= alc269_laptop_dmic_setup
,
15106 .init_hook
= alc_inithook
,
15108 [ALC269VB_AMIC
] = {
15109 .mixers
= { alc269vb_laptop_mixer
},
15110 .cap_mixer
= alc269vb_laptop_analog_capture_mixer
,
15111 .init_verbs
= { alc269vb_init_verbs
,
15112 alc269vb_laptop_amic_init_verbs
},
15113 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15114 .dac_nids
= alc269_dac_nids
,
15116 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15117 .channel_mode
= alc269_modes
,
15118 .unsol_event
= alc_sku_unsol_event
,
15119 .setup
= alc269vb_laptop_amic_setup
,
15120 .init_hook
= alc_inithook
,
15122 [ALC269VB_DMIC
] = {
15123 .mixers
= { alc269vb_laptop_mixer
},
15124 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
15125 .init_verbs
= { alc269vb_init_verbs
,
15126 alc269vb_laptop_dmic_init_verbs
},
15127 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15128 .dac_nids
= alc269_dac_nids
,
15130 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15131 .channel_mode
= alc269_modes
,
15132 .unsol_event
= alc_sku_unsol_event
,
15133 .setup
= alc269vb_laptop_dmic_setup
,
15134 .init_hook
= alc_inithook
,
15136 [ALC269_FUJITSU
] = {
15137 .mixers
= { alc269_fujitsu_mixer
},
15138 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
15139 .init_verbs
= { alc269_init_verbs
,
15140 alc269_laptop_dmic_init_verbs
},
15141 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15142 .dac_nids
= alc269_dac_nids
,
15144 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15145 .channel_mode
= alc269_modes
,
15146 .unsol_event
= alc_sku_unsol_event
,
15147 .setup
= alc269_laptop_dmic_setup
,
15148 .init_hook
= alc_inithook
,
15150 [ALC269_LIFEBOOK
] = {
15151 .mixers
= { alc269_lifebook_mixer
},
15152 .init_verbs
= { alc269_init_verbs
, alc269_lifebook_verbs
},
15153 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15154 .dac_nids
= alc269_dac_nids
,
15156 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15157 .channel_mode
= alc269_modes
,
15158 .input_mux
= &alc269_capture_source
,
15159 .unsol_event
= alc269_lifebook_unsol_event
,
15160 .setup
= alc269_lifebook_setup
,
15161 .init_hook
= alc269_lifebook_init_hook
,
15164 .mixers
= { alc269_asus_mixer
},
15165 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
15166 .init_verbs
= { alc269_init_verbs
, alc271_acer_dmic_verbs
},
15167 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
15168 .dac_nids
= alc269_dac_nids
,
15169 .adc_nids
= alc262_dmic_adc_nids
,
15170 .num_adc_nids
= ARRAY_SIZE(alc262_dmic_adc_nids
),
15171 .capsrc_nids
= alc262_dmic_capsrc_nids
,
15172 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
15173 .channel_mode
= alc269_modes
,
15174 .input_mux
= &alc269_capture_source
,
15175 .dig_out_nid
= ALC880_DIGOUT_NID
,
15176 .unsol_event
= alc_sku_unsol_event
,
15177 .setup
= alc269vb_laptop_dmic_setup
,
15178 .init_hook
= alc_inithook
,
15182 static int alc269_fill_coef(struct hda_codec
*codec
)
15186 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) < 0x015) {
15187 alc_write_coef_idx(codec
, 0xf, 0x960b);
15188 alc_write_coef_idx(codec
, 0xe, 0x8817);
15191 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x016) {
15192 alc_write_coef_idx(codec
, 0xf, 0x960b);
15193 alc_write_coef_idx(codec
, 0xe, 0x8814);
15196 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017) {
15197 val
= alc_read_coef_idx(codec
, 0x04);
15198 /* Power up output pin */
15199 alc_write_coef_idx(codec
, 0x04, val
| (1<<11));
15202 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
15203 val
= alc_read_coef_idx(codec
, 0xd);
15204 if ((val
& 0x0c00) >> 10 != 0x1) {
15205 /* Capless ramp up clock control */
15206 alc_write_coef_idx(codec
, 0xd, val
| (1<<10));
15208 val
= alc_read_coef_idx(codec
, 0x17);
15209 if ((val
& 0x01c0) >> 6 != 0x4) {
15210 /* Class D power on reset */
15211 alc_write_coef_idx(codec
, 0x17, val
| (1<<7));
15215 val
= alc_read_coef_idx(codec
, 0xd); /* Class D */
15216 alc_write_coef_idx(codec
, 0xd, val
| (1<<14));
15218 val
= alc_read_coef_idx(codec
, 0x4); /* HP */
15219 alc_write_coef_idx(codec
, 0x4, val
| (1<<11));
15224 static int patch_alc269(struct hda_codec
*codec
)
15226 struct alc_spec
*spec
;
15227 int board_config
, coef
;
15230 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
15234 codec
->spec
= spec
;
15236 alc_auto_parse_customize_define(codec
);
15238 if (codec
->vendor_id
== 0x10ec0269) {
15239 coef
= alc_read_coef_idx(codec
, 0);
15240 if ((coef
& 0x00f0) == 0x0010) {
15241 if (codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
15242 spec
->cdefine
.platform_type
== 1) {
15243 alc_codec_rename(codec
, "ALC271X");
15244 spec
->codec_variant
= ALC269_TYPE_ALC271X
;
15245 } else if ((coef
& 0xf000) == 0x1000) {
15246 spec
->codec_variant
= ALC269_TYPE_ALC270
;
15247 } else if ((coef
& 0xf000) == 0x2000) {
15248 alc_codec_rename(codec
, "ALC259");
15249 spec
->codec_variant
= ALC269_TYPE_ALC259
;
15250 } else if ((coef
& 0xf000) == 0x3000) {
15251 alc_codec_rename(codec
, "ALC258");
15252 spec
->codec_variant
= ALC269_TYPE_ALC258
;
15254 alc_codec_rename(codec
, "ALC269VB");
15255 spec
->codec_variant
= ALC269_TYPE_ALC269VB
;
15258 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
15259 alc269_fill_coef(codec
);
15262 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
15266 if (board_config
< 0) {
15267 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
15269 board_config
= ALC269_AUTO
;
15272 if (board_config
== ALC269_AUTO
) {
15273 alc_pick_fixup(codec
, NULL
, alc269_fixup_tbl
, alc269_fixups
);
15274 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
15277 if (board_config
== ALC269_AUTO
) {
15278 /* automatic parse from the BIOS config */
15279 err
= alc269_parse_auto_config(codec
);
15285 "hda_codec: Cannot set up configuration "
15286 "from BIOS. Using base mode...\n");
15287 board_config
= ALC269_BASIC
;
15291 if (has_cdefine_beep(codec
)) {
15292 err
= snd_hda_attach_beep_device(codec
, 0x1);
15299 if (board_config
!= ALC269_AUTO
)
15300 setup_preset(codec
, &alc269_presets
[board_config
]);
15302 if (board_config
== ALC269_QUANTA_FL1
) {
15303 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15304 * fix the sample rate of analog I/O to 44.1kHz
15306 spec
->stream_analog_playback
= &alc269_44k_pcm_analog_playback
;
15307 spec
->stream_analog_capture
= &alc269_44k_pcm_analog_capture
;
15308 } else if (spec
->dual_adc_switch
) {
15309 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
15310 /* switch ADC dynamically */
15311 spec
->stream_analog_capture
= &dualmic_pcm_analog_capture
;
15313 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
15314 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
15316 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
15317 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
15319 if (!spec
->adc_nids
) { /* wasn't filled automatically? use default */
15320 if (spec
->codec_variant
== ALC269_TYPE_NORMAL
) {
15321 spec
->adc_nids
= alc269_adc_nids
;
15322 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
15323 spec
->capsrc_nids
= alc269_capsrc_nids
;
15325 spec
->adc_nids
= alc269vb_adc_nids
;
15326 spec
->num_adc_nids
= ARRAY_SIZE(alc269vb_adc_nids
);
15327 spec
->capsrc_nids
= alc269vb_capsrc_nids
;
15331 if (!spec
->cap_mixer
)
15332 set_capture_mixer(codec
);
15333 if (has_cdefine_beep(codec
))
15334 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
15336 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
15338 spec
->vmaster_nid
= 0x02;
15340 codec
->patch_ops
= alc_patch_ops
;
15341 #ifdef SND_HDA_NEEDS_RESUME
15342 codec
->patch_ops
.resume
= alc269_resume
;
15344 if (board_config
== ALC269_AUTO
)
15345 spec
->init_hook
= alc269_auto_init
;
15346 spec
->shutup
= alc269_shutup
;
15348 alc_init_jacks(codec
);
15349 #ifdef CONFIG_SND_HDA_POWER_SAVE
15350 if (!spec
->loopback
.amplist
)
15351 spec
->loopback
.amplist
= alc269_loopbacks
;
15352 if (alc269_mic2_for_mute_led(codec
))
15353 codec
->patch_ops
.check_power_status
= alc269_mic2_mute_check_ps
;
15360 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15364 * set the path ways for 2 channel output
15365 * need to set the codec line out and mic 1 pin widgets to inputs
15367 static const struct hda_verb alc861_threestack_ch2_init
[] = {
15368 /* set pin widget 1Ah (line in) for input */
15369 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15370 /* set pin widget 18h (mic1/2) for input, for mic also enable
15373 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15375 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
15377 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15378 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
15384 * need to set the codec line out and mic 1 pin widgets to outputs
15386 static const struct hda_verb alc861_threestack_ch6_init
[] = {
15387 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15388 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15389 /* set pin widget 18h (mic1) for output (CLFE)*/
15390 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15392 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15393 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15395 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
15397 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15398 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
15403 static const struct hda_channel_mode alc861_threestack_modes
[2] = {
15404 { 2, alc861_threestack_ch2_init
},
15405 { 6, alc861_threestack_ch6_init
},
15407 /* Set mic1 as input and unmute the mixer */
15408 static const struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
15409 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15410 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15413 /* Set mic1 as output and mute mixer */
15414 static const struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
15415 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15416 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15420 static const struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
15421 { 2, alc861_uniwill_m31_ch2_init
},
15422 { 4, alc861_uniwill_m31_ch4_init
},
15425 /* Set mic1 and line-in as input and unmute the mixer */
15426 static const struct hda_verb alc861_asus_ch2_init
[] = {
15427 /* set pin widget 1Ah (line in) for input */
15428 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15429 /* set pin widget 18h (mic1/2) for input, for mic also enable
15432 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15434 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
15436 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15437 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
15441 /* Set mic1 nad line-in as output and mute mixer */
15442 static const struct hda_verb alc861_asus_ch6_init
[] = {
15443 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15444 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15445 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15446 /* set pin widget 18h (mic1) for output (CLFE)*/
15447 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15448 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15449 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15450 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15452 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
15454 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15455 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
15460 static const struct hda_channel_mode alc861_asus_modes
[2] = {
15461 { 2, alc861_asus_ch2_init
},
15462 { 6, alc861_asus_ch6_init
},
15467 static const struct snd_kcontrol_new alc861_base_mixer
[] = {
15468 /* output mixer control */
15469 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15470 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15471 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15472 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15473 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
15475 /*Input mixer control */
15476 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15477 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15478 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15479 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15480 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15481 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15482 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15483 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15484 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15485 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15490 static const struct snd_kcontrol_new alc861_3ST_mixer
[] = {
15491 /* output mixer control */
15492 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15493 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15494 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15495 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15496 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15498 /* Input mixer control */
15499 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15500 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15501 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15502 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15503 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15504 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15505 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15506 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15507 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15508 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15511 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15512 .name
= "Channel Mode",
15513 .info
= alc_ch_mode_info
,
15514 .get
= alc_ch_mode_get
,
15515 .put
= alc_ch_mode_put
,
15516 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
15521 static const struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
15522 /* output mixer control */
15523 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15525 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15530 static const struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
15531 /* output mixer control */
15532 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15533 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15534 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15535 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15536 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15538 /* Input mixer control */
15539 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15540 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15541 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15542 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15543 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15544 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15545 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15546 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15547 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15548 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15551 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15552 .name
= "Channel Mode",
15553 .info
= alc_ch_mode_info
,
15554 .get
= alc_ch_mode_get
,
15555 .put
= alc_ch_mode_put
,
15556 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
15561 static const struct snd_kcontrol_new alc861_asus_mixer
[] = {
15562 /* output mixer control */
15563 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15564 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15565 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15566 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15567 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
15569 /* Input mixer control */
15570 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
15571 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15572 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15573 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15574 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15575 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15576 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15577 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15578 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15579 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
15582 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15583 .name
= "Channel Mode",
15584 .info
= alc_ch_mode_info
,
15585 .get
= alc_ch_mode_get
,
15586 .put
= alc_ch_mode_put
,
15587 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
15592 /* additional mixer */
15593 static const struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
15594 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15595 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15600 * generic initialization of ADC, input mixers and output mixers
15602 static const struct hda_verb alc861_base_init_verbs
[] = {
15604 * Unmute ADC0 and set the default input to mic-in
15606 /* port-A for surround (rear panel) */
15607 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15608 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15609 /* port-B for mic-in (rear panel) with vref */
15610 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15611 /* port-C for line-in (rear panel) */
15612 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15613 /* port-D for Front */
15614 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15615 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15616 /* port-E for HP out (front panel) */
15617 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
15618 /* route front PCM to HP */
15619 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15620 /* port-F for mic-in (front panel) with vref */
15621 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15622 /* port-G for CLFE (rear panel) */
15623 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15624 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15625 /* port-H for side (rear panel) */
15626 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15627 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15629 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15630 /* route front mic to ADC1*/
15631 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15632 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15634 /* Unmute DAC0~3 & spdif out*/
15635 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15636 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15637 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15638 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15641 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15642 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15643 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15644 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15645 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15647 /* Unmute Stereo Mixer 15 */
15648 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15649 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15650 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15651 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15653 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15654 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15655 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15656 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15657 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15658 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15659 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15660 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15661 /* hp used DAC 3 (Front) */
15662 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15663 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15668 static const struct hda_verb alc861_threestack_init_verbs
[] = {
15670 * Unmute ADC0 and set the default input to mic-in
15672 /* port-A for surround (rear panel) */
15673 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15674 /* port-B for mic-in (rear panel) with vref */
15675 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15676 /* port-C for line-in (rear panel) */
15677 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15678 /* port-D for Front */
15679 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15680 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15681 /* port-E for HP out (front panel) */
15682 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
15683 /* route front PCM to HP */
15684 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15685 /* port-F for mic-in (front panel) with vref */
15686 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15687 /* port-G for CLFE (rear panel) */
15688 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15689 /* port-H for side (rear panel) */
15690 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15692 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15693 /* route front mic to ADC1*/
15694 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15695 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15696 /* Unmute DAC0~3 & spdif out*/
15697 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15698 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15699 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15700 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15703 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15704 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15705 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15706 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15707 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15709 /* Unmute Stereo Mixer 15 */
15710 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15711 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15713 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15715 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15716 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15717 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15718 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15719 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15720 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15721 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15722 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15723 /* hp used DAC 3 (Front) */
15724 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15725 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15729 static const struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
15731 * Unmute ADC0 and set the default input to mic-in
15733 /* port-A for surround (rear panel) */
15734 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15735 /* port-B for mic-in (rear panel) with vref */
15736 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15737 /* port-C for line-in (rear panel) */
15738 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15739 /* port-D for Front */
15740 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15741 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15742 /* port-E for HP out (front panel) */
15743 /* this has to be set to VREF80 */
15744 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15745 /* route front PCM to HP */
15746 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15747 /* port-F for mic-in (front panel) with vref */
15748 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15749 /* port-G for CLFE (rear panel) */
15750 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15751 /* port-H for side (rear panel) */
15752 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15754 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15755 /* route front mic to ADC1*/
15756 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15757 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15758 /* Unmute DAC0~3 & spdif out*/
15759 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15760 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15761 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15762 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15763 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15765 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15766 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15767 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15768 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15769 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15771 /* Unmute Stereo Mixer 15 */
15772 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15777 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15778 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15779 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15780 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15781 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15782 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15783 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15784 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15785 /* hp used DAC 3 (Front) */
15786 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15787 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15791 static const struct hda_verb alc861_asus_init_verbs
[] = {
15793 * Unmute ADC0 and set the default input to mic-in
15795 /* port-A for surround (rear panel)
15796 * according to codec#0 this is the HP jack
15798 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
15799 /* route front PCM to HP */
15800 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
15801 /* port-B for mic-in (rear panel) with vref */
15802 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15803 /* port-C for line-in (rear panel) */
15804 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15805 /* port-D for Front */
15806 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15807 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15808 /* port-E for HP out (front panel) */
15809 /* this has to be set to VREF80 */
15810 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15811 /* route front PCM to HP */
15812 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15813 /* port-F for mic-in (front panel) with vref */
15814 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15815 /* port-G for CLFE (rear panel) */
15816 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15817 /* port-H for side (rear panel) */
15818 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15820 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15821 /* route front mic to ADC1*/
15822 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15824 /* Unmute DAC0~3 & spdif out*/
15825 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15826 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15827 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15828 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15829 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15830 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15831 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15832 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15833 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15834 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15836 /* Unmute Stereo Mixer 15 */
15837 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15838 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15839 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15840 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15842 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15843 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15844 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15845 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15846 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15847 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15848 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15849 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15850 /* hp used DAC 3 (Front) */
15851 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15852 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15856 /* additional init verbs for ASUS laptops */
15857 static const struct hda_verb alc861_asus_laptop_init_verbs
[] = {
15858 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
15859 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
15864 * generic initialization of ADC, input mixers and output mixers
15866 static const struct hda_verb alc861_auto_init_verbs
[] = {
15868 * Unmute ADC0 and set the default input to mic-in
15870 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15871 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15873 /* Unmute DAC0~3 & spdif out*/
15874 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15875 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15876 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15877 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15878 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15880 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15881 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15882 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15883 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15884 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15886 /* Unmute Stereo Mixer 15 */
15887 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15888 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15889 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
15892 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15893 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15894 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15895 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15896 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15897 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15898 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15899 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15901 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15902 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15903 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15905 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15906 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15907 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15908 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15910 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
15915 static const struct hda_verb alc861_toshiba_init_verbs
[] = {
15916 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15921 /* toggle speaker-output according to the hp-jack state */
15922 static void alc861_toshiba_automute(struct hda_codec
*codec
)
15924 unsigned int present
= snd_hda_jack_detect(codec
, 0x0f);
15926 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
15927 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
15928 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
15929 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
15932 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
15935 if ((res
>> 26) == ALC880_HP_EVENT
)
15936 alc861_toshiba_automute(codec
);
15939 /* pcm configuration: identical with ALC880 */
15940 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15941 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15942 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15943 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15946 #define ALC861_DIGOUT_NID 0x07
15948 static const struct hda_channel_mode alc861_8ch_modes
[1] = {
15952 static const hda_nid_t alc861_dac_nids
[4] = {
15953 /* front, surround, clfe, side */
15954 0x03, 0x06, 0x05, 0x04
15957 static const hda_nid_t alc660_dac_nids
[3] = {
15958 /* front, clfe, surround */
15962 static const hda_nid_t alc861_adc_nids
[1] = {
15967 static const struct hda_input_mux alc861_capture_source
= {
15971 { "Front Mic", 0x3 },
15978 static hda_nid_t
alc861_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
15980 struct alc_spec
*spec
= codec
->spec
;
15981 hda_nid_t mix
, srcs
[5];
15984 if (snd_hda_get_connections(codec
, pin
, &mix
, 1) != 1)
15986 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
15989 for (i
= 0; i
< num
; i
++) {
15991 type
= get_wcaps_type(get_wcaps(codec
, srcs
[i
]));
15992 if (type
!= AC_WID_AUD_OUT
)
15994 for (j
= 0; j
< spec
->multiout
.num_dacs
; j
++)
15995 if (spec
->multiout
.dac_nids
[j
] == srcs
[i
])
15997 if (j
>= spec
->multiout
.num_dacs
)
16003 /* fill in the dac_nids table from the parsed pin configuration */
16004 static int alc861_auto_fill_dac_nids(struct hda_codec
*codec
,
16005 const struct auto_pin_cfg
*cfg
)
16007 struct alc_spec
*spec
= codec
->spec
;
16009 hda_nid_t nid
, dac
;
16011 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
16012 for (i
= 0; i
< cfg
->line_outs
; i
++) {
16013 nid
= cfg
->line_out_pins
[i
];
16014 dac
= alc861_look_for_dac(codec
, nid
);
16017 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
16022 static int __alc861_create_out_sw(struct hda_codec
*codec
, const char *pfx
,
16023 hda_nid_t nid
, int idx
, unsigned int chs
)
16025 return __add_pb_sw_ctrl(codec
->spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
,
16026 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
16029 #define alc861_create_out_sw(codec, pfx, nid, chs) \
16030 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
16032 /* add playback controls from the parsed DAC table */
16033 static int alc861_auto_create_multi_out_ctls(struct hda_codec
*codec
,
16034 const struct auto_pin_cfg
*cfg
)
16036 struct alc_spec
*spec
= codec
->spec
;
16037 static const char * const chname
[4] = {
16038 "Front", "Surround", NULL
/*CLFE*/, "Side"
16040 const char *pfx
= alc_get_line_out_pfx(spec
, true);
16042 int i
, err
, noutputs
;
16044 noutputs
= cfg
->line_outs
;
16045 if (spec
->multi_ios
> 0)
16046 noutputs
+= spec
->multi_ios
;
16048 for (i
= 0; i
< noutputs
; i
++) {
16049 nid
= spec
->multiout
.dac_nids
[i
];
16052 if (!pfx
&& i
== 2) {
16054 err
= alc861_create_out_sw(codec
, "Center", nid
, 1);
16057 err
= alc861_create_out_sw(codec
, "LFE", nid
, 2);
16061 const char *name
= pfx
;
16067 err
= __alc861_create_out_sw(codec
, name
, nid
, index
, 3);
16075 static int alc861_auto_create_hp_ctls(struct hda_codec
*codec
, hda_nid_t pin
)
16077 struct alc_spec
*spec
= codec
->spec
;
16084 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
16085 nid
= alc861_look_for_dac(codec
, pin
);
16087 err
= alc861_create_out_sw(codec
, "Headphone", nid
, 3);
16090 spec
->multiout
.hp_nid
= nid
;
16096 /* create playback/capture controls for input pins */
16097 static int alc861_auto_create_input_ctls(struct hda_codec
*codec
,
16098 const struct auto_pin_cfg
*cfg
)
16100 return alc_auto_create_input_ctls(codec
, cfg
, 0x15, 0x08, 0);
16103 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
16105 int pin_type
, hda_nid_t dac
)
16107 hda_nid_t mix
, srcs
[5];
16110 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
16112 snd_hda_codec_write(codec
, dac
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16114 if (snd_hda_get_connections(codec
, nid
, &mix
, 1) != 1)
16116 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
16119 for (i
= 0; i
< num
; i
++) {
16121 if (srcs
[i
] == dac
|| srcs
[i
] == 0x15)
16122 mute
= AMP_IN_UNMUTE(i
);
16124 mute
= AMP_IN_MUTE(i
);
16125 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16130 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
16132 struct alc_spec
*spec
= codec
->spec
;
16135 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
16136 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
16137 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
16139 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
16140 spec
->multiout
.dac_nids
[i
]);
16144 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
16146 struct alc_spec
*spec
= codec
->spec
;
16148 if (spec
->autocfg
.hp_outs
)
16149 alc861_auto_set_output_and_unmute(codec
,
16150 spec
->autocfg
.hp_pins
[0],
16152 spec
->multiout
.hp_nid
);
16153 if (spec
->autocfg
.speaker_outs
)
16154 alc861_auto_set_output_and_unmute(codec
,
16155 spec
->autocfg
.speaker_pins
[0],
16157 spec
->multiout
.dac_nids
[0]);
16160 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
16162 struct alc_spec
*spec
= codec
->spec
;
16163 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
16166 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
16167 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
16168 if (nid
>= 0x0c && nid
<= 0x11)
16169 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
16173 /* parse the BIOS configuration and set up the alc_spec */
16174 /* return 1 if successful, 0 if the proper config is not found,
16175 * or a negative error code
16177 static int alc861_parse_auto_config(struct hda_codec
*codec
)
16179 struct alc_spec
*spec
= codec
->spec
;
16181 static const hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
16183 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
16187 if (!spec
->autocfg
.line_outs
)
16188 return 0; /* can't find valid BIOS pin config */
16190 err
= alc861_auto_fill_dac_nids(codec
, &spec
->autocfg
);
16193 err
= alc_auto_add_multi_channel_mode(codec
);
16196 err
= alc861_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
16199 err
= alc861_auto_create_hp_ctls(codec
, spec
->autocfg
.hp_pins
[0]);
16202 err
= alc861_auto_create_input_ctls(codec
, &spec
->autocfg
);
16206 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
16208 alc_auto_parse_digital(codec
);
16210 if (spec
->kctls
.list
)
16211 add_mixer(spec
, spec
->kctls
.list
);
16213 add_verb(spec
, alc861_auto_init_verbs
);
16215 spec
->num_mux_defs
= 1;
16216 spec
->input_mux
= &spec
->private_imux
[0];
16218 spec
->adc_nids
= alc861_adc_nids
;
16219 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
16220 set_capture_mixer(codec
);
16222 alc_ssid_check(codec
, 0x0e, 0x0f, 0x0b, 0);
16227 /* additional initialization for auto-configuration model */
16228 static void alc861_auto_init(struct hda_codec
*codec
)
16230 struct alc_spec
*spec
= codec
->spec
;
16231 alc861_auto_init_multi_out(codec
);
16232 alc861_auto_init_hp_out(codec
);
16233 alc861_auto_init_analog_input(codec
);
16234 alc_auto_init_digital(codec
);
16235 if (spec
->unsol_event
)
16236 alc_inithook(codec
);
16239 #ifdef CONFIG_SND_HDA_POWER_SAVE
16240 static const struct hda_amp_list alc861_loopbacks
[] = {
16241 { 0x15, HDA_INPUT
, 0 },
16242 { 0x15, HDA_INPUT
, 1 },
16243 { 0x15, HDA_INPUT
, 2 },
16244 { 0x15, HDA_INPUT
, 3 },
16251 * configuration and preset
16253 static const char * const alc861_models
[ALC861_MODEL_LAST
] = {
16254 [ALC861_3ST
] = "3stack",
16255 [ALC660_3ST
] = "3stack-660",
16256 [ALC861_3ST_DIG
] = "3stack-dig",
16257 [ALC861_6ST_DIG
] = "6stack-dig",
16258 [ALC861_UNIWILL_M31
] = "uniwill-m31",
16259 [ALC861_TOSHIBA
] = "toshiba",
16260 [ALC861_ASUS
] = "asus",
16261 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
16262 [ALC861_AUTO
] = "auto",
16265 static const struct snd_pci_quirk alc861_cfg_tbl
[] = {
16266 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
16267 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
16268 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
16269 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
16270 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
16271 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
16272 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
16273 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16274 * Any other models that need this preset?
16276 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16277 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
16278 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
16279 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
16280 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
16281 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
16282 /* FIXME: the below seems conflict */
16283 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16284 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
16285 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
16289 static const struct alc_config_preset alc861_presets
[] = {
16291 .mixers
= { alc861_3ST_mixer
},
16292 .init_verbs
= { alc861_threestack_init_verbs
},
16293 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16294 .dac_nids
= alc861_dac_nids
,
16295 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16296 .channel_mode
= alc861_threestack_modes
,
16298 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16299 .adc_nids
= alc861_adc_nids
,
16300 .input_mux
= &alc861_capture_source
,
16302 [ALC861_3ST_DIG
] = {
16303 .mixers
= { alc861_base_mixer
},
16304 .init_verbs
= { alc861_threestack_init_verbs
},
16305 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16306 .dac_nids
= alc861_dac_nids
,
16307 .dig_out_nid
= ALC861_DIGOUT_NID
,
16308 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16309 .channel_mode
= alc861_threestack_modes
,
16311 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16312 .adc_nids
= alc861_adc_nids
,
16313 .input_mux
= &alc861_capture_source
,
16315 [ALC861_6ST_DIG
] = {
16316 .mixers
= { alc861_base_mixer
},
16317 .init_verbs
= { alc861_base_init_verbs
},
16318 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16319 .dac_nids
= alc861_dac_nids
,
16320 .dig_out_nid
= ALC861_DIGOUT_NID
,
16321 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
16322 .channel_mode
= alc861_8ch_modes
,
16323 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16324 .adc_nids
= alc861_adc_nids
,
16325 .input_mux
= &alc861_capture_source
,
16328 .mixers
= { alc861_3ST_mixer
},
16329 .init_verbs
= { alc861_threestack_init_verbs
},
16330 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
16331 .dac_nids
= alc660_dac_nids
,
16332 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
16333 .channel_mode
= alc861_threestack_modes
,
16335 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16336 .adc_nids
= alc861_adc_nids
,
16337 .input_mux
= &alc861_capture_source
,
16339 [ALC861_UNIWILL_M31
] = {
16340 .mixers
= { alc861_uniwill_m31_mixer
},
16341 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
16342 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16343 .dac_nids
= alc861_dac_nids
,
16344 .dig_out_nid
= ALC861_DIGOUT_NID
,
16345 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
16346 .channel_mode
= alc861_uniwill_m31_modes
,
16348 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16349 .adc_nids
= alc861_adc_nids
,
16350 .input_mux
= &alc861_capture_source
,
16352 [ALC861_TOSHIBA
] = {
16353 .mixers
= { alc861_toshiba_mixer
},
16354 .init_verbs
= { alc861_base_init_verbs
,
16355 alc861_toshiba_init_verbs
},
16356 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16357 .dac_nids
= alc861_dac_nids
,
16358 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
16359 .channel_mode
= alc883_3ST_2ch_modes
,
16360 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16361 .adc_nids
= alc861_adc_nids
,
16362 .input_mux
= &alc861_capture_source
,
16363 .unsol_event
= alc861_toshiba_unsol_event
,
16364 .init_hook
= alc861_toshiba_automute
,
16367 .mixers
= { alc861_asus_mixer
},
16368 .init_verbs
= { alc861_asus_init_verbs
},
16369 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16370 .dac_nids
= alc861_dac_nids
,
16371 .dig_out_nid
= ALC861_DIGOUT_NID
,
16372 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
16373 .channel_mode
= alc861_asus_modes
,
16376 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16377 .adc_nids
= alc861_adc_nids
,
16378 .input_mux
= &alc861_capture_source
,
16380 [ALC861_ASUS_LAPTOP
] = {
16381 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
16382 .init_verbs
= { alc861_asus_init_verbs
,
16383 alc861_asus_laptop_init_verbs
},
16384 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
16385 .dac_nids
= alc861_dac_nids
,
16386 .dig_out_nid
= ALC861_DIGOUT_NID
,
16387 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
16388 .channel_mode
= alc883_3ST_2ch_modes
,
16390 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
16391 .adc_nids
= alc861_adc_nids
,
16392 .input_mux
= &alc861_capture_source
,
16396 /* Pin config fixes */
16398 PINFIX_FSC_AMILO_PI1505
,
16401 static const struct alc_fixup alc861_fixups
[] = {
16402 [PINFIX_FSC_AMILO_PI1505
] = {
16403 .type
= ALC_FIXUP_PINS
,
16404 .v
.pins
= (const struct alc_pincfg
[]) {
16405 { 0x0b, 0x0221101f }, /* HP */
16406 { 0x0f, 0x90170310 }, /* speaker */
16412 static const struct snd_pci_quirk alc861_fixup_tbl
[] = {
16413 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505
),
16417 static int patch_alc861(struct hda_codec
*codec
)
16419 struct alc_spec
*spec
;
16423 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
16427 codec
->spec
= spec
;
16429 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
16433 if (board_config
< 0) {
16434 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
16436 board_config
= ALC861_AUTO
;
16439 if (board_config
== ALC861_AUTO
) {
16440 alc_pick_fixup(codec
, NULL
, alc861_fixup_tbl
, alc861_fixups
);
16441 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
16444 if (board_config
== ALC861_AUTO
) {
16445 /* automatic parse from the BIOS config */
16446 err
= alc861_parse_auto_config(codec
);
16452 "hda_codec: Cannot set up configuration "
16453 "from BIOS. Using base mode...\n");
16454 board_config
= ALC861_3ST_DIG
;
16458 err
= snd_hda_attach_beep_device(codec
, 0x23);
16464 if (board_config
!= ALC861_AUTO
)
16465 setup_preset(codec
, &alc861_presets
[board_config
]);
16467 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
16468 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
16470 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
16471 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
16473 if (!spec
->cap_mixer
)
16474 set_capture_mixer(codec
);
16475 set_beep_amp(spec
, 0x23, 0, HDA_OUTPUT
);
16477 spec
->vmaster_nid
= 0x03;
16479 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
16481 codec
->patch_ops
= alc_patch_ops
;
16482 if (board_config
== ALC861_AUTO
) {
16483 spec
->init_hook
= alc861_auto_init
;
16484 #ifdef CONFIG_SND_HDA_POWER_SAVE
16485 spec
->power_hook
= alc_power_eapd
;
16488 #ifdef CONFIG_SND_HDA_POWER_SAVE
16489 if (!spec
->loopback
.amplist
)
16490 spec
->loopback
.amplist
= alc861_loopbacks
;
16497 * ALC861-VD support
16501 * In addition, an independent DAC
16503 #define ALC861VD_DIGOUT_NID 0x06
16505 static const hda_nid_t alc861vd_dac_nids
[4] = {
16506 /* front, surr, clfe, side surr */
16507 0x02, 0x03, 0x04, 0x05
16510 /* dac_nids for ALC660vd are in a different order - according to
16511 * Realtek's driver.
16512 * This should probably result in a different mixer for 6stack models
16513 * of ALC660vd codecs, but for now there is only 3stack mixer
16514 * - and it is the same as in 861vd.
16515 * adc_nids in ALC660vd are (is) the same as in 861vd
16517 static const hda_nid_t alc660vd_dac_nids
[3] = {
16518 /* front, rear, clfe, rear_surr */
16522 static const hda_nid_t alc861vd_adc_nids
[1] = {
16527 static const hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
16530 /* FIXME: should be a matrix-type input source selection */
16531 static const struct hda_input_mux alc861vd_capture_source
= {
16535 { "Front Mic", 0x1 },
16541 static const struct hda_input_mux alc861vd_dallas_capture_source
= {
16545 { "Internal Mic", 0x1 },
16549 static const struct hda_input_mux alc861vd_hp_capture_source
= {
16552 { "Front Mic", 0x0 },
16553 { "ATAPI Mic", 0x1 },
16560 static const struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
16567 static const struct hda_verb alc861vd_6stack_ch6_init
[] = {
16568 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
16569 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16570 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16571 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16578 static const struct hda_verb alc861vd_6stack_ch8_init
[] = {
16579 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16580 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16581 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16582 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16586 static const struct hda_channel_mode alc861vd_6stack_modes
[2] = {
16587 { 6, alc861vd_6stack_ch6_init
},
16588 { 8, alc861vd_6stack_ch8_init
},
16591 static const struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
16593 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
16594 .name
= "Channel Mode",
16595 .info
= alc_ch_mode_info
,
16596 .get
= alc_ch_mode_get
,
16597 .put
= alc_ch_mode_put
,
16602 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16603 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16605 static const struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
16606 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16607 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16609 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16610 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
16612 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16614 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16616 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
16617 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
16619 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
16620 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
16622 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16624 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16626 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16628 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16629 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16630 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16632 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16633 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16635 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16636 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16641 static const struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
16642 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16643 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16645 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16647 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16648 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16649 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16651 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16652 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16653 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16655 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16656 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16658 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16659 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16664 static const struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
16665 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16666 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16667 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
16669 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16671 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16672 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16673 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16675 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16676 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16677 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16679 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16680 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16685 /* Pin assignment: Speaker=0x14, HP = 0x15,
16686 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16688 static const struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
16689 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16690 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
16691 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16692 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
16693 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16695 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16696 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16697 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16698 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16702 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16703 * Front Mic=0x18, ATAPI Mic = 0x19,
16705 static const struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
16706 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16707 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16708 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16709 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
16710 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16711 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16712 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16713 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16719 * generic initialization of ADC, input mixers and output mixers
16721 static const struct hda_verb alc861vd_volume_init_verbs
[] = {
16723 * Unmute ADC0 and set the default input to mic-in
16725 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16726 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16728 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16729 * the analog-loopback mixer widget
16731 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16736 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16738 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16741 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
16742 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
16745 * Set up output mixers (0x02 - 0x05)
16747 /* set vol=0 to output mixers */
16748 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16749 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16750 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16751 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16753 /* set up input amps for analog loopback */
16754 /* Amp Indices: DAC = 0, mixer = 1 */
16755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16757 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16758 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16759 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16760 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16761 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16762 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16768 * 3-stack pin configuration:
16769 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16771 static const struct hda_verb alc861vd_3stack_init_verbs
[] = {
16773 * Set pin mode and muting
16775 /* set front pin widgets 0x14 for output */
16776 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16777 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16778 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
16780 /* Mic (rear) pin: input vref at 80% */
16781 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16782 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16783 /* Front Mic pin: input vref at 80% */
16784 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16785 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16786 /* Line In pin: input */
16787 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16788 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16789 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16790 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16791 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16792 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16793 /* CD pin widget for input */
16794 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16800 * 6-stack pin configuration:
16802 static const struct hda_verb alc861vd_6stack_init_verbs
[] = {
16804 * Set pin mode and muting
16806 /* set front pin widgets 0x14 for output */
16807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16809 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
16811 /* Rear Pin: output 1 (0x0d) */
16812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16814 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
16815 /* CLFE Pin: output 2 (0x0e) */
16816 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16817 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16818 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
16819 /* Side Pin: output 3 (0x0f) */
16820 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16822 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
16824 /* Mic (rear) pin: input vref at 80% */
16825 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16826 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16827 /* Front Mic pin: input vref at 80% */
16828 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16829 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16830 /* Line In pin: input */
16831 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16832 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16833 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16834 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16835 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16836 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16837 /* CD pin widget for input */
16838 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16843 static const struct hda_verb alc861vd_eapd_verbs
[] = {
16844 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16848 static const struct hda_verb alc660vd_eapd_verbs
[] = {
16849 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16850 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16854 static const struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
16855 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16856 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
16858 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16859 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16863 static void alc861vd_lenovo_setup(struct hda_codec
*codec
)
16865 struct alc_spec
*spec
= codec
->spec
;
16866 spec
->autocfg
.hp_pins
[0] = 0x1b;
16867 spec
->autocfg
.speaker_pins
[0] = 0x14;
16868 spec
->automute
= 1;
16869 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
16872 static void alc861vd_lenovo_init_hook(struct hda_codec
*codec
)
16874 alc_hp_automute(codec
);
16875 alc88x_simple_mic_automute(codec
);
16878 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
16881 switch (res
>> 26) {
16882 case ALC880_MIC_EVENT
:
16883 alc88x_simple_mic_automute(codec
);
16886 alc_sku_unsol_event(codec
, res
);
16891 static const struct hda_verb alc861vd_dallas_verbs
[] = {
16892 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16893 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16894 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16895 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16897 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16898 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16899 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16900 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16901 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16902 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16903 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16904 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16906 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16907 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16908 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16909 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16910 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16911 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16912 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16913 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16915 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16916 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16917 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16918 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16919 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16920 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16921 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16922 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16924 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16927 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16929 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16930 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16931 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16936 /* toggle speaker-output according to the hp-jack state */
16937 static void alc861vd_dallas_setup(struct hda_codec
*codec
)
16939 struct alc_spec
*spec
= codec
->spec
;
16941 spec
->autocfg
.hp_pins
[0] = 0x15;
16942 spec
->autocfg
.speaker_pins
[0] = 0x14;
16943 spec
->automute
= 1;
16944 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
16947 #ifdef CONFIG_SND_HDA_POWER_SAVE
16948 #define alc861vd_loopbacks alc880_loopbacks
16951 /* pcm configuration: identical with ALC880 */
16952 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16953 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16954 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16955 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16958 * configuration and preset
16960 static const char * const alc861vd_models
[ALC861VD_MODEL_LAST
] = {
16961 [ALC660VD_3ST
] = "3stack-660",
16962 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
16963 [ALC660VD_ASUS_V1S
] = "asus-v1s",
16964 [ALC861VD_3ST
] = "3stack",
16965 [ALC861VD_3ST_DIG
] = "3stack-digout",
16966 [ALC861VD_6ST_DIG
] = "6stack-digout",
16967 [ALC861VD_LENOVO
] = "lenovo",
16968 [ALC861VD_DALLAS
] = "dallas",
16969 [ALC861VD_HP
] = "hp",
16970 [ALC861VD_AUTO
] = "auto",
16973 static const struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
16974 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
16975 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
16976 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
16977 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16978 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S
),
16979 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
16980 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
16981 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
16982 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16983 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO
),
16984 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
16985 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
16986 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
16987 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO
),
16988 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
16992 static const struct alc_config_preset alc861vd_presets
[] = {
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 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17000 .channel_mode
= alc861vd_3stack_2ch_modes
,
17001 .input_mux
= &alc861vd_capture_source
,
17003 [ALC660VD_3ST_DIG
] = {
17004 .mixers
= { alc861vd_3st_mixer
},
17005 .init_verbs
= { alc861vd_volume_init_verbs
,
17006 alc861vd_3stack_init_verbs
},
17007 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
17008 .dac_nids
= alc660vd_dac_nids
,
17009 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17010 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17011 .channel_mode
= alc861vd_3stack_2ch_modes
,
17012 .input_mux
= &alc861vd_capture_source
,
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 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17021 .channel_mode
= alc861vd_3stack_2ch_modes
,
17022 .input_mux
= &alc861vd_capture_source
,
17024 [ALC861VD_3ST_DIG
] = {
17025 .mixers
= { alc861vd_3st_mixer
},
17026 .init_verbs
= { alc861vd_volume_init_verbs
,
17027 alc861vd_3stack_init_verbs
},
17028 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17029 .dac_nids
= alc861vd_dac_nids
,
17030 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17031 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17032 .channel_mode
= alc861vd_3stack_2ch_modes
,
17033 .input_mux
= &alc861vd_capture_source
,
17035 [ALC861VD_6ST_DIG
] = {
17036 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
17037 .init_verbs
= { alc861vd_volume_init_verbs
,
17038 alc861vd_6stack_init_verbs
},
17039 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17040 .dac_nids
= alc861vd_dac_nids
,
17041 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17042 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
17043 .channel_mode
= alc861vd_6stack_modes
,
17044 .input_mux
= &alc861vd_capture_source
,
17046 [ALC861VD_LENOVO
] = {
17047 .mixers
= { alc861vd_lenovo_mixer
},
17048 .init_verbs
= { alc861vd_volume_init_verbs
,
17049 alc861vd_3stack_init_verbs
,
17050 alc861vd_eapd_verbs
,
17051 alc861vd_lenovo_unsol_verbs
},
17052 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
17053 .dac_nids
= alc660vd_dac_nids
,
17054 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17055 .channel_mode
= alc861vd_3stack_2ch_modes
,
17056 .input_mux
= &alc861vd_capture_source
,
17057 .unsol_event
= alc861vd_lenovo_unsol_event
,
17058 .setup
= alc861vd_lenovo_setup
,
17059 .init_hook
= alc861vd_lenovo_init_hook
,
17061 [ALC861VD_DALLAS
] = {
17062 .mixers
= { alc861vd_dallas_mixer
},
17063 .init_verbs
= { alc861vd_dallas_verbs
},
17064 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17065 .dac_nids
= alc861vd_dac_nids
,
17066 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17067 .channel_mode
= alc861vd_3stack_2ch_modes
,
17068 .input_mux
= &alc861vd_dallas_capture_source
,
17069 .unsol_event
= alc_sku_unsol_event
,
17070 .setup
= alc861vd_dallas_setup
,
17071 .init_hook
= alc_hp_automute
,
17074 .mixers
= { alc861vd_hp_mixer
},
17075 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
17076 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
17077 .dac_nids
= alc861vd_dac_nids
,
17078 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17079 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17080 .channel_mode
= alc861vd_3stack_2ch_modes
,
17081 .input_mux
= &alc861vd_hp_capture_source
,
17082 .unsol_event
= alc_sku_unsol_event
,
17083 .setup
= alc861vd_dallas_setup
,
17084 .init_hook
= alc_hp_automute
,
17086 [ALC660VD_ASUS_V1S
] = {
17087 .mixers
= { alc861vd_lenovo_mixer
},
17088 .init_verbs
= { alc861vd_volume_init_verbs
,
17089 alc861vd_3stack_init_verbs
,
17090 alc861vd_eapd_verbs
,
17091 alc861vd_lenovo_unsol_verbs
},
17092 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
17093 .dac_nids
= alc660vd_dac_nids
,
17094 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
17095 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
17096 .channel_mode
= alc861vd_3stack_2ch_modes
,
17097 .input_mux
= &alc861vd_capture_source
,
17098 .unsol_event
= alc861vd_lenovo_unsol_event
,
17099 .setup
= alc861vd_lenovo_setup
,
17100 .init_hook
= alc861vd_lenovo_init_hook
,
17105 * BIOS auto configuration
17107 static int alc861vd_auto_create_input_ctls(struct hda_codec
*codec
,
17108 const struct auto_pin_cfg
*cfg
)
17110 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x22, 0);
17114 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
17115 hda_nid_t nid
, int pin_type
, int dac_idx
)
17117 alc_set_pin_output(codec
, nid
, pin_type
);
17120 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
17122 struct alc_spec
*spec
= codec
->spec
;
17125 for (i
= 0; i
<= HDA_SIDE
; i
++) {
17126 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
17127 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
17129 alc861vd_auto_set_output_and_unmute(codec
, nid
,
17135 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
17137 struct alc_spec
*spec
= codec
->spec
;
17140 pin
= spec
->autocfg
.hp_pins
[0];
17141 if (pin
) /* connect to front and use dac 0 */
17142 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
17143 pin
= spec
->autocfg
.speaker_pins
[0];
17145 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
17148 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17150 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
17152 struct alc_spec
*spec
= codec
->spec
;
17153 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
17156 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
17157 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
17158 if (alc_is_input_pin(codec
, nid
)) {
17159 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
17160 if (nid
!= ALC861VD_PIN_CD_NID
&&
17161 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
17162 snd_hda_codec_write(codec
, nid
, 0,
17163 AC_VERB_SET_AMP_GAIN_MUTE
,
17169 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17171 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17172 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17174 /* add playback controls from the parsed DAC table */
17175 /* Based on ALC880 version. But ALC861VD has separate,
17176 * different NIDs for mute/unmute switch and volume control */
17177 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
17178 const struct auto_pin_cfg
*cfg
)
17180 static const char * const chname
[4] = {
17181 "Front", "Surround", "CLFE", "Side"
17183 const char *pfx
= alc_get_line_out_pfx(spec
, true);
17184 hda_nid_t nid_v
, nid_s
;
17185 int i
, err
, noutputs
;
17187 noutputs
= cfg
->line_outs
;
17188 if (spec
->multi_ios
> 0)
17189 noutputs
+= spec
->multi_ios
;
17191 for (i
= 0; i
< noutputs
; i
++) {
17192 if (!spec
->multiout
.dac_nids
[i
])
17194 nid_v
= alc861vd_idx_to_mixer_vol(
17196 spec
->multiout
.dac_nids
[i
]));
17197 nid_s
= alc861vd_idx_to_mixer_switch(
17199 spec
->multiout
.dac_nids
[i
]));
17201 if (!pfx
&& i
== 2) {
17203 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17205 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
17209 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17211 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
17215 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17217 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
17221 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17223 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
17228 const char *name
= pfx
;
17234 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
17236 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
17240 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
17242 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
17251 /* add playback controls for speaker and HP outputs */
17252 /* Based on ALC880 version. But ALC861VD has separate,
17253 * different NIDs for mute/unmute switch and volume control */
17254 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
17255 hda_nid_t pin
, const char *pfx
)
17257 hda_nid_t nid_v
, nid_s
;
17263 if (alc880_is_fixed_pin(pin
)) {
17264 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
17265 /* specify the DAC as the extra output */
17266 if (!spec
->multiout
.hp_nid
)
17267 spec
->multiout
.hp_nid
= nid_v
;
17269 spec
->multiout
.extra_out_nid
[0] = nid_v
;
17270 /* control HP volume/switch on the output mixer amp */
17271 nid_v
= alc861vd_idx_to_mixer_vol(
17272 alc880_fixed_pin_idx(pin
));
17273 nid_s
= alc861vd_idx_to_mixer_switch(
17274 alc880_fixed_pin_idx(pin
));
17276 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
17277 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
17280 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
17281 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
17284 } else if (alc880_is_multi_pin(pin
)) {
17285 /* set manual connection */
17286 /* we have only a switch on HP-out PIN */
17287 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
17288 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
17295 /* parse the BIOS configuration and set up the alc_spec
17296 * return 1 if successful, 0 if the proper config is not found,
17297 * or a negative error code
17298 * Based on ALC880 version - had to change it to override
17299 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17300 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
17302 struct alc_spec
*spec
= codec
->spec
;
17304 static const hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
17306 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
17310 if (!spec
->autocfg
.line_outs
)
17311 return 0; /* can't find valid BIOS pin config */
17313 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
17316 err
= alc_auto_add_multi_channel_mode(codec
);
17319 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
17322 err
= alc861vd_auto_create_extra_out(spec
,
17323 spec
->autocfg
.speaker_pins
[0],
17327 err
= alc861vd_auto_create_extra_out(spec
,
17328 spec
->autocfg
.hp_pins
[0],
17332 err
= alc861vd_auto_create_input_ctls(codec
, &spec
->autocfg
);
17336 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
17338 alc_auto_parse_digital(codec
);
17340 if (spec
->kctls
.list
)
17341 add_mixer(spec
, spec
->kctls
.list
);
17343 add_verb(spec
, alc861vd_volume_init_verbs
);
17345 spec
->num_mux_defs
= 1;
17346 spec
->input_mux
= &spec
->private_imux
[0];
17348 err
= alc_auto_add_mic_boost(codec
);
17352 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
17357 /* additional initialization for auto-configuration model */
17358 static void alc861vd_auto_init(struct hda_codec
*codec
)
17360 struct alc_spec
*spec
= codec
->spec
;
17361 alc861vd_auto_init_multi_out(codec
);
17362 alc861vd_auto_init_hp_out(codec
);
17363 alc861vd_auto_init_analog_input(codec
);
17364 alc861vd_auto_init_input_src(codec
);
17365 alc_auto_init_digital(codec
);
17366 if (spec
->unsol_event
)
17367 alc_inithook(codec
);
17371 ALC660VD_FIX_ASUS_GPIO1
17375 static const struct alc_fixup alc861vd_fixups
[] = {
17376 [ALC660VD_FIX_ASUS_GPIO1
] = {
17377 .type
= ALC_FIXUP_VERBS
,
17378 .v
.verbs
= (const struct hda_verb
[]) {
17379 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
17380 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
17381 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
17387 static const struct snd_pci_quirk alc861vd_fixup_tbl
[] = {
17388 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1
),
17392 static int patch_alc861vd(struct hda_codec
*codec
)
17394 struct alc_spec
*spec
;
17395 int err
, board_config
;
17397 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
17401 codec
->spec
= spec
;
17403 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
17407 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
17408 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
17410 board_config
= ALC861VD_AUTO
;
17413 if (board_config
== ALC861VD_AUTO
) {
17414 alc_pick_fixup(codec
, NULL
, alc861vd_fixup_tbl
, alc861vd_fixups
);
17415 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
17418 if (board_config
== ALC861VD_AUTO
) {
17419 /* automatic parse from the BIOS config */
17420 err
= alc861vd_parse_auto_config(codec
);
17426 "hda_codec: Cannot set up configuration "
17427 "from BIOS. Using base mode...\n");
17428 board_config
= ALC861VD_3ST
;
17432 err
= snd_hda_attach_beep_device(codec
, 0x23);
17438 if (board_config
!= ALC861VD_AUTO
)
17439 setup_preset(codec
, &alc861vd_presets
[board_config
]);
17441 if (codec
->vendor_id
== 0x10ec0660) {
17442 /* always turn on EAPD */
17443 add_verb(spec
, alc660vd_eapd_verbs
);
17446 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
17447 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
17449 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
17450 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
17452 if (!spec
->adc_nids
) {
17453 spec
->adc_nids
= alc861vd_adc_nids
;
17454 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
17456 if (!spec
->capsrc_nids
)
17457 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
17459 set_capture_mixer(codec
);
17460 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
17462 spec
->vmaster_nid
= 0x02;
17464 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
17466 codec
->patch_ops
= alc_patch_ops
;
17468 if (board_config
== ALC861VD_AUTO
)
17469 spec
->init_hook
= alc861vd_auto_init
;
17470 spec
->shutup
= alc_eapd_shutup
;
17471 #ifdef CONFIG_SND_HDA_POWER_SAVE
17472 if (!spec
->loopback
.amplist
)
17473 spec
->loopback
.amplist
= alc861vd_loopbacks
;
17482 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17483 * configuration. Each pin widget can choose any input DACs and a mixer.
17484 * Each ADC is connected from a mixer of all inputs. This makes possible
17485 * 6-channel independent captures.
17487 * In addition, an independent DAC for the multi-playback (not used in this
17490 #define ALC662_DIGOUT_NID 0x06
17491 #define ALC662_DIGIN_NID 0x0a
17493 static const hda_nid_t alc662_dac_nids
[3] = {
17494 /* front, rear, clfe */
17498 static const hda_nid_t alc272_dac_nids
[2] = {
17502 static const hda_nid_t alc662_adc_nids
[2] = {
17507 static const hda_nid_t alc272_adc_nids
[1] = {
17512 static const hda_nid_t alc662_capsrc_nids
[2] = { 0x22, 0x23 };
17513 static const hda_nid_t alc272_capsrc_nids
[1] = { 0x23 };
17517 /* FIXME: should be a matrix-type input source selection */
17518 static const struct hda_input_mux alc662_capture_source
= {
17522 { "Front Mic", 0x1 },
17528 static const struct hda_input_mux alc662_lenovo_101e_capture_source
= {
17536 static const struct hda_input_mux alc663_capture_source
= {
17540 { "Front Mic", 0x1 },
17545 #if 0 /* set to 1 for testing other input sources below */
17546 static const struct hda_input_mux alc272_nc10_capture_source
= {
17549 { "Autoselect Mic", 0x0 },
17550 { "Internal Mic", 0x1 },
17551 { "In-0x02", 0x2 },
17552 { "In-0x03", 0x3 },
17553 { "In-0x04", 0x4 },
17554 { "In-0x05", 0x5 },
17555 { "In-0x06", 0x6 },
17556 { "In-0x07", 0x7 },
17557 { "In-0x08", 0x8 },
17558 { "In-0x09", 0x9 },
17559 { "In-0x0a", 0x0a },
17560 { "In-0x0b", 0x0b },
17561 { "In-0x0c", 0x0c },
17562 { "In-0x0d", 0x0d },
17563 { "In-0x0e", 0x0e },
17564 { "In-0x0f", 0x0f },
17572 static const struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
17579 static const struct hda_verb alc662_3ST_ch2_init
[] = {
17580 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17581 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17582 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17583 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17590 static const struct hda_verb alc662_3ST_ch6_init
[] = {
17591 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17592 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17593 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
17594 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17595 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17596 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
17600 static const struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
17601 { 2, alc662_3ST_ch2_init
},
17602 { 6, alc662_3ST_ch6_init
},
17608 static const struct hda_verb alc662_sixstack_ch6_init
[] = {
17609 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
17610 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
17611 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17618 static const struct hda_verb alc662_sixstack_ch8_init
[] = {
17619 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17620 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17621 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17625 static const struct hda_channel_mode alc662_5stack_modes
[2] = {
17626 { 2, alc662_sixstack_ch6_init
},
17627 { 6, alc662_sixstack_ch8_init
},
17630 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17631 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17634 static const struct snd_kcontrol_new alc662_base_mixer
[] = {
17635 /* output mixer control */
17636 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
17637 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17638 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
17639 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
17640 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17641 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17642 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
17643 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
17644 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17646 /*Input mixer control */
17647 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
17648 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
17649 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
17650 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
17651 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
17652 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
17653 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
17654 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
17658 static const struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
17659 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17660 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17661 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17662 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
17663 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
17664 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17665 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17667 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17668 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17669 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17673 static const struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
17674 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17675 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17676 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17677 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
17678 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17679 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17680 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
17681 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
17682 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17683 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
17684 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
17685 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17686 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17687 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17688 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17689 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17690 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17694 static const struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
17695 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17696 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
17697 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17698 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
17699 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17700 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17701 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17702 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17703 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17707 static const struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
17708 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17709 ALC262_HIPPO_MASTER_SWITCH
,
17711 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
17712 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17715 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
17716 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17717 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17721 static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
17722 ALC262_HIPPO_MASTER_SWITCH
,
17723 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17724 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17725 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17726 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17727 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
17728 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17729 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17735 static const struct hda_bind_ctls alc663_asus_bind_master_vol
= {
17736 .ops
= &snd_hda_bind_vol
,
17738 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
17739 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
17744 static const struct hda_bind_ctls alc663_asus_one_bind_switch
= {
17745 .ops
= &snd_hda_bind_sw
,
17747 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17748 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17753 static const struct snd_kcontrol_new alc663_m51va_mixer
[] = {
17754 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17755 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch
),
17756 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17761 static const struct hda_bind_ctls alc663_asus_tree_bind_switch
= {
17762 .ops
= &snd_hda_bind_sw
,
17764 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17765 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17766 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17771 static const struct snd_kcontrol_new alc663_two_hp_m1_mixer
[] = {
17772 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17773 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch
),
17774 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17776 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17777 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17782 static const struct hda_bind_ctls alc663_asus_four_bind_switch
= {
17783 .ops
= &snd_hda_bind_sw
,
17785 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17786 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17787 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17792 static const struct snd_kcontrol_new alc663_two_hp_m2_mixer
[] = {
17793 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17794 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch
),
17795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17797 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17798 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17802 static const struct snd_kcontrol_new alc662_1bjd_mixer
[] = {
17803 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17804 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17805 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17806 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17807 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17808 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17809 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17813 static const struct hda_bind_ctls alc663_asus_two_bind_master_vol
= {
17814 .ops
= &snd_hda_bind_vol
,
17816 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
17817 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT
),
17822 static const struct hda_bind_ctls alc663_asus_two_bind_switch
= {
17823 .ops
= &snd_hda_bind_sw
,
17825 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17826 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT
),
17831 static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer
[] = {
17832 HDA_BIND_VOL("Master Playback Volume",
17833 &alc663_asus_two_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", 0x21, 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_asus_15jd_clfe_mixer
[] = {
17843 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17844 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
17845 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17846 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17852 static const struct snd_kcontrol_new alc663_g71v_mixer
[] = {
17853 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17854 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17855 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17856 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17857 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17861 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17862 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17866 static const struct snd_kcontrol_new alc663_g50v_mixer
[] = {
17867 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17868 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17869 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17871 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17872 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17873 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17874 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17875 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17876 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17880 static const struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch
= {
17881 .ops
= &snd_hda_bind_sw
,
17883 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17884 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17885 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17886 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17887 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17892 static const struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch
= {
17893 .ops
= &snd_hda_bind_sw
,
17895 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17896 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17901 static const struct snd_kcontrol_new alc663_mode7_mixer
[] = {
17902 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17903 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17904 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17905 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17906 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17907 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17908 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17909 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17910 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17914 static const struct snd_kcontrol_new alc663_mode8_mixer
[] = {
17915 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17916 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17917 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17918 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17919 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17926 static const struct snd_kcontrol_new alc662_chmode_mixer
[] = {
17928 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
17929 .name
= "Channel Mode",
17930 .info
= alc_ch_mode_info
,
17931 .get
= alc_ch_mode_get
,
17932 .put
= alc_ch_mode_put
,
17937 static const struct hda_verb alc662_init_verbs
[] = {
17938 /* ADC: mute amp left and right */
17939 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17940 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
17942 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17944 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17945 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17946 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17947 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17949 /* Front Pin: output 0 (0x0c) */
17950 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17951 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17953 /* Rear Pin: output 1 (0x0d) */
17954 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17957 /* CLFE Pin: output 2 (0x0e) */
17958 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17959 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17961 /* Mic (rear) pin: input vref at 80% */
17962 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17963 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17964 /* Front Mic pin: input vref at 80% */
17965 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17966 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17967 /* Line In pin: input */
17968 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17969 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17970 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17971 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17972 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17973 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
17974 /* CD pin widget for input */
17975 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17977 /* FIXME: use matrix-type input source selection */
17978 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17981 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17986 static const struct hda_verb alc662_eapd_init_verbs
[] = {
17987 /* always trun on EAPD */
17988 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17989 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17993 static const struct hda_verb alc662_sue_init_verbs
[] = {
17994 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
17995 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
17999 static const struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
18000 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18001 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18005 /* Set Unsolicited Event*/
18006 static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
18007 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
18008 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18012 static const struct hda_verb alc663_m51va_init_verbs
[] = {
18013 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18014 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18015 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18016 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18017 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18018 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18020 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18021 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18025 static const struct hda_verb alc663_21jd_amic_init_verbs
[] = {
18026 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18027 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18028 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18030 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18031 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18032 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18036 static const struct hda_verb alc662_1bjd_amic_init_verbs
[] = {
18037 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18038 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18039 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18040 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
18041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18042 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18043 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18044 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18048 static const struct hda_verb alc663_15jd_amic_init_verbs
[] = {
18049 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18051 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18053 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18054 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18055 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18059 static const struct hda_verb alc663_two_hp_amic_m1_init_verbs
[] = {
18060 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18061 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18062 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18063 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
18064 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18066 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
18067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18069 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18070 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18071 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18075 static const struct hda_verb alc663_two_hp_amic_m2_init_verbs
[] = {
18076 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18077 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18078 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18079 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18080 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18081 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18082 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
18085 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18086 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18087 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18091 static const struct hda_verb alc663_g71v_init_verbs
[] = {
18092 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18093 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18094 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18096 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18097 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18098 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
18100 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
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 alc663_g50v_init_verbs
[] = {
18107 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18108 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18109 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
18111 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18112 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18116 static const struct hda_verb alc662_ecs_init_verbs
[] = {
18117 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
18118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18119 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18120 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18124 static const struct hda_verb alc272_dell_zm1_init_verbs
[] = {
18125 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18126 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18127 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18128 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18129 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18130 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18131 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18133 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18134 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18135 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18139 static const struct hda_verb alc272_dell_init_verbs
[] = {
18140 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18141 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18143 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18144 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18145 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18146 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18147 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18148 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18149 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18150 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18154 static const struct hda_verb alc663_mode7_init_verbs
[] = {
18155 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18156 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18157 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
18158 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18159 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18160 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18161 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
18162 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18163 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18164 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18165 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18166 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18167 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18168 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18169 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18173 static const struct hda_verb alc663_mode8_init_verbs
[] = {
18174 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18177 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
18178 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18179 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
18180 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18181 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
18182 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
18183 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
18184 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
18185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
18186 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
18187 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18188 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
18189 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
18193 static const struct snd_kcontrol_new alc662_auto_capture_mixer
[] = {
18194 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
18195 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
18199 static const struct snd_kcontrol_new alc272_auto_capture_mixer
[] = {
18200 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
18201 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
18205 static void alc662_lenovo_101e_setup(struct hda_codec
*codec
)
18207 struct alc_spec
*spec
= codec
->spec
;
18209 spec
->autocfg
.hp_pins
[0] = 0x1b;
18210 spec
->autocfg
.line_out_pins
[0] = 0x14;
18211 spec
->autocfg
.speaker_pins
[0] = 0x15;
18212 spec
->automute
= 1;
18213 spec
->detect_line
= 1;
18214 spec
->automute_lines
= 1;
18215 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
18218 static void alc662_eeepc_setup(struct hda_codec
*codec
)
18220 struct alc_spec
*spec
= codec
->spec
;
18222 alc262_hippo1_setup(codec
);
18223 spec
->ext_mic
.pin
= 0x18;
18224 spec
->ext_mic
.mux_idx
= 0;
18225 spec
->int_mic
.pin
= 0x19;
18226 spec
->int_mic
.mux_idx
= 1;
18227 spec
->auto_mic
= 1;
18230 static void alc662_eeepc_ep20_setup(struct hda_codec
*codec
)
18232 struct alc_spec
*spec
= codec
->spec
;
18234 spec
->autocfg
.hp_pins
[0] = 0x14;
18235 spec
->autocfg
.speaker_pins
[0] = 0x1b;
18236 spec
->automute
= 1;
18237 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
18240 static void alc663_m51va_setup(struct hda_codec
*codec
)
18242 struct alc_spec
*spec
= codec
->spec
;
18243 spec
->autocfg
.hp_pins
[0] = 0x21;
18244 spec
->autocfg
.speaker_pins
[0] = 0x14;
18245 spec
->automute_mixer_nid
[0] = 0x0c;
18246 spec
->automute
= 1;
18247 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
18248 spec
->ext_mic
.pin
= 0x18;
18249 spec
->ext_mic
.mux_idx
= 0;
18250 spec
->int_mic
.pin
= 0x12;
18251 spec
->int_mic
.mux_idx
= 9;
18252 spec
->auto_mic
= 1;
18255 /* ***************** Mode1 ******************************/
18256 static void alc663_mode1_setup(struct hda_codec
*codec
)
18258 struct alc_spec
*spec
= codec
->spec
;
18259 spec
->autocfg
.hp_pins
[0] = 0x21;
18260 spec
->autocfg
.speaker_pins
[0] = 0x14;
18261 spec
->automute_mixer_nid
[0] = 0x0c;
18262 spec
->automute
= 1;
18263 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
18264 spec
->ext_mic
.pin
= 0x18;
18265 spec
->ext_mic
.mux_idx
= 0;
18266 spec
->int_mic
.pin
= 0x19;
18267 spec
->int_mic
.mux_idx
= 1;
18268 spec
->auto_mic
= 1;
18271 /* ***************** Mode2 ******************************/
18272 static void alc662_mode2_setup(struct hda_codec
*codec
)
18274 struct alc_spec
*spec
= codec
->spec
;
18275 spec
->autocfg
.hp_pins
[0] = 0x1b;
18276 spec
->autocfg
.speaker_pins
[0] = 0x14;
18277 spec
->automute
= 1;
18278 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
18279 spec
->ext_mic
.pin
= 0x18;
18280 spec
->ext_mic
.mux_idx
= 0;
18281 spec
->int_mic
.pin
= 0x19;
18282 spec
->int_mic
.mux_idx
= 1;
18283 spec
->auto_mic
= 1;
18286 /* ***************** Mode3 ******************************/
18287 static void alc663_mode3_setup(struct hda_codec
*codec
)
18289 struct alc_spec
*spec
= codec
->spec
;
18290 spec
->autocfg
.hp_pins
[0] = 0x21;
18291 spec
->autocfg
.hp_pins
[0] = 0x15;
18292 spec
->autocfg
.speaker_pins
[0] = 0x14;
18293 spec
->automute
= 1;
18294 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
18295 spec
->ext_mic
.pin
= 0x18;
18296 spec
->ext_mic
.mux_idx
= 0;
18297 spec
->int_mic
.pin
= 0x19;
18298 spec
->int_mic
.mux_idx
= 1;
18299 spec
->auto_mic
= 1;
18302 /* ***************** Mode4 ******************************/
18303 static void alc663_mode4_setup(struct hda_codec
*codec
)
18305 struct alc_spec
*spec
= codec
->spec
;
18306 spec
->autocfg
.hp_pins
[0] = 0x21;
18307 spec
->autocfg
.speaker_pins
[0] = 0x14;
18308 spec
->autocfg
.speaker_pins
[1] = 0x16;
18309 spec
->automute_mixer_nid
[0] = 0x0c;
18310 spec
->automute_mixer_nid
[1] = 0x0e;
18311 spec
->automute
= 1;
18312 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
18313 spec
->ext_mic
.pin
= 0x18;
18314 spec
->ext_mic
.mux_idx
= 0;
18315 spec
->int_mic
.pin
= 0x19;
18316 spec
->int_mic
.mux_idx
= 1;
18317 spec
->auto_mic
= 1;
18320 /* ***************** Mode5 ******************************/
18321 static void alc663_mode5_setup(struct hda_codec
*codec
)
18323 struct alc_spec
*spec
= codec
->spec
;
18324 spec
->autocfg
.hp_pins
[0] = 0x15;
18325 spec
->autocfg
.speaker_pins
[0] = 0x14;
18326 spec
->autocfg
.speaker_pins
[1] = 0x16;
18327 spec
->automute_mixer_nid
[0] = 0x0c;
18328 spec
->automute_mixer_nid
[1] = 0x0e;
18329 spec
->automute
= 1;
18330 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
18331 spec
->ext_mic
.pin
= 0x18;
18332 spec
->ext_mic
.mux_idx
= 0;
18333 spec
->int_mic
.pin
= 0x19;
18334 spec
->int_mic
.mux_idx
= 1;
18335 spec
->auto_mic
= 1;
18338 /* ***************** Mode6 ******************************/
18339 static void alc663_mode6_setup(struct hda_codec
*codec
)
18341 struct alc_spec
*spec
= codec
->spec
;
18342 spec
->autocfg
.hp_pins
[0] = 0x1b;
18343 spec
->autocfg
.hp_pins
[0] = 0x15;
18344 spec
->autocfg
.speaker_pins
[0] = 0x14;
18345 spec
->automute_mixer_nid
[0] = 0x0c;
18346 spec
->automute
= 1;
18347 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
18348 spec
->ext_mic
.pin
= 0x18;
18349 spec
->ext_mic
.mux_idx
= 0;
18350 spec
->int_mic
.pin
= 0x19;
18351 spec
->int_mic
.mux_idx
= 1;
18352 spec
->auto_mic
= 1;
18355 /* ***************** Mode7 ******************************/
18356 static void alc663_mode7_setup(struct hda_codec
*codec
)
18358 struct alc_spec
*spec
= codec
->spec
;
18359 spec
->autocfg
.hp_pins
[0] = 0x1b;
18360 spec
->autocfg
.hp_pins
[0] = 0x21;
18361 spec
->autocfg
.speaker_pins
[0] = 0x14;
18362 spec
->autocfg
.speaker_pins
[0] = 0x17;
18363 spec
->automute
= 1;
18364 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
18365 spec
->ext_mic
.pin
= 0x18;
18366 spec
->ext_mic
.mux_idx
= 0;
18367 spec
->int_mic
.pin
= 0x19;
18368 spec
->int_mic
.mux_idx
= 1;
18369 spec
->auto_mic
= 1;
18372 /* ***************** Mode8 ******************************/
18373 static void alc663_mode8_setup(struct hda_codec
*codec
)
18375 struct alc_spec
*spec
= codec
->spec
;
18376 spec
->autocfg
.hp_pins
[0] = 0x21;
18377 spec
->autocfg
.hp_pins
[1] = 0x15;
18378 spec
->autocfg
.speaker_pins
[0] = 0x14;
18379 spec
->autocfg
.speaker_pins
[0] = 0x17;
18380 spec
->automute
= 1;
18381 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
18382 spec
->ext_mic
.pin
= 0x18;
18383 spec
->ext_mic
.mux_idx
= 0;
18384 spec
->int_mic
.pin
= 0x12;
18385 spec
->int_mic
.mux_idx
= 9;
18386 spec
->auto_mic
= 1;
18389 static void alc663_g71v_setup(struct hda_codec
*codec
)
18391 struct alc_spec
*spec
= codec
->spec
;
18392 spec
->autocfg
.hp_pins
[0] = 0x21;
18393 spec
->autocfg
.line_out_pins
[0] = 0x15;
18394 spec
->autocfg
.speaker_pins
[0] = 0x14;
18395 spec
->automute
= 1;
18396 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
18397 spec
->detect_line
= 1;
18398 spec
->automute_lines
= 1;
18399 spec
->ext_mic
.pin
= 0x18;
18400 spec
->ext_mic
.mux_idx
= 0;
18401 spec
->int_mic
.pin
= 0x12;
18402 spec
->int_mic
.mux_idx
= 9;
18403 spec
->auto_mic
= 1;
18406 #define alc663_g50v_setup alc663_m51va_setup
18408 static const struct snd_kcontrol_new alc662_ecs_mixer
[] = {
18409 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
18410 ALC262_HIPPO_MASTER_SWITCH
,
18412 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT
),
18413 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT
),
18414 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT
),
18416 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
18417 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
18418 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
18422 static const struct snd_kcontrol_new alc272_nc10_mixer
[] = {
18423 /* Master Playback automatically created from Speaker and Headphone */
18424 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
18425 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
18426 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
18427 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
18429 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
18430 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
18431 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
18433 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
18434 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
18435 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
18439 #ifdef CONFIG_SND_HDA_POWER_SAVE
18440 #define alc662_loopbacks alc880_loopbacks
18444 /* pcm configuration: identical with ALC880 */
18445 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18446 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18447 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18448 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18451 * configuration and preset
18453 static const char * const alc662_models
[ALC662_MODEL_LAST
] = {
18454 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
18455 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
18456 [ALC662_3ST_6ch
] = "3stack-6ch",
18457 [ALC662_5ST_DIG
] = "5stack-dig",
18458 [ALC662_LENOVO_101E
] = "lenovo-101e",
18459 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
18460 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
18461 [ALC662_ECS
] = "ecs",
18462 [ALC663_ASUS_M51VA
] = "m51va",
18463 [ALC663_ASUS_G71V
] = "g71v",
18464 [ALC663_ASUS_H13
] = "h13",
18465 [ALC663_ASUS_G50V
] = "g50v",
18466 [ALC663_ASUS_MODE1
] = "asus-mode1",
18467 [ALC662_ASUS_MODE2
] = "asus-mode2",
18468 [ALC663_ASUS_MODE3
] = "asus-mode3",
18469 [ALC663_ASUS_MODE4
] = "asus-mode4",
18470 [ALC663_ASUS_MODE5
] = "asus-mode5",
18471 [ALC663_ASUS_MODE6
] = "asus-mode6",
18472 [ALC663_ASUS_MODE7
] = "asus-mode7",
18473 [ALC663_ASUS_MODE8
] = "asus-mode8",
18474 [ALC272_DELL
] = "dell",
18475 [ALC272_DELL_ZM1
] = "dell-zm1",
18476 [ALC272_SAMSUNG_NC10
] = "samsung-nc10",
18477 [ALC662_AUTO
] = "auto",
18480 static const struct snd_pci_quirk alc662_cfg_tbl
[] = {
18481 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS
),
18482 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL
),
18483 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1
),
18484 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1
),
18485 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3
),
18486 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1
),
18487 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3
),
18488 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1
),
18489 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2
),
18490 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1
),
18491 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1
),
18492 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1
),
18493 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2
),
18494 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7
),
18495 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7
),
18496 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8
),
18497 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3
),
18498 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1
),
18499 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2
),
18500 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2
),
18501 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1
),
18502 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2
),
18503 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6
),
18504 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6
),
18505 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2
),
18506 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1
),
18507 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3
),
18508 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA
),
18509 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2
),
18510 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2
),
18511 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5
),
18512 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6
),
18513 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2
),
18514 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1
),
18515 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2
),
18516 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2
),
18517 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
18518 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18519 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3
),
18520 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3
),
18521 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1
),
18522 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1
),
18523 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1
),
18524 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1
),
18525 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1
),
18526 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2
),
18527 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2
),
18528 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1
),
18529 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1
),
18530 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3
),
18531 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1
),
18532 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1
),
18533 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V
),
18534 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18535 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1
),
18536 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2
),
18537 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA
),
18538 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1
),
18539 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4
),
18540 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
18541 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
18542 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
18543 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS
),
18544 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18545 ALC662_3ST_6ch_DIG
),
18546 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO
),
18547 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10
),
18548 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18549 ALC662_3ST_6ch_DIG
),
18550 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13
),
18551 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG
),
18552 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA
),
18553 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
18554 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18555 ALC662_3ST_6ch_DIG
),
18556 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18558 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E
),
18562 static const struct alc_config_preset alc662_presets
[] = {
18563 [ALC662_3ST_2ch_DIG
] = {
18564 .mixers
= { alc662_3ST_2ch_mixer
},
18565 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18566 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18567 .dac_nids
= alc662_dac_nids
,
18568 .dig_out_nid
= ALC662_DIGOUT_NID
,
18569 .dig_in_nid
= ALC662_DIGIN_NID
,
18570 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18571 .channel_mode
= alc662_3ST_2ch_modes
,
18572 .input_mux
= &alc662_capture_source
,
18574 [ALC662_3ST_6ch_DIG
] = {
18575 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18576 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18577 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18578 .dac_nids
= alc662_dac_nids
,
18579 .dig_out_nid
= ALC662_DIGOUT_NID
,
18580 .dig_in_nid
= ALC662_DIGIN_NID
,
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_3ST_6ch
] = {
18587 .mixers
= { alc662_3ST_6ch_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 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18592 .channel_mode
= alc662_3ST_6ch_modes
,
18594 .input_mux
= &alc662_capture_source
,
18596 [ALC662_5ST_DIG
] = {
18597 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
},
18598 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18599 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18600 .dac_nids
= alc662_dac_nids
,
18601 .dig_out_nid
= ALC662_DIGOUT_NID
,
18602 .dig_in_nid
= ALC662_DIGIN_NID
,
18603 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
18604 .channel_mode
= alc662_5stack_modes
,
18605 .input_mux
= &alc662_capture_source
,
18607 [ALC662_LENOVO_101E
] = {
18608 .mixers
= { alc662_lenovo_101e_mixer
},
18609 .init_verbs
= { alc662_init_verbs
,
18610 alc662_eapd_init_verbs
,
18611 alc662_sue_init_verbs
},
18612 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18613 .dac_nids
= alc662_dac_nids
,
18614 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18615 .channel_mode
= alc662_3ST_2ch_modes
,
18616 .input_mux
= &alc662_lenovo_101e_capture_source
,
18617 .unsol_event
= alc_sku_unsol_event
,
18618 .setup
= alc662_lenovo_101e_setup
,
18619 .init_hook
= alc_inithook
,
18621 [ALC662_ASUS_EEEPC_P701
] = {
18622 .mixers
= { alc662_eeepc_p701_mixer
},
18623 .init_verbs
= { alc662_init_verbs
,
18624 alc662_eapd_init_verbs
,
18625 alc662_eeepc_sue_init_verbs
},
18626 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18627 .dac_nids
= alc662_dac_nids
,
18628 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18629 .channel_mode
= alc662_3ST_2ch_modes
,
18630 .unsol_event
= alc_sku_unsol_event
,
18631 .setup
= alc662_eeepc_setup
,
18632 .init_hook
= alc_inithook
,
18634 [ALC662_ASUS_EEEPC_EP20
] = {
18635 .mixers
= { alc662_eeepc_ep20_mixer
,
18636 alc662_chmode_mixer
},
18637 .init_verbs
= { alc662_init_verbs
,
18638 alc662_eapd_init_verbs
,
18639 alc662_eeepc_ep20_sue_init_verbs
},
18640 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18641 .dac_nids
= alc662_dac_nids
,
18642 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18643 .channel_mode
= alc662_3ST_6ch_modes
,
18644 .input_mux
= &alc662_lenovo_101e_capture_source
,
18645 .unsol_event
= alc_sku_unsol_event
,
18646 .setup
= alc662_eeepc_ep20_setup
,
18647 .init_hook
= alc_inithook
,
18650 .mixers
= { alc662_ecs_mixer
},
18651 .init_verbs
= { alc662_init_verbs
,
18652 alc662_eapd_init_verbs
,
18653 alc662_ecs_init_verbs
},
18654 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18655 .dac_nids
= alc662_dac_nids
,
18656 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18657 .channel_mode
= alc662_3ST_2ch_modes
,
18658 .unsol_event
= alc_sku_unsol_event
,
18659 .setup
= alc662_eeepc_setup
,
18660 .init_hook
= alc_inithook
,
18662 [ALC663_ASUS_M51VA
] = {
18663 .mixers
= { alc663_m51va_mixer
},
18664 .init_verbs
= { alc662_init_verbs
,
18665 alc662_eapd_init_verbs
,
18666 alc663_m51va_init_verbs
},
18667 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18668 .dac_nids
= alc662_dac_nids
,
18669 .dig_out_nid
= ALC662_DIGOUT_NID
,
18670 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18671 .channel_mode
= alc662_3ST_2ch_modes
,
18672 .unsol_event
= alc_sku_unsol_event
,
18673 .setup
= alc663_m51va_setup
,
18674 .init_hook
= alc_inithook
,
18676 [ALC663_ASUS_G71V
] = {
18677 .mixers
= { alc663_g71v_mixer
},
18678 .init_verbs
= { alc662_init_verbs
,
18679 alc662_eapd_init_verbs
,
18680 alc663_g71v_init_verbs
},
18681 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18682 .dac_nids
= alc662_dac_nids
,
18683 .dig_out_nid
= ALC662_DIGOUT_NID
,
18684 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18685 .channel_mode
= alc662_3ST_2ch_modes
,
18686 .unsol_event
= alc_sku_unsol_event
,
18687 .setup
= alc663_g71v_setup
,
18688 .init_hook
= alc_inithook
,
18690 [ALC663_ASUS_H13
] = {
18691 .mixers
= { alc663_m51va_mixer
},
18692 .init_verbs
= { alc662_init_verbs
,
18693 alc662_eapd_init_verbs
,
18694 alc663_m51va_init_verbs
},
18695 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18696 .dac_nids
= alc662_dac_nids
,
18697 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18698 .channel_mode
= alc662_3ST_2ch_modes
,
18699 .setup
= alc663_m51va_setup
,
18700 .unsol_event
= alc_sku_unsol_event
,
18701 .init_hook
= alc_inithook
,
18703 [ALC663_ASUS_G50V
] = {
18704 .mixers
= { alc663_g50v_mixer
},
18705 .init_verbs
= { alc662_init_verbs
,
18706 alc662_eapd_init_verbs
,
18707 alc663_g50v_init_verbs
},
18708 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18709 .dac_nids
= alc662_dac_nids
,
18710 .dig_out_nid
= ALC662_DIGOUT_NID
,
18711 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18712 .channel_mode
= alc662_3ST_6ch_modes
,
18713 .input_mux
= &alc663_capture_source
,
18714 .unsol_event
= alc_sku_unsol_event
,
18715 .setup
= alc663_g50v_setup
,
18716 .init_hook
= alc_inithook
,
18718 [ALC663_ASUS_MODE1
] = {
18719 .mixers
= { alc663_m51va_mixer
},
18720 .cap_mixer
= alc662_auto_capture_mixer
,
18721 .init_verbs
= { alc662_init_verbs
,
18722 alc662_eapd_init_verbs
,
18723 alc663_21jd_amic_init_verbs
},
18724 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18726 .dac_nids
= alc662_dac_nids
,
18727 .dig_out_nid
= ALC662_DIGOUT_NID
,
18728 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18729 .channel_mode
= alc662_3ST_2ch_modes
,
18730 .unsol_event
= alc_sku_unsol_event
,
18731 .setup
= alc663_mode1_setup
,
18732 .init_hook
= alc_inithook
,
18734 [ALC662_ASUS_MODE2
] = {
18735 .mixers
= { alc662_1bjd_mixer
},
18736 .cap_mixer
= alc662_auto_capture_mixer
,
18737 .init_verbs
= { alc662_init_verbs
,
18738 alc662_eapd_init_verbs
,
18739 alc662_1bjd_amic_init_verbs
},
18740 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18741 .dac_nids
= alc662_dac_nids
,
18742 .dig_out_nid
= ALC662_DIGOUT_NID
,
18743 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18744 .channel_mode
= alc662_3ST_2ch_modes
,
18745 .unsol_event
= alc_sku_unsol_event
,
18746 .setup
= alc662_mode2_setup
,
18747 .init_hook
= alc_inithook
,
18749 [ALC663_ASUS_MODE3
] = {
18750 .mixers
= { alc663_two_hp_m1_mixer
},
18751 .cap_mixer
= alc662_auto_capture_mixer
,
18752 .init_verbs
= { alc662_init_verbs
,
18753 alc662_eapd_init_verbs
,
18754 alc663_two_hp_amic_m1_init_verbs
},
18755 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18757 .dac_nids
= alc662_dac_nids
,
18758 .dig_out_nid
= ALC662_DIGOUT_NID
,
18759 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18760 .channel_mode
= alc662_3ST_2ch_modes
,
18761 .unsol_event
= alc_sku_unsol_event
,
18762 .setup
= alc663_mode3_setup
,
18763 .init_hook
= alc_inithook
,
18765 [ALC663_ASUS_MODE4
] = {
18766 .mixers
= { alc663_asus_21jd_clfe_mixer
},
18767 .cap_mixer
= alc662_auto_capture_mixer
,
18768 .init_verbs
= { alc662_init_verbs
,
18769 alc662_eapd_init_verbs
,
18770 alc663_21jd_amic_init_verbs
},
18771 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18773 .dac_nids
= alc662_dac_nids
,
18774 .dig_out_nid
= ALC662_DIGOUT_NID
,
18775 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18776 .channel_mode
= alc662_3ST_2ch_modes
,
18777 .unsol_event
= alc_sku_unsol_event
,
18778 .setup
= alc663_mode4_setup
,
18779 .init_hook
= alc_inithook
,
18781 [ALC663_ASUS_MODE5
] = {
18782 .mixers
= { alc663_asus_15jd_clfe_mixer
},
18783 .cap_mixer
= alc662_auto_capture_mixer
,
18784 .init_verbs
= { alc662_init_verbs
,
18785 alc662_eapd_init_verbs
,
18786 alc663_15jd_amic_init_verbs
},
18787 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18789 .dac_nids
= alc662_dac_nids
,
18790 .dig_out_nid
= ALC662_DIGOUT_NID
,
18791 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18792 .channel_mode
= alc662_3ST_2ch_modes
,
18793 .unsol_event
= alc_sku_unsol_event
,
18794 .setup
= alc663_mode5_setup
,
18795 .init_hook
= alc_inithook
,
18797 [ALC663_ASUS_MODE6
] = {
18798 .mixers
= { alc663_two_hp_m2_mixer
},
18799 .cap_mixer
= alc662_auto_capture_mixer
,
18800 .init_verbs
= { alc662_init_verbs
,
18801 alc662_eapd_init_verbs
,
18802 alc663_two_hp_amic_m2_init_verbs
},
18803 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18805 .dac_nids
= alc662_dac_nids
,
18806 .dig_out_nid
= ALC662_DIGOUT_NID
,
18807 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18808 .channel_mode
= alc662_3ST_2ch_modes
,
18809 .unsol_event
= alc_sku_unsol_event
,
18810 .setup
= alc663_mode6_setup
,
18811 .init_hook
= alc_inithook
,
18813 [ALC663_ASUS_MODE7
] = {
18814 .mixers
= { alc663_mode7_mixer
},
18815 .cap_mixer
= alc662_auto_capture_mixer
,
18816 .init_verbs
= { alc662_init_verbs
,
18817 alc662_eapd_init_verbs
,
18818 alc663_mode7_init_verbs
},
18819 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18821 .dac_nids
= alc662_dac_nids
,
18822 .dig_out_nid
= ALC662_DIGOUT_NID
,
18823 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18824 .channel_mode
= alc662_3ST_2ch_modes
,
18825 .unsol_event
= alc_sku_unsol_event
,
18826 .setup
= alc663_mode7_setup
,
18827 .init_hook
= alc_inithook
,
18829 [ALC663_ASUS_MODE8
] = {
18830 .mixers
= { alc663_mode8_mixer
},
18831 .cap_mixer
= alc662_auto_capture_mixer
,
18832 .init_verbs
= { alc662_init_verbs
,
18833 alc662_eapd_init_verbs
,
18834 alc663_mode8_init_verbs
},
18835 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18837 .dac_nids
= alc662_dac_nids
,
18838 .dig_out_nid
= ALC662_DIGOUT_NID
,
18839 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18840 .channel_mode
= alc662_3ST_2ch_modes
,
18841 .unsol_event
= alc_sku_unsol_event
,
18842 .setup
= alc663_mode8_setup
,
18843 .init_hook
= alc_inithook
,
18846 .mixers
= { alc663_m51va_mixer
},
18847 .cap_mixer
= alc272_auto_capture_mixer
,
18848 .init_verbs
= { alc662_init_verbs
,
18849 alc662_eapd_init_verbs
,
18850 alc272_dell_init_verbs
},
18851 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18852 .dac_nids
= alc272_dac_nids
,
18853 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18854 .adc_nids
= alc272_adc_nids
,
18855 .num_adc_nids
= ARRAY_SIZE(alc272_adc_nids
),
18856 .capsrc_nids
= alc272_capsrc_nids
,
18857 .channel_mode
= alc662_3ST_2ch_modes
,
18858 .unsol_event
= alc_sku_unsol_event
,
18859 .setup
= alc663_m51va_setup
,
18860 .init_hook
= alc_inithook
,
18862 [ALC272_DELL_ZM1
] = {
18863 .mixers
= { alc663_m51va_mixer
},
18864 .cap_mixer
= alc662_auto_capture_mixer
,
18865 .init_verbs
= { alc662_init_verbs
,
18866 alc662_eapd_init_verbs
,
18867 alc272_dell_zm1_init_verbs
},
18868 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18869 .dac_nids
= alc272_dac_nids
,
18870 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18871 .adc_nids
= alc662_adc_nids
,
18873 .capsrc_nids
= alc662_capsrc_nids
,
18874 .channel_mode
= alc662_3ST_2ch_modes
,
18875 .unsol_event
= alc_sku_unsol_event
,
18876 .setup
= alc663_m51va_setup
,
18877 .init_hook
= alc_inithook
,
18879 [ALC272_SAMSUNG_NC10
] = {
18880 .mixers
= { alc272_nc10_mixer
},
18881 .init_verbs
= { alc662_init_verbs
,
18882 alc662_eapd_init_verbs
,
18883 alc663_21jd_amic_init_verbs
},
18884 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18885 .dac_nids
= alc272_dac_nids
,
18886 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18887 .channel_mode
= alc662_3ST_2ch_modes
,
18888 /*.input_mux = &alc272_nc10_capture_source,*/
18889 .unsol_event
= alc_sku_unsol_event
,
18890 .setup
= alc663_mode4_setup
,
18891 .init_hook
= alc_inithook
,
18897 * BIOS auto configuration
18900 /* convert from MIX nid to DAC */
18901 static hda_nid_t
alc_auto_mix_to_dac(struct hda_codec
*codec
, hda_nid_t nid
)
18906 num
= snd_hda_get_connections(codec
, nid
, list
, ARRAY_SIZE(list
));
18907 for (i
= 0; i
< num
; i
++) {
18908 if (get_wcaps_type(get_wcaps(codec
, list
[i
])) == AC_WID_AUD_OUT
)
18914 /* go down to the selector widget before the mixer */
18915 static hda_nid_t
alc_go_down_to_selector(struct hda_codec
*codec
, hda_nid_t pin
)
18918 int num
= snd_hda_get_connections(codec
, pin
, srcs
,
18921 get_wcaps_type(get_wcaps(codec
, srcs
[0])) != AC_WID_AUD_SEL
)
18926 /* get MIX nid connected to the given pin targeted to DAC */
18927 static hda_nid_t
alc_auto_dac_to_mix(struct hda_codec
*codec
, hda_nid_t pin
,
18933 pin
= alc_go_down_to_selector(codec
, pin
);
18934 num
= snd_hda_get_connections(codec
, pin
, mix
, ARRAY_SIZE(mix
));
18935 for (i
= 0; i
< num
; i
++) {
18936 if (alc_auto_mix_to_dac(codec
, mix
[i
]) == dac
)
18942 /* select the connection from pin to DAC if needed */
18943 static int alc_auto_select_dac(struct hda_codec
*codec
, hda_nid_t pin
,
18949 pin
= alc_go_down_to_selector(codec
, pin
);
18950 num
= snd_hda_get_connections(codec
, pin
, mix
, ARRAY_SIZE(mix
));
18953 for (i
= 0; i
< num
; i
++) {
18954 if (alc_auto_mix_to_dac(codec
, mix
[i
]) == dac
) {
18955 snd_hda_codec_update_cache(codec
, pin
, 0,
18956 AC_VERB_SET_CONNECT_SEL
, i
);
18963 /* look for an empty DAC slot */
18964 static hda_nid_t
alc_auto_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
18966 struct alc_spec
*spec
= codec
->spec
;
18970 pin
= alc_go_down_to_selector(codec
, pin
);
18971 num
= snd_hda_get_connections(codec
, pin
, srcs
, ARRAY_SIZE(srcs
));
18972 for (i
= 0; i
< num
; i
++) {
18973 hda_nid_t nid
= alc_auto_mix_to_dac(codec
, srcs
[i
]);
18976 for (j
= 0; j
< spec
->multiout
.num_dacs
; j
++)
18977 if (spec
->multiout
.dac_nids
[j
] == nid
)
18979 if (j
>= spec
->multiout
.num_dacs
)
18985 /* fill in the dac_nids table from the parsed pin configuration */
18986 static int alc662_auto_fill_dac_nids(struct hda_codec
*codec
,
18987 const struct auto_pin_cfg
*cfg
)
18989 struct alc_spec
*spec
= codec
->spec
;
18993 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
18994 for (i
= 0; i
< cfg
->line_outs
; i
++) {
18995 dac
= alc_auto_look_for_dac(codec
, cfg
->line_out_pins
[i
]);
18998 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
19003 static inline int __alc662_add_vol_ctl(struct alc_spec
*spec
, const char *pfx
,
19004 hda_nid_t nid
, int idx
, unsigned int chs
)
19006 return __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, idx
,
19007 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
19010 static inline int __alc662_add_sw_ctl(struct alc_spec
*spec
, const char *pfx
,
19011 hda_nid_t nid
, int idx
, unsigned int chs
)
19013 return __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
,
19014 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_INPUT
));
19017 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19018 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19019 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19020 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19021 #define alc662_add_stereo_vol(spec, pfx, nid) \
19022 alc662_add_vol_ctl(spec, pfx, nid, 3)
19023 #define alc662_add_stereo_sw(spec, pfx, nid) \
19024 alc662_add_sw_ctl(spec, pfx, nid, 3)
19026 /* add playback controls from the parsed DAC table */
19027 static int alc662_auto_create_multi_out_ctls(struct hda_codec
*codec
,
19028 const struct auto_pin_cfg
*cfg
)
19030 struct alc_spec
*spec
= codec
->spec
;
19031 static const char * const chname
[4] = {
19032 "Front", "Surround", NULL
/*CLFE*/, "Side"
19034 const char *pfx
= alc_get_line_out_pfx(spec
, true);
19035 hda_nid_t nid
, mix
, pin
;
19036 int i
, err
, noutputs
;
19038 noutputs
= cfg
->line_outs
;
19039 if (spec
->multi_ios
> 0)
19040 noutputs
+= spec
->multi_ios
;
19042 for (i
= 0; i
< noutputs
; i
++) {
19043 nid
= spec
->multiout
.dac_nids
[i
];
19046 if (i
>= cfg
->line_outs
)
19047 pin
= spec
->multi_io
[i
- 1].pin
;
19049 pin
= cfg
->line_out_pins
[i
];
19050 mix
= alc_auto_dac_to_mix(codec
, pin
, nid
);
19053 if (!pfx
&& i
== 2) {
19055 err
= alc662_add_vol_ctl(spec
, "Center", nid
, 1);
19058 err
= alc662_add_vol_ctl(spec
, "LFE", nid
, 2);
19061 err
= alc662_add_sw_ctl(spec
, "Center", mix
, 1);
19064 err
= alc662_add_sw_ctl(spec
, "LFE", mix
, 2);
19068 const char *name
= pfx
;
19074 err
= __alc662_add_vol_ctl(spec
, name
, nid
, index
, 3);
19077 err
= __alc662_add_sw_ctl(spec
, name
, mix
, index
, 3);
19085 /* add playback controls for speaker and HP outputs */
19086 /* return DAC nid if any new DAC is assigned */
19087 static int alc662_auto_create_extra_out(struct hda_codec
*codec
, hda_nid_t pin
,
19090 struct alc_spec
*spec
= codec
->spec
;
19091 hda_nid_t nid
, mix
;
19096 nid
= alc_auto_look_for_dac(codec
, pin
);
19098 /* the corresponding DAC is already occupied */
19099 if (!(get_wcaps(codec
, pin
) & AC_WCAP_OUT_AMP
))
19100 return 0; /* no way */
19101 /* create a switch only */
19102 return add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
19103 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
19106 mix
= alc_auto_dac_to_mix(codec
, pin
, nid
);
19109 err
= alc662_add_vol_ctl(spec
, pfx
, nid
, 3);
19112 err
= alc662_add_sw_ctl(spec
, pfx
, mix
, 3);
19118 /* create playback/capture controls for input pins */
19119 #define alc662_auto_create_input_ctls \
19120 alc882_auto_create_input_ctls
19122 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
19123 hda_nid_t nid
, int pin_type
,
19127 hda_nid_t srcs
[HDA_MAX_CONNECTIONS
];
19129 alc_set_pin_output(codec
, nid
, pin_type
);
19130 num
= snd_hda_get_connections(codec
, nid
, srcs
, ARRAY_SIZE(srcs
));
19131 for (i
= 0; i
< num
; i
++) {
19132 if (alc_auto_mix_to_dac(codec
, srcs
[i
]) != dac
)
19134 /* need the manual connection? */
19136 snd_hda_codec_write(codec
, nid
, 0,
19137 AC_VERB_SET_CONNECT_SEL
, i
);
19138 /* unmute mixer widget inputs */
19139 snd_hda_codec_write(codec
, srcs
[i
], 0,
19140 AC_VERB_SET_AMP_GAIN_MUTE
,
19142 snd_hda_codec_write(codec
, srcs
[i
], 0,
19143 AC_VERB_SET_AMP_GAIN_MUTE
,
19149 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
19151 struct alc_spec
*spec
= codec
->spec
;
19152 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
19155 for (i
= 0; i
<= HDA_SIDE
; i
++) {
19156 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
19158 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
19159 spec
->multiout
.dac_nids
[i
]);
19163 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
19165 struct alc_spec
*spec
= codec
->spec
;
19168 pin
= spec
->autocfg
.hp_pins
[0];
19170 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
19171 spec
->multiout
.hp_nid
);
19172 pin
= spec
->autocfg
.speaker_pins
[0];
19174 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
,
19175 spec
->multiout
.extra_out_nid
[0]);
19178 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19180 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
19182 struct alc_spec
*spec
= codec
->spec
;
19183 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19186 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19187 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
19188 if (alc_is_input_pin(codec
, nid
)) {
19189 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
19190 if (nid
!= ALC662_PIN_CD_NID
&&
19191 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
19192 snd_hda_codec_write(codec
, nid
, 0,
19193 AC_VERB_SET_AMP_GAIN_MUTE
,
19199 #define alc662_auto_init_input_src alc882_auto_init_input_src
19204 static int alc_auto_fill_multi_ios(struct hda_codec
*codec
,
19205 unsigned int location
)
19207 struct alc_spec
*spec
= codec
->spec
;
19208 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19209 int type
, i
, num_pins
= 0;
19211 for (type
= AUTO_PIN_LINE_IN
; type
>= AUTO_PIN_MIC
; type
--) {
19212 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19213 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
19215 unsigned int defcfg
, caps
;
19216 if (cfg
->inputs
[i
].type
!= type
)
19218 defcfg
= snd_hda_codec_get_pincfg(codec
, nid
);
19219 if (get_defcfg_connect(defcfg
) != AC_JACK_PORT_COMPLEX
)
19221 if (location
&& get_defcfg_location(defcfg
) != location
)
19223 caps
= snd_hda_query_pin_caps(codec
, nid
);
19224 if (!(caps
& AC_PINCAP_OUT
))
19226 dac
= alc_auto_look_for_dac(codec
, nid
);
19229 spec
->multi_io
[num_pins
].pin
= nid
;
19230 spec
->multi_io
[num_pins
].dac
= dac
;
19232 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
19235 spec
->multiout
.num_dacs
= 1;
19241 static int alc_auto_ch_mode_info(struct snd_kcontrol
*kcontrol
,
19242 struct snd_ctl_elem_info
*uinfo
)
19244 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
19245 struct alc_spec
*spec
= codec
->spec
;
19247 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
19249 uinfo
->value
.enumerated
.items
= spec
->multi_ios
+ 1;
19250 if (uinfo
->value
.enumerated
.item
> spec
->multi_ios
)
19251 uinfo
->value
.enumerated
.item
= spec
->multi_ios
;
19252 sprintf(uinfo
->value
.enumerated
.name
, "%dch",
19253 (uinfo
->value
.enumerated
.item
+ 1) * 2);
19257 static int alc_auto_ch_mode_get(struct snd_kcontrol
*kcontrol
,
19258 struct snd_ctl_elem_value
*ucontrol
)
19260 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
19261 struct alc_spec
*spec
= codec
->spec
;
19262 ucontrol
->value
.enumerated
.item
[0] = (spec
->ext_channel_count
- 1) / 2;
19266 static int alc_set_multi_io(struct hda_codec
*codec
, int idx
, bool output
)
19268 struct alc_spec
*spec
= codec
->spec
;
19269 hda_nid_t nid
= spec
->multi_io
[idx
].pin
;
19271 if (!spec
->multi_io
[idx
].ctl_in
)
19272 spec
->multi_io
[idx
].ctl_in
=
19273 snd_hda_codec_read(codec
, nid
, 0,
19274 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
19276 snd_hda_codec_update_cache(codec
, nid
, 0,
19277 AC_VERB_SET_PIN_WIDGET_CONTROL
,
19279 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
19280 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
19282 alc_auto_select_dac(codec
, nid
, spec
->multi_io
[idx
].dac
);
19284 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
19285 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
19286 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
19287 snd_hda_codec_update_cache(codec
, nid
, 0,
19288 AC_VERB_SET_PIN_WIDGET_CONTROL
,
19289 spec
->multi_io
[idx
].ctl_in
);
19294 static int alc_auto_ch_mode_put(struct snd_kcontrol
*kcontrol
,
19295 struct snd_ctl_elem_value
*ucontrol
)
19297 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
19298 struct alc_spec
*spec
= codec
->spec
;
19301 ch
= ucontrol
->value
.enumerated
.item
[0];
19302 if (ch
< 0 || ch
> spec
->multi_ios
)
19304 if (ch
== (spec
->ext_channel_count
- 1) / 2)
19306 spec
->ext_channel_count
= (ch
+ 1) * 2;
19307 for (i
= 0; i
< spec
->multi_ios
; i
++)
19308 alc_set_multi_io(codec
, i
, i
< ch
);
19309 spec
->multiout
.max_channels
= spec
->ext_channel_count
;
19313 static const struct snd_kcontrol_new alc_auto_channel_mode_enum
= {
19314 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
19315 .name
= "Channel Mode",
19316 .info
= alc_auto_ch_mode_info
,
19317 .get
= alc_auto_ch_mode_get
,
19318 .put
= alc_auto_ch_mode_put
,
19321 static int alc_auto_add_multi_channel_mode(struct hda_codec
*codec
)
19323 struct alc_spec
*spec
= codec
->spec
;
19324 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19325 unsigned int location
, defcfg
;
19328 if (cfg
->line_outs
!= 1 ||
19329 cfg
->line_out_type
!= AUTO_PIN_LINE_OUT
)
19332 defcfg
= snd_hda_codec_get_pincfg(codec
, cfg
->line_out_pins
[0]);
19333 location
= get_defcfg_location(defcfg
);
19335 num_pins
= alc_auto_fill_multi_ios(codec
, location
);
19336 if (num_pins
> 0) {
19337 struct snd_kcontrol_new
*knew
;
19339 knew
= alc_kcontrol_new(spec
);
19342 *knew
= alc_auto_channel_mode_enum
;
19343 knew
->name
= kstrdup("Channel Mode", GFP_KERNEL
);
19347 spec
->multi_ios
= num_pins
;
19348 spec
->ext_channel_count
= 2;
19349 spec
->multiout
.num_dacs
= num_pins
+ 1;
19354 static int alc662_parse_auto_config(struct hda_codec
*codec
)
19356 struct alc_spec
*spec
= codec
->spec
;
19358 static const hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
19360 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
19364 if (!spec
->autocfg
.line_outs
)
19365 return 0; /* can't find valid BIOS pin config */
19367 err
= alc662_auto_fill_dac_nids(codec
, &spec
->autocfg
);
19370 err
= alc_auto_add_multi_channel_mode(codec
);
19373 err
= alc662_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
19376 err
= alc662_auto_create_extra_out(codec
,
19377 spec
->autocfg
.speaker_pins
[0],
19382 spec
->multiout
.extra_out_nid
[0] = err
;
19383 err
= alc662_auto_create_extra_out(codec
, spec
->autocfg
.hp_pins
[0],
19388 spec
->multiout
.hp_nid
= err
;
19389 err
= alc662_auto_create_input_ctls(codec
, &spec
->autocfg
);
19393 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
19395 alc_auto_parse_digital(codec
);
19397 if (spec
->kctls
.list
)
19398 add_mixer(spec
, spec
->kctls
.list
);
19400 spec
->num_mux_defs
= 1;
19401 spec
->input_mux
= &spec
->private_imux
[0];
19403 err
= alc_auto_add_mic_boost(codec
);
19407 if (codec
->vendor_id
== 0x10ec0272 || codec
->vendor_id
== 0x10ec0663 ||
19408 codec
->vendor_id
== 0x10ec0665 || codec
->vendor_id
== 0x10ec0670)
19409 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0x21);
19411 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
19416 /* additional initialization for auto-configuration model */
19417 static void alc662_auto_init(struct hda_codec
*codec
)
19419 struct alc_spec
*spec
= codec
->spec
;
19420 alc662_auto_init_multi_out(codec
);
19421 alc662_auto_init_hp_out(codec
);
19422 alc662_auto_init_analog_input(codec
);
19423 alc662_auto_init_input_src(codec
);
19424 alc_auto_init_digital(codec
);
19425 if (spec
->unsol_event
)
19426 alc_inithook(codec
);
19429 static void alc272_fixup_mario(struct hda_codec
*codec
,
19430 const struct alc_fixup
*fix
, int action
)
19432 if (action
!= ALC_FIXUP_ACT_PROBE
)
19434 if (snd_hda_override_amp_caps(codec
, 0x2, HDA_OUTPUT
,
19435 (0x3b << AC_AMPCAP_OFFSET_SHIFT
) |
19436 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT
) |
19437 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
19438 (0 << AC_AMPCAP_MUTE_SHIFT
)))
19439 printk(KERN_WARNING
19440 "hda_codec: failed to override amp caps for NID 0x2\n");
19444 ALC662_FIXUP_ASPIRE
,
19445 ALC662_FIXUP_IDEAPAD
,
19446 ALC272_FIXUP_MARIO
,
19447 ALC662_FIXUP_CZC_P10T
,
19448 ALC662_FIXUP_SKU_IGNORE
,
19451 static const struct alc_fixup alc662_fixups
[] = {
19452 [ALC662_FIXUP_ASPIRE
] = {
19453 .type
= ALC_FIXUP_PINS
,
19454 .v
.pins
= (const struct alc_pincfg
[]) {
19455 { 0x15, 0x99130112 }, /* subwoofer */
19459 [ALC662_FIXUP_IDEAPAD
] = {
19460 .type
= ALC_FIXUP_PINS
,
19461 .v
.pins
= (const struct alc_pincfg
[]) {
19462 { 0x17, 0x99130112 }, /* subwoofer */
19466 [ALC272_FIXUP_MARIO
] = {
19467 .type
= ALC_FIXUP_FUNC
,
19468 .v
.func
= alc272_fixup_mario
,
19470 [ALC662_FIXUP_CZC_P10T
] = {
19471 .type
= ALC_FIXUP_VERBS
,
19472 .v
.verbs
= (const struct hda_verb
[]) {
19473 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
19477 [ALC662_FIXUP_SKU_IGNORE
] = {
19478 .type
= ALC_FIXUP_SKU
,
19479 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
19483 static const struct snd_pci_quirk alc662_fixup_tbl
[] = {
19484 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE
),
19485 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE
),
19486 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE
),
19487 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD
),
19488 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD
),
19489 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD
),
19490 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T
),
19494 static const struct alc_model_fixup alc662_fixup_models
[] = {
19495 {.id
= ALC272_FIXUP_MARIO
, .name
= "mario"},
19500 static int patch_alc662(struct hda_codec
*codec
)
19502 struct alc_spec
*spec
;
19503 int err
, board_config
;
19506 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
19510 codec
->spec
= spec
;
19512 alc_auto_parse_customize_define(codec
);
19514 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
19516 coef
= alc_read_coef_idx(codec
, 0);
19517 if (coef
== 0x8020 || coef
== 0x8011)
19518 alc_codec_rename(codec
, "ALC661");
19519 else if (coef
& (1 << 14) &&
19520 codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
19521 spec
->cdefine
.platform_type
== 1)
19522 alc_codec_rename(codec
, "ALC272X");
19523 else if (coef
== 0x4011)
19524 alc_codec_rename(codec
, "ALC656");
19526 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
19529 if (board_config
< 0) {
19530 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
19532 board_config
= ALC662_AUTO
;
19535 if (board_config
== ALC662_AUTO
) {
19536 alc_pick_fixup(codec
, alc662_fixup_models
,
19537 alc662_fixup_tbl
, alc662_fixups
);
19538 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
19539 /* automatic parse from the BIOS config */
19540 err
= alc662_parse_auto_config(codec
);
19546 "hda_codec: Cannot set up configuration "
19547 "from BIOS. Using base mode...\n");
19548 board_config
= ALC662_3ST_2ch_DIG
;
19552 if (has_cdefine_beep(codec
)) {
19553 err
= snd_hda_attach_beep_device(codec
, 0x1);
19560 if (board_config
!= ALC662_AUTO
)
19561 setup_preset(codec
, &alc662_presets
[board_config
]);
19563 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
19564 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
19566 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
19567 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
19569 if (!spec
->adc_nids
) {
19570 spec
->adc_nids
= alc662_adc_nids
;
19571 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
19573 if (!spec
->capsrc_nids
)
19574 spec
->capsrc_nids
= alc662_capsrc_nids
;
19576 if (!spec
->cap_mixer
)
19577 set_capture_mixer(codec
);
19579 if (has_cdefine_beep(codec
)) {
19580 switch (codec
->vendor_id
) {
19582 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
19587 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
19590 set_beep_amp(spec
, 0x0b, 0x03, HDA_INPUT
);
19594 spec
->vmaster_nid
= 0x02;
19596 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
19598 codec
->patch_ops
= alc_patch_ops
;
19599 if (board_config
== ALC662_AUTO
)
19600 spec
->init_hook
= alc662_auto_init
;
19601 spec
->shutup
= alc_eapd_shutup
;
19603 alc_init_jacks(codec
);
19605 #ifdef CONFIG_SND_HDA_POWER_SAVE
19606 if (!spec
->loopback
.amplist
)
19607 spec
->loopback
.amplist
= alc662_loopbacks
;
19613 static int patch_alc888(struct hda_codec
*codec
)
19615 if ((alc_read_coef_idx(codec
, 0) & 0x00f0)==0x0030){
19616 kfree(codec
->chip_name
);
19617 if (codec
->vendor_id
== 0x10ec0887)
19618 codec
->chip_name
= kstrdup("ALC887-VD", GFP_KERNEL
);
19620 codec
->chip_name
= kstrdup("ALC888-VD", GFP_KERNEL
);
19621 if (!codec
->chip_name
) {
19625 return patch_alc662(codec
);
19627 return patch_alc882(codec
);
19630 static int patch_alc899(struct hda_codec
*codec
)
19632 if ((alc_read_coef_idx(codec
, 0) & 0x2000) != 0x2000) {
19633 kfree(codec
->chip_name
);
19634 codec
->chip_name
= kstrdup("ALC898", GFP_KERNEL
);
19636 return patch_alc882(codec
);
19642 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19643 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19644 #define alc680_modes alc260_modes
19646 static const hda_nid_t alc680_dac_nids
[3] = {
19647 /* Lout1, Lout2, hp */
19651 static const hda_nid_t alc680_adc_nids
[3] = {
19653 /* DMIC, MIC, Line-in*/
19658 * Analog capture ADC cgange
19660 static void alc680_rec_autoswitch(struct hda_codec
*codec
)
19662 struct alc_spec
*spec
= codec
->spec
;
19663 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19665 int type_found
= AUTO_PIN_LAST
;
19669 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19670 nid
= cfg
->inputs
[i
].pin
;
19671 if (!is_jack_detectable(codec
, nid
))
19673 if (snd_hda_jack_detect(codec
, nid
)) {
19674 if (cfg
->inputs
[i
].type
< type_found
) {
19675 type_found
= cfg
->inputs
[i
].type
;
19683 snd_hda_get_connections(codec
, pin_found
, &nid
, 1);
19685 if (nid
!= spec
->cur_adc
)
19686 __snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
, 1);
19687 spec
->cur_adc
= nid
;
19688 snd_hda_codec_setup_stream(codec
, nid
, spec
->cur_adc_stream_tag
, 0,
19689 spec
->cur_adc_format
);
19692 static int alc680_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
19693 struct hda_codec
*codec
,
19694 unsigned int stream_tag
,
19695 unsigned int format
,
19696 struct snd_pcm_substream
*substream
)
19698 struct alc_spec
*spec
= codec
->spec
;
19700 spec
->cur_adc
= 0x07;
19701 spec
->cur_adc_stream_tag
= stream_tag
;
19702 spec
->cur_adc_format
= format
;
19704 alc680_rec_autoswitch(codec
);
19708 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
19709 struct hda_codec
*codec
,
19710 struct snd_pcm_substream
*substream
)
19712 snd_hda_codec_cleanup_stream(codec
, 0x07);
19713 snd_hda_codec_cleanup_stream(codec
, 0x08);
19714 snd_hda_codec_cleanup_stream(codec
, 0x09);
19718 static const struct hda_pcm_stream alc680_pcm_analog_auto_capture
= {
19719 .substreams
= 1, /* can be overridden */
19722 /* NID is set in alc_build_pcms */
19724 .prepare
= alc680_capture_pcm_prepare
,
19725 .cleanup
= alc680_capture_pcm_cleanup
19729 static const struct snd_kcontrol_new alc680_base_mixer
[] = {
19730 /* output mixer control */
19731 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
19732 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
19733 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT
),
19734 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
19735 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT
),
19736 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
19737 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT
),
19741 static const struct hda_bind_ctls alc680_bind_cap_vol
= {
19742 .ops
= &snd_hda_bind_vol
,
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 hda_bind_ctls alc680_bind_cap_switch
= {
19752 .ops
= &snd_hda_bind_sw
,
19754 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT
),
19755 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
19756 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
19761 static const struct snd_kcontrol_new alc680_master_capture_mixer
[] = {
19762 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol
),
19763 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch
),
19768 * generic initialization of ADC, input mixers and output mixers
19770 static const struct hda_verb alc680_init_verbs
[] = {
19771 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19772 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19773 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19775 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
19776 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
19777 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
19778 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
19779 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
19780 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
19782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19783 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19784 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19785 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19786 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19788 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
19789 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
19790 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
19795 /* toggle speaker-output according to the hp-jack state */
19796 static void alc680_base_setup(struct hda_codec
*codec
)
19798 struct alc_spec
*spec
= codec
->spec
;
19800 spec
->autocfg
.hp_pins
[0] = 0x16;
19801 spec
->autocfg
.speaker_pins
[0] = 0x14;
19802 spec
->autocfg
.speaker_pins
[1] = 0x15;
19803 spec
->autocfg
.num_inputs
= 2;
19804 spec
->autocfg
.inputs
[0].pin
= 0x18;
19805 spec
->autocfg
.inputs
[0].type
= AUTO_PIN_MIC
;
19806 spec
->autocfg
.inputs
[1].pin
= 0x19;
19807 spec
->autocfg
.inputs
[1].type
= AUTO_PIN_LINE_IN
;
19808 spec
->automute
= 1;
19809 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
19812 static void alc680_unsol_event(struct hda_codec
*codec
,
19815 if ((res
>> 26) == ALC880_HP_EVENT
)
19816 alc_hp_automute(codec
);
19817 if ((res
>> 26) == ALC880_MIC_EVENT
)
19818 alc680_rec_autoswitch(codec
);
19821 static void alc680_inithook(struct hda_codec
*codec
)
19823 alc_hp_automute(codec
);
19824 alc680_rec_autoswitch(codec
);
19827 /* create input playback/capture controls for the given pin */
19828 static int alc680_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
19829 const char *ctlname
, int idx
)
19847 if (spec
->multiout
.dac_nids
[0] != dac
&&
19848 spec
->multiout
.dac_nids
[1] != dac
) {
19849 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
19850 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
19855 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
19856 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
19860 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
19866 /* add playback controls from the parsed DAC table */
19867 static int alc680_auto_create_multi_out_ctls(struct alc_spec
*spec
,
19868 const struct auto_pin_cfg
*cfg
)
19873 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
19875 nid
= cfg
->line_out_pins
[0];
19878 if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
19882 err
= alc680_new_analog_output(spec
, nid
, name
, 0);
19887 nid
= cfg
->speaker_pins
[0];
19889 err
= alc680_new_analog_output(spec
, nid
, "Speaker", 0);
19893 nid
= cfg
->hp_pins
[0];
19895 err
= alc680_new_analog_output(spec
, nid
, "Headphone", 0);
19903 static void alc680_auto_set_output_and_unmute(struct hda_codec
*codec
,
19904 hda_nid_t nid
, int pin_type
)
19906 alc_set_pin_output(codec
, nid
, pin_type
);
19909 static void alc680_auto_init_multi_out(struct hda_codec
*codec
)
19911 struct alc_spec
*spec
= codec
->spec
;
19912 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[0];
19914 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
19915 alc680_auto_set_output_and_unmute(codec
, nid
, pin_type
);
19919 static void alc680_auto_init_hp_out(struct hda_codec
*codec
)
19921 struct alc_spec
*spec
= codec
->spec
;
19924 pin
= spec
->autocfg
.hp_pins
[0];
19926 alc680_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
19927 pin
= spec
->autocfg
.speaker_pins
[0];
19929 alc680_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
19932 /* pcm configuration: identical with ALC880 */
19933 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19934 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19935 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19936 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19937 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19940 * BIOS auto configuration
19942 static int alc680_parse_auto_config(struct hda_codec
*codec
)
19944 struct alc_spec
*spec
= codec
->spec
;
19946 static const hda_nid_t alc680_ignore
[] = { 0 };
19948 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
19953 if (!spec
->autocfg
.line_outs
) {
19954 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
19955 spec
->multiout
.max_channels
= 2;
19956 spec
->no_analog
= 1;
19959 return 0; /* can't find valid BIOS pin config */
19961 err
= alc680_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
19965 spec
->multiout
.max_channels
= 2;
19968 /* digital only support output */
19969 alc_auto_parse_digital(codec
);
19970 if (spec
->kctls
.list
)
19971 add_mixer(spec
, spec
->kctls
.list
);
19973 add_verb(spec
, alc680_init_verbs
);
19975 err
= alc_auto_add_mic_boost(codec
);
19982 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19984 /* init callback for auto-configuration model -- overriding the default init */
19985 static void alc680_auto_init(struct hda_codec
*codec
)
19987 struct alc_spec
*spec
= codec
->spec
;
19988 alc680_auto_init_multi_out(codec
);
19989 alc680_auto_init_hp_out(codec
);
19990 alc680_auto_init_analog_input(codec
);
19991 alc_auto_init_digital(codec
);
19992 if (spec
->unsol_event
)
19993 alc_inithook(codec
);
19997 * configuration and preset
19999 static const char * const alc680_models
[ALC680_MODEL_LAST
] = {
20000 [ALC680_BASE
] = "base",
20001 [ALC680_AUTO
] = "auto",
20004 static const struct snd_pci_quirk alc680_cfg_tbl
[] = {
20005 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE
),
20009 static const struct alc_config_preset alc680_presets
[] = {
20011 .mixers
= { alc680_base_mixer
},
20012 .cap_mixer
= alc680_master_capture_mixer
,
20013 .init_verbs
= { alc680_init_verbs
},
20014 .num_dacs
= ARRAY_SIZE(alc680_dac_nids
),
20015 .dac_nids
= alc680_dac_nids
,
20016 .dig_out_nid
= ALC680_DIGOUT_NID
,
20017 .num_channel_mode
= ARRAY_SIZE(alc680_modes
),
20018 .channel_mode
= alc680_modes
,
20019 .unsol_event
= alc680_unsol_event
,
20020 .setup
= alc680_base_setup
,
20021 .init_hook
= alc680_inithook
,
20026 static int patch_alc680(struct hda_codec
*codec
)
20028 struct alc_spec
*spec
;
20032 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
20036 codec
->spec
= spec
;
20038 board_config
= snd_hda_check_board_config(codec
, ALC680_MODEL_LAST
,
20042 if (board_config
< 0 || board_config
>= ALC680_MODEL_LAST
) {
20043 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
20045 board_config
= ALC680_AUTO
;
20048 if (board_config
== ALC680_AUTO
) {
20049 /* automatic parse from the BIOS config */
20050 err
= alc680_parse_auto_config(codec
);
20056 "hda_codec: Cannot set up configuration "
20057 "from BIOS. Using base mode...\n");
20058 board_config
= ALC680_BASE
;
20062 if (board_config
!= ALC680_AUTO
)
20063 setup_preset(codec
, &alc680_presets
[board_config
]);
20065 spec
->stream_analog_playback
= &alc680_pcm_analog_playback
;
20066 spec
->stream_analog_capture
= &alc680_pcm_analog_auto_capture
;
20067 spec
->stream_digital_playback
= &alc680_pcm_digital_playback
;
20068 spec
->stream_digital_capture
= &alc680_pcm_digital_capture
;
20070 if (!spec
->adc_nids
) {
20071 spec
->adc_nids
= alc680_adc_nids
;
20072 spec
->num_adc_nids
= ARRAY_SIZE(alc680_adc_nids
);
20075 if (!spec
->cap_mixer
)
20076 set_capture_mixer(codec
);
20078 spec
->vmaster_nid
= 0x02;
20080 codec
->patch_ops
= alc_patch_ops
;
20081 if (board_config
== ALC680_AUTO
)
20082 spec
->init_hook
= alc680_auto_init
;
20090 static const struct hda_codec_preset snd_hda_preset_realtek
[] = {
20091 { .id
= 0x10ec0221, .name
= "ALC221", .patch
= patch_alc269
},
20092 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
20093 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
20094 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
20095 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
20096 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
20097 { .id
= 0x10ec0270, .name
= "ALC270", .patch
= patch_alc269
},
20098 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
20099 { .id
= 0x10ec0275, .name
= "ALC275", .patch
= patch_alc269
},
20100 { .id
= 0x10ec0276, .name
= "ALC276", .patch
= patch_alc269
},
20101 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
20102 .patch
= patch_alc861
},
20103 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
20104 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
20105 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
20106 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
20107 .patch
= patch_alc882
},
20108 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
20109 .patch
= patch_alc662
},
20110 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
20111 { .id
= 0x10ec0665, .name
= "ALC665", .patch
= patch_alc662
},
20112 { .id
= 0x10ec0670, .name
= "ALC670", .patch
= patch_alc662
},
20113 { .id
= 0x10ec0680, .name
= "ALC680", .patch
= patch_alc680
},
20114 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
20115 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
20116 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc882
},
20117 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
20118 .patch
= patch_alc882
},
20119 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
20120 .patch
= patch_alc882
},
20121 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
20122 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc888
},
20123 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
20124 .patch
= patch_alc882
},
20125 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc888
},
20126 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc882
},
20127 { .id
= 0x10ec0892, .name
= "ALC892", .patch
= patch_alc662
},
20128 { .id
= 0x10ec0899, .name
= "ALC899", .patch
= patch_alc899
},
20129 {} /* terminator */
20132 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20134 MODULE_LICENSE("GPL");
20135 MODULE_DESCRIPTION("Realtek HD-audio codec");
20137 static struct hda_codec_preset_list realtek_list
= {
20138 .preset
= snd_hda_preset_realtek
,
20139 .owner
= THIS_MODULE
,
20142 static int __init
patch_realtek_init(void)
20144 return snd_hda_add_codec_preset(&realtek_list
);
20147 static void __exit
patch_realtek_exit(void)
20149 snd_hda_delete_codec_preset(&realtek_list
);
20152 module_init(patch_realtek_init
)
20153 module_exit(patch_realtek_exit
)