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 */
351 hda_nid_t mixer_nid
; /* analog-mixer NID */
353 /* capture setup for dynamic dual-adc switch */
354 unsigned int cur_adc_idx
;
356 unsigned int cur_adc_stream_tag
;
357 unsigned int cur_adc_format
;
360 unsigned int num_mux_defs
;
361 const struct hda_input_mux
*input_mux
;
362 unsigned int cur_mux
[3];
363 struct alc_mic_route ext_mic
;
364 struct alc_mic_route dock_mic
;
365 struct alc_mic_route int_mic
;
368 const struct hda_channel_mode
*channel_mode
;
369 int num_channel_mode
;
371 int const_channel_count
;
372 int ext_channel_count
;
374 /* PCM information */
375 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
377 /* dynamic controls, init_verbs and input_mux */
378 struct auto_pin_cfg autocfg
;
379 struct alc_customize_define cdefine
;
380 struct snd_array kctls
;
381 struct hda_input_mux private_imux
[3];
382 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
383 hda_nid_t private_adc_nids
[AUTO_CFG_MAX_OUTS
];
384 hda_nid_t private_capsrc_nids
[AUTO_CFG_MAX_OUTS
];
387 void (*init_hook
)(struct hda_codec
*codec
);
388 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
389 #ifdef CONFIG_SND_HDA_POWER_SAVE
390 void (*power_hook
)(struct hda_codec
*codec
);
392 void (*shutup
)(struct hda_codec
*codec
);
394 /* for pin sensing */
395 unsigned int jack_present
: 1;
396 unsigned int line_jack_present
:1;
397 unsigned int master_mute
:1;
398 unsigned int auto_mic
:1;
399 unsigned int automute
:1; /* HP automute enabled */
400 unsigned int detect_line
:1; /* Line-out detection enabled */
401 unsigned int automute_lines
:1; /* automute line-out as well */
402 unsigned int automute_hp_lo
:1; /* both HP and LO available */
405 unsigned int no_analog
:1; /* digital I/O only */
406 unsigned int dual_adc_switch
:1; /* switch ADCs (for ALC275) */
407 unsigned int single_input_src
:1;
409 /* auto-mute control */
411 hda_nid_t automute_mixer_nid
[AUTO_CFG_MAX_OUTS
];
414 int codec_variant
; /* flag for other variants */
416 /* for virtual master */
417 hda_nid_t vmaster_nid
;
418 #ifdef CONFIG_SND_HDA_POWER_SAVE
419 struct hda_loopback_check loopback
;
424 unsigned int pll_coef_idx
, pll_coef_bit
;
428 const struct alc_fixup
*fixup_list
;
429 const char *fixup_name
;
433 struct alc_multi_io multi_io
[4];
437 * configuration template - to be copied to the spec instance
439 struct alc_config_preset
{
440 const struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
443 const struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
444 const struct hda_verb
*init_verbs
[5];
445 unsigned int num_dacs
;
446 const hda_nid_t
*dac_nids
;
447 hda_nid_t dig_out_nid
; /* optional */
448 hda_nid_t hp_nid
; /* optional */
449 const hda_nid_t
*slave_dig_outs
;
450 unsigned int num_adc_nids
;
451 const hda_nid_t
*adc_nids
;
452 const hda_nid_t
*capsrc_nids
;
453 hda_nid_t dig_in_nid
;
454 unsigned int num_channel_mode
;
455 const struct hda_channel_mode
*channel_mode
;
457 int const_channel_count
;
458 unsigned int num_mux_defs
;
459 const struct hda_input_mux
*input_mux
;
460 void (*unsol_event
)(struct hda_codec
*, unsigned int);
461 void (*setup
)(struct hda_codec
*);
462 void (*init_hook
)(struct hda_codec
*);
463 #ifdef CONFIG_SND_HDA_POWER_SAVE
464 const struct hda_amp_list
*loopbacks
;
465 void (*power_hook
)(struct hda_codec
*codec
);
473 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
474 struct snd_ctl_elem_info
*uinfo
)
476 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
477 struct alc_spec
*spec
= codec
->spec
;
478 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
479 if (mux_idx
>= spec
->num_mux_defs
)
481 if (!spec
->input_mux
[mux_idx
].num_items
&& mux_idx
> 0)
483 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
486 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
487 struct snd_ctl_elem_value
*ucontrol
)
489 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
490 struct alc_spec
*spec
= codec
->spec
;
491 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
493 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
497 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
498 struct snd_ctl_elem_value
*ucontrol
)
500 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
501 struct alc_spec
*spec
= codec
->spec
;
502 const struct hda_input_mux
*imux
;
503 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
504 unsigned int mux_idx
;
505 hda_nid_t nid
= spec
->capsrc_nids
?
506 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
509 mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
510 imux
= &spec
->input_mux
[mux_idx
];
511 if (!imux
->num_items
&& mux_idx
> 0)
512 imux
= &spec
->input_mux
[0];
514 type
= get_wcaps_type(get_wcaps(codec
, nid
));
515 if (type
== AC_WID_AUD_MIX
) {
516 /* Matrix-mixer style (e.g. ALC882) */
517 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
520 idx
= ucontrol
->value
.enumerated
.item
[0];
521 if (idx
>= imux
->num_items
)
522 idx
= imux
->num_items
- 1;
525 for (i
= 0; i
< imux
->num_items
; i
++) {
526 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
527 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
528 imux
->items
[i
].index
,
534 /* MUX style (e.g. ALC880) */
535 return snd_hda_input_mux_put(codec
, imux
, ucontrol
, nid
,
536 &spec
->cur_mux
[adc_idx
]);
541 * channel mode setting
543 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
544 struct snd_ctl_elem_info
*uinfo
)
546 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
547 struct alc_spec
*spec
= codec
->spec
;
548 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
549 spec
->num_channel_mode
);
552 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
553 struct snd_ctl_elem_value
*ucontrol
)
555 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
556 struct alc_spec
*spec
= codec
->spec
;
557 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
558 spec
->num_channel_mode
,
559 spec
->ext_channel_count
);
562 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
563 struct snd_ctl_elem_value
*ucontrol
)
565 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
566 struct alc_spec
*spec
= codec
->spec
;
567 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
568 spec
->num_channel_mode
,
569 &spec
->ext_channel_count
);
570 if (err
>= 0 && !spec
->const_channel_count
) {
571 spec
->multiout
.max_channels
= spec
->ext_channel_count
;
572 if (spec
->need_dac_fix
)
573 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
579 * Control the mode of pin widget settings via the mixer. "pc" is used
580 * instead of "%" to avoid consequences of accidentally treating the % as
581 * being part of a format specifier. Maximum allowed length of a value is
582 * 63 characters plus NULL terminator.
584 * Note: some retasking pin complexes seem to ignore requests for input
585 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
586 * are requested. Therefore order this list so that this behaviour will not
587 * cause problems when mixer clients move through the enum sequentially.
588 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
591 static const char * const alc_pin_mode_names
[] = {
592 "Mic 50pc bias", "Mic 80pc bias",
593 "Line in", "Line out", "Headphone out",
595 static const unsigned char alc_pin_mode_values
[] = {
596 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
598 /* The control can present all 5 options, or it can limit the options based
599 * in the pin being assumed to be exclusively an input or an output pin. In
600 * addition, "input" pins may or may not process the mic bias option
601 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
602 * accept requests for bias as of chip versions up to March 2006) and/or
603 * wiring in the computer.
605 #define ALC_PIN_DIR_IN 0x00
606 #define ALC_PIN_DIR_OUT 0x01
607 #define ALC_PIN_DIR_INOUT 0x02
608 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
609 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
611 /* Info about the pin modes supported by the different pin direction modes.
612 * For each direction the minimum and maximum values are given.
614 static const signed char alc_pin_mode_dir_info
[5][2] = {
615 { 0, 2 }, /* ALC_PIN_DIR_IN */
616 { 3, 4 }, /* ALC_PIN_DIR_OUT */
617 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
618 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
619 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
621 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
622 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
623 #define alc_pin_mode_n_items(_dir) \
624 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
626 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
627 struct snd_ctl_elem_info
*uinfo
)
629 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
630 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
632 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
634 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
636 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
637 item_num
= alc_pin_mode_min(dir
);
638 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
642 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
643 struct snd_ctl_elem_value
*ucontrol
)
646 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
647 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
648 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
649 long *valp
= ucontrol
->value
.integer
.value
;
650 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
651 AC_VERB_GET_PIN_WIDGET_CONTROL
,
654 /* Find enumerated value for current pinctl setting */
655 i
= alc_pin_mode_min(dir
);
656 while (i
<= alc_pin_mode_max(dir
) && alc_pin_mode_values
[i
] != pinctl
)
658 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
662 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
663 struct snd_ctl_elem_value
*ucontrol
)
666 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
667 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
668 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
669 long val
= *ucontrol
->value
.integer
.value
;
670 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
671 AC_VERB_GET_PIN_WIDGET_CONTROL
,
674 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
675 val
= alc_pin_mode_min(dir
);
677 change
= pinctl
!= alc_pin_mode_values
[val
];
679 /* Set pin mode to that requested */
680 snd_hda_codec_write_cache(codec
, nid
, 0,
681 AC_VERB_SET_PIN_WIDGET_CONTROL
,
682 alc_pin_mode_values
[val
]);
684 /* Also enable the retasking pin's input/output as required
685 * for the requested pin mode. Enum values of 2 or less are
688 * Dynamically switching the input/output buffers probably
689 * reduces noise slightly (particularly on input) so we'll
690 * do it. However, having both input and output buffers
691 * enabled simultaneously doesn't seem to be problematic if
692 * this turns out to be necessary in the future.
695 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
696 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
697 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
700 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
701 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
702 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
709 #define ALC_PIN_MODE(xname, nid, dir) \
710 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
711 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
712 .info = alc_pin_mode_info, \
713 .get = alc_pin_mode_get, \
714 .put = alc_pin_mode_put, \
715 .private_value = nid | (dir<<16) }
717 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
718 * together using a mask with more than one bit set. This control is
719 * currently used only by the ALC260 test model. At this stage they are not
720 * needed for any "production" models.
722 #ifdef CONFIG_SND_DEBUG
723 #define alc_gpio_data_info snd_ctl_boolean_mono_info
725 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
726 struct snd_ctl_elem_value
*ucontrol
)
728 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
729 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
730 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
731 long *valp
= ucontrol
->value
.integer
.value
;
732 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
733 AC_VERB_GET_GPIO_DATA
, 0x00);
735 *valp
= (val
& mask
) != 0;
738 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
739 struct snd_ctl_elem_value
*ucontrol
)
742 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
743 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
744 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
745 long val
= *ucontrol
->value
.integer
.value
;
746 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
747 AC_VERB_GET_GPIO_DATA
,
750 /* Set/unset the masked GPIO bit(s) as needed */
751 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
756 snd_hda_codec_write_cache(codec
, nid
, 0,
757 AC_VERB_SET_GPIO_DATA
, gpio_data
);
761 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
762 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
763 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
764 .info = alc_gpio_data_info, \
765 .get = alc_gpio_data_get, \
766 .put = alc_gpio_data_put, \
767 .private_value = nid | (mask<<16) }
768 #endif /* CONFIG_SND_DEBUG */
770 /* A switch control to allow the enabling of the digital IO pins on the
771 * ALC260. This is incredibly simplistic; the intention of this control is
772 * to provide something in the test model allowing digital outputs to be
773 * identified if present. If models are found which can utilise these
774 * outputs a more complete mixer control can be devised for those models if
777 #ifdef CONFIG_SND_DEBUG
778 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
780 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
781 struct snd_ctl_elem_value
*ucontrol
)
783 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
784 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
785 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
786 long *valp
= ucontrol
->value
.integer
.value
;
787 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
788 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
790 *valp
= (val
& mask
) != 0;
793 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
794 struct snd_ctl_elem_value
*ucontrol
)
797 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
798 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
799 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
800 long val
= *ucontrol
->value
.integer
.value
;
801 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
802 AC_VERB_GET_DIGI_CONVERT_1
,
805 /* Set/unset the masked control bit(s) as needed */
806 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
811 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
816 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
817 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
818 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
819 .info = alc_spdif_ctrl_info, \
820 .get = alc_spdif_ctrl_get, \
821 .put = alc_spdif_ctrl_put, \
822 .private_value = nid | (mask<<16) }
823 #endif /* CONFIG_SND_DEBUG */
825 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
826 * Again, this is only used in the ALC26x test models to help identify when
827 * the EAPD line must be asserted for features to work.
829 #ifdef CONFIG_SND_DEBUG
830 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
832 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
833 struct snd_ctl_elem_value
*ucontrol
)
835 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
836 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
837 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
838 long *valp
= ucontrol
->value
.integer
.value
;
839 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
840 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
842 *valp
= (val
& mask
) != 0;
846 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
847 struct snd_ctl_elem_value
*ucontrol
)
850 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
851 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
852 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
853 long val
= *ucontrol
->value
.integer
.value
;
854 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
855 AC_VERB_GET_EAPD_BTLENABLE
,
858 /* Set/unset the masked control bit(s) as needed */
859 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
864 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
870 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
871 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
872 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
873 .info = alc_eapd_ctrl_info, \
874 .get = alc_eapd_ctrl_get, \
875 .put = alc_eapd_ctrl_put, \
876 .private_value = nid | (mask<<16) }
877 #endif /* CONFIG_SND_DEBUG */
880 * set up the input pin config (depending on the given auto-pin type)
882 static void alc_set_input_pin(struct hda_codec
*codec
, hda_nid_t nid
,
885 unsigned int val
= PIN_IN
;
887 if (auto_pin_type
== AUTO_PIN_MIC
) {
890 oldval
= snd_hda_codec_read(codec
, nid
, 0,
891 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
892 pincap
= snd_hda_query_pin_caps(codec
, nid
);
893 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
894 /* if the default pin setup is vref50, we give it priority */
895 if ((pincap
& AC_PINCAP_VREF_80
) && oldval
!= PIN_VREF50
)
897 else if (pincap
& AC_PINCAP_VREF_50
)
899 else if (pincap
& AC_PINCAP_VREF_100
)
901 else if (pincap
& AC_PINCAP_VREF_GRD
)
904 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, val
);
907 static void alc_fixup_autocfg_pin_nums(struct hda_codec
*codec
)
909 struct alc_spec
*spec
= codec
->spec
;
910 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
912 if (!cfg
->line_outs
) {
913 while (cfg
->line_outs
< AUTO_CFG_MAX_OUTS
&&
914 cfg
->line_out_pins
[cfg
->line_outs
])
917 if (!cfg
->speaker_outs
) {
918 while (cfg
->speaker_outs
< AUTO_CFG_MAX_OUTS
&&
919 cfg
->speaker_pins
[cfg
->speaker_outs
])
923 while (cfg
->hp_outs
< AUTO_CFG_MAX_OUTS
&&
924 cfg
->hp_pins
[cfg
->hp_outs
])
931 static void add_mixer(struct alc_spec
*spec
, const struct snd_kcontrol_new
*mix
)
933 if (snd_BUG_ON(spec
->num_mixers
>= ARRAY_SIZE(spec
->mixers
)))
935 spec
->mixers
[spec
->num_mixers
++] = mix
;
938 static void add_verb(struct alc_spec
*spec
, const struct hda_verb
*verb
)
940 if (snd_BUG_ON(spec
->num_init_verbs
>= ARRAY_SIZE(spec
->init_verbs
)))
942 spec
->init_verbs
[spec
->num_init_verbs
++] = verb
;
946 * set up from the preset table
948 static void setup_preset(struct hda_codec
*codec
,
949 const struct alc_config_preset
*preset
)
951 struct alc_spec
*spec
= codec
->spec
;
954 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
955 add_mixer(spec
, preset
->mixers
[i
]);
956 spec
->cap_mixer
= preset
->cap_mixer
;
957 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
959 add_verb(spec
, preset
->init_verbs
[i
]);
961 spec
->channel_mode
= preset
->channel_mode
;
962 spec
->num_channel_mode
= preset
->num_channel_mode
;
963 spec
->need_dac_fix
= preset
->need_dac_fix
;
964 spec
->const_channel_count
= preset
->const_channel_count
;
966 if (preset
->const_channel_count
)
967 spec
->multiout
.max_channels
= preset
->const_channel_count
;
969 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
970 spec
->ext_channel_count
= spec
->channel_mode
[0].channels
;
972 spec
->multiout
.num_dacs
= preset
->num_dacs
;
973 spec
->multiout
.dac_nids
= preset
->dac_nids
;
974 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
975 spec
->multiout
.slave_dig_outs
= preset
->slave_dig_outs
;
976 spec
->multiout
.hp_nid
= preset
->hp_nid
;
978 spec
->num_mux_defs
= preset
->num_mux_defs
;
979 if (!spec
->num_mux_defs
)
980 spec
->num_mux_defs
= 1;
981 spec
->input_mux
= preset
->input_mux
;
983 spec
->num_adc_nids
= preset
->num_adc_nids
;
984 spec
->adc_nids
= preset
->adc_nids
;
985 spec
->capsrc_nids
= preset
->capsrc_nids
;
986 spec
->dig_in_nid
= preset
->dig_in_nid
;
988 spec
->unsol_event
= preset
->unsol_event
;
989 spec
->init_hook
= preset
->init_hook
;
990 #ifdef CONFIG_SND_HDA_POWER_SAVE
991 spec
->power_hook
= preset
->power_hook
;
992 spec
->loopback
.amplist
= preset
->loopbacks
;
996 preset
->setup(codec
);
998 alc_fixup_autocfg_pin_nums(codec
);
1001 /* Enable GPIO mask and set output */
1002 static const struct hda_verb alc_gpio1_init_verbs
[] = {
1003 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
1004 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
1005 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
1009 static const struct hda_verb alc_gpio2_init_verbs
[] = {
1010 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
1011 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
1012 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
1016 static const struct hda_verb alc_gpio3_init_verbs
[] = {
1017 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
1018 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
1019 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
1024 * Fix hardware PLL issue
1025 * On some codecs, the analog PLL gating control must be off while
1026 * the default value is 1.
1028 static void alc_fix_pll(struct hda_codec
*codec
)
1030 struct alc_spec
*spec
= codec
->spec
;
1035 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
1036 spec
->pll_coef_idx
);
1037 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
1038 AC_VERB_GET_PROC_COEF
, 0);
1039 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
1040 spec
->pll_coef_idx
);
1041 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
1042 val
& ~(1 << spec
->pll_coef_bit
));
1045 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
1046 unsigned int coef_idx
, unsigned int coef_bit
)
1048 struct alc_spec
*spec
= codec
->spec
;
1049 spec
->pll_nid
= nid
;
1050 spec
->pll_coef_idx
= coef_idx
;
1051 spec
->pll_coef_bit
= coef_bit
;
1055 static int alc_init_jacks(struct hda_codec
*codec
)
1057 #ifdef CONFIG_SND_HDA_INPUT_JACK
1058 struct alc_spec
*spec
= codec
->spec
;
1060 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
1061 unsigned int mic_nid
= spec
->ext_mic
.pin
;
1062 unsigned int dock_nid
= spec
->dock_mic
.pin
;
1065 err
= snd_hda_input_jack_add(codec
, hp_nid
,
1066 SND_JACK_HEADPHONE
, NULL
);
1069 snd_hda_input_jack_report(codec
, hp_nid
);
1073 err
= snd_hda_input_jack_add(codec
, mic_nid
,
1074 SND_JACK_MICROPHONE
, NULL
);
1077 snd_hda_input_jack_report(codec
, mic_nid
);
1080 err
= snd_hda_input_jack_add(codec
, dock_nid
,
1081 SND_JACK_MICROPHONE
, NULL
);
1084 snd_hda_input_jack_report(codec
, dock_nid
);
1086 #endif /* CONFIG_SND_HDA_INPUT_JACK */
1090 static int detect_jacks(struct hda_codec
*codec
, int num_pins
, hda_nid_t
*pins
)
1094 for (i
= 0; i
< num_pins
; i
++) {
1095 hda_nid_t nid
= pins
[i
];
1098 snd_hda_input_jack_report(codec
, nid
);
1099 present
|= snd_hda_jack_detect(codec
, nid
);
1104 static void do_automute(struct hda_codec
*codec
, int num_pins
, hda_nid_t
*pins
,
1105 bool mute
, bool hp_out
)
1107 struct alc_spec
*spec
= codec
->spec
;
1108 unsigned int mute_bits
= mute
? HDA_AMP_MUTE
: 0;
1109 unsigned int pin_bits
= mute
? 0 : (hp_out
? PIN_HP
: PIN_OUT
);
1112 for (i
= 0; i
< num_pins
; i
++) {
1113 hda_nid_t nid
= pins
[i
];
1116 switch (spec
->automute_mode
) {
1117 case ALC_AUTOMUTE_PIN
:
1118 snd_hda_codec_write(codec
, nid
, 0,
1119 AC_VERB_SET_PIN_WIDGET_CONTROL
,
1122 case ALC_AUTOMUTE_AMP
:
1123 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
1124 HDA_AMP_MUTE
, mute_bits
);
1126 case ALC_AUTOMUTE_MIXER
:
1127 nid
= spec
->automute_mixer_nid
[i
];
1130 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
1131 HDA_AMP_MUTE
, mute_bits
);
1132 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 1,
1133 HDA_AMP_MUTE
, mute_bits
);
1139 /* Toggle internal speakers muting */
1140 static void update_speakers(struct hda_codec
*codec
)
1142 struct alc_spec
*spec
= codec
->spec
;
1145 /* Control HP pins/amps depending on master_mute state;
1146 * in general, HP pins/amps control should be enabled in all cases,
1147 * but currently set only for master_mute, just to be safe
1149 do_automute(codec
, ARRAY_SIZE(spec
->autocfg
.hp_pins
),
1150 spec
->autocfg
.hp_pins
, spec
->master_mute
, true);
1152 if (!spec
->automute
)
1155 on
= spec
->jack_present
| spec
->line_jack_present
;
1156 on
|= spec
->master_mute
;
1157 do_automute(codec
, ARRAY_SIZE(spec
->autocfg
.speaker_pins
),
1158 spec
->autocfg
.speaker_pins
, on
, false);
1160 /* toggle line-out mutes if needed, too */
1161 /* if LO is a copy of either HP or Speaker, don't need to handle it */
1162 if (spec
->autocfg
.line_out_pins
[0] == spec
->autocfg
.hp_pins
[0] ||
1163 spec
->autocfg
.line_out_pins
[0] == spec
->autocfg
.speaker_pins
[0])
1165 if (!spec
->automute_lines
|| !spec
->automute
)
1168 on
= spec
->jack_present
;
1169 on
|= spec
->master_mute
;
1170 do_automute(codec
, ARRAY_SIZE(spec
->autocfg
.line_out_pins
),
1171 spec
->autocfg
.line_out_pins
, on
, false);
1174 static void alc_hp_automute(struct hda_codec
*codec
)
1176 struct alc_spec
*spec
= codec
->spec
;
1178 if (!spec
->automute
)
1180 spec
->jack_present
=
1181 detect_jacks(codec
, ARRAY_SIZE(spec
->autocfg
.hp_pins
),
1182 spec
->autocfg
.hp_pins
);
1183 update_speakers(codec
);
1186 static void alc_line_automute(struct hda_codec
*codec
)
1188 struct alc_spec
*spec
= codec
->spec
;
1190 if (!spec
->automute
|| !spec
->detect_line
)
1192 spec
->line_jack_present
=
1193 detect_jacks(codec
, ARRAY_SIZE(spec
->autocfg
.line_out_pins
),
1194 spec
->autocfg
.line_out_pins
);
1195 update_speakers(codec
);
1198 #define get_connection_index(codec, mux, nid) \
1199 snd_hda_get_conn_index(codec, mux, nid, 0)
1201 /* switch the current ADC according to the jack state */
1202 static void alc_dual_mic_adc_auto_switch(struct hda_codec
*codec
)
1204 struct alc_spec
*spec
= codec
->spec
;
1205 unsigned int present
;
1208 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1210 spec
->cur_adc_idx
= 1;
1212 spec
->cur_adc_idx
= 0;
1213 new_adc
= spec
->adc_nids
[spec
->cur_adc_idx
];
1214 if (spec
->cur_adc
&& spec
->cur_adc
!= new_adc
) {
1215 /* stream is running, let's swap the current ADC */
1216 __snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
, 1);
1217 spec
->cur_adc
= new_adc
;
1218 snd_hda_codec_setup_stream(codec
, new_adc
,
1219 spec
->cur_adc_stream_tag
, 0,
1220 spec
->cur_adc_format
);
1224 static void alc_mic_automute(struct hda_codec
*codec
)
1226 struct alc_spec
*spec
= codec
->spec
;
1227 struct alc_mic_route
*dead1
, *dead2
, *alive
;
1228 unsigned int present
, type
;
1231 if (!spec
->auto_mic
)
1233 if (!spec
->int_mic
.pin
|| !spec
->ext_mic
.pin
)
1235 if (snd_BUG_ON(!spec
->adc_nids
))
1238 if (spec
->dual_adc_switch
) {
1239 alc_dual_mic_adc_auto_switch(codec
);
1243 cap_nid
= spec
->capsrc_nids
? spec
->capsrc_nids
[0] : spec
->adc_nids
[0];
1245 alive
= &spec
->int_mic
;
1246 dead1
= &spec
->ext_mic
;
1247 dead2
= &spec
->dock_mic
;
1249 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1251 alive
= &spec
->ext_mic
;
1252 dead1
= &spec
->int_mic
;
1253 dead2
= &spec
->dock_mic
;
1255 if (!present
&& spec
->dock_mic
.pin
> 0) {
1256 present
= snd_hda_jack_detect(codec
, spec
->dock_mic
.pin
);
1258 alive
= &spec
->dock_mic
;
1259 dead1
= &spec
->int_mic
;
1260 dead2
= &spec
->ext_mic
;
1262 snd_hda_input_jack_report(codec
, spec
->dock_mic
.pin
);
1265 type
= get_wcaps_type(get_wcaps(codec
, cap_nid
));
1266 if (type
== AC_WID_AUD_MIX
) {
1267 /* Matrix-mixer style (e.g. ALC882) */
1268 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1272 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1274 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
1276 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1278 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
1280 /* MUX style (e.g. ALC880) */
1281 snd_hda_codec_write_cache(codec
, cap_nid
, 0,
1282 AC_VERB_SET_CONNECT_SEL
,
1285 snd_hda_input_jack_report(codec
, spec
->ext_mic
.pin
);
1287 /* FIXME: analog mixer */
1290 /* unsolicited event for HP jack sensing */
1291 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1293 if (codec
->vendor_id
== 0x10ec0880)
1298 case ALC880_HP_EVENT
:
1299 alc_hp_automute(codec
);
1301 case ALC880_FRONT_EVENT
:
1302 alc_line_automute(codec
);
1304 case ALC880_MIC_EVENT
:
1305 alc_mic_automute(codec
);
1310 static void alc_inithook(struct hda_codec
*codec
)
1312 alc_hp_automute(codec
);
1313 alc_line_automute(codec
);
1314 alc_mic_automute(codec
);
1317 /* additional initialization for ALC888 variants */
1318 static void alc888_coef_init(struct hda_codec
*codec
)
1322 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
1323 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1324 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1325 if ((tmp
& 0xf0) == 0x20)
1327 snd_hda_codec_read(codec
, 0x20, 0,
1328 AC_VERB_SET_PROC_COEF
, 0x830);
1331 snd_hda_codec_read(codec
, 0x20, 0,
1332 AC_VERB_SET_PROC_COEF
, 0x3030);
1335 static void alc889_coef_init(struct hda_codec
*codec
)
1339 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1340 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1341 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1342 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
, tmp
|0x2010);
1345 /* turn on/off EAPD control (only if available) */
1346 static void set_eapd(struct hda_codec
*codec
, hda_nid_t nid
, int on
)
1348 if (get_wcaps_type(get_wcaps(codec
, nid
)) != AC_WID_PIN
)
1350 if (snd_hda_query_pin_caps(codec
, nid
) & AC_PINCAP_EAPD
)
1351 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
1355 /* turn on/off EAPD controls of the codec */
1356 static void alc_auto_setup_eapd(struct hda_codec
*codec
, bool on
)
1358 /* We currently only handle front, HP */
1359 static hda_nid_t pins
[] = {
1360 0x0f, 0x10, 0x14, 0x15, 0
1363 for (p
= pins
; *p
; p
++)
1364 set_eapd(codec
, *p
, on
);
1367 /* generic shutup callback;
1368 * just turning off EPAD and a little pause for avoiding pop-noise
1370 static void alc_eapd_shutup(struct hda_codec
*codec
)
1372 alc_auto_setup_eapd(codec
, false);
1376 static void alc_auto_init_amp(struct hda_codec
*codec
, int type
)
1380 alc_auto_setup_eapd(codec
, true);
1382 case ALC_INIT_GPIO1
:
1383 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
1385 case ALC_INIT_GPIO2
:
1386 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
1388 case ALC_INIT_GPIO3
:
1389 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
1391 case ALC_INIT_DEFAULT
:
1392 switch (codec
->vendor_id
) {
1394 snd_hda_codec_write(codec
, 0x1a, 0,
1395 AC_VERB_SET_COEF_INDEX
, 7);
1396 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
1397 AC_VERB_GET_PROC_COEF
, 0);
1398 snd_hda_codec_write(codec
, 0x1a, 0,
1399 AC_VERB_SET_COEF_INDEX
, 7);
1400 snd_hda_codec_write(codec
, 0x1a, 0,
1401 AC_VERB_SET_PROC_COEF
,
1410 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
1411 alc889_coef_init(codec
);
1414 alc888_coef_init(codec
);
1416 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1419 snd_hda_codec_write(codec
, 0x20, 0,
1420 AC_VERB_SET_COEF_INDEX
, 7);
1421 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1422 AC_VERB_GET_PROC_COEF
, 0);
1423 snd_hda_codec_write(codec
, 0x20, 0,
1424 AC_VERB_SET_COEF_INDEX
, 7);
1425 snd_hda_codec_write(codec
, 0x20, 0,
1426 AC_VERB_SET_PROC_COEF
,
1435 static int alc_automute_mode_info(struct snd_kcontrol
*kcontrol
,
1436 struct snd_ctl_elem_info
*uinfo
)
1438 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1439 struct alc_spec
*spec
= codec
->spec
;
1440 static const char * const texts2
[] = {
1441 "Disabled", "Enabled"
1443 static const char * const texts3
[] = {
1444 "Disabled", "Speaker Only", "Line-Out+Speaker"
1446 const char * const *texts
;
1448 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
1450 if (spec
->automute_hp_lo
) {
1451 uinfo
->value
.enumerated
.items
= 3;
1454 uinfo
->value
.enumerated
.items
= 2;
1457 if (uinfo
->value
.enumerated
.item
>= uinfo
->value
.enumerated
.items
)
1458 uinfo
->value
.enumerated
.item
= uinfo
->value
.enumerated
.items
- 1;
1459 strcpy(uinfo
->value
.enumerated
.name
,
1460 texts
[uinfo
->value
.enumerated
.item
]);
1464 static int alc_automute_mode_get(struct snd_kcontrol
*kcontrol
,
1465 struct snd_ctl_elem_value
*ucontrol
)
1467 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1468 struct alc_spec
*spec
= codec
->spec
;
1470 if (!spec
->automute
)
1472 else if (!spec
->automute_lines
)
1476 ucontrol
->value
.enumerated
.item
[0] = val
;
1480 static int alc_automute_mode_put(struct snd_kcontrol
*kcontrol
,
1481 struct snd_ctl_elem_value
*ucontrol
)
1483 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1484 struct alc_spec
*spec
= codec
->spec
;
1486 switch (ucontrol
->value
.enumerated
.item
[0]) {
1488 if (!spec
->automute
)
1493 if (spec
->automute
&& !spec
->automute_lines
)
1496 spec
->automute_lines
= 0;
1499 if (!spec
->automute_hp_lo
)
1501 if (spec
->automute
&& spec
->automute_lines
)
1504 spec
->automute_lines
= 1;
1509 update_speakers(codec
);
1513 static const struct snd_kcontrol_new alc_automute_mode_enum
= {
1514 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1515 .name
= "Auto-Mute Mode",
1516 .info
= alc_automute_mode_info
,
1517 .get
= alc_automute_mode_get
,
1518 .put
= alc_automute_mode_put
,
1521 static struct snd_kcontrol_new
*alc_kcontrol_new(struct alc_spec
*spec
);
1523 static int alc_add_automute_mode_enum(struct hda_codec
*codec
)
1525 struct alc_spec
*spec
= codec
->spec
;
1526 struct snd_kcontrol_new
*knew
;
1528 knew
= alc_kcontrol_new(spec
);
1531 *knew
= alc_automute_mode_enum
;
1532 knew
->name
= kstrdup("Auto-Mute Mode", GFP_KERNEL
);
1538 static void alc_init_auto_hp(struct hda_codec
*codec
)
1540 struct alc_spec
*spec
= codec
->spec
;
1541 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1545 if (cfg
->hp_pins
[0])
1547 if (cfg
->line_out_pins
[0])
1549 if (cfg
->speaker_pins
[0])
1551 if (present
< 2) /* need two different output types */
1554 spec
->automute_hp_lo
= 1; /* both HP and LO automute */
1556 if (!cfg
->speaker_pins
[0]) {
1557 memcpy(cfg
->speaker_pins
, cfg
->line_out_pins
,
1558 sizeof(cfg
->speaker_pins
));
1559 cfg
->speaker_outs
= cfg
->line_outs
;
1562 if (!cfg
->hp_pins
[0]) {
1563 memcpy(cfg
->hp_pins
, cfg
->line_out_pins
,
1564 sizeof(cfg
->hp_pins
));
1565 cfg
->hp_outs
= cfg
->line_outs
;
1568 for (i
= 0; i
< cfg
->hp_outs
; i
++) {
1569 hda_nid_t nid
= cfg
->hp_pins
[i
];
1570 if (!is_jack_detectable(codec
, nid
))
1572 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1574 snd_hda_codec_write_cache(codec
, nid
, 0,
1575 AC_VERB_SET_UNSOLICITED_ENABLE
,
1576 AC_USRSP_EN
| ALC880_HP_EVENT
);
1578 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
1580 if (spec
->automute
&& cfg
->line_out_pins
[0] &&
1581 cfg
->line_out_pins
[0] != cfg
->hp_pins
[0] &&
1582 cfg
->line_out_pins
[0] != cfg
->speaker_pins
[0]) {
1583 for (i
= 0; i
< cfg
->line_outs
; i
++) {
1584 hda_nid_t nid
= cfg
->line_out_pins
[i
];
1585 if (!is_jack_detectable(codec
, nid
))
1587 snd_printdd("realtek: Enable Line-Out auto-muting "
1588 "on NID 0x%x\n", nid
);
1589 snd_hda_codec_write_cache(codec
, nid
, 0,
1590 AC_VERB_SET_UNSOLICITED_ENABLE
,
1591 AC_USRSP_EN
| ALC880_FRONT_EVENT
);
1592 spec
->detect_line
= 1;
1594 spec
->automute_lines
= spec
->detect_line
;
1597 if (spec
->automute
) {
1598 /* create a control for automute mode */
1599 alc_add_automute_mode_enum(codec
);
1600 spec
->unsol_event
= alc_sku_unsol_event
;
1604 static void alc_init_auto_mic(struct hda_codec
*codec
)
1606 struct alc_spec
*spec
= codec
->spec
;
1607 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1608 hda_nid_t fixed
, ext
, dock
;
1611 fixed
= ext
= dock
= 0;
1612 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
1613 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
1614 unsigned int defcfg
;
1615 defcfg
= snd_hda_codec_get_pincfg(codec
, nid
);
1616 switch (snd_hda_get_input_pin_attr(defcfg
)) {
1617 case INPUT_PIN_ATTR_INT
:
1619 return; /* already occupied */
1620 if (cfg
->inputs
[i
].type
!= AUTO_PIN_MIC
)
1621 return; /* invalid type */
1624 case INPUT_PIN_ATTR_UNUSED
:
1625 return; /* invalid entry */
1626 case INPUT_PIN_ATTR_DOCK
:
1628 return; /* already occupied */
1629 if (cfg
->inputs
[i
].type
> AUTO_PIN_LINE_IN
)
1630 return; /* invalid type */
1635 return; /* already occupied */
1636 if (cfg
->inputs
[i
].type
!= AUTO_PIN_MIC
)
1637 return; /* invalid type */
1648 if (!is_jack_detectable(codec
, ext
))
1649 return; /* no unsol support */
1650 if (dock
&& !is_jack_detectable(codec
, dock
))
1651 return; /* no unsol support */
1652 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
1654 spec
->ext_mic
.pin
= ext
;
1655 spec
->dock_mic
.pin
= dock
;
1656 spec
->int_mic
.pin
= fixed
;
1657 spec
->ext_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1658 spec
->dock_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1659 spec
->int_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1661 snd_hda_codec_write_cache(codec
, spec
->ext_mic
.pin
, 0,
1662 AC_VERB_SET_UNSOLICITED_ENABLE
,
1663 AC_USRSP_EN
| ALC880_MIC_EVENT
);
1664 spec
->unsol_event
= alc_sku_unsol_event
;
1667 /* Could be any non-zero and even value. When used as fixup, tells
1668 * the driver to ignore any present sku defines.
1670 #define ALC_FIXUP_SKU_IGNORE (2)
1672 static int alc_auto_parse_customize_define(struct hda_codec
*codec
)
1674 unsigned int ass
, tmp
, i
;
1676 struct alc_spec
*spec
= codec
->spec
;
1678 spec
->cdefine
.enable_pcbeep
= 1; /* assume always enabled */
1680 if (spec
->cdefine
.fixup
) {
1681 ass
= spec
->cdefine
.sku_cfg
;
1682 if (ass
== ALC_FIXUP_SKU_IGNORE
)
1687 ass
= codec
->subsystem_id
& 0xffff;
1688 if (ass
!= codec
->bus
->pci
->subsystem_device
&& (ass
& 1))
1692 if (codec
->vendor_id
== 0x10ec0260)
1694 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1697 printk(KERN_INFO
"hda_codec: %s: SKU not ready 0x%08x\n",
1698 codec
->chip_name
, ass
);
1704 for (i
= 1; i
< 16; i
++) {
1708 if (((ass
>> 16) & 0xf) != tmp
)
1711 spec
->cdefine
.port_connectivity
= ass
>> 30;
1712 spec
->cdefine
.enable_pcbeep
= (ass
& 0x100000) >> 20;
1713 spec
->cdefine
.check_sum
= (ass
>> 16) & 0xf;
1714 spec
->cdefine
.customization
= ass
>> 8;
1716 spec
->cdefine
.sku_cfg
= ass
;
1717 spec
->cdefine
.external_amp
= (ass
& 0x38) >> 3;
1718 spec
->cdefine
.platform_type
= (ass
& 0x4) >> 2;
1719 spec
->cdefine
.swap
= (ass
& 0x2) >> 1;
1720 spec
->cdefine
.override
= ass
& 0x1;
1722 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1723 nid
, spec
->cdefine
.sku_cfg
);
1724 snd_printd("SKU: port_connectivity=0x%x\n",
1725 spec
->cdefine
.port_connectivity
);
1726 snd_printd("SKU: enable_pcbeep=0x%x\n", spec
->cdefine
.enable_pcbeep
);
1727 snd_printd("SKU: check_sum=0x%08x\n", spec
->cdefine
.check_sum
);
1728 snd_printd("SKU: customization=0x%08x\n", spec
->cdefine
.customization
);
1729 snd_printd("SKU: external_amp=0x%x\n", spec
->cdefine
.external_amp
);
1730 snd_printd("SKU: platform_type=0x%x\n", spec
->cdefine
.platform_type
);
1731 snd_printd("SKU: swap=0x%x\n", spec
->cdefine
.swap
);
1732 snd_printd("SKU: override=0x%x\n", spec
->cdefine
.override
);
1737 static bool found_in_nid_list(hda_nid_t nid
, const hda_nid_t
*list
, int nums
)
1740 for (i
= 0; i
< nums
; i
++)
1746 /* check subsystem ID and set up device-specific initialization;
1747 * return 1 if initialized, 0 if invalid SSID
1749 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1750 * 31 ~ 16 : Manufacture ID
1752 * 7 ~ 0 : Assembly ID
1753 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1755 static int alc_subsystem_id(struct hda_codec
*codec
,
1756 hda_nid_t porta
, hda_nid_t porte
,
1757 hda_nid_t portd
, hda_nid_t porti
)
1759 unsigned int ass
, tmp
, i
;
1761 struct alc_spec
*spec
= codec
->spec
;
1763 if (spec
->cdefine
.fixup
) {
1764 ass
= spec
->cdefine
.sku_cfg
;
1765 if (ass
== ALC_FIXUP_SKU_IGNORE
)
1770 ass
= codec
->subsystem_id
& 0xffff;
1771 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
1774 /* invalid SSID, check the special NID pin defcfg instead */
1776 * 31~30 : port connectivity
1779 * 19~16 : Check sum (15:1)
1784 if (codec
->vendor_id
== 0x10ec0260)
1786 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1787 snd_printd("realtek: No valid SSID, "
1788 "checking pincfg 0x%08x for NID 0x%x\n",
1792 if ((ass
>> 30) != 1) /* no physical connection */
1797 for (i
= 1; i
< 16; i
++) {
1801 if (((ass
>> 16) & 0xf) != tmp
)
1804 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1805 ass
& 0xffff, codec
->vendor_id
);
1809 * 2 : 0 --> Desktop, 1 --> Laptop
1810 * 3~5 : External Amplifier control
1813 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
1816 spec
->init_amp
= ALC_INIT_GPIO1
;
1819 spec
->init_amp
= ALC_INIT_GPIO2
;
1822 spec
->init_amp
= ALC_INIT_GPIO3
;
1826 spec
->init_amp
= ALC_INIT_DEFAULT
;
1830 /* is laptop or Desktop and enable the function "Mute internal speaker
1831 * when the external headphone out jack is plugged"
1833 if (!(ass
& 0x8000))
1836 * 10~8 : Jack location
1837 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1839 * 15 : 1 --> enable the function "Mute internal speaker
1840 * when the external headphone out jack is plugged"
1842 if (!spec
->autocfg
.hp_pins
[0]) {
1844 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
1855 if (found_in_nid_list(nid
, spec
->autocfg
.line_out_pins
,
1856 spec
->autocfg
.line_outs
))
1858 spec
->autocfg
.hp_pins
[0] = nid
;
1863 static void alc_ssid_check(struct hda_codec
*codec
,
1864 hda_nid_t porta
, hda_nid_t porte
,
1865 hda_nid_t portd
, hda_nid_t porti
)
1867 if (!alc_subsystem_id(codec
, porta
, porte
, portd
, porti
)) {
1868 struct alc_spec
*spec
= codec
->spec
;
1869 snd_printd("realtek: "
1870 "Enable default setup for auto mode as fallback\n");
1871 spec
->init_amp
= ALC_INIT_DEFAULT
;
1874 alc_init_auto_hp(codec
);
1875 alc_init_auto_mic(codec
);
1879 * Fix-up pin default configurations and add default verbs
1887 struct alc_model_fixup
{
1898 const struct alc_pincfg
*pins
;
1899 const struct hda_verb
*verbs
;
1900 void (*func
)(struct hda_codec
*codec
,
1901 const struct alc_fixup
*fix
,
1915 ALC_FIXUP_ACT_PRE_PROBE
,
1916 ALC_FIXUP_ACT_PROBE
,
1920 static void alc_apply_fixup(struct hda_codec
*codec
, int action
)
1922 struct alc_spec
*spec
= codec
->spec
;
1923 int id
= spec
->fixup_id
;
1924 #ifdef CONFIG_SND_DEBUG_VERBOSE
1925 const char *modelname
= spec
->fixup_name
;
1929 if (!spec
->fixup_list
)
1933 const struct alc_fixup
*fix
= spec
->fixup_list
+ id
;
1934 const struct alc_pincfg
*cfg
;
1936 switch (fix
->type
) {
1938 if (action
!= ALC_FIXUP_ACT_PRE_PROBE
|| !fix
->v
.sku
)
1940 snd_printdd(KERN_INFO
"hda_codec: %s: "
1941 "Apply sku override for %s\n",
1942 codec
->chip_name
, modelname
);
1943 spec
->cdefine
.sku_cfg
= fix
->v
.sku
;
1944 spec
->cdefine
.fixup
= 1;
1946 case ALC_FIXUP_PINS
:
1948 if (action
!= ALC_FIXUP_ACT_PRE_PROBE
|| !cfg
)
1950 snd_printdd(KERN_INFO
"hda_codec: %s: "
1951 "Apply pincfg for %s\n",
1952 codec
->chip_name
, modelname
);
1953 for (; cfg
->nid
; cfg
++)
1954 snd_hda_codec_set_pincfg(codec
, cfg
->nid
,
1957 case ALC_FIXUP_VERBS
:
1958 if (action
!= ALC_FIXUP_ACT_PROBE
|| !fix
->v
.verbs
)
1960 snd_printdd(KERN_INFO
"hda_codec: %s: "
1961 "Apply fix-verbs for %s\n",
1962 codec
->chip_name
, modelname
);
1963 add_verb(codec
->spec
, fix
->v
.verbs
);
1965 case ALC_FIXUP_FUNC
:
1968 snd_printdd(KERN_INFO
"hda_codec: %s: "
1969 "Apply fix-func for %s\n",
1970 codec
->chip_name
, modelname
);
1971 fix
->v
.func(codec
, fix
, action
);
1974 snd_printk(KERN_ERR
"hda_codec: %s: "
1975 "Invalid fixup type %d\n",
1976 codec
->chip_name
, fix
->type
);
1987 static void alc_pick_fixup(struct hda_codec
*codec
,
1988 const struct alc_model_fixup
*models
,
1989 const struct snd_pci_quirk
*quirk
,
1990 const struct alc_fixup
*fixlist
)
1992 struct alc_spec
*spec
= codec
->spec
;
1994 const char *name
= NULL
;
1996 if (codec
->modelname
&& models
) {
1997 while (models
->name
) {
1998 if (!strcmp(codec
->modelname
, models
->name
)) {
2000 name
= models
->name
;
2007 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
2010 #ifdef CONFIG_SND_DEBUG_VERBOSE
2016 spec
->fixup_id
= id
;
2018 spec
->fixup_list
= fixlist
;
2019 spec
->fixup_name
= name
;
2023 static int alc_read_coef_idx(struct hda_codec
*codec
,
2024 unsigned int coef_idx
)
2027 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
2029 val
= snd_hda_codec_read(codec
, 0x20, 0,
2030 AC_VERB_GET_PROC_COEF
, 0);
2034 static void alc_write_coef_idx(struct hda_codec
*codec
, unsigned int coef_idx
,
2035 unsigned int coef_val
)
2037 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
2039 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
,
2043 /* set right pin controls for digital I/O */
2044 static void alc_auto_init_digital(struct hda_codec
*codec
)
2046 struct alc_spec
*spec
= codec
->spec
;
2050 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
2051 pin
= spec
->autocfg
.dig_out_pins
[i
];
2054 snd_hda_codec_write(codec
, pin
, 0,
2055 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
2057 dac
= spec
->multiout
.dig_out_nid
;
2059 dac
= spec
->slave_dig_outs
[i
- 1];
2060 if (!dac
|| !(get_wcaps(codec
, dac
) & AC_WCAP_OUT_AMP
))
2062 snd_hda_codec_write(codec
, dac
, 0,
2063 AC_VERB_SET_AMP_GAIN_MUTE
,
2066 pin
= spec
->autocfg
.dig_in_pin
;
2068 snd_hda_codec_write(codec
, pin
, 0,
2069 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2073 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
2074 static void alc_auto_parse_digital(struct hda_codec
*codec
)
2076 struct alc_spec
*spec
= codec
->spec
;
2080 /* support multiple SPDIFs; the secondary is set up as a slave */
2081 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
2082 err
= snd_hda_get_connections(codec
,
2083 spec
->autocfg
.dig_out_pins
[i
],
2088 spec
->multiout
.dig_out_nid
= dig_nid
;
2089 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
2091 spec
->multiout
.slave_dig_outs
= spec
->slave_dig_outs
;
2092 if (i
>= ARRAY_SIZE(spec
->slave_dig_outs
) - 1)
2094 spec
->slave_dig_outs
[i
- 1] = dig_nid
;
2098 if (spec
->autocfg
.dig_in_pin
) {
2099 dig_nid
= codec
->start_nid
;
2100 for (i
= 0; i
< codec
->num_nodes
; i
++, dig_nid
++) {
2101 unsigned int wcaps
= get_wcaps(codec
, dig_nid
);
2102 if (get_wcaps_type(wcaps
) != AC_WID_AUD_IN
)
2104 if (!(wcaps
& AC_WCAP_DIGITAL
))
2106 if (!(wcaps
& AC_WCAP_CONN_LIST
))
2108 err
= get_connection_index(codec
, dig_nid
,
2109 spec
->autocfg
.dig_in_pin
);
2111 spec
->dig_in_nid
= dig_nid
;
2125 static const struct hda_verb alc888_4ST_ch2_intel_init
[] = {
2126 /* Mic-in jack as mic in */
2127 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2128 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2129 /* Line-in jack as Line in */
2130 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2131 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2132 /* Line-Out as Front */
2133 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
2140 static const struct hda_verb alc888_4ST_ch4_intel_init
[] = {
2141 /* Mic-in jack as mic in */
2142 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2143 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2144 /* Line-in jack as Surround */
2145 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2146 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2147 /* Line-Out as Front */
2148 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
2155 static const struct hda_verb alc888_4ST_ch6_intel_init
[] = {
2156 /* Mic-in jack as CLFE */
2157 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2158 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2159 /* Line-in jack as Surround */
2160 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2161 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2162 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
2163 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
2170 static const struct hda_verb alc888_4ST_ch8_intel_init
[] = {
2171 /* Mic-in jack as CLFE */
2172 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2173 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2174 /* Line-in jack as Surround */
2175 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2176 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2177 /* Line-Out as Side */
2178 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
2182 static const struct hda_channel_mode alc888_4ST_8ch_intel_modes
[4] = {
2183 { 2, alc888_4ST_ch2_intel_init
},
2184 { 4, alc888_4ST_ch4_intel_init
},
2185 { 6, alc888_4ST_ch6_intel_init
},
2186 { 8, alc888_4ST_ch8_intel_init
},
2190 * ALC888 Fujitsu Siemens Amillo xa3530
2193 static const struct hda_verb alc888_fujitsu_xa3530_verbs
[] = {
2194 /* Front Mic: set to PIN_IN (empty by default) */
2195 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2196 /* Connect Internal HP to Front */
2197 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2198 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2199 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2200 /* Connect Bass HP to Front */
2201 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2202 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2203 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2204 /* Connect Line-Out side jack (SPDIF) to Side */
2205 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2206 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2207 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
2208 /* Connect Mic jack to CLFE */
2209 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2210 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2211 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
2212 /* Connect Line-in jack to Surround */
2213 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2214 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2215 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
2216 /* Connect HP out jack to Front */
2217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2218 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2219 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2220 /* Enable unsolicited event for HP jack and Line-out jack */
2221 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2222 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2226 static void alc889_automute_setup(struct hda_codec
*codec
)
2228 struct alc_spec
*spec
= codec
->spec
;
2230 spec
->autocfg
.hp_pins
[0] = 0x15;
2231 spec
->autocfg
.speaker_pins
[0] = 0x14;
2232 spec
->autocfg
.speaker_pins
[1] = 0x16;
2233 spec
->autocfg
.speaker_pins
[2] = 0x17;
2234 spec
->autocfg
.speaker_pins
[3] = 0x19;
2235 spec
->autocfg
.speaker_pins
[4] = 0x1a;
2237 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2240 static void alc889_intel_init_hook(struct hda_codec
*codec
)
2242 alc889_coef_init(codec
);
2243 alc_hp_automute(codec
);
2246 static void alc888_fujitsu_xa3530_setup(struct hda_codec
*codec
)
2248 struct alc_spec
*spec
= codec
->spec
;
2250 spec
->autocfg
.hp_pins
[0] = 0x17; /* line-out */
2251 spec
->autocfg
.hp_pins
[1] = 0x1b; /* hp */
2252 spec
->autocfg
.speaker_pins
[0] = 0x14; /* speaker */
2253 spec
->autocfg
.speaker_pins
[1] = 0x15; /* bass */
2255 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2259 * ALC888 Acer Aspire 4930G model
2262 static const struct hda_verb alc888_acer_aspire_4930g_verbs
[] = {
2263 /* Front Mic: set to PIN_IN (empty by default) */
2264 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2265 /* Unselect Front Mic by default in input mixer 3 */
2266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2267 /* Enable unsolicited event for HP jack */
2268 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2269 /* Connect Internal HP to front */
2270 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2271 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2272 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2273 /* Connect HP out to front */
2274 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2275 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2276 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2277 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2282 * ALC888 Acer Aspire 6530G model
2285 static const struct hda_verb alc888_acer_aspire_6530g_verbs
[] = {
2286 /* Route to built-in subwoofer as well as speakers */
2287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2289 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2291 /* Bias voltage on for external mic port */
2292 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
2293 /* Front Mic: set to PIN_IN (empty by default) */
2294 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2295 /* Unselect Front Mic by default in input mixer 3 */
2296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2297 /* Enable unsolicited event for HP jack */
2298 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2299 /* Enable speaker output */
2300 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2301 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2302 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2303 /* Enable headphone output */
2304 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2306 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2307 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2312 *ALC888 Acer Aspire 7730G model
2315 static const struct hda_verb alc888_acer_aspire_7730G_verbs
[] = {
2316 /* Bias voltage on for external mic port */
2317 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
2318 /* Front Mic: set to PIN_IN (empty by default) */
2319 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2320 /* Unselect Front Mic by default in input mixer 3 */
2321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2322 /* Enable unsolicited event for HP jack */
2323 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2324 /* Enable speaker output */
2325 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2326 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2327 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2328 /* Enable headphone output */
2329 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2331 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2332 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2333 /*Enable internal subwoofer */
2334 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2335 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2336 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
2337 {0x17, AC_VERB_SET_EAPD_BTLENABLE
, 2},
2342 * ALC889 Acer Aspire 8930G model
2345 static const struct hda_verb alc889_acer_aspire_8930g_verbs
[] = {
2346 /* Front Mic: set to PIN_IN (empty by default) */
2347 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2348 /* Unselect Front Mic by default in input mixer 3 */
2349 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
2350 /* Enable unsolicited event for HP jack */
2351 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
2352 /* Connect Internal Front to Front */
2353 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2354 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2355 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
2356 /* Connect Internal Rear to Rear */
2357 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2358 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2359 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
2360 /* Connect Internal CLFE to CLFE */
2361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2362 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2363 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
2364 /* Connect HP out to Front */
2365 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
2366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2367 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
2368 /* Enable all DACs */
2369 /* DAC DISABLE/MUTE 1? */
2370 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2371 {0x20, AC_VERB_SET_COEF_INDEX
, 0x03},
2372 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
2373 /* DAC DISABLE/MUTE 2? */
2374 /* some bit here disables the other DACs. Init=0x4900 */
2375 {0x20, AC_VERB_SET_COEF_INDEX
, 0x08},
2376 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
2378 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2379 * which makes the stereo useless. However, either the mic or the ALC889
2380 * makes the signal become a difference/sum signal instead of standard
2381 * stereo, which is annoying. So instead we flip this bit which makes the
2382 * codec replicate the sum signal to both channels, turning it into a
2385 /* DMIC_CONTROL? Init value = 0x0001 */
2386 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
2387 {0x20, AC_VERB_SET_PROC_COEF
, 0x0003},
2391 static const struct hda_input_mux alc888_2_capture_sources
[2] = {
2392 /* Front mic only available on one ADC */
2399 { "Front Mic", 0xb },
2412 static const struct hda_input_mux alc888_acer_aspire_6530_sources
[2] = {
2413 /* Interal mic only available on one ADC */
2420 { "Input Mix", 0xa },
2421 { "Internal Mic", 0xb },
2430 { "Input Mix", 0xa },
2435 static const struct hda_input_mux alc889_capture_sources
[3] = {
2436 /* Digital mic only available on first "ADC" */
2443 { "Front Mic", 0xb },
2444 { "Input Mix", 0xa },
2453 { "Input Mix", 0xa },
2462 { "Input Mix", 0xa },
2467 static const struct snd_kcontrol_new alc888_base_mixer
[] = {
2468 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2469 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2470 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2471 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2472 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2474 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2475 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2476 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2477 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2478 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2479 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2480 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2482 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2484 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2489 static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer
[] = {
2490 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2491 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2492 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2493 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2494 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2496 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2497 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2498 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2499 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT
),
2500 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT
),
2501 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2502 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2503 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2504 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2505 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2506 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2507 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2511 static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer
[] = {
2512 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2513 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2514 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2515 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2516 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2518 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2519 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2520 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2521 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2522 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2523 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2524 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
2525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2530 static void alc888_acer_aspire_4930g_setup(struct hda_codec
*codec
)
2532 struct alc_spec
*spec
= codec
->spec
;
2534 spec
->autocfg
.hp_pins
[0] = 0x15;
2535 spec
->autocfg
.speaker_pins
[0] = 0x14;
2536 spec
->autocfg
.speaker_pins
[1] = 0x16;
2537 spec
->autocfg
.speaker_pins
[2] = 0x17;
2539 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2542 static void alc888_acer_aspire_6530g_setup(struct hda_codec
*codec
)
2544 struct alc_spec
*spec
= codec
->spec
;
2546 spec
->autocfg
.hp_pins
[0] = 0x15;
2547 spec
->autocfg
.speaker_pins
[0] = 0x14;
2548 spec
->autocfg
.speaker_pins
[1] = 0x16;
2549 spec
->autocfg
.speaker_pins
[2] = 0x17;
2551 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2554 static void alc888_acer_aspire_7730g_setup(struct hda_codec
*codec
)
2556 struct alc_spec
*spec
= codec
->spec
;
2558 spec
->autocfg
.hp_pins
[0] = 0x15;
2559 spec
->autocfg
.speaker_pins
[0] = 0x14;
2560 spec
->autocfg
.speaker_pins
[1] = 0x16;
2561 spec
->autocfg
.speaker_pins
[2] = 0x17;
2563 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2566 static void alc889_acer_aspire_8930g_setup(struct hda_codec
*codec
)
2568 struct alc_spec
*spec
= codec
->spec
;
2570 spec
->autocfg
.hp_pins
[0] = 0x15;
2571 spec
->autocfg
.speaker_pins
[0] = 0x14;
2572 spec
->autocfg
.speaker_pins
[1] = 0x16;
2573 spec
->autocfg
.speaker_pins
[2] = 0x1b;
2575 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
2579 * ALC880 3-stack model
2581 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2582 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2583 * F-Mic = 0x1b, HP = 0x19
2586 static const hda_nid_t alc880_dac_nids
[4] = {
2587 /* front, rear, clfe, rear_surr */
2588 0x02, 0x05, 0x04, 0x03
2591 static const hda_nid_t alc880_adc_nids
[3] = {
2596 /* The datasheet says the node 0x07 is connected from inputs,
2597 * but it shows zero connection in the real implementation on some devices.
2598 * Note: this is a 915GAV bug, fixed on 915GLV
2600 static const hda_nid_t alc880_adc_nids_alt
[2] = {
2605 #define ALC880_DIGOUT_NID 0x06
2606 #define ALC880_DIGIN_NID 0x0a
2608 static const struct hda_input_mux alc880_capture_source
= {
2612 { "Front Mic", 0x3 },
2618 /* channel source setting (2/6 channel selection for 3-stack) */
2620 static const struct hda_verb alc880_threestack_ch2_init
[] = {
2621 /* set line-in to input, mute it */
2622 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2623 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2624 /* set mic-in to input vref 80%, mute it */
2625 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2626 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2631 static const struct hda_verb alc880_threestack_ch6_init
[] = {
2632 /* set line-in to output, unmute it */
2633 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2634 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2635 /* set mic-in to output, unmute it */
2636 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2637 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2641 static const struct hda_channel_mode alc880_threestack_modes
[2] = {
2642 { 2, alc880_threestack_ch2_init
},
2643 { 6, alc880_threestack_ch6_init
},
2646 static const struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
2647 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2648 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2649 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2650 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2651 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2652 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2653 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2654 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2655 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2656 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2657 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2658 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2661 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2662 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
2665 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2666 .name
= "Channel Mode",
2667 .info
= alc_ch_mode_info
,
2668 .get
= alc_ch_mode_get
,
2669 .put
= alc_ch_mode_put
,
2674 /* capture mixer elements */
2675 static int alc_cap_vol_info(struct snd_kcontrol
*kcontrol
,
2676 struct snd_ctl_elem_info
*uinfo
)
2678 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2679 struct alc_spec
*spec
= codec
->spec
;
2682 mutex_lock(&codec
->control_mutex
);
2683 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2685 err
= snd_hda_mixer_amp_volume_info(kcontrol
, uinfo
);
2686 mutex_unlock(&codec
->control_mutex
);
2690 static int alc_cap_vol_tlv(struct snd_kcontrol
*kcontrol
, int op_flag
,
2691 unsigned int size
, unsigned int __user
*tlv
)
2693 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2694 struct alc_spec
*spec
= codec
->spec
;
2697 mutex_lock(&codec
->control_mutex
);
2698 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2700 err
= snd_hda_mixer_amp_tlv(kcontrol
, op_flag
, size
, tlv
);
2701 mutex_unlock(&codec
->control_mutex
);
2705 typedef int (*getput_call_t
)(struct snd_kcontrol
*kcontrol
,
2706 struct snd_ctl_elem_value
*ucontrol
);
2708 static int alc_cap_getput_caller(struct snd_kcontrol
*kcontrol
,
2709 struct snd_ctl_elem_value
*ucontrol
,
2710 getput_call_t func
, bool check_adc_switch
)
2712 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2713 struct alc_spec
*spec
= codec
->spec
;
2716 mutex_lock(&codec
->control_mutex
);
2717 if (check_adc_switch
&& spec
->dual_adc_switch
) {
2718 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
2719 kcontrol
->private_value
=
2720 HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[i
],
2722 err
= func(kcontrol
, ucontrol
);
2727 i
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
2728 kcontrol
->private_value
=
2729 HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[i
],
2731 err
= func(kcontrol
, ucontrol
);
2734 mutex_unlock(&codec
->control_mutex
);
2738 static int alc_cap_vol_get(struct snd_kcontrol
*kcontrol
,
2739 struct snd_ctl_elem_value
*ucontrol
)
2741 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2742 snd_hda_mixer_amp_volume_get
, false);
2745 static int alc_cap_vol_put(struct snd_kcontrol
*kcontrol
,
2746 struct snd_ctl_elem_value
*ucontrol
)
2748 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2749 snd_hda_mixer_amp_volume_put
, true);
2752 /* capture mixer elements */
2753 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2755 static int alc_cap_sw_get(struct snd_kcontrol
*kcontrol
,
2756 struct snd_ctl_elem_value
*ucontrol
)
2758 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2759 snd_hda_mixer_amp_switch_get
, false);
2762 static int alc_cap_sw_put(struct snd_kcontrol
*kcontrol
,
2763 struct snd_ctl_elem_value
*ucontrol
)
2765 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2766 snd_hda_mixer_amp_switch_put
, true);
2769 #define _DEFINE_CAPMIX(num) \
2771 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2772 .name = "Capture Switch", \
2773 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2775 .info = alc_cap_sw_info, \
2776 .get = alc_cap_sw_get, \
2777 .put = alc_cap_sw_put, \
2780 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2781 .name = "Capture Volume", \
2782 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2783 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2784 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2786 .info = alc_cap_vol_info, \
2787 .get = alc_cap_vol_get, \
2788 .put = alc_cap_vol_put, \
2789 .tlv = { .c = alc_cap_vol_tlv }, \
2792 #define _DEFINE_CAPSRC(num) \
2794 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2795 /* .name = "Capture Source", */ \
2796 .name = "Input Source", \
2798 .info = alc_mux_enum_info, \
2799 .get = alc_mux_enum_get, \
2800 .put = alc_mux_enum_put, \
2803 #define DEFINE_CAPMIX(num) \
2804 static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2805 _DEFINE_CAPMIX(num), \
2806 _DEFINE_CAPSRC(num), \
2810 #define DEFINE_CAPMIX_NOSRC(num) \
2811 static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2812 _DEFINE_CAPMIX(num), \
2816 /* up to three ADCs */
2820 DEFINE_CAPMIX_NOSRC(1);
2821 DEFINE_CAPMIX_NOSRC(2);
2822 DEFINE_CAPMIX_NOSRC(3);
2825 * ALC880 5-stack model
2827 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2829 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2830 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2833 /* additional mixers to alc880_three_stack_mixer */
2834 static const struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
2835 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2836 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
2840 /* channel source setting (6/8 channel selection for 5-stack) */
2842 static const struct hda_verb alc880_fivestack_ch6_init
[] = {
2843 /* set line-in to input, mute it */
2844 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2845 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2850 static const struct hda_verb alc880_fivestack_ch8_init
[] = {
2851 /* set line-in to output, unmute it */
2852 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2853 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2857 static const struct hda_channel_mode alc880_fivestack_modes
[2] = {
2858 { 6, alc880_fivestack_ch6_init
},
2859 { 8, alc880_fivestack_ch8_init
},
2864 * ALC880 6-stack model
2866 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2867 * Side = 0x05 (0x0f)
2868 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2869 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2872 static const hda_nid_t alc880_6st_dac_nids
[4] = {
2873 /* front, rear, clfe, rear_surr */
2874 0x02, 0x03, 0x04, 0x05
2877 static const struct hda_input_mux alc880_6stack_capture_source
= {
2881 { "Front Mic", 0x1 },
2887 /* fixed 8-channels */
2888 static const struct hda_channel_mode alc880_sixstack_modes
[1] = {
2892 static const struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
2893 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2894 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2895 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2896 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2897 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2898 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2899 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2900 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2901 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2902 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2903 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2904 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2905 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2906 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2908 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2909 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2910 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2912 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2913 .name
= "Channel Mode",
2914 .info
= alc_ch_mode_info
,
2915 .get
= alc_ch_mode_get
,
2916 .put
= alc_ch_mode_put
,
2925 * W810 has rear IO for:
2928 * Center/LFE (DAC 04)
2931 * The system also has a pair of internal speakers, and a headphone jack.
2932 * These are both connected to Line2 on the codec, hence to DAC 02.
2934 * There is a variable resistor to control the speaker or headphone
2935 * volume. This is a hardware-only device without a software API.
2937 * Plugging headphones in will disable the internal speakers. This is
2938 * implemented in hardware, not via the driver using jack sense. In
2939 * a similar fashion, plugging into the rear socket marked "front" will
2940 * disable both the speakers and headphones.
2942 * For input, there's a microphone jack, and an "audio in" jack.
2943 * These may not do anything useful with this driver yet, because I
2944 * haven't setup any initialization verbs for these yet...
2947 static const hda_nid_t alc880_w810_dac_nids
[3] = {
2948 /* front, rear/surround, clfe */
2952 /* fixed 6 channels */
2953 static const struct hda_channel_mode alc880_w810_modes
[1] = {
2957 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2958 static const struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
2959 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2960 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2961 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2962 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2963 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2964 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2965 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2966 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2967 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2975 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2976 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2980 static const hda_nid_t alc880_z71v_dac_nids
[1] = {
2983 #define ALC880_Z71V_HP_DAC 0x03
2985 /* fixed 2 channels */
2986 static const struct hda_channel_mode alc880_2_jack_modes
[1] = {
2990 static const struct snd_kcontrol_new alc880_z71v_mixer
[] = {
2991 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2992 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2993 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2994 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
2995 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2996 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3004 * ALC880 F1734 model
3006 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
3007 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
3010 static const hda_nid_t alc880_f1734_dac_nids
[1] = {
3013 #define ALC880_F1734_HP_DAC 0x02
3015 static const struct snd_kcontrol_new alc880_f1734_mixer
[] = {
3016 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3017 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3019 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3020 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3021 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3022 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3023 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3027 static const struct hda_input_mux alc880_f1734_capture_source
= {
3039 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3040 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3041 * Mic = 0x18, Line = 0x1a
3044 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
3045 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
3047 static const struct snd_kcontrol_new alc880_asus_mixer
[] = {
3048 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3049 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3050 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3051 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
3052 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3053 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3054 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3055 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3056 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3057 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3058 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3059 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3061 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3063 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3064 .name
= "Channel Mode",
3065 .info
= alc_ch_mode_info
,
3066 .get
= alc_ch_mode_get
,
3067 .put
= alc_ch_mode_put
,
3073 * ALC880 ASUS W1V model
3075 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3076 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3077 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
3080 /* additional mixers to alc880_asus_mixer */
3081 static const struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
3082 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
3083 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
3088 static const struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
3089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3090 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
3091 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
3092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
3093 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
3094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
3095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
3096 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
3097 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
3102 static const struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
3103 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3104 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3105 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3106 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3107 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3108 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3109 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3110 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3111 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3112 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3113 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3114 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3115 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3116 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3117 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3118 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3120 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3121 .name
= "Channel Mode",
3122 .info
= alc_ch_mode_info
,
3123 .get
= alc_ch_mode_get
,
3124 .put
= alc_ch_mode_put
,
3129 static const struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
3130 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3131 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3132 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3133 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3134 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
3135 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
3136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3137 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3138 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3139 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3143 static const struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
3144 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3145 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
3146 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3147 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
3148 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3149 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3154 * virtual master controls
3158 * slave controls for virtual master
3160 static const char * const alc_slave_vols
[] = {
3161 "Front Playback Volume",
3162 "Surround Playback Volume",
3163 "Center Playback Volume",
3164 "LFE Playback Volume",
3165 "Side Playback Volume",
3166 "Headphone Playback Volume",
3167 "Speaker Playback Volume",
3168 "Mono Playback Volume",
3169 "Line-Out Playback Volume",
3173 static const char * const alc_slave_sws
[] = {
3174 "Front Playback Switch",
3175 "Surround Playback Switch",
3176 "Center Playback Switch",
3177 "LFE Playback Switch",
3178 "Side Playback Switch",
3179 "Headphone Playback Switch",
3180 "Speaker Playback Switch",
3181 "Mono Playback Switch",
3182 "IEC958 Playback Switch",
3183 "Line-Out Playback Switch",
3188 * build control elements
3191 #define NID_MAPPING (-1)
3193 #define SUBDEV_SPEAKER_ (0 << 6)
3194 #define SUBDEV_HP_ (1 << 6)
3195 #define SUBDEV_LINE_ (2 << 6)
3196 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
3197 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
3198 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
3200 static void alc_free_kctls(struct hda_codec
*codec
);
3202 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3203 /* additional beep mixers; the actual parameters are overwritten at build */
3204 static const struct snd_kcontrol_new alc_beep_mixer
[] = {
3205 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT
),
3206 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT
),
3211 static int alc_build_controls(struct hda_codec
*codec
)
3213 struct alc_spec
*spec
= codec
->spec
;
3214 struct snd_kcontrol
*kctl
= NULL
;
3215 const struct snd_kcontrol_new
*knew
;
3220 for (i
= 0; i
< spec
->num_mixers
; i
++) {
3221 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
3225 if (spec
->cap_mixer
) {
3226 err
= snd_hda_add_new_ctls(codec
, spec
->cap_mixer
);
3230 if (spec
->multiout
.dig_out_nid
) {
3231 err
= snd_hda_create_spdif_out_ctls(codec
,
3232 spec
->multiout
.dig_out_nid
,
3233 spec
->multiout
.dig_out_nid
);
3236 if (!spec
->no_analog
) {
3237 err
= snd_hda_create_spdif_share_sw(codec
,
3241 spec
->multiout
.share_spdif
= 1;
3244 if (spec
->dig_in_nid
) {
3245 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
3250 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3251 /* create beep controls if needed */
3252 if (spec
->beep_amp
) {
3253 const struct snd_kcontrol_new
*knew
;
3254 for (knew
= alc_beep_mixer
; knew
->name
; knew
++) {
3255 struct snd_kcontrol
*kctl
;
3256 kctl
= snd_ctl_new1(knew
, codec
);
3259 kctl
->private_value
= spec
->beep_amp
;
3260 err
= snd_hda_ctl_add(codec
, 0, kctl
);
3267 /* if we have no master control, let's create it */
3268 if (!spec
->no_analog
&&
3269 !snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
3270 unsigned int vmaster_tlv
[4];
3271 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
3272 HDA_OUTPUT
, vmaster_tlv
);
3273 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
3274 vmaster_tlv
, alc_slave_vols
);
3278 if (!spec
->no_analog
&&
3279 !snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
3280 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
3281 NULL
, alc_slave_sws
);
3286 /* assign Capture Source enums to NID */
3287 if (spec
->capsrc_nids
|| spec
->adc_nids
) {
3288 kctl
= snd_hda_find_mixer_ctl(codec
, "Capture Source");
3290 kctl
= snd_hda_find_mixer_ctl(codec
, "Input Source");
3291 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
3292 const hda_nid_t
*nids
= spec
->capsrc_nids
;
3294 nids
= spec
->adc_nids
;
3295 err
= snd_hda_add_nid(codec
, kctl
, i
, nids
[i
]);
3300 if (spec
->cap_mixer
) {
3301 const char *kname
= kctl
? kctl
->id
.name
: NULL
;
3302 for (knew
= spec
->cap_mixer
; knew
->name
; knew
++) {
3303 if (kname
&& strcmp(knew
->name
, kname
) == 0)
3305 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
3306 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
3307 err
= snd_hda_add_nid(codec
, kctl
, i
,
3315 /* other nid->control mapping */
3316 for (i
= 0; i
< spec
->num_mixers
; i
++) {
3317 for (knew
= spec
->mixers
[i
]; knew
->name
; knew
++) {
3318 if (knew
->iface
!= NID_MAPPING
)
3320 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
3323 u
= knew
->subdevice
;
3324 for (j
= 0; j
< 4; j
++, u
>>= 8) {
3329 case SUBDEV_SPEAKER_
:
3330 nid
= spec
->autocfg
.speaker_pins
[nid
];
3333 nid
= spec
->autocfg
.line_out_pins
[nid
];
3336 nid
= spec
->autocfg
.hp_pins
[nid
];
3341 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
3345 u
= knew
->private_value
;
3346 for (j
= 0; j
< 4; j
++, u
>>= 8) {
3350 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
3357 alc_free_kctls(codec
); /* no longer needed */
3364 * initialize the codec volumes, etc
3368 * generic initialization of ADC, input mixers and output mixers
3370 static const struct hda_verb alc880_volume_init_verbs
[] = {
3372 * Unmute ADC0-2 and set the default input to mic-in
3374 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
3375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3376 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
3377 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3378 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
3379 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3381 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3383 * Note: PASD motherboards uses the Line In 2 as the input for front
3386 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3391 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3392 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3393 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3396 * Set up output mixers (0x0c - 0x0f)
3398 /* set vol=0 to output mixers */
3399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3400 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3401 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3402 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3403 /* set up input amps for analog loopback */
3404 /* Amp Indices: DAC = 0, mixer = 1 */
3405 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3406 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3407 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3408 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3409 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3410 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3412 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3418 * 3-stack pin configuration:
3419 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3421 static const struct hda_verb alc880_pin_3stack_init_verbs
[] = {
3423 * preset connection lists of input pins
3424 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3426 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
3427 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3428 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
3431 * Set pin mode and muting
3433 /* set front pin widgets 0x14 for output */
3434 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3435 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3436 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3437 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3438 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3439 /* Mic2 (as headphone out) for HP output */
3440 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3441 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3442 /* Line In pin widget for input */
3443 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3444 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3445 /* Line2 (as front mic) pin widget for input and vref at 80% */
3446 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3447 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3448 /* CD pin widget for input */
3449 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3455 * 5-stack pin configuration:
3456 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3457 * line-in/side = 0x1a, f-mic = 0x1b
3459 static const struct hda_verb alc880_pin_5stack_init_verbs
[] = {
3461 * preset connection lists of input pins
3462 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3464 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3465 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
3468 * Set pin mode and muting
3470 /* set pin widgets 0x14-0x17 for output */
3471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3472 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3473 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3474 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3475 /* unmute pins for output (no gain on this amp) */
3476 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3477 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3478 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3479 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3481 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3482 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3483 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3484 /* Mic2 (as headphone out) for HP output */
3485 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3486 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3487 /* Line In pin widget for input */
3488 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3489 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3490 /* Line2 (as front mic) pin widget for input and vref at 80% */
3491 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3492 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3493 /* CD pin widget for input */
3494 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3500 * W810 pin configuration:
3501 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3503 static const struct hda_verb alc880_pin_w810_init_verbs
[] = {
3504 /* hphone/speaker input selector: front DAC */
3505 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
3507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3509 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3510 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3511 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3512 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3514 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3515 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3521 * Z71V pin configuration:
3522 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3524 static const struct hda_verb alc880_pin_z71v_init_verbs
[] = {
3525 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3526 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3528 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3530 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3531 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3532 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3533 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3539 * 6-stack pin configuration:
3540 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3541 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3543 static const struct hda_verb alc880_pin_6stack_init_verbs
[] = {
3544 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3548 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3550 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3551 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3552 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3553 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3555 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3556 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3557 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3558 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3559 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3560 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3561 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3562 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3563 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3569 * Uniwill pin configuration:
3570 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3573 static const struct hda_verb alc880_uniwill_init_verbs
[] = {
3574 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3577 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3578 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3579 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3580 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3581 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3582 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3583 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3584 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3587 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3589 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3591 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3592 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3593 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3594 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3596 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3597 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3598 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3599 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3601 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3602 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
3609 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3611 static const struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
3612 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3615 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3616 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3618 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3619 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3623 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3624 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3627 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3628 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3629 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3630 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3631 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3632 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3634 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3635 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
3640 static const struct hda_verb alc880_beep_init_verbs
[] = {
3641 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
3645 /* auto-toggle front mic */
3646 static void alc88x_simple_mic_automute(struct hda_codec
*codec
)
3648 unsigned int present
;
3651 present
= snd_hda_jack_detect(codec
, 0x18);
3652 bits
= present
? HDA_AMP_MUTE
: 0;
3653 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
3656 static void alc880_uniwill_setup(struct hda_codec
*codec
)
3658 struct alc_spec
*spec
= codec
->spec
;
3660 spec
->autocfg
.hp_pins
[0] = 0x14;
3661 spec
->autocfg
.speaker_pins
[0] = 0x15;
3662 spec
->autocfg
.speaker_pins
[0] = 0x16;
3664 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
3667 static void alc880_uniwill_init_hook(struct hda_codec
*codec
)
3669 alc_hp_automute(codec
);
3670 alc88x_simple_mic_automute(codec
);
3673 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
3676 /* Looks like the unsol event is incompatible with the standard
3677 * definition. 4bit tag is placed at 28 bit!
3679 switch (res
>> 28) {
3680 case ALC880_MIC_EVENT
:
3681 alc88x_simple_mic_automute(codec
);
3684 alc_sku_unsol_event(codec
, res
);
3689 static void alc880_uniwill_p53_setup(struct hda_codec
*codec
)
3691 struct alc_spec
*spec
= codec
->spec
;
3693 spec
->autocfg
.hp_pins
[0] = 0x14;
3694 spec
->autocfg
.speaker_pins
[0] = 0x15;
3696 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
3699 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
3701 unsigned int present
;
3703 present
= snd_hda_codec_read(codec
, 0x21, 0,
3704 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
3705 present
&= HDA_AMP_VOLMASK
;
3706 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
3707 HDA_AMP_VOLMASK
, present
);
3708 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
3709 HDA_AMP_VOLMASK
, present
);
3712 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
3715 /* Looks like the unsol event is incompatible with the standard
3716 * definition. 4bit tag is placed at 28 bit!
3718 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
3719 alc880_uniwill_p53_dcvol_automute(codec
);
3721 alc_sku_unsol_event(codec
, res
);
3725 * F1734 pin configuration:
3726 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3728 static const struct hda_verb alc880_pin_f1734_init_verbs
[] = {
3729 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
3730 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3731 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3732 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3733 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3736 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3737 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3740 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3741 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
3743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3744 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3745 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3746 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3747 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3748 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3750 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
3751 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
3757 * ASUS pin configuration:
3758 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3760 static const struct hda_verb alc880_pin_asus_init_verbs
[] = {
3761 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3762 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3763 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3764 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3766 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3768 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3770 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3771 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3772 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3775 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3776 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3777 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3778 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3779 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3780 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3781 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3783 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3788 /* Enable GPIO mask and set output */
3789 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3790 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3791 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3793 /* Clevo m520g init */
3794 static const struct hda_verb alc880_pin_clevo_init_verbs
[] = {
3795 /* headphone output */
3796 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3798 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3799 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3801 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3802 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3804 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3805 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3806 /* Mic1 (rear panel) */
3807 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3808 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3809 /* Mic2 (front panel) */
3810 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3811 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3814 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3815 /* change to EAPD mode */
3816 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3817 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3822 static const struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
3823 /* change to EAPD mode */
3824 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3825 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3827 /* Headphone output */
3828 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3830 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3831 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
3833 /* Line In pin widget for input */
3834 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3835 /* CD pin widget for input */
3836 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3837 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3838 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3840 /* change to EAPD mode */
3841 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3842 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
3848 * LG m1 express dual
3851 * Rear Line-In/Out (blue): 0x14
3852 * Build-in Mic-In: 0x15
3854 * HP-Out (green): 0x1b
3855 * Mic-In/Out (red): 0x19
3859 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3860 static const hda_nid_t alc880_lg_dac_nids
[3] = {
3864 /* seems analog CD is not working */
3865 static const struct hda_input_mux alc880_lg_capture_source
= {
3870 { "Internal Mic", 0x6 },
3874 /* 2,4,6 channel modes */
3875 static const struct hda_verb alc880_lg_ch2_init
[] = {
3876 /* set line-in and mic-in to input */
3877 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3878 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3882 static const struct hda_verb alc880_lg_ch4_init
[] = {
3883 /* set line-in to out and mic-in to input */
3884 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3885 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3889 static const struct hda_verb alc880_lg_ch6_init
[] = {
3890 /* set line-in and mic-in to output */
3891 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3892 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3896 static const struct hda_channel_mode alc880_lg_ch_modes
[3] = {
3897 { 2, alc880_lg_ch2_init
},
3898 { 4, alc880_lg_ch4_init
},
3899 { 6, alc880_lg_ch6_init
},
3902 static const struct snd_kcontrol_new alc880_lg_mixer
[] = {
3903 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3904 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
3905 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3906 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
3907 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
3908 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
3909 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
3910 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
3911 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3912 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3913 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
3914 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
3915 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
3916 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
3918 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3919 .name
= "Channel Mode",
3920 .info
= alc_ch_mode_info
,
3921 .get
= alc_ch_mode_get
,
3922 .put
= alc_ch_mode_put
,
3927 static const struct hda_verb alc880_lg_init_verbs
[] = {
3928 /* set capture source to mic-in */
3929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3930 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3931 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3932 /* mute all amp mixer inputs */
3933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
3934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3936 /* line-in to input */
3937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3940 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3943 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3944 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3945 /* mic-in to input */
3946 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3947 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3948 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3950 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
3951 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3952 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3954 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3958 /* toggle speaker-output according to the hp-jack state */
3959 static void alc880_lg_setup(struct hda_codec
*codec
)
3961 struct alc_spec
*spec
= codec
->spec
;
3963 spec
->autocfg
.hp_pins
[0] = 0x1b;
3964 spec
->autocfg
.speaker_pins
[0] = 0x17;
3966 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
3975 * Built-in Mic-In: 0x19
3981 static const struct hda_input_mux alc880_lg_lw_capture_source
= {
3985 { "Internal Mic", 0x1 },
3990 #define alc880_lg_lw_modes alc880_threestack_modes
3992 static const struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
3993 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3994 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3995 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3996 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
3997 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3998 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3999 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
4000 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
4001 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
4002 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
4003 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4004 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4005 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
4006 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
4008 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4009 .name
= "Channel Mode",
4010 .info
= alc_ch_mode_info
,
4011 .get
= alc_ch_mode_get
,
4012 .put
= alc_ch_mode_put
,
4017 static const struct hda_verb alc880_lg_lw_init_verbs
[] = {
4018 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
4019 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
4020 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
4022 /* set capture source to mic-in */
4023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4024 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4025 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4026 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
4028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4031 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4032 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4033 /* mic-in to input */
4034 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4035 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4037 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4038 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4040 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4044 /* toggle speaker-output according to the hp-jack state */
4045 static void alc880_lg_lw_setup(struct hda_codec
*codec
)
4047 struct alc_spec
*spec
= codec
->spec
;
4049 spec
->autocfg
.hp_pins
[0] = 0x1b;
4050 spec
->autocfg
.speaker_pins
[0] = 0x14;
4052 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
4055 static const struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
4056 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4057 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
4058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4059 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4060 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4061 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4065 static const struct hda_input_mux alc880_medion_rim_capture_source
= {
4069 { "Internal Mic", 0x1 },
4073 static const struct hda_verb alc880_medion_rim_init_verbs
[] = {
4074 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
4076 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4077 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4079 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4080 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4081 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4082 /* Mic2 (as headphone out) for HP output */
4083 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4084 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4085 /* Internal Speaker */
4086 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4087 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4089 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
4090 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
4092 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4096 /* toggle speaker-output according to the hp-jack state */
4097 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
4099 struct alc_spec
*spec
= codec
->spec
;
4100 alc_hp_automute(codec
);
4102 if (spec
->jack_present
)
4103 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
4105 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
4108 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
4111 /* Looks like the unsol event is incompatible with the standard
4112 * definition. 4bit tag is placed at 28 bit!
4114 if ((res
>> 28) == ALC880_HP_EVENT
)
4115 alc880_medion_rim_automute(codec
);
4118 static void alc880_medion_rim_setup(struct hda_codec
*codec
)
4120 struct alc_spec
*spec
= codec
->spec
;
4122 spec
->autocfg
.hp_pins
[0] = 0x14;
4123 spec
->autocfg
.speaker_pins
[0] = 0x1b;
4125 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
4128 #ifdef CONFIG_SND_HDA_POWER_SAVE
4129 static const struct hda_amp_list alc880_loopbacks
[] = {
4130 { 0x0b, HDA_INPUT
, 0 },
4131 { 0x0b, HDA_INPUT
, 1 },
4132 { 0x0b, HDA_INPUT
, 2 },
4133 { 0x0b, HDA_INPUT
, 3 },
4134 { 0x0b, HDA_INPUT
, 4 },
4138 static const struct hda_amp_list alc880_lg_loopbacks
[] = {
4139 { 0x0b, HDA_INPUT
, 1 },
4140 { 0x0b, HDA_INPUT
, 6 },
4141 { 0x0b, HDA_INPUT
, 7 },
4150 static void alc_init_special_input_src(struct hda_codec
*codec
);
4152 static int alc_init(struct hda_codec
*codec
)
4154 struct alc_spec
*spec
= codec
->spec
;
4158 alc_auto_init_amp(codec
, spec
->init_amp
);
4160 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
4161 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
4162 alc_init_special_input_src(codec
);
4164 if (spec
->init_hook
)
4165 spec
->init_hook(codec
);
4167 alc_apply_fixup(codec
, ALC_FIXUP_ACT_INIT
);
4169 hda_call_check_power_status(codec
, 0x01);
4173 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4175 struct alc_spec
*spec
= codec
->spec
;
4177 if (spec
->unsol_event
)
4178 spec
->unsol_event(codec
, res
);
4181 #ifdef CONFIG_SND_HDA_POWER_SAVE
4182 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
4184 struct alc_spec
*spec
= codec
->spec
;
4185 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
4190 * Analog playback callbacks
4192 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
4193 struct hda_codec
*codec
,
4194 struct snd_pcm_substream
*substream
)
4196 struct alc_spec
*spec
= codec
->spec
;
4197 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
4201 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4202 struct hda_codec
*codec
,
4203 unsigned int stream_tag
,
4204 unsigned int format
,
4205 struct snd_pcm_substream
*substream
)
4207 struct alc_spec
*spec
= codec
->spec
;
4208 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
4209 stream_tag
, format
, substream
);
4212 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4213 struct hda_codec
*codec
,
4214 struct snd_pcm_substream
*substream
)
4216 struct alc_spec
*spec
= codec
->spec
;
4217 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
4223 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
4224 struct hda_codec
*codec
,
4225 struct snd_pcm_substream
*substream
)
4227 struct alc_spec
*spec
= codec
->spec
;
4228 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
4231 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4232 struct hda_codec
*codec
,
4233 unsigned int stream_tag
,
4234 unsigned int format
,
4235 struct snd_pcm_substream
*substream
)
4237 struct alc_spec
*spec
= codec
->spec
;
4238 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
4239 stream_tag
, format
, substream
);
4242 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4243 struct hda_codec
*codec
,
4244 struct snd_pcm_substream
*substream
)
4246 struct alc_spec
*spec
= codec
->spec
;
4247 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
4250 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
4251 struct hda_codec
*codec
,
4252 struct snd_pcm_substream
*substream
)
4254 struct alc_spec
*spec
= codec
->spec
;
4255 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
4261 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4262 struct hda_codec
*codec
,
4263 unsigned int stream_tag
,
4264 unsigned int format
,
4265 struct snd_pcm_substream
*substream
)
4267 struct alc_spec
*spec
= codec
->spec
;
4269 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
4270 stream_tag
, 0, format
);
4274 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4275 struct hda_codec
*codec
,
4276 struct snd_pcm_substream
*substream
)
4278 struct alc_spec
*spec
= codec
->spec
;
4280 snd_hda_codec_cleanup_stream(codec
,
4281 spec
->adc_nids
[substream
->number
+ 1]);
4285 /* analog capture with dynamic dual-adc changes */
4286 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
4287 struct hda_codec
*codec
,
4288 unsigned int stream_tag
,
4289 unsigned int format
,
4290 struct snd_pcm_substream
*substream
)
4292 struct alc_spec
*spec
= codec
->spec
;
4293 spec
->cur_adc
= spec
->adc_nids
[spec
->cur_adc_idx
];
4294 spec
->cur_adc_stream_tag
= stream_tag
;
4295 spec
->cur_adc_format
= format
;
4296 snd_hda_codec_setup_stream(codec
, spec
->cur_adc
, stream_tag
, 0, format
);
4300 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
4301 struct hda_codec
*codec
,
4302 struct snd_pcm_substream
*substream
)
4304 struct alc_spec
*spec
= codec
->spec
;
4305 snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
);
4310 static const struct hda_pcm_stream dualmic_pcm_analog_capture
= {
4314 .nid
= 0, /* fill later */
4316 .prepare
= dualmic_capture_pcm_prepare
,
4317 .cleanup
= dualmic_capture_pcm_cleanup
4323 static const struct hda_pcm_stream alc880_pcm_analog_playback
= {
4327 /* NID is set in alc_build_pcms */
4329 .open
= alc880_playback_pcm_open
,
4330 .prepare
= alc880_playback_pcm_prepare
,
4331 .cleanup
= alc880_playback_pcm_cleanup
4335 static const struct hda_pcm_stream alc880_pcm_analog_capture
= {
4339 /* NID is set in alc_build_pcms */
4342 static const struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
4346 /* NID is set in alc_build_pcms */
4349 static const struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
4350 .substreams
= 2, /* can be overridden */
4353 /* NID is set in alc_build_pcms */
4355 .prepare
= alc880_alt_capture_pcm_prepare
,
4356 .cleanup
= alc880_alt_capture_pcm_cleanup
4360 static const struct hda_pcm_stream alc880_pcm_digital_playback
= {
4364 /* NID is set in alc_build_pcms */
4366 .open
= alc880_dig_playback_pcm_open
,
4367 .close
= alc880_dig_playback_pcm_close
,
4368 .prepare
= alc880_dig_playback_pcm_prepare
,
4369 .cleanup
= alc880_dig_playback_pcm_cleanup
4373 static const struct hda_pcm_stream alc880_pcm_digital_capture
= {
4377 /* NID is set in alc_build_pcms */
4380 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4381 static const struct hda_pcm_stream alc_pcm_null_stream
= {
4387 static int alc_build_pcms(struct hda_codec
*codec
)
4389 struct alc_spec
*spec
= codec
->spec
;
4390 struct hda_pcm
*info
= spec
->pcm_rec
;
4393 codec
->num_pcms
= 1;
4394 codec
->pcm_info
= info
;
4396 if (spec
->no_analog
)
4399 snprintf(spec
->stream_name_analog
, sizeof(spec
->stream_name_analog
),
4400 "%s Analog", codec
->chip_name
);
4401 info
->name
= spec
->stream_name_analog
;
4403 if (spec
->stream_analog_playback
) {
4404 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
4406 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
4407 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
4409 if (spec
->stream_analog_capture
) {
4410 if (snd_BUG_ON(!spec
->adc_nids
))
4412 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
4413 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
4416 if (spec
->channel_mode
) {
4417 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
4418 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
4419 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
4420 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
4426 /* SPDIF for stream index #1 */
4427 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
4428 snprintf(spec
->stream_name_digital
,
4429 sizeof(spec
->stream_name_digital
),
4430 "%s Digital", codec
->chip_name
);
4431 codec
->num_pcms
= 2;
4432 codec
->slave_dig_outs
= spec
->multiout
.slave_dig_outs
;
4433 info
= spec
->pcm_rec
+ 1;
4434 info
->name
= spec
->stream_name_digital
;
4435 if (spec
->dig_out_type
)
4436 info
->pcm_type
= spec
->dig_out_type
;
4438 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
4439 if (spec
->multiout
.dig_out_nid
&&
4440 spec
->stream_digital_playback
) {
4441 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
4442 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
4444 if (spec
->dig_in_nid
&&
4445 spec
->stream_digital_capture
) {
4446 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
4447 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
4449 /* FIXME: do we need this for all Realtek codec models? */
4450 codec
->spdif_status_reset
= 1;
4453 if (spec
->no_analog
)
4456 /* If the use of more than one ADC is requested for the current
4457 * model, configure a second analog capture-only PCM.
4459 /* Additional Analaog capture for index #2 */
4460 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
4461 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
4462 codec
->num_pcms
= 3;
4463 info
= spec
->pcm_rec
+ 2;
4464 info
->name
= spec
->stream_name_analog
;
4465 if (spec
->alt_dac_nid
) {
4466 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
4467 *spec
->stream_analog_alt_playback
;
4468 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
4471 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
4472 alc_pcm_null_stream
;
4473 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
4475 if (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
) {
4476 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
4477 *spec
->stream_analog_alt_capture
;
4478 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
4480 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
4481 spec
->num_adc_nids
- 1;
4483 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
4484 alc_pcm_null_stream
;
4485 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
4492 static inline void alc_shutup(struct hda_codec
*codec
)
4494 struct alc_spec
*spec
= codec
->spec
;
4496 if (spec
&& spec
->shutup
)
4497 spec
->shutup(codec
);
4498 snd_hda_shutup_pins(codec
);
4501 static void alc_free_kctls(struct hda_codec
*codec
)
4503 struct alc_spec
*spec
= codec
->spec
;
4505 if (spec
->kctls
.list
) {
4506 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
4508 for (i
= 0; i
< spec
->kctls
.used
; i
++)
4509 kfree(kctl
[i
].name
);
4511 snd_array_free(&spec
->kctls
);
4514 static void alc_free(struct hda_codec
*codec
)
4516 struct alc_spec
*spec
= codec
->spec
;
4522 snd_hda_input_jack_free(codec
);
4523 alc_free_kctls(codec
);
4525 snd_hda_detach_beep_device(codec
);
4528 #ifdef CONFIG_SND_HDA_POWER_SAVE
4529 static void alc_power_eapd(struct hda_codec
*codec
)
4531 alc_auto_setup_eapd(codec
, false);
4534 static int alc_suspend(struct hda_codec
*codec
, pm_message_t state
)
4536 struct alc_spec
*spec
= codec
->spec
;
4538 if (spec
&& spec
->power_hook
)
4539 spec
->power_hook(codec
);
4544 #ifdef SND_HDA_NEEDS_RESUME
4545 static int alc_resume(struct hda_codec
*codec
)
4547 msleep(150); /* to avoid pop noise */
4548 codec
->patch_ops
.init(codec
);
4549 snd_hda_codec_resume_amp(codec
);
4550 snd_hda_codec_resume_cache(codec
);
4551 hda_call_check_power_status(codec
, 0x01);
4558 static const struct hda_codec_ops alc_patch_ops
= {
4559 .build_controls
= alc_build_controls
,
4560 .build_pcms
= alc_build_pcms
,
4563 .unsol_event
= alc_unsol_event
,
4564 #ifdef SND_HDA_NEEDS_RESUME
4565 .resume
= alc_resume
,
4567 #ifdef CONFIG_SND_HDA_POWER_SAVE
4568 .suspend
= alc_suspend
,
4569 .check_power_status
= alc_check_power_status
,
4571 .reboot_notify
= alc_shutup
,
4574 /* replace the codec chip_name with the given string */
4575 static int alc_codec_rename(struct hda_codec
*codec
, const char *name
)
4577 kfree(codec
->chip_name
);
4578 codec
->chip_name
= kstrdup(name
, GFP_KERNEL
);
4579 if (!codec
->chip_name
) {
4587 * Test configuration for debugging
4589 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4592 #ifdef CONFIG_SND_DEBUG
4593 static const hda_nid_t alc880_test_dac_nids
[4] = {
4594 0x02, 0x03, 0x04, 0x05
4597 static const struct hda_input_mux alc880_test_capture_source
= {
4606 { "Surround", 0x6 },
4610 static const struct hda_channel_mode alc880_test_modes
[4] = {
4617 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
4618 struct snd_ctl_elem_info
*uinfo
)
4620 static const char * const texts
[] = {
4621 "N/A", "Line Out", "HP Out",
4622 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4624 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4626 uinfo
->value
.enumerated
.items
= 8;
4627 if (uinfo
->value
.enumerated
.item
>= 8)
4628 uinfo
->value
.enumerated
.item
= 7;
4629 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4633 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
4634 struct snd_ctl_elem_value
*ucontrol
)
4636 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4637 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4638 unsigned int pin_ctl
, item
= 0;
4640 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
4641 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4642 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
4643 if (pin_ctl
& AC_PINCTL_HP_EN
)
4647 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
4648 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
4649 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
4650 case AC_PINCTL_VREF_50
: item
= 4; break;
4651 case AC_PINCTL_VREF_GRD
: item
= 5; break;
4652 case AC_PINCTL_VREF_80
: item
= 6; break;
4653 case AC_PINCTL_VREF_100
: item
= 7; break;
4656 ucontrol
->value
.enumerated
.item
[0] = item
;
4660 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
4661 struct snd_ctl_elem_value
*ucontrol
)
4663 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4664 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4665 static const unsigned int ctls
[] = {
4666 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
4667 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
4668 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
4669 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
4670 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
4671 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
4673 unsigned int old_ctl
, new_ctl
;
4675 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
4676 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
4677 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
4678 if (old_ctl
!= new_ctl
) {
4680 snd_hda_codec_write_cache(codec
, nid
, 0,
4681 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4683 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
4685 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
4692 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
4693 struct snd_ctl_elem_info
*uinfo
)
4695 static const char * const texts
[] = {
4696 "Front", "Surround", "CLFE", "Side"
4698 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4700 uinfo
->value
.enumerated
.items
= 4;
4701 if (uinfo
->value
.enumerated
.item
>= 4)
4702 uinfo
->value
.enumerated
.item
= 3;
4703 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4707 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
4708 struct snd_ctl_elem_value
*ucontrol
)
4710 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4711 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4714 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
4715 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
4719 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
4720 struct snd_ctl_elem_value
*ucontrol
)
4722 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4723 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4726 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
4727 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
4728 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
4729 snd_hda_codec_write_cache(codec
, nid
, 0,
4730 AC_VERB_SET_CONNECT_SEL
, sel
);
4736 #define PIN_CTL_TEST(xname,nid) { \
4737 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4739 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4740 .info = alc_test_pin_ctl_info, \
4741 .get = alc_test_pin_ctl_get, \
4742 .put = alc_test_pin_ctl_put, \
4743 .private_value = nid \
4746 #define PIN_SRC_TEST(xname,nid) { \
4747 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4749 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4750 .info = alc_test_pin_src_info, \
4751 .get = alc_test_pin_src_get, \
4752 .put = alc_test_pin_src_put, \
4753 .private_value = nid \
4756 static const struct snd_kcontrol_new alc880_test_mixer
[] = {
4757 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4758 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4759 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
4760 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
4761 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4762 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4763 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
4764 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
4765 PIN_CTL_TEST("Front Pin Mode", 0x14),
4766 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4767 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4768 PIN_CTL_TEST("Side Pin Mode", 0x17),
4769 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4770 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4771 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4772 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4773 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4774 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4775 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4776 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4777 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4778 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4779 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4780 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4781 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
4782 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
4783 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
4784 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
4785 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
4786 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
4788 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4789 .name
= "Channel Mode",
4790 .info
= alc_ch_mode_info
,
4791 .get
= alc_ch_mode_get
,
4792 .put
= alc_ch_mode_put
,
4797 static const struct hda_verb alc880_test_init_verbs
[] = {
4798 /* Unmute inputs of 0x0c - 0x0f */
4799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4801 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4802 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4803 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4804 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4805 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4806 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4807 /* Vol output for 0x0c-0x0f */
4808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4811 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4812 /* Set output pins 0x14-0x17 */
4813 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4814 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4815 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4816 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4817 /* Unmute output pins 0x14-0x17 */
4818 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4820 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4822 /* Set input pins 0x18-0x1c */
4823 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4824 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4825 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4826 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4828 /* Mute input pins 0x18-0x1b */
4829 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4830 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4832 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4834 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4835 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4836 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4837 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4838 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4839 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4840 /* Analog input/passthru */
4841 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4843 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4844 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4845 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4853 static const char * const alc880_models
[ALC880_MODEL_LAST
] = {
4854 [ALC880_3ST
] = "3stack",
4855 [ALC880_TCL_S700
] = "tcl",
4856 [ALC880_3ST_DIG
] = "3stack-digout",
4857 [ALC880_CLEVO
] = "clevo",
4858 [ALC880_5ST
] = "5stack",
4859 [ALC880_5ST_DIG
] = "5stack-digout",
4860 [ALC880_W810
] = "w810",
4861 [ALC880_Z71V
] = "z71v",
4862 [ALC880_6ST
] = "6stack",
4863 [ALC880_6ST_DIG
] = "6stack-digout",
4864 [ALC880_ASUS
] = "asus",
4865 [ALC880_ASUS_W1V
] = "asus-w1v",
4866 [ALC880_ASUS_DIG
] = "asus-dig",
4867 [ALC880_ASUS_DIG2
] = "asus-dig2",
4868 [ALC880_UNIWILL_DIG
] = "uniwill",
4869 [ALC880_UNIWILL_P53
] = "uniwill-p53",
4870 [ALC880_FUJITSU
] = "fujitsu",
4871 [ALC880_F1734
] = "F1734",
4873 [ALC880_LG_LW
] = "lg-lw",
4874 [ALC880_MEDION_RIM
] = "medion",
4875 #ifdef CONFIG_SND_DEBUG
4876 [ALC880_TEST
] = "test",
4878 [ALC880_AUTO
] = "auto",
4881 static const struct snd_pci_quirk alc880_cfg_tbl
[] = {
4882 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
4883 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
4884 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
4885 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
4886 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
4887 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
4888 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
4889 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
4890 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
4891 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
4892 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
4893 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
4894 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
4895 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
4896 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
4897 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
4898 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
4899 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4900 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
4901 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
4902 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
4903 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
4904 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
4905 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
4906 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS
), /* default ASUS */
4907 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
4908 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
4909 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
4910 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
4911 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
4912 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
4913 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
4914 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
4915 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
4916 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
4917 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
4918 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
4919 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
4920 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
4921 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734
),
4922 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
4923 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
4924 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
4925 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
4926 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
4927 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
4928 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
4929 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
4930 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734
),
4931 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
4932 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
4933 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
4934 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG
),
4935 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
4936 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
4937 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
4938 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
4939 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
4940 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
4941 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
4942 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
4943 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
4944 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
4945 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
4946 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
4947 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
4948 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
4949 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
4951 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST
),
4952 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
4953 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
4958 * ALC880 codec presets
4960 static const struct alc_config_preset alc880_presets
[] = {
4962 .mixers
= { alc880_three_stack_mixer
},
4963 .init_verbs
= { alc880_volume_init_verbs
,
4964 alc880_pin_3stack_init_verbs
},
4965 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4966 .dac_nids
= alc880_dac_nids
,
4967 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4968 .channel_mode
= alc880_threestack_modes
,
4970 .input_mux
= &alc880_capture_source
,
4972 [ALC880_3ST_DIG
] = {
4973 .mixers
= { alc880_three_stack_mixer
},
4974 .init_verbs
= { alc880_volume_init_verbs
,
4975 alc880_pin_3stack_init_verbs
},
4976 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4977 .dac_nids
= alc880_dac_nids
,
4978 .dig_out_nid
= ALC880_DIGOUT_NID
,
4979 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4980 .channel_mode
= alc880_threestack_modes
,
4982 .input_mux
= &alc880_capture_source
,
4984 [ALC880_TCL_S700
] = {
4985 .mixers
= { alc880_tcl_s700_mixer
},
4986 .init_verbs
= { alc880_volume_init_verbs
,
4987 alc880_pin_tcl_S700_init_verbs
,
4988 alc880_gpio2_init_verbs
},
4989 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4990 .dac_nids
= alc880_dac_nids
,
4991 .adc_nids
= alc880_adc_nids_alt
, /* FIXME: correct? */
4992 .num_adc_nids
= 1, /* single ADC */
4994 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4995 .channel_mode
= alc880_2_jack_modes
,
4996 .input_mux
= &alc880_capture_source
,
4999 .mixers
= { alc880_three_stack_mixer
,
5000 alc880_five_stack_mixer
},
5001 .init_verbs
= { alc880_volume_init_verbs
,
5002 alc880_pin_5stack_init_verbs
},
5003 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5004 .dac_nids
= alc880_dac_nids
,
5005 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
5006 .channel_mode
= alc880_fivestack_modes
,
5007 .input_mux
= &alc880_capture_source
,
5009 [ALC880_5ST_DIG
] = {
5010 .mixers
= { alc880_three_stack_mixer
,
5011 alc880_five_stack_mixer
},
5012 .init_verbs
= { alc880_volume_init_verbs
,
5013 alc880_pin_5stack_init_verbs
},
5014 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5015 .dac_nids
= alc880_dac_nids
,
5016 .dig_out_nid
= ALC880_DIGOUT_NID
,
5017 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
5018 .channel_mode
= alc880_fivestack_modes
,
5019 .input_mux
= &alc880_capture_source
,
5022 .mixers
= { alc880_six_stack_mixer
},
5023 .init_verbs
= { alc880_volume_init_verbs
,
5024 alc880_pin_6stack_init_verbs
},
5025 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
5026 .dac_nids
= alc880_6st_dac_nids
,
5027 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
5028 .channel_mode
= alc880_sixstack_modes
,
5029 .input_mux
= &alc880_6stack_capture_source
,
5031 [ALC880_6ST_DIG
] = {
5032 .mixers
= { alc880_six_stack_mixer
},
5033 .init_verbs
= { alc880_volume_init_verbs
,
5034 alc880_pin_6stack_init_verbs
},
5035 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
5036 .dac_nids
= alc880_6st_dac_nids
,
5037 .dig_out_nid
= ALC880_DIGOUT_NID
,
5038 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
5039 .channel_mode
= alc880_sixstack_modes
,
5040 .input_mux
= &alc880_6stack_capture_source
,
5043 .mixers
= { alc880_w810_base_mixer
},
5044 .init_verbs
= { alc880_volume_init_verbs
,
5045 alc880_pin_w810_init_verbs
,
5046 alc880_gpio2_init_verbs
},
5047 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
5048 .dac_nids
= alc880_w810_dac_nids
,
5049 .dig_out_nid
= ALC880_DIGOUT_NID
,
5050 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
5051 .channel_mode
= alc880_w810_modes
,
5052 .input_mux
= &alc880_capture_source
,
5055 .mixers
= { alc880_z71v_mixer
},
5056 .init_verbs
= { alc880_volume_init_verbs
,
5057 alc880_pin_z71v_init_verbs
},
5058 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
5059 .dac_nids
= alc880_z71v_dac_nids
,
5060 .dig_out_nid
= ALC880_DIGOUT_NID
,
5062 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5063 .channel_mode
= alc880_2_jack_modes
,
5064 .input_mux
= &alc880_capture_source
,
5067 .mixers
= { alc880_f1734_mixer
},
5068 .init_verbs
= { alc880_volume_init_verbs
,
5069 alc880_pin_f1734_init_verbs
},
5070 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
5071 .dac_nids
= alc880_f1734_dac_nids
,
5073 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5074 .channel_mode
= alc880_2_jack_modes
,
5075 .input_mux
= &alc880_f1734_capture_source
,
5076 .unsol_event
= alc880_uniwill_p53_unsol_event
,
5077 .setup
= alc880_uniwill_p53_setup
,
5078 .init_hook
= alc_hp_automute
,
5081 .mixers
= { alc880_asus_mixer
},
5082 .init_verbs
= { alc880_volume_init_verbs
,
5083 alc880_pin_asus_init_verbs
,
5084 alc880_gpio1_init_verbs
},
5085 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5086 .dac_nids
= alc880_asus_dac_nids
,
5087 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5088 .channel_mode
= alc880_asus_modes
,
5090 .input_mux
= &alc880_capture_source
,
5092 [ALC880_ASUS_DIG
] = {
5093 .mixers
= { alc880_asus_mixer
},
5094 .init_verbs
= { alc880_volume_init_verbs
,
5095 alc880_pin_asus_init_verbs
,
5096 alc880_gpio1_init_verbs
},
5097 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5098 .dac_nids
= alc880_asus_dac_nids
,
5099 .dig_out_nid
= ALC880_DIGOUT_NID
,
5100 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5101 .channel_mode
= alc880_asus_modes
,
5103 .input_mux
= &alc880_capture_source
,
5105 [ALC880_ASUS_DIG2
] = {
5106 .mixers
= { alc880_asus_mixer
},
5107 .init_verbs
= { alc880_volume_init_verbs
,
5108 alc880_pin_asus_init_verbs
,
5109 alc880_gpio2_init_verbs
}, /* use GPIO2 */
5110 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5111 .dac_nids
= alc880_asus_dac_nids
,
5112 .dig_out_nid
= ALC880_DIGOUT_NID
,
5113 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5114 .channel_mode
= alc880_asus_modes
,
5116 .input_mux
= &alc880_capture_source
,
5118 [ALC880_ASUS_W1V
] = {
5119 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
5120 .init_verbs
= { alc880_volume_init_verbs
,
5121 alc880_pin_asus_init_verbs
,
5122 alc880_gpio1_init_verbs
},
5123 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5124 .dac_nids
= alc880_asus_dac_nids
,
5125 .dig_out_nid
= ALC880_DIGOUT_NID
,
5126 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5127 .channel_mode
= alc880_asus_modes
,
5129 .input_mux
= &alc880_capture_source
,
5131 [ALC880_UNIWILL_DIG
] = {
5132 .mixers
= { alc880_asus_mixer
},
5133 .init_verbs
= { alc880_volume_init_verbs
,
5134 alc880_pin_asus_init_verbs
},
5135 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5136 .dac_nids
= alc880_asus_dac_nids
,
5137 .dig_out_nid
= ALC880_DIGOUT_NID
,
5138 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
5139 .channel_mode
= alc880_asus_modes
,
5141 .input_mux
= &alc880_capture_source
,
5143 [ALC880_UNIWILL
] = {
5144 .mixers
= { alc880_uniwill_mixer
},
5145 .init_verbs
= { alc880_volume_init_verbs
,
5146 alc880_uniwill_init_verbs
},
5147 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5148 .dac_nids
= alc880_asus_dac_nids
,
5149 .dig_out_nid
= ALC880_DIGOUT_NID
,
5150 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
5151 .channel_mode
= alc880_threestack_modes
,
5153 .input_mux
= &alc880_capture_source
,
5154 .unsol_event
= alc880_uniwill_unsol_event
,
5155 .setup
= alc880_uniwill_setup
,
5156 .init_hook
= alc880_uniwill_init_hook
,
5158 [ALC880_UNIWILL_P53
] = {
5159 .mixers
= { alc880_uniwill_p53_mixer
},
5160 .init_verbs
= { alc880_volume_init_verbs
,
5161 alc880_uniwill_p53_init_verbs
},
5162 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
5163 .dac_nids
= alc880_asus_dac_nids
,
5164 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
5165 .channel_mode
= alc880_threestack_modes
,
5166 .input_mux
= &alc880_capture_source
,
5167 .unsol_event
= alc880_uniwill_p53_unsol_event
,
5168 .setup
= alc880_uniwill_p53_setup
,
5169 .init_hook
= alc_hp_automute
,
5171 [ALC880_FUJITSU
] = {
5172 .mixers
= { alc880_fujitsu_mixer
},
5173 .init_verbs
= { alc880_volume_init_verbs
,
5174 alc880_uniwill_p53_init_verbs
,
5175 alc880_beep_init_verbs
},
5176 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5177 .dac_nids
= alc880_dac_nids
,
5178 .dig_out_nid
= ALC880_DIGOUT_NID
,
5179 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5180 .channel_mode
= alc880_2_jack_modes
,
5181 .input_mux
= &alc880_capture_source
,
5182 .unsol_event
= alc880_uniwill_p53_unsol_event
,
5183 .setup
= alc880_uniwill_p53_setup
,
5184 .init_hook
= alc_hp_automute
,
5187 .mixers
= { alc880_three_stack_mixer
},
5188 .init_verbs
= { alc880_volume_init_verbs
,
5189 alc880_pin_clevo_init_verbs
},
5190 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5191 .dac_nids
= alc880_dac_nids
,
5193 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
5194 .channel_mode
= alc880_threestack_modes
,
5196 .input_mux
= &alc880_capture_source
,
5199 .mixers
= { alc880_lg_mixer
},
5200 .init_verbs
= { alc880_volume_init_verbs
,
5201 alc880_lg_init_verbs
},
5202 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
5203 .dac_nids
= alc880_lg_dac_nids
,
5204 .dig_out_nid
= ALC880_DIGOUT_NID
,
5205 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
5206 .channel_mode
= alc880_lg_ch_modes
,
5208 .input_mux
= &alc880_lg_capture_source
,
5209 .unsol_event
= alc_sku_unsol_event
,
5210 .setup
= alc880_lg_setup
,
5211 .init_hook
= alc_hp_automute
,
5212 #ifdef CONFIG_SND_HDA_POWER_SAVE
5213 .loopbacks
= alc880_lg_loopbacks
,
5217 .mixers
= { alc880_lg_lw_mixer
},
5218 .init_verbs
= { alc880_volume_init_verbs
,
5219 alc880_lg_lw_init_verbs
},
5220 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5221 .dac_nids
= alc880_dac_nids
,
5222 .dig_out_nid
= ALC880_DIGOUT_NID
,
5223 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
5224 .channel_mode
= alc880_lg_lw_modes
,
5225 .input_mux
= &alc880_lg_lw_capture_source
,
5226 .unsol_event
= alc_sku_unsol_event
,
5227 .setup
= alc880_lg_lw_setup
,
5228 .init_hook
= alc_hp_automute
,
5230 [ALC880_MEDION_RIM
] = {
5231 .mixers
= { alc880_medion_rim_mixer
},
5232 .init_verbs
= { alc880_volume_init_verbs
,
5233 alc880_medion_rim_init_verbs
,
5234 alc_gpio2_init_verbs
},
5235 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
5236 .dac_nids
= alc880_dac_nids
,
5237 .dig_out_nid
= ALC880_DIGOUT_NID
,
5238 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
5239 .channel_mode
= alc880_2_jack_modes
,
5240 .input_mux
= &alc880_medion_rim_capture_source
,
5241 .unsol_event
= alc880_medion_rim_unsol_event
,
5242 .setup
= alc880_medion_rim_setup
,
5243 .init_hook
= alc880_medion_rim_automute
,
5245 #ifdef CONFIG_SND_DEBUG
5247 .mixers
= { alc880_test_mixer
},
5248 .init_verbs
= { alc880_test_init_verbs
},
5249 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
5250 .dac_nids
= alc880_test_dac_nids
,
5251 .dig_out_nid
= ALC880_DIGOUT_NID
,
5252 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
5253 .channel_mode
= alc880_test_modes
,
5254 .input_mux
= &alc880_test_capture_source
,
5260 * Automatic parse of I/O pins from the BIOS configuration
5265 ALC_CTL_WIDGET_MUTE
,
5268 static const struct snd_kcontrol_new alc880_control_templates
[] = {
5269 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
5270 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
5271 HDA_BIND_MUTE(NULL
, 0, 0, 0),
5274 static struct snd_kcontrol_new
*alc_kcontrol_new(struct alc_spec
*spec
)
5276 snd_array_init(&spec
->kctls
, sizeof(struct snd_kcontrol_new
), 32);
5277 return snd_array_new(&spec
->kctls
);
5280 /* add dynamic controls */
5281 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
5282 int cidx
, unsigned long val
)
5284 struct snd_kcontrol_new
*knew
;
5286 knew
= alc_kcontrol_new(spec
);
5289 *knew
= alc880_control_templates
[type
];
5290 knew
->name
= kstrdup(name
, GFP_KERNEL
);
5294 if (get_amp_nid_(val
))
5295 knew
->subdevice
= HDA_SUBDEV_AMP_FLAG
;
5296 knew
->private_value
= val
;
5300 static int add_control_with_pfx(struct alc_spec
*spec
, int type
,
5301 const char *pfx
, const char *dir
,
5302 const char *sfx
, int cidx
, unsigned long val
)
5305 snprintf(name
, sizeof(name
), "%s %s %s", pfx
, dir
, sfx
);
5306 return add_control(spec
, type
, name
, cidx
, val
);
5309 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5310 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5311 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5312 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5313 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5314 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5315 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5316 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5318 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5319 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5320 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5321 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5322 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5323 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5324 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5325 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5326 #define ALC880_PIN_CD_NID 0x1c
5328 static const char *alc_get_line_out_pfx(struct alc_spec
*spec
, int ch
,
5329 bool can_be_master
, int *index
)
5331 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5332 static const char * const chname
[4] = {
5333 "Front", "Surround", NULL
/*CLFE*/, "Side"
5337 if (cfg
->line_outs
== 1 && !spec
->multi_ios
&&
5338 !cfg
->hp_outs
&& !cfg
->speaker_outs
&& can_be_master
)
5341 switch (cfg
->line_out_type
) {
5342 case AUTO_PIN_SPEAKER_OUT
:
5343 if (cfg
->line_outs
== 1)
5346 case AUTO_PIN_HP_OUT
:
5347 /* for multi-io case, only the primary out */
5348 if (ch
&& spec
->multi_ios
)
5353 if (cfg
->line_outs
== 1 && !spec
->multi_ios
)
5360 /* create input playback/capture controls for the given pin */
5361 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
5362 const char *ctlname
, int ctlidx
,
5363 int idx
, hda_nid_t mix_nid
)
5367 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
, ctlidx
,
5368 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
5371 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
, ctlidx
,
5372 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
5378 static int alc_is_input_pin(struct hda_codec
*codec
, hda_nid_t nid
)
5380 unsigned int pincap
= snd_hda_query_pin_caps(codec
, nid
);
5381 return (pincap
& AC_PINCAP_IN
) != 0;
5384 static int alc_auto_fill_adc_caps(struct hda_codec
*codec
, hda_nid_t
*adc_nids
,
5385 hda_nid_t
*cap_nids
, int max_nums
)
5390 nid
= codec
->start_nid
;
5391 for (i
= 0; i
< codec
->num_nodes
; i
++, nid
++) {
5393 const hda_nid_t
*list
;
5394 unsigned int caps
= get_wcaps(codec
, nid
);
5395 int type
= get_wcaps_type(caps
);
5397 if (type
!= AC_WID_AUD_IN
|| (caps
& AC_WCAP_DIGITAL
))
5399 adc_nids
[nums
] = nid
;
5400 cap_nids
[nums
] = nid
;
5404 type
= get_wcaps_type(get_wcaps(codec
, src
));
5405 if (type
== AC_WID_PIN
)
5407 if (type
== AC_WID_AUD_SEL
) {
5408 cap_nids
[nums
] = src
;
5411 n
= snd_hda_get_conn_list(codec
, src
, &list
);
5413 cap_nids
[nums
] = src
;
5419 if (++nums
>= max_nums
)
5425 /* create playback/capture controls for input pins */
5426 static int alc_auto_create_input_ctls(struct hda_codec
*codec
)
5428 struct alc_spec
*spec
= codec
->spec
;
5429 const struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5430 hda_nid_t mixer
= spec
->mixer_nid
;
5431 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
5433 hda_nid_t caps
[5], adcs
[5];
5434 int i
, c
, err
, idx
, type_idx
= 0;
5435 const char *prev_label
= NULL
;
5437 num_adcs
= alc_auto_fill_adc_caps(codec
, adcs
, caps
, ARRAY_SIZE(adcs
));
5441 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5445 pin
= cfg
->inputs
[i
].pin
;
5446 if (!alc_is_input_pin(codec
, pin
))
5449 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
5450 if (prev_label
&& !strcmp(label
, prev_label
))
5457 idx
= get_connection_index(codec
, mixer
, pin
);
5459 err
= new_analog_input(spec
, pin
,
5467 for (c
= 0; c
< num_adcs
; c
++) {
5468 idx
= get_connection_index(codec
, caps
[c
], pin
);
5470 snd_hda_add_imux_item(imux
, label
, idx
, NULL
);
5478 static int alc_auto_fill_dac_nids(struct hda_codec
*codec
);
5479 static int alc_auto_create_multi_out_ctls(struct hda_codec
*codec
,
5480 const struct auto_pin_cfg
*cfg
);
5481 static int alc_auto_create_hp_out(struct hda_codec
*codec
);
5482 static int alc_auto_create_speaker_out(struct hda_codec
*codec
);
5483 static void alc_auto_init_multi_out(struct hda_codec
*codec
);
5484 static void alc_auto_init_extra_out(struct hda_codec
*codec
);
5486 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
5487 unsigned int pin_type
)
5489 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5492 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5496 static int get_pin_type(int line_out_type
)
5498 if (line_out_type
== AUTO_PIN_HP_OUT
)
5504 static void alc_auto_init_analog_input(struct hda_codec
*codec
)
5506 struct alc_spec
*spec
= codec
->spec
;
5507 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5510 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5511 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5512 if (alc_is_input_pin(codec
, nid
)) {
5513 alc_set_input_pin(codec
, nid
, cfg
->inputs
[i
].type
);
5514 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
5515 snd_hda_codec_write(codec
, nid
, 0,
5516 AC_VERB_SET_AMP_GAIN_MUTE
,
5521 /* mute all loopback inputs */
5522 if (spec
->mixer_nid
) {
5523 int nums
= snd_hda_get_conn_list(codec
, spec
->mixer_nid
, NULL
);
5524 for (i
= 0; i
< nums
; i
++)
5525 snd_hda_codec_write(codec
, spec
->mixer_nid
, 0,
5526 AC_VERB_SET_AMP_GAIN_MUTE
,
5531 static void alc880_auto_init_input_src(struct hda_codec
*codec
)
5533 struct alc_spec
*spec
= codec
->spec
;
5536 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
5537 unsigned int mux_idx
;
5538 const struct hda_input_mux
*imux
;
5539 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
5540 imux
= &spec
->input_mux
[mux_idx
];
5541 if (!imux
->num_items
&& mux_idx
> 0)
5542 imux
= &spec
->input_mux
[0];
5544 snd_hda_codec_write(codec
, spec
->adc_nids
[c
], 0,
5545 AC_VERB_SET_CONNECT_SEL
,
5546 imux
->items
[0].index
);
5547 snd_hda_codec_write(codec
, spec
->adc_nids
[c
], 0,
5548 AC_VERB_SET_AMP_GAIN_MUTE
,
5553 static int alc_auto_add_multi_channel_mode(struct hda_codec
*codec
,
5554 int (*fill_dac
)(struct hda_codec
*));
5556 /* parse the BIOS configuration and set up the alc_spec */
5557 /* return 1 if successful, 0 if the proper config is not found,
5558 * or a negative error code
5560 static int alc880_parse_auto_config(struct hda_codec
*codec
)
5562 struct alc_spec
*spec
= codec
->spec
;
5564 static const hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
5566 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5570 if (!spec
->autocfg
.line_outs
)
5571 return 0; /* can't find valid BIOS pin config */
5573 err
= alc_auto_fill_dac_nids(codec
);
5576 err
= alc_auto_add_multi_channel_mode(codec
, alc_auto_fill_dac_nids
);
5579 err
= alc_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
5582 err
= alc_auto_create_hp_out(codec
);
5585 err
= alc_auto_create_speaker_out(codec
);
5588 err
= alc_auto_create_input_ctls(codec
);
5592 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
5594 alc_auto_parse_digital(codec
);
5596 if (spec
->kctls
.list
)
5597 add_mixer(spec
, spec
->kctls
.list
);
5599 spec
->num_mux_defs
= 1;
5600 spec
->input_mux
= &spec
->private_imux
[0];
5602 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
5607 /* additional initialization for auto-configuration model */
5608 static void alc880_auto_init(struct hda_codec
*codec
)
5610 struct alc_spec
*spec
= codec
->spec
;
5611 alc_auto_init_multi_out(codec
);
5612 alc_auto_init_extra_out(codec
);
5613 alc_auto_init_analog_input(codec
);
5614 alc880_auto_init_input_src(codec
);
5615 alc_auto_init_digital(codec
);
5616 if (spec
->unsol_event
)
5617 alc_inithook(codec
);
5620 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5621 * one of two digital mic pins, e.g. on ALC272
5623 static void fixup_automic_adc(struct hda_codec
*codec
)
5625 struct alc_spec
*spec
= codec
->spec
;
5628 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5629 hda_nid_t cap
= spec
->capsrc_nids
?
5630 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5633 iidx
= get_connection_index(codec
, cap
, spec
->int_mic
.pin
);
5636 eidx
= get_connection_index(codec
, cap
, spec
->ext_mic
.pin
);
5639 spec
->int_mic
.mux_idx
= iidx
;
5640 spec
->ext_mic
.mux_idx
= eidx
;
5641 if (spec
->capsrc_nids
)
5642 spec
->capsrc_nids
+= i
;
5643 spec
->adc_nids
+= i
;
5644 spec
->num_adc_nids
= 1;
5645 /* optional dock-mic */
5646 eidx
= get_connection_index(codec
, cap
, spec
->dock_mic
.pin
);
5648 spec
->dock_mic
.pin
= 0;
5650 spec
->dock_mic
.mux_idx
= eidx
;
5653 snd_printd(KERN_INFO
"hda_codec: %s: "
5654 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5655 codec
->chip_name
, spec
->int_mic
.pin
, spec
->ext_mic
.pin
);
5656 spec
->auto_mic
= 0; /* disable auto-mic to be sure */
5659 /* select or unmute the given capsrc route */
5660 static void select_or_unmute_capsrc(struct hda_codec
*codec
, hda_nid_t cap
,
5663 if (get_wcaps_type(get_wcaps(codec
, cap
)) == AC_WID_AUD_MIX
) {
5664 snd_hda_codec_amp_stereo(codec
, cap
, HDA_INPUT
, idx
,
5667 snd_hda_codec_write_cache(codec
, cap
, 0,
5668 AC_VERB_SET_CONNECT_SEL
, idx
);
5672 /* set the default connection to that pin */
5673 static int init_capsrc_for_pin(struct hda_codec
*codec
, hda_nid_t pin
)
5675 struct alc_spec
*spec
= codec
->spec
;
5680 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5681 hda_nid_t cap
= spec
->capsrc_nids
?
5682 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5685 idx
= get_connection_index(codec
, cap
, pin
);
5688 select_or_unmute_capsrc(codec
, cap
, idx
);
5689 return i
; /* return the found index */
5691 return -1; /* not found */
5694 /* choose the ADC/MUX containing the input pin and initialize the setup */
5695 static void fixup_single_adc(struct hda_codec
*codec
)
5697 struct alc_spec
*spec
= codec
->spec
;
5698 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5701 /* search for the input pin; there must be only one */
5702 if (cfg
->num_inputs
!= 1)
5704 i
= init_capsrc_for_pin(codec
, cfg
->inputs
[0].pin
);
5706 /* use only this ADC */
5707 if (spec
->capsrc_nids
)
5708 spec
->capsrc_nids
+= i
;
5709 spec
->adc_nids
+= i
;
5710 spec
->num_adc_nids
= 1;
5711 spec
->single_input_src
= 1;
5715 /* initialize dual adcs */
5716 static void fixup_dual_adc_switch(struct hda_codec
*codec
)
5718 struct alc_spec
*spec
= codec
->spec
;
5719 init_capsrc_for_pin(codec
, spec
->ext_mic
.pin
);
5720 init_capsrc_for_pin(codec
, spec
->dock_mic
.pin
);
5721 init_capsrc_for_pin(codec
, spec
->int_mic
.pin
);
5724 /* initialize some special cases for input sources */
5725 static void alc_init_special_input_src(struct hda_codec
*codec
)
5727 struct alc_spec
*spec
= codec
->spec
;
5728 if (spec
->dual_adc_switch
)
5729 fixup_dual_adc_switch(codec
);
5730 else if (spec
->single_input_src
)
5731 init_capsrc_for_pin(codec
, spec
->autocfg
.inputs
[0].pin
);
5734 static void set_capture_mixer(struct hda_codec
*codec
)
5736 struct alc_spec
*spec
= codec
->spec
;
5737 static const struct snd_kcontrol_new
*caps
[2][3] = {
5738 { alc_capture_mixer_nosrc1
,
5739 alc_capture_mixer_nosrc2
,
5740 alc_capture_mixer_nosrc3
},
5741 { alc_capture_mixer1
,
5743 alc_capture_mixer3
},
5745 if (spec
->num_adc_nids
> 0 && spec
->num_adc_nids
<= 3) {
5747 int num_adcs
= spec
->num_adc_nids
;
5748 if (spec
->dual_adc_switch
)
5750 else if (spec
->auto_mic
)
5751 fixup_automic_adc(codec
);
5752 else if (spec
->input_mux
) {
5753 if (spec
->input_mux
->num_items
> 1)
5755 else if (spec
->input_mux
->num_items
== 1)
5756 fixup_single_adc(codec
);
5758 spec
->cap_mixer
= caps
[mux
][num_adcs
- 1];
5762 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5763 static void fillup_priv_adc_nids(struct hda_codec
*codec
, const hda_nid_t
*nids
,
5766 struct alc_spec
*spec
= codec
->spec
;
5767 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
5769 hda_nid_t fallback_adc
= 0, fallback_cap
= 0;
5771 for (n
= 0; n
< num_nids
; n
++) {
5773 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
5777 if (get_wcaps_type(get_wcaps(codec
, adc
)) != AC_WID_AUD_IN
)
5780 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5784 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5789 if (!fallback_adc
) {
5793 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
5794 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
5795 for (j
= 0; j
< nconns
; j
++) {
5802 if (i
>= cfg
->num_inputs
) {
5803 int num_adcs
= spec
->num_adc_nids
;
5804 spec
->private_adc_nids
[num_adcs
] = adc
;
5805 spec
->private_capsrc_nids
[num_adcs
] = cap
;
5806 spec
->num_adc_nids
++;
5807 spec
->adc_nids
= spec
->private_adc_nids
;
5809 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
5812 if (!spec
->num_adc_nids
) {
5813 printk(KERN_WARNING
"hda_codec: %s: no valid ADC found;"
5814 " using fallback 0x%x\n",
5815 codec
->chip_name
, fallback_adc
);
5816 spec
->private_adc_nids
[0] = fallback_adc
;
5817 spec
->adc_nids
= spec
->private_adc_nids
;
5818 if (fallback_adc
!= fallback_cap
) {
5819 spec
->private_capsrc_nids
[0] = fallback_cap
;
5820 spec
->capsrc_nids
= spec
->private_adc_nids
;
5825 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5826 #define set_beep_amp(spec, nid, idx, dir) \
5827 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5829 static const struct snd_pci_quirk beep_white_list
[] = {
5830 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5831 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5832 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
5833 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
5834 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5838 static inline int has_cdefine_beep(struct hda_codec
*codec
)
5840 struct alc_spec
*spec
= codec
->spec
;
5841 const struct snd_pci_quirk
*q
;
5842 q
= snd_pci_quirk_lookup(codec
->bus
->pci
, beep_white_list
);
5845 return spec
->cdefine
.enable_pcbeep
;
5848 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5849 #define has_cdefine_beep(codec) 0
5853 * OK, here we have finally the patch for ALC880
5856 static int patch_alc880(struct hda_codec
*codec
)
5858 struct alc_spec
*spec
;
5862 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5868 spec
->mixer_nid
= 0x0b;
5870 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
5873 if (board_config
< 0) {
5874 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5876 board_config
= ALC880_AUTO
;
5879 if (board_config
== ALC880_AUTO
) {
5880 /* automatic parse from the BIOS config */
5881 err
= alc880_parse_auto_config(codec
);
5887 "hda_codec: Cannot set up configuration "
5888 "from BIOS. Using 3-stack mode...\n");
5889 board_config
= ALC880_3ST
;
5893 err
= snd_hda_attach_beep_device(codec
, 0x1);
5899 if (board_config
!= ALC880_AUTO
)
5900 setup_preset(codec
, &alc880_presets
[board_config
]);
5902 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
5903 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
5904 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
5906 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
5907 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
5909 if (!spec
->adc_nids
&& spec
->input_mux
) {
5910 /* check whether NID 0x07 is valid */
5911 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
5913 wcap
= get_wcaps_type(wcap
);
5914 if (wcap
!= AC_WID_AUD_IN
) {
5915 spec
->adc_nids
= alc880_adc_nids_alt
;
5916 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
5918 spec
->adc_nids
= alc880_adc_nids
;
5919 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
5922 set_capture_mixer(codec
);
5923 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
5925 spec
->vmaster_nid
= 0x0c;
5927 codec
->patch_ops
= alc_patch_ops
;
5928 if (board_config
== ALC880_AUTO
)
5929 spec
->init_hook
= alc880_auto_init
;
5930 #ifdef CONFIG_SND_HDA_POWER_SAVE
5931 if (!spec
->loopback
.amplist
)
5932 spec
->loopback
.amplist
= alc880_loopbacks
;
5943 static const hda_nid_t alc260_dac_nids
[1] = {
5948 static const hda_nid_t alc260_adc_nids
[1] = {
5953 static const hda_nid_t alc260_adc_nids_alt
[1] = {
5958 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5959 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5961 static const hda_nid_t alc260_dual_adc_nids
[2] = {
5966 #define ALC260_DIGOUT_NID 0x03
5967 #define ALC260_DIGIN_NID 0x06
5969 static const struct hda_input_mux alc260_capture_source
= {
5973 { "Front Mic", 0x1 },
5979 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5980 * headphone jack and the internal CD lines since these are the only pins at
5981 * which audio can appear. For flexibility, also allow the option of
5982 * recording the mixer output on the second ADC (ADC0 doesn't have a
5983 * connection to the mixer output).
5985 static const struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
5989 { "Mic/Line", 0x0 },
5991 { "Headphone", 0x2 },
5997 { "Mic/Line", 0x0 },
5999 { "Headphone", 0x2 },
6006 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
6007 * the Fujitsu S702x, but jacks are marked differently.
6009 static const struct hda_input_mux alc260_acer_capture_sources
[2] = {
6016 { "Headphone", 0x5 },
6025 { "Headphone", 0x6 },
6031 /* Maxdata Favorit 100XS */
6032 static const struct hda_input_mux alc260_favorit100_capture_sources
[2] = {
6036 { "Line/Mic", 0x0 },
6043 { "Line/Mic", 0x0 },
6051 * This is just place-holder, so there's something for alc_build_pcms to look
6052 * at when it calculates the maximum number of channels. ALC260 has no mixer
6053 * element which allows changing the channel mode, so the verb list is
6056 static const struct hda_channel_mode alc260_modes
[1] = {
6061 /* Mixer combinations
6063 * basic: base_output + input + pc_beep + capture
6064 * HP: base_output + input + capture_alt
6065 * HP_3013: hp_3013 + input + capture
6066 * fujitsu: fujitsu + capture
6067 * acer: acer + capture
6070 static const struct snd_kcontrol_new alc260_base_output_mixer
[] = {
6071 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6072 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
6073 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6074 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
6075 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6076 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6080 static const struct snd_kcontrol_new alc260_input_mixer
[] = {
6081 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6082 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6083 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6084 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6085 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6086 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6087 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
6088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
6092 /* update HP, line and mono out pins according to the master switch */
6093 static void alc260_hp_master_update(struct hda_codec
*codec
)
6095 update_speakers(codec
);
6098 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
6099 struct snd_ctl_elem_value
*ucontrol
)
6101 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6102 struct alc_spec
*spec
= codec
->spec
;
6103 *ucontrol
->value
.integer
.value
= !spec
->master_mute
;
6107 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
6108 struct snd_ctl_elem_value
*ucontrol
)
6110 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6111 struct alc_spec
*spec
= codec
->spec
;
6112 int val
= !*ucontrol
->value
.integer
.value
;
6114 if (val
== spec
->master_mute
)
6116 spec
->master_mute
= val
;
6117 alc260_hp_master_update(codec
);
6121 static const struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
6123 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6124 .name
= "Master Playback Switch",
6125 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
6126 .info
= snd_ctl_boolean_mono_info
,
6127 .get
= alc260_hp_master_sw_get
,
6128 .put
= alc260_hp_master_sw_put
,
6130 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6131 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
6132 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6133 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
6134 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6136 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6140 static const struct hda_verb alc260_hp_unsol_verbs
[] = {
6141 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6145 static void alc260_hp_setup(struct hda_codec
*codec
)
6147 struct alc_spec
*spec
= codec
->spec
;
6149 spec
->autocfg
.hp_pins
[0] = 0x0f;
6150 spec
->autocfg
.speaker_pins
[0] = 0x10;
6151 spec
->autocfg
.speaker_pins
[1] = 0x11;
6153 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
6156 static const struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
6158 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6159 .name
= "Master Playback Switch",
6160 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
6161 .info
= snd_ctl_boolean_mono_info
,
6162 .get
= alc260_hp_master_sw_get
,
6163 .put
= alc260_hp_master_sw_put
,
6165 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6166 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
6167 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
6168 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
6169 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6170 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6171 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6172 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
6176 static void alc260_hp_3013_setup(struct hda_codec
*codec
)
6178 struct alc_spec
*spec
= codec
->spec
;
6180 spec
->autocfg
.hp_pins
[0] = 0x15;
6181 spec
->autocfg
.speaker_pins
[0] = 0x10;
6182 spec
->autocfg
.speaker_pins
[1] = 0x11;
6184 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
6187 static const struct hda_bind_ctls alc260_dc7600_bind_master_vol
= {
6188 .ops
= &snd_hda_bind_vol
,
6190 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT
),
6191 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
6192 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT
),
6197 static const struct hda_bind_ctls alc260_dc7600_bind_switch
= {
6198 .ops
= &snd_hda_bind_sw
,
6200 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT
),
6201 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
6206 static const struct snd_kcontrol_new alc260_hp_dc7600_mixer
[] = {
6207 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol
),
6208 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch
),
6209 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT
),
6210 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
6214 static const struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
6215 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6219 static void alc260_hp_3012_setup(struct hda_codec
*codec
)
6221 struct alc_spec
*spec
= codec
->spec
;
6223 spec
->autocfg
.hp_pins
[0] = 0x10;
6224 spec
->autocfg
.speaker_pins
[0] = 0x0f;
6225 spec
->autocfg
.speaker_pins
[1] = 0x11;
6226 spec
->autocfg
.speaker_pins
[2] = 0x15;
6228 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
6231 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6232 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6234 static const struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
6235 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6236 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
6237 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6238 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6239 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6240 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
6241 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
6242 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6243 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6244 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
6248 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6249 * versions of the ALC260 don't act on requests to enable mic bias from NID
6250 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6251 * datasheet doesn't mention this restriction. At this stage it's not clear
6252 * whether this behaviour is intentional or is a hardware bug in chip
6253 * revisions available in early 2006. Therefore for now allow the
6254 * "Headphone Jack Mode" control to span all choices, but if it turns out
6255 * that the lack of mic bias for this NID is intentional we could change the
6256 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6258 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6259 * don't appear to make the mic bias available from the "line" jack, even
6260 * though the NID used for this jack (0x14) can supply it. The theory is
6261 * that perhaps Acer have included blocking capacitors between the ALC260
6262 * and the output jack. If this turns out to be the case for all such
6263 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6264 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6266 * The C20x Tablet series have a mono internal speaker which is controlled
6267 * via the chip's Mono sum widget and pin complex, so include the necessary
6268 * controls for such models. On models without a "mono speaker" the control
6269 * won't do anything.
6271 static const struct snd_kcontrol_new alc260_acer_mixer
[] = {
6272 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6273 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
6274 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
6275 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6277 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6279 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6280 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6282 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6283 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6284 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6285 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6286 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6290 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6292 static const struct snd_kcontrol_new alc260_favorit100_mixer
[] = {
6293 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6294 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
6295 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
6296 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6297 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6298 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6302 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6303 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6305 static const struct snd_kcontrol_new alc260_will_mixer
[] = {
6306 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6307 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
6308 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6309 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6310 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6311 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6312 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6313 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6314 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6315 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6319 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6320 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6322 static const struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
6323 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6324 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
6325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
6326 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
6327 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
6328 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
6329 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
6330 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
6331 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
6332 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
6337 * initialization verbs
6339 static const struct hda_verb alc260_init_verbs
[] = {
6340 /* Line In pin widget for input */
6341 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6342 /* CD pin widget for input */
6343 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6344 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6345 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6346 /* Mic2 (front panel) pin widget for input and vref at 80% */
6347 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6348 /* LINE-2 is used for line-out in rear */
6349 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6350 /* select line-out */
6351 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
6353 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6355 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6357 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6358 /* mute capture amp left and right */
6359 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6360 /* set connection select to line in (default select for this ADC) */
6361 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6362 /* mute capture amp left and right */
6363 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6364 /* set connection select to line in (default select for this ADC) */
6365 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
6366 /* set vol=0 Line-Out mixer amp left and right */
6367 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6368 /* unmute pin widget amp left and right (no gain on this amp) */
6369 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6370 /* set vol=0 HP mixer amp left and right */
6371 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6372 /* unmute pin widget amp left and right (no gain on this amp) */
6373 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6374 /* set vol=0 Mono mixer amp left and right */
6375 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6376 /* unmute pin widget amp left and right (no gain on this amp) */
6377 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6378 /* unmute LINE-2 out pin */
6379 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6380 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6383 /* mute analog inputs */
6384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6386 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6387 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6388 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6389 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6390 /* mute Front out path */
6391 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6392 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6393 /* mute Headphone out path */
6394 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6395 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6396 /* mute Mono out path */
6397 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6398 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6402 #if 0 /* should be identical with alc260_init_verbs? */
6403 static const struct hda_verb alc260_hp_init_verbs
[] = {
6404 /* Headphone and output */
6405 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6407 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6408 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6409 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6410 /* Mic2 (front panel) pin widget for input and vref at 80% */
6411 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6412 /* Line In pin widget for input */
6413 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6414 /* Line-2 pin widget for output */
6415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6416 /* CD pin widget for input */
6417 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6418 /* unmute amp left and right */
6419 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
6420 /* set connection select to line in (default select for this ADC) */
6421 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6422 /* unmute Line-Out mixer amp left and right (volume = 0) */
6423 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6424 /* mute pin widget amp left and right (no gain on this amp) */
6425 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6426 /* unmute HP mixer amp left and right (volume = 0) */
6427 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6428 /* mute pin widget amp left and right (no gain on this amp) */
6429 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6430 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6433 /* mute analog inputs */
6434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6435 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6436 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6437 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6438 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6439 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6440 /* Unmute Front out path */
6441 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6443 /* Unmute Headphone out path */
6444 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6445 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6446 /* Unmute Mono out path */
6447 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6448 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6453 static const struct hda_verb alc260_hp_3013_init_verbs
[] = {
6454 /* Line out and output */
6455 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6457 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
6458 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6459 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6460 /* Mic2 (front panel) pin widget for input and vref at 80% */
6461 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6462 /* Line In pin widget for input */
6463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6464 /* Headphone pin widget for output */
6465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6466 /* CD pin widget for input */
6467 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6468 /* unmute amp left and right */
6469 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
6470 /* set connection select to line in (default select for this ADC) */
6471 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
6472 /* unmute Line-Out mixer amp left and right (volume = 0) */
6473 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6474 /* mute pin widget amp left and right (no gain on this amp) */
6475 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6476 /* unmute HP mixer amp left and right (volume = 0) */
6477 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
6478 /* mute pin widget amp left and right (no gain on this amp) */
6479 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6480 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6483 /* mute analog inputs */
6484 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6489 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6490 /* Unmute Front out path */
6491 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6493 /* Unmute Headphone out path */
6494 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6495 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6496 /* Unmute Mono out path */
6497 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6498 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
6502 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6503 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6504 * audio = 0x16, internal speaker = 0x10.
6506 static const struct hda_verb alc260_fujitsu_init_verbs
[] = {
6507 /* Disable all GPIOs */
6508 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
6509 /* Internal speaker is connected to headphone pin */
6510 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6511 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6513 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6514 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6515 /* Ensure all other unused pins are disabled and muted. */
6516 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6517 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6518 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6519 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6520 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6521 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6523 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6525 /* Disable digital (SPDIF) pins */
6526 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6527 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6529 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6530 * when acting as an output.
6532 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6534 /* Start with output sum widgets muted and their output gains at min */
6535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6536 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6537 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6541 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6542 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6543 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6545 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6546 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6547 /* Unmute Line1 pin widget output buffer since it starts as an output.
6548 * If the pin mode is changed by the user the pin mode control will
6549 * take care of enabling the pin's input/output buffers as needed.
6550 * Therefore there's no need to enable the input buffer at this
6553 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6554 /* Unmute input buffer of pin widget used for Line-in (no equiv
6557 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6559 /* Mute capture amp left and right */
6560 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6561 /* Set ADC connection select to match default mixer setting - line
6564 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6566 /* Do the same for the second ADC: mute capture input amp and
6567 * set ADC connection to line in (on mic1 pin)
6569 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6570 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6572 /* Mute all inputs to mixer widget (even unconnected ones) */
6573 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6574 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6575 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6577 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6578 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6585 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6586 * similar laptops (adapted from Fujitsu init verbs).
6588 static const struct hda_verb alc260_acer_init_verbs
[] = {
6589 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6590 * the headphone jack. Turn this on and rely on the standard mute
6591 * methods whenever the user wants to turn these outputs off.
6593 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6594 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6595 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6596 /* Internal speaker/Headphone jack is connected to Line-out pin */
6597 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6598 /* Internal microphone/Mic jack is connected to Mic1 pin */
6599 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6600 /* Line In jack is connected to Line1 pin */
6601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6602 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6603 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6604 /* Ensure all other unused pins are disabled and muted. */
6605 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6606 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6607 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6608 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6611 /* Disable digital (SPDIF) pins */
6612 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6613 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6615 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6616 * bus when acting as outputs.
6618 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6619 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6621 /* Start with output sum widgets muted and their output gains at min */
6622 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6623 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6624 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6625 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6626 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6627 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6628 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6629 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6630 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6632 /* Unmute Line-out pin widget amp left and right
6633 * (no equiv mixer ctrl)
6635 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6636 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6637 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6638 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6639 * inputs. If the pin mode is changed by the user the pin mode control
6640 * will take care of enabling the pin's input/output buffers as needed.
6641 * Therefore there's no need to enable the input buffer at this
6644 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6647 /* Mute capture amp left and right */
6648 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6649 /* Set ADC connection select to match default mixer setting - mic
6652 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6654 /* Do similar with the second ADC: mute capture input amp and
6655 * set ADC connection to mic to match ALSA's default state.
6657 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6658 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6660 /* Mute all inputs to mixer widget (even unconnected ones) */
6661 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6662 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6663 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6664 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6665 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6666 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6667 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6668 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6673 /* Initialisation sequence for Maxdata Favorit 100XS
6674 * (adapted from Acer init verbs).
6676 static const struct hda_verb alc260_favorit100_init_verbs
[] = {
6677 /* GPIO 0 enables the output jack.
6678 * Turn this on and rely on the standard mute
6679 * methods whenever the user wants to turn these outputs off.
6681 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6682 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6683 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6684 /* Line/Mic input jack is connected to Mic1 pin */
6685 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6686 /* Ensure all other unused pins are disabled and muted. */
6687 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6688 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6689 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6690 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6691 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6692 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6693 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6694 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6695 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6696 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6697 /* Disable digital (SPDIF) pins */
6698 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6699 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6701 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6702 * bus when acting as outputs.
6704 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6705 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6707 /* Start with output sum widgets muted and their output gains at min */
6708 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6709 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6710 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6711 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6712 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6713 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6714 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6715 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6716 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6718 /* Unmute Line-out pin widget amp left and right
6719 * (no equiv mixer ctrl)
6721 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6722 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6723 * inputs. If the pin mode is changed by the user the pin mode control
6724 * will take care of enabling the pin's input/output buffers as needed.
6725 * Therefore there's no need to enable the input buffer at this
6728 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6730 /* Mute capture amp left and right */
6731 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6732 /* Set ADC connection select to match default mixer setting - mic
6735 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6737 /* Do similar with the second ADC: mute capture input amp and
6738 * set ADC connection to mic to match ALSA's default state.
6740 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6741 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6743 /* Mute all inputs to mixer widget (even unconnected ones) */
6744 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6746 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6750 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6756 static const struct hda_verb alc260_will_verbs
[] = {
6757 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6758 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6759 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
6760 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6761 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6762 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
6766 static const struct hda_verb alc260_replacer_672v_verbs
[] = {
6767 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6768 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6769 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
6771 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6772 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6773 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
6775 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6779 /* toggle speaker-output according to the hp-jack state */
6780 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
6782 unsigned int present
;
6784 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6785 present
= snd_hda_jack_detect(codec
, 0x0f);
6787 snd_hda_codec_write_cache(codec
, 0x01, 0,
6788 AC_VERB_SET_GPIO_DATA
, 1);
6789 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6790 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6793 snd_hda_codec_write_cache(codec
, 0x01, 0,
6794 AC_VERB_SET_GPIO_DATA
, 0);
6795 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6796 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6801 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
6804 if ((res
>> 26) == ALC880_HP_EVENT
)
6805 alc260_replacer_672v_automute(codec
);
6808 static const struct hda_verb alc260_hp_dc7600_verbs
[] = {
6809 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x01},
6810 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6811 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6812 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6813 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6814 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6815 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6816 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6817 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6818 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6822 /* Test configuration for debugging, modelled after the ALC880 test
6825 #ifdef CONFIG_SND_DEBUG
6826 static const hda_nid_t alc260_test_dac_nids
[1] = {
6829 static const hda_nid_t alc260_test_adc_nids
[2] = {
6832 /* For testing the ALC260, each input MUX needs its own definition since
6833 * the signal assignments are different. This assumes that the first ADC
6836 static const struct hda_input_mux alc260_test_capture_sources
[2] = {
6840 { "MIC1 pin", 0x0 },
6841 { "MIC2 pin", 0x1 },
6842 { "LINE1 pin", 0x2 },
6843 { "LINE2 pin", 0x3 },
6845 { "LINE-OUT pin", 0x5 },
6846 { "HP-OUT pin", 0x6 },
6852 { "MIC1 pin", 0x0 },
6853 { "MIC2 pin", 0x1 },
6854 { "LINE1 pin", 0x2 },
6855 { "LINE2 pin", 0x3 },
6858 { "LINE-OUT pin", 0x6 },
6859 { "HP-OUT pin", 0x7 },
6863 static const struct snd_kcontrol_new alc260_test_mixer
[] = {
6864 /* Output driver widgets */
6865 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6866 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6867 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6868 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
6869 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6870 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
6872 /* Modes for retasking pin widgets
6873 * Note: the ALC260 doesn't seem to act on requests to enable mic
6874 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6875 * mention this restriction. At this stage it's not clear whether
6876 * this behaviour is intentional or is a hardware bug in chip
6877 * revisions available at least up until early 2006. Therefore for
6878 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6879 * choices, but if it turns out that the lack of mic bias for these
6880 * NIDs is intentional we could change their modes from
6881 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6883 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
6884 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
6885 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
6886 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
6887 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
6888 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
6890 /* Loopback mixer controls */
6891 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
6892 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
6893 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
6894 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
6895 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
6896 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
6897 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
6898 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
6899 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6900 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6901 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
6902 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
6903 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
6904 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
6906 /* Controls for GPIO pins, assuming they are configured as outputs */
6907 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6908 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6909 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6910 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6912 /* Switches to allow the digital IO pins to be enabled. The datasheet
6913 * is ambigious as to which NID is which; testing on laptops which
6914 * make this output available should provide clarification.
6916 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6917 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6919 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6920 * this output to turn on an external amplifier.
6922 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6923 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6927 static const struct hda_verb alc260_test_init_verbs
[] = {
6928 /* Enable all GPIOs as outputs with an initial value of 0 */
6929 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
6930 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
6931 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
6933 /* Enable retasking pins as output, initially without power amp */
6934 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6935 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6936 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6938 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6939 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6941 /* Disable digital (SPDIF) pins initially, but users can enable
6942 * them via a mixer switch. In the case of SPDIF-out, this initverb
6943 * payload also sets the generation to 0, output to be in "consumer"
6944 * PCM format, copyright asserted, no pre-emphasis and no validity
6947 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6948 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6950 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6951 * OUT1 sum bus when acting as an output.
6953 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6954 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
6955 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6956 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
6958 /* Start with output sum widgets muted and their output gains at min */
6959 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6960 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6961 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6962 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6963 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6964 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6965 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6966 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6967 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6969 /* Unmute retasking pin widget output buffers since the default
6970 * state appears to be output. As the pin mode is changed by the
6971 * user the pin mode control will take care of enabling the pin's
6972 * input/output buffers as needed.
6974 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6975 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6977 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6978 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6979 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6980 /* Also unmute the mono-out pin widget */
6981 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6983 /* Mute capture amp left and right */
6984 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6985 /* Set ADC connection select to match default mixer setting (mic1
6988 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6990 /* Do the same for the second ADC: mute capture input amp and
6991 * set ADC connection to mic1 pin
6993 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6994 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6996 /* Mute all inputs to mixer widget (even unconnected ones) */
6997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6998 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6999 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
7000 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
7001 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
7002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
7003 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
7004 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
7010 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
7011 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
7013 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
7014 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
7017 * for BIOS auto-configuration
7020 /* convert from pin to volume-mixer widget */
7021 static hda_nid_t
alc260_pin_to_vol_mix(hda_nid_t nid
)
7023 if (nid
>= 0x0f && nid
<= 0x11)
7025 else if (nid
>= 0x12 && nid
<= 0x15)
7031 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
7032 const char *pfx
, int *vol_bits
)
7035 unsigned long vol_val
, sw_val
;
7038 nid_vol
= alc260_pin_to_vol_mix(nid
);
7045 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, chs
, 0, HDA_OUTPUT
);
7046 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
);
7048 if (!(*vol_bits
& (1 << nid_vol
))) {
7049 /* first control for the volume widget */
7050 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, vol_val
);
7053 *vol_bits
|= (1 << nid_vol
);
7055 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, sw_val
);
7061 /* add playback controls from the parsed DAC table */
7062 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
7063 const struct auto_pin_cfg
*cfg
)
7069 spec
->multiout
.num_dacs
= 1;
7070 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
7071 spec
->private_dac_nids
[0] = 0x02;
7073 nid
= cfg
->line_out_pins
[0];
7077 pfx
= alc_get_line_out_pfx(spec
, 0, true, &index
);
7078 err
= alc260_add_playback_controls(spec
, nid
, pfx
, &vols
);
7083 nid
= cfg
->speaker_pins
[0];
7085 err
= alc260_add_playback_controls(spec
, nid
, "Speaker", &vols
);
7090 nid
= cfg
->hp_pins
[0];
7092 err
= alc260_add_playback_controls(spec
, nid
, "Headphone",
7100 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
7101 hda_nid_t nid
, int pin_type
,
7106 alc_set_pin_output(codec
, nid
, pin_type
);
7107 /* need the manual connection? */
7109 int idx
= nid
- 0x12;
7110 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
7111 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
7114 mix
= alc260_pin_to_vol_mix(nid
);
7117 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
7119 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
7121 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
7125 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
7127 struct alc_spec
*spec
= codec
->spec
;
7130 nid
= spec
->autocfg
.line_out_pins
[0];
7132 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
7133 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
7136 nid
= spec
->autocfg
.speaker_pins
[0];
7138 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
7140 nid
= spec
->autocfg
.hp_pins
[0];
7142 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
7145 #define alc260_auto_init_input_src alc880_auto_init_input_src
7147 static int alc260_parse_auto_config(struct hda_codec
*codec
)
7149 struct alc_spec
*spec
= codec
->spec
;
7151 static const hda_nid_t alc260_ignore
[] = { 0x17, 0 };
7153 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
7157 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
7160 if (!spec
->kctls
.list
)
7161 return 0; /* can't find valid BIOS pin config */
7162 err
= alc_auto_create_input_ctls(codec
);
7166 spec
->multiout
.max_channels
= 2;
7168 if (spec
->autocfg
.dig_outs
)
7169 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
7170 if (spec
->kctls
.list
)
7171 add_mixer(spec
, spec
->kctls
.list
);
7173 spec
->num_mux_defs
= 1;
7174 spec
->input_mux
= &spec
->private_imux
[0];
7176 alc_ssid_check(codec
, 0x10, 0x15, 0x0f, 0);
7181 /* additional initialization for auto-configuration model */
7182 static void alc260_auto_init(struct hda_codec
*codec
)
7184 struct alc_spec
*spec
= codec
->spec
;
7185 alc260_auto_init_multi_out(codec
);
7186 alc_auto_init_analog_input(codec
);
7187 alc260_auto_init_input_src(codec
);
7188 alc_auto_init_digital(codec
);
7189 if (spec
->unsol_event
)
7190 alc_inithook(codec
);
7193 #ifdef CONFIG_SND_HDA_POWER_SAVE
7194 static const struct hda_amp_list alc260_loopbacks
[] = {
7195 { 0x07, HDA_INPUT
, 0 },
7196 { 0x07, HDA_INPUT
, 1 },
7197 { 0x07, HDA_INPUT
, 2 },
7198 { 0x07, HDA_INPUT
, 3 },
7199 { 0x07, HDA_INPUT
, 4 },
7211 static const struct alc_fixup alc260_fixups
[] = {
7212 [PINFIX_HP_DC5750
] = {
7213 .type
= ALC_FIXUP_PINS
,
7214 .v
.pins
= (const struct alc_pincfg
[]) {
7215 { 0x11, 0x90130110 }, /* speaker */
7221 static const struct snd_pci_quirk alc260_fixup_tbl
[] = {
7222 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750
),
7227 * ALC260 configurations
7229 static const char * const alc260_models
[ALC260_MODEL_LAST
] = {
7230 [ALC260_BASIC
] = "basic",
7232 [ALC260_HP_3013
] = "hp-3013",
7233 [ALC260_HP_DC7600
] = "hp-dc7600",
7234 [ALC260_FUJITSU_S702X
] = "fujitsu",
7235 [ALC260_ACER
] = "acer",
7236 [ALC260_WILL
] = "will",
7237 [ALC260_REPLACER_672V
] = "replacer",
7238 [ALC260_FAVORIT100
] = "favorit100",
7239 #ifdef CONFIG_SND_DEBUG
7240 [ALC260_TEST
] = "test",
7242 [ALC260_AUTO
] = "auto",
7245 static const struct snd_pci_quirk alc260_cfg_tbl
[] = {
7246 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
7247 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL
),
7248 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
7249 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100
),
7250 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
7251 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO
), /* no quirk */
7252 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
7253 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
7254 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600
),
7255 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
7256 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
7257 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
7258 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
7259 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
7260 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
7261 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
7262 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
7263 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
7264 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
7265 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
7269 static const struct alc_config_preset alc260_presets
[] = {
7271 .mixers
= { alc260_base_output_mixer
,
7272 alc260_input_mixer
},
7273 .init_verbs
= { alc260_init_verbs
},
7274 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7275 .dac_nids
= alc260_dac_nids
,
7276 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7277 .adc_nids
= alc260_dual_adc_nids
,
7278 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7279 .channel_mode
= alc260_modes
,
7280 .input_mux
= &alc260_capture_source
,
7283 .mixers
= { alc260_hp_output_mixer
,
7284 alc260_input_mixer
},
7285 .init_verbs
= { alc260_init_verbs
,
7286 alc260_hp_unsol_verbs
},
7287 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7288 .dac_nids
= alc260_dac_nids
,
7289 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7290 .adc_nids
= alc260_adc_nids_alt
,
7291 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7292 .channel_mode
= alc260_modes
,
7293 .input_mux
= &alc260_capture_source
,
7294 .unsol_event
= alc_sku_unsol_event
,
7295 .setup
= alc260_hp_setup
,
7296 .init_hook
= alc_inithook
,
7298 [ALC260_HP_DC7600
] = {
7299 .mixers
= { alc260_hp_dc7600_mixer
,
7300 alc260_input_mixer
},
7301 .init_verbs
= { alc260_init_verbs
,
7302 alc260_hp_dc7600_verbs
},
7303 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7304 .dac_nids
= alc260_dac_nids
,
7305 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7306 .adc_nids
= alc260_adc_nids_alt
,
7307 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7308 .channel_mode
= alc260_modes
,
7309 .input_mux
= &alc260_capture_source
,
7310 .unsol_event
= alc_sku_unsol_event
,
7311 .setup
= alc260_hp_3012_setup
,
7312 .init_hook
= alc_inithook
,
7314 [ALC260_HP_3013
] = {
7315 .mixers
= { alc260_hp_3013_mixer
,
7316 alc260_input_mixer
},
7317 .init_verbs
= { alc260_hp_3013_init_verbs
,
7318 alc260_hp_3013_unsol_verbs
},
7319 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7320 .dac_nids
= alc260_dac_nids
,
7321 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
7322 .adc_nids
= alc260_adc_nids_alt
,
7323 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7324 .channel_mode
= alc260_modes
,
7325 .input_mux
= &alc260_capture_source
,
7326 .unsol_event
= alc_sku_unsol_event
,
7327 .setup
= alc260_hp_3013_setup
,
7328 .init_hook
= alc_inithook
,
7330 [ALC260_FUJITSU_S702X
] = {
7331 .mixers
= { alc260_fujitsu_mixer
},
7332 .init_verbs
= { alc260_fujitsu_init_verbs
},
7333 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7334 .dac_nids
= alc260_dac_nids
,
7335 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7336 .adc_nids
= alc260_dual_adc_nids
,
7337 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7338 .channel_mode
= alc260_modes
,
7339 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
7340 .input_mux
= alc260_fujitsu_capture_sources
,
7343 .mixers
= { alc260_acer_mixer
},
7344 .init_verbs
= { alc260_acer_init_verbs
},
7345 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7346 .dac_nids
= alc260_dac_nids
,
7347 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7348 .adc_nids
= alc260_dual_adc_nids
,
7349 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7350 .channel_mode
= alc260_modes
,
7351 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
7352 .input_mux
= alc260_acer_capture_sources
,
7354 [ALC260_FAVORIT100
] = {
7355 .mixers
= { alc260_favorit100_mixer
},
7356 .init_verbs
= { alc260_favorit100_init_verbs
},
7357 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7358 .dac_nids
= alc260_dac_nids
,
7359 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
7360 .adc_nids
= alc260_dual_adc_nids
,
7361 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7362 .channel_mode
= alc260_modes
,
7363 .num_mux_defs
= ARRAY_SIZE(alc260_favorit100_capture_sources
),
7364 .input_mux
= alc260_favorit100_capture_sources
,
7367 .mixers
= { alc260_will_mixer
},
7368 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
7369 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7370 .dac_nids
= alc260_dac_nids
,
7371 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
7372 .adc_nids
= alc260_adc_nids
,
7373 .dig_out_nid
= ALC260_DIGOUT_NID
,
7374 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7375 .channel_mode
= alc260_modes
,
7376 .input_mux
= &alc260_capture_source
,
7378 [ALC260_REPLACER_672V
] = {
7379 .mixers
= { alc260_replacer_672v_mixer
},
7380 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
7381 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
7382 .dac_nids
= alc260_dac_nids
,
7383 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
7384 .adc_nids
= alc260_adc_nids
,
7385 .dig_out_nid
= ALC260_DIGOUT_NID
,
7386 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7387 .channel_mode
= alc260_modes
,
7388 .input_mux
= &alc260_capture_source
,
7389 .unsol_event
= alc260_replacer_672v_unsol_event
,
7390 .init_hook
= alc260_replacer_672v_automute
,
7392 #ifdef CONFIG_SND_DEBUG
7394 .mixers
= { alc260_test_mixer
},
7395 .init_verbs
= { alc260_test_init_verbs
},
7396 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
7397 .dac_nids
= alc260_test_dac_nids
,
7398 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
7399 .adc_nids
= alc260_test_adc_nids
,
7400 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
7401 .channel_mode
= alc260_modes
,
7402 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
7403 .input_mux
= alc260_test_capture_sources
,
7408 static int patch_alc260(struct hda_codec
*codec
)
7410 struct alc_spec
*spec
;
7411 int err
, board_config
;
7413 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
7419 spec
->mixer_nid
= 0x07;
7421 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
7424 if (board_config
< 0) {
7425 snd_printd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
7427 board_config
= ALC260_AUTO
;
7430 if (board_config
== ALC260_AUTO
) {
7431 alc_pick_fixup(codec
, NULL
, alc260_fixup_tbl
, alc260_fixups
);
7432 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
7435 if (board_config
== ALC260_AUTO
) {
7436 /* automatic parse from the BIOS config */
7437 err
= alc260_parse_auto_config(codec
);
7443 "hda_codec: Cannot set up configuration "
7444 "from BIOS. Using base mode...\n");
7445 board_config
= ALC260_BASIC
;
7449 err
= snd_hda_attach_beep_device(codec
, 0x1);
7455 if (board_config
!= ALC260_AUTO
)
7456 setup_preset(codec
, &alc260_presets
[board_config
]);
7458 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
7459 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
7460 spec
->stream_analog_alt_capture
= &alc260_pcm_analog_capture
;
7462 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
7463 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
7465 if (!spec
->adc_nids
&& spec
->input_mux
) {
7466 /* check whether NID 0x04 is valid */
7467 unsigned int wcap
= get_wcaps(codec
, 0x04);
7468 wcap
= get_wcaps_type(wcap
);
7470 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
7471 spec
->adc_nids
= alc260_adc_nids_alt
;
7472 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
7474 spec
->adc_nids
= alc260_adc_nids
;
7475 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
7478 set_capture_mixer(codec
);
7479 set_beep_amp(spec
, 0x07, 0x05, HDA_INPUT
);
7481 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
7483 spec
->vmaster_nid
= 0x08;
7485 codec
->patch_ops
= alc_patch_ops
;
7486 if (board_config
== ALC260_AUTO
)
7487 spec
->init_hook
= alc260_auto_init
;
7488 spec
->shutup
= alc_eapd_shutup
;
7489 #ifdef CONFIG_SND_HDA_POWER_SAVE
7490 if (!spec
->loopback
.amplist
)
7491 spec
->loopback
.amplist
= alc260_loopbacks
;
7499 * ALC882/883/885/888/889 support
7501 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7502 * configuration. Each pin widget can choose any input DACs and a mixer.
7503 * Each ADC is connected from a mixer of all inputs. This makes possible
7504 * 6-channel independent captures.
7506 * In addition, an independent DAC for the multi-playback (not used in this
7509 #define ALC882_DIGOUT_NID 0x06
7510 #define ALC882_DIGIN_NID 0x0a
7511 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7512 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7513 #define ALC1200_DIGOUT_NID 0x10
7516 static const struct hda_channel_mode alc882_ch_modes
[1] = {
7521 static const hda_nid_t alc882_dac_nids
[4] = {
7522 /* front, rear, clfe, rear_surr */
7523 0x02, 0x03, 0x04, 0x05
7525 #define alc883_dac_nids alc882_dac_nids
7528 #define alc882_adc_nids alc880_adc_nids
7529 #define alc882_adc_nids_alt alc880_adc_nids_alt
7530 #define alc883_adc_nids alc882_adc_nids_alt
7531 static const hda_nid_t alc883_adc_nids_alt
[1] = { 0x08 };
7532 static const hda_nid_t alc883_adc_nids_rev
[2] = { 0x09, 0x08 };
7533 #define alc889_adc_nids alc880_adc_nids
7535 static const hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
7536 static const hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
7537 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7538 static const hda_nid_t alc883_capsrc_nids_rev
[2] = { 0x22, 0x23 };
7539 #define alc889_capsrc_nids alc882_capsrc_nids
7542 /* FIXME: should be a matrix-type input source selection */
7544 static const struct hda_input_mux alc882_capture_source
= {
7548 { "Front Mic", 0x1 },
7554 #define alc883_capture_source alc882_capture_source
7556 static const struct hda_input_mux alc889_capture_source
= {
7559 { "Front Mic", 0x0 },
7565 static const struct hda_input_mux mb5_capture_source
= {
7574 static const struct hda_input_mux macmini3_capture_source
= {
7582 static const struct hda_input_mux alc883_3stack_6ch_intel
= {
7586 { "Front Mic", 0x0 },
7592 static const struct hda_input_mux alc883_lenovo_101e_capture_source
= {
7600 static const struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
7604 { "Internal Mic", 0x1 },
7610 static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
7614 { "Internal Mic", 0x1 },
7618 static const struct hda_input_mux alc883_lenovo_sky_capture_source
= {
7622 { "Front Mic", 0x1 },
7627 static const struct hda_input_mux alc883_asus_eee1601_capture_source
= {
7635 static const struct hda_input_mux alc889A_mb31_capture_source
= {
7639 /* Front Mic (0x01) unused */
7641 /* Line 2 (0x03) unused */
7642 /* CD (0x04) unused? */
7646 static const struct hda_input_mux alc889A_imac91_capture_source
= {
7650 { "Line", 0x2 }, /* Not sure! */
7657 static const struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
7664 static const struct hda_verb alc882_3ST_ch2_init
[] = {
7665 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7666 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7667 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7668 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7675 static const struct hda_verb alc882_3ST_ch4_init
[] = {
7676 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7677 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7678 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7679 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7680 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7687 static const struct hda_verb alc882_3ST_ch6_init
[] = {
7688 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7689 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7690 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7691 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7692 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7693 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7697 static const struct hda_channel_mode alc882_3ST_6ch_modes
[3] = {
7698 { 2, alc882_3ST_ch2_init
},
7699 { 4, alc882_3ST_ch4_init
},
7700 { 6, alc882_3ST_ch6_init
},
7703 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7708 static const struct hda_verb alc883_3ST_ch2_clevo_init
[] = {
7709 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7710 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7711 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7712 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7713 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7720 static const struct hda_verb alc883_3ST_ch4_clevo_init
[] = {
7721 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7722 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7723 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7724 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7725 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7726 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7733 static const struct hda_verb alc883_3ST_ch6_clevo_init
[] = {
7734 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7735 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7736 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7737 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7738 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7739 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7740 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7744 static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes
[3] = {
7745 { 2, alc883_3ST_ch2_clevo_init
},
7746 { 4, alc883_3ST_ch4_clevo_init
},
7747 { 6, alc883_3ST_ch6_clevo_init
},
7754 static const struct hda_verb alc882_sixstack_ch6_init
[] = {
7755 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7756 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7757 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7758 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7765 static const struct hda_verb alc882_sixstack_ch8_init
[] = {
7766 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7767 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7768 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7769 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7773 static const struct hda_channel_mode alc882_sixstack_modes
[2] = {
7774 { 6, alc882_sixstack_ch6_init
},
7775 { 8, alc882_sixstack_ch8_init
},
7779 /* Macbook Air 2,1 */
7781 static const struct hda_channel_mode alc885_mba21_ch_modes
[1] = {
7786 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7792 static const struct hda_verb alc885_mbp_ch2_init
[] = {
7793 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7794 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7795 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7802 static const struct hda_verb alc885_mbp_ch4_init
[] = {
7803 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7804 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7805 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7806 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7807 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7811 static const struct hda_channel_mode alc885_mbp_4ch_modes
[2] = {
7812 { 2, alc885_mbp_ch2_init
},
7813 { 4, alc885_mbp_ch4_init
},
7818 * Speakers/Woofer/HP = Front
7821 static const struct hda_verb alc885_mb5_ch2_init
[] = {
7822 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7823 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7829 * Speakers/HP = Front
7833 static const struct hda_verb alc885_mb5_ch6_init
[] = {
7834 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7835 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7836 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7840 static const struct hda_channel_mode alc885_mb5_6ch_modes
[2] = {
7841 { 2, alc885_mb5_ch2_init
},
7842 { 6, alc885_mb5_ch6_init
},
7845 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7850 static const struct hda_verb alc883_4ST_ch2_init
[] = {
7851 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7852 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7853 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7854 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7855 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7856 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7863 static const struct hda_verb alc883_4ST_ch4_init
[] = {
7864 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7865 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7866 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7867 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7868 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7869 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7870 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7877 static const struct hda_verb alc883_4ST_ch6_init
[] = {
7878 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7879 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7880 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7881 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7882 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7883 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7884 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7885 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7892 static const struct hda_verb alc883_4ST_ch8_init
[] = {
7893 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7894 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7895 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7896 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7897 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7898 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7899 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7900 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7901 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7905 static const struct hda_channel_mode alc883_4ST_8ch_modes
[4] = {
7906 { 2, alc883_4ST_ch2_init
},
7907 { 4, alc883_4ST_ch4_init
},
7908 { 6, alc883_4ST_ch6_init
},
7909 { 8, alc883_4ST_ch8_init
},
7916 static const struct hda_verb alc883_3ST_ch2_intel_init
[] = {
7917 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7918 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7919 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7920 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7927 static const struct hda_verb alc883_3ST_ch4_intel_init
[] = {
7928 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7929 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7930 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7931 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7932 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7939 static const struct hda_verb alc883_3ST_ch6_intel_init
[] = {
7940 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7941 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7942 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7943 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7944 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7945 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7949 static const struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
7950 { 2, alc883_3ST_ch2_intel_init
},
7951 { 4, alc883_3ST_ch4_intel_init
},
7952 { 6, alc883_3ST_ch6_intel_init
},
7958 static const struct hda_verb alc889_ch2_intel_init
[] = {
7959 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7960 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7961 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7962 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7963 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7964 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7971 static const struct hda_verb alc889_ch6_intel_init
[] = {
7972 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7973 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7974 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7975 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7976 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7977 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7984 static const struct hda_verb alc889_ch8_intel_init
[] = {
7985 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7986 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7987 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7988 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7989 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7990 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7991 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7995 static const struct hda_channel_mode alc889_8ch_intel_modes
[3] = {
7996 { 2, alc889_ch2_intel_init
},
7997 { 6, alc889_ch6_intel_init
},
7998 { 8, alc889_ch8_intel_init
},
8004 static const struct hda_verb alc883_sixstack_ch6_init
[] = {
8005 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
8006 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8007 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8008 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8015 static const struct hda_verb alc883_sixstack_ch8_init
[] = {
8016 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8017 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8018 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8019 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8023 static const struct hda_channel_mode alc883_sixstack_modes
[2] = {
8024 { 6, alc883_sixstack_ch6_init
},
8025 { 8, alc883_sixstack_ch8_init
},
8029 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
8030 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
8032 static const struct snd_kcontrol_new alc882_base_mixer
[] = {
8033 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8034 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8035 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8036 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8037 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8038 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8039 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8040 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8041 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8042 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
8043 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8044 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8045 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8047 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8049 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8051 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8052 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8053 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8057 /* Macbook Air 2,1 same control for HP and internal Speaker */
8059 static const struct snd_kcontrol_new alc885_mba21_mixer
[] = {
8060 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8061 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT
),
8066 static const struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
8067 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8068 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8069 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
8070 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT
),
8071 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8072 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8073 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8074 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
8075 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
8076 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT
),
8077 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT
),
8081 static const struct snd_kcontrol_new alc885_mb5_mixer
[] = {
8082 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8083 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8084 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8085 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
8086 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
8087 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
8088 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
8089 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
8090 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
8091 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
8092 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8093 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8094 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT
),
8095 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT
),
8099 static const struct snd_kcontrol_new alc885_macmini3_mixer
[] = {
8100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8101 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8102 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8103 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
8104 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
8105 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
8106 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
8107 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
8108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
8109 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
8110 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT
),
8114 static const struct snd_kcontrol_new alc885_imac91_mixer
[] = {
8115 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8116 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8121 static const struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
8122 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8123 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8124 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8125 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8126 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8127 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8129 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8134 static const struct snd_kcontrol_new alc882_targa_mixer
[] = {
8135 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8136 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8138 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8139 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8140 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8141 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8144 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8145 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8146 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8147 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8151 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8152 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8154 static const struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
8155 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8156 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8157 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8158 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
8159 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8160 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8161 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8162 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8163 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
8164 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
8165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8167 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8171 static const struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
8172 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8173 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8175 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8176 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8177 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8178 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8179 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8180 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8181 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8185 static const struct snd_kcontrol_new alc882_chmode_mixer
[] = {
8187 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8188 .name
= "Channel Mode",
8189 .info
= alc_ch_mode_info
,
8190 .get
= alc_ch_mode_get
,
8191 .put
= alc_ch_mode_put
,
8196 static const struct hda_verb alc882_base_init_verbs
[] = {
8197 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8198 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8201 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8202 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8204 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8205 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8207 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8208 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8210 /* Front Pin: output 0 (0x0c) */
8211 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8212 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8213 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8214 /* Rear Pin: output 1 (0x0d) */
8215 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8216 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8217 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8218 /* CLFE Pin: output 2 (0x0e) */
8219 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8220 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8221 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8222 /* Side Pin: output 3 (0x0f) */
8223 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8224 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8225 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8226 /* Mic (rear) pin: input vref at 80% */
8227 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8228 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8229 /* Front Mic pin: input vref at 80% */
8230 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8231 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8232 /* Line In pin: input */
8233 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8234 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8235 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8236 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8237 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8238 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8239 /* CD pin widget for input */
8240 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8242 /* FIXME: use matrix-type input source selection */
8243 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8245 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8247 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8248 /* ADC2: mute amp left and right */
8249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8250 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8251 /* ADC3: mute amp left and right */
8252 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8253 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8258 static const struct hda_verb alc882_adc1_init_verbs
[] = {
8259 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8260 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8261 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8262 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8264 /* ADC1: mute amp left and right */
8265 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8266 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8270 static const struct hda_verb alc882_eapd_verbs
[] = {
8271 /* change to EAPD mode */
8272 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8273 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
8277 static const struct hda_verb alc889_eapd_verbs
[] = {
8278 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8279 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8283 static const struct hda_verb alc_hp15_unsol_verbs
[] = {
8284 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8285 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8289 static const struct hda_verb alc885_init_verbs
[] = {
8290 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8295 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8300 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8301 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8303 /* Front HP Pin: output 0 (0x0c) */
8304 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8306 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8307 /* Front Pin: output 0 (0x0c) */
8308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8310 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8311 /* Rear Pin: output 1 (0x0d) */
8312 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8313 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8314 {0x19, AC_VERB_SET_CONNECT_SEL
, 0x01},
8315 /* CLFE Pin: output 2 (0x0e) */
8316 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8317 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8318 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8319 /* Side Pin: output 3 (0x0f) */
8320 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8321 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8322 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8323 /* Mic (rear) pin: input vref at 80% */
8324 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8325 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8326 /* Front Mic pin: input vref at 80% */
8327 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8328 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8329 /* Line In pin: input */
8330 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8331 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8333 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8337 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8339 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8340 /* ADC2: mute amp left and right */
8341 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8342 /* ADC3: mute amp left and right */
8343 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8348 static const struct hda_verb alc885_init_input_verbs
[] = {
8349 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
8356 /* Unmute Selector 24h and set the default input to front mic */
8357 static const struct hda_verb alc889_init_input_verbs
[] = {
8358 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
8359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8364 #define alc883_init_verbs alc882_base_init_verbs
8367 static const struct snd_kcontrol_new alc882_macpro_mixer
[] = {
8368 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8369 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8370 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
8371 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8372 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8373 /* FIXME: this looks suspicious...
8374 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8375 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8380 static const struct hda_verb alc882_macpro_init_verbs
[] = {
8381 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8385 /* Front Pin: output 0 (0x0c) */
8386 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8388 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8389 /* Front Mic pin: input vref at 80% */
8390 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8391 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8392 /* Speaker: output */
8393 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8394 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8395 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
8396 /* Headphone output (output 0 - 0x0c) */
8397 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8398 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8399 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8401 /* FIXME: use matrix-type input source selection */
8402 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8403 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8404 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8409 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8410 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8418 /* ADC1: mute amp left and right */
8419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8420 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8421 /* ADC2: mute amp left and right */
8422 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8423 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8424 /* ADC3: mute amp left and right */
8425 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8426 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8432 static const struct hda_verb alc885_mb5_init_verbs
[] = {
8434 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8435 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8436 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8437 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8439 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8440 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8442 /* Surround mixer */
8443 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8444 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8445 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8447 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8448 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8449 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8451 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8452 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8453 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8454 /* Front Pin (0x0c) */
8455 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8456 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8457 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8458 /* LFE Pin (0x0e) */
8459 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8460 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8461 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
8463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8464 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8465 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
8466 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8467 /* Front Mic pin: input vref at 80% */
8468 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8469 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8471 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8472 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0x1)},
8475 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x7)},
8476 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x4)},
8481 static const struct hda_verb alc885_macmini3_init_verbs
[] = {
8483 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8484 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8485 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8486 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8490 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8491 /* Surround mixer */
8492 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8493 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8494 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8496 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8497 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8498 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8500 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8501 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8502 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8503 /* Front Pin (0x0c) */
8504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8506 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8507 /* LFE Pin (0x0e) */
8508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
8509 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8510 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
8512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8513 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8514 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
8515 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8523 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8528 static const struct hda_verb alc885_mba21_init_verbs
[] = {
8529 /*Internal and HP Speaker Mixer*/
8530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8533 /*Internal Speaker Pin (0x0c)*/
8534 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8535 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8536 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8537 /* HP Pin: output 0 (0x0e) */
8538 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
8539 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8540 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8541 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8542 /* Line in (is hp when jack connected)*/
8543 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8544 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8550 /* Macbook Pro rev3 */
8551 static const struct hda_verb alc885_mbp3_init_verbs
[] = {
8552 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8557 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8558 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8559 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8561 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8562 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8563 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8564 /* Front Pin: output 0 (0x0c) */
8565 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8566 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8567 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8568 /* HP Pin: output 0 (0x0e) */
8569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
8570 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8571 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x02},
8572 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8573 /* Mic (rear) pin: input vref at 80% */
8574 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8575 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8576 /* Front Mic pin: input vref at 80% */
8577 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8578 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8579 /* Line In pin: use output 1 when in LineOut mode */
8580 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8582 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
8584 /* FIXME: use matrix-type input source selection */
8585 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8586 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8587 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8588 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8589 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8590 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8592 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8593 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8594 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8595 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8598 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8601 /* ADC1: mute amp left and right */
8602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8603 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8604 /* ADC2: mute amp left and right */
8605 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8606 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8607 /* ADC3: mute amp left and right */
8608 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8609 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8615 static const struct hda_verb alc885_imac91_init_verbs
[] = {
8616 /* Internal Speaker Pin (0x0c) */
8617 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8618 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8619 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8620 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8621 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8622 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8625 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8626 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8627 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8629 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8630 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8631 /* Front Mic pin: input vref at 80% */
8632 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8633 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8636 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8637 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8638 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8639 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8642 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8647 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8648 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8652 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8657 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8658 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8659 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8660 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8661 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8662 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8663 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8664 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8665 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8669 /* iMac 24 mixer. */
8670 static const struct snd_kcontrol_new alc885_imac24_mixer
[] = {
8671 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8672 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
8676 /* iMac 24 init verbs. */
8677 static const struct hda_verb alc885_imac24_init_verbs
[] = {
8678 /* Internal speakers: output 0 (0x0c) */
8679 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8680 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8681 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8682 /* Internal speakers: output 0 (0x0c) */
8683 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8684 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8685 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8686 /* Headphone: output 0 (0x0c) */
8687 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8688 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8689 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8690 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8691 /* Front Mic: input vref at 80% */
8692 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8693 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8697 /* Toggle speaker-output according to the hp-jack state */
8698 static void alc885_imac24_setup(struct hda_codec
*codec
)
8700 struct alc_spec
*spec
= codec
->spec
;
8702 spec
->autocfg
.hp_pins
[0] = 0x14;
8703 spec
->autocfg
.speaker_pins
[0] = 0x18;
8704 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8706 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8709 #define alc885_mb5_setup alc885_imac24_setup
8710 #define alc885_macmini3_setup alc885_imac24_setup
8712 /* Macbook Air 2,1 */
8713 static void alc885_mba21_setup(struct hda_codec
*codec
)
8715 struct alc_spec
*spec
= codec
->spec
;
8717 spec
->autocfg
.hp_pins
[0] = 0x14;
8718 spec
->autocfg
.speaker_pins
[0] = 0x18;
8720 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8725 static void alc885_mbp3_setup(struct hda_codec
*codec
)
8727 struct alc_spec
*spec
= codec
->spec
;
8729 spec
->autocfg
.hp_pins
[0] = 0x15;
8730 spec
->autocfg
.speaker_pins
[0] = 0x14;
8732 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8735 static void alc885_imac91_setup(struct hda_codec
*codec
)
8737 struct alc_spec
*spec
= codec
->spec
;
8739 spec
->autocfg
.hp_pins
[0] = 0x14;
8740 spec
->autocfg
.speaker_pins
[0] = 0x18;
8741 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8743 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8746 static const struct hda_verb alc882_targa_verbs
[] = {
8747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8750 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8751 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8753 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8754 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8755 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8757 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8761 /* toggle speaker-output according to the hp-jack state */
8762 static void alc882_targa_automute(struct hda_codec
*codec
)
8764 struct alc_spec
*spec
= codec
->spec
;
8765 alc_hp_automute(codec
);
8766 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
8767 spec
->jack_present
? 1 : 3);
8770 static void alc882_targa_setup(struct hda_codec
*codec
)
8772 struct alc_spec
*spec
= codec
->spec
;
8774 spec
->autocfg
.hp_pins
[0] = 0x14;
8775 spec
->autocfg
.speaker_pins
[0] = 0x1b;
8777 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
8780 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8782 if ((res
>> 26) == ALC880_HP_EVENT
)
8783 alc882_targa_automute(codec
);
8786 static const struct hda_verb alc882_asus_a7j_verbs
[] = {
8787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8788 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8790 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8791 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8792 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8794 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8795 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8796 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8798 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8799 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8800 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8804 static const struct hda_verb alc882_asus_a7m_verbs
[] = {
8805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8808 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8809 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8810 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8812 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8813 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8814 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8816 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8817 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8818 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8822 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
8824 unsigned int gpiostate
, gpiomask
, gpiodir
;
8826 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8827 AC_VERB_GET_GPIO_DATA
, 0);
8830 gpiostate
|= (1 << pin
);
8832 gpiostate
&= ~(1 << pin
);
8834 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8835 AC_VERB_GET_GPIO_MASK
, 0);
8836 gpiomask
|= (1 << pin
);
8838 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8839 AC_VERB_GET_GPIO_DIRECTION
, 0);
8840 gpiodir
|= (1 << pin
);
8843 snd_hda_codec_write(codec
, codec
->afg
, 0,
8844 AC_VERB_SET_GPIO_MASK
, gpiomask
);
8845 snd_hda_codec_write(codec
, codec
->afg
, 0,
8846 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
8850 snd_hda_codec_write(codec
, codec
->afg
, 0,
8851 AC_VERB_SET_GPIO_DATA
, gpiostate
);
8854 /* set up GPIO at initialization */
8855 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
8857 alc882_gpio_mute(codec
, 0, 0);
8858 alc882_gpio_mute(codec
, 1, 0);
8861 /* set up GPIO and update auto-muting at initialization */
8862 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
8864 alc885_macpro_init_hook(codec
);
8865 alc_hp_automute(codec
);
8868 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8869 static const struct hda_verb alc889A_mb31_ch2_init
[] = {
8870 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
8871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8872 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
8873 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
8877 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8878 static const struct hda_verb alc889A_mb31_ch4_init
[] = {
8879 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
8880 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8881 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
8882 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
8886 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8887 static const struct hda_verb alc889A_mb31_ch5_init
[] = {
8888 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as rear */
8889 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8890 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
8891 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
8895 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8896 static const struct hda_verb alc889A_mb31_ch6_init
[] = {
8897 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as front */
8898 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Subwoofer off */
8899 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
8900 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
8904 static const struct hda_channel_mode alc889A_mb31_6ch_modes
[4] = {
8905 { 2, alc889A_mb31_ch2_init
},
8906 { 4, alc889A_mb31_ch4_init
},
8907 { 5, alc889A_mb31_ch5_init
},
8908 { 6, alc889A_mb31_ch6_init
},
8911 static const struct hda_verb alc883_medion_eapd_verbs
[] = {
8912 /* eanable EAPD on medion laptop */
8913 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8914 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
8918 #define alc883_base_mixer alc882_base_mixer
8920 static const struct snd_kcontrol_new alc883_mitac_mixer
[] = {
8921 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8922 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8923 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8924 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8925 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8926 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8927 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8929 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8931 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8932 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8933 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8937 static const struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
8938 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8939 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8940 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8941 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8943 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8944 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8945 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8946 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8947 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8951 static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
8952 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8953 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8954 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8955 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8956 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8957 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8958 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8959 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8960 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8961 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8965 static const struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
8966 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8967 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8968 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8969 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8970 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8971 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8972 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8973 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8974 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8976 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8977 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
8978 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8982 static const struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
8983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8984 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8985 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8986 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8987 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8988 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8989 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8990 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8991 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8992 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8993 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8994 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8995 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8997 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
8998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8999 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9000 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9001 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9005 static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
9006 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9007 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9008 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9009 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9010 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9012 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9013 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9014 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9015 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9016 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9017 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9018 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9019 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9021 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9022 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9023 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9024 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9025 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9029 static const struct snd_kcontrol_new alc885_8ch_intel_mixer
[] = {
9030 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9031 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9032 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9033 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9034 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9036 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9037 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9038 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9039 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9040 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT
),
9041 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9042 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9043 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9044 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
9045 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT
),
9046 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
9047 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9048 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9049 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9053 static const struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
9054 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9055 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9056 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9057 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9058 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9059 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9060 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9061 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9062 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9063 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9064 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9065 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9066 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9068 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9069 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9070 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9071 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9072 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9076 static const struct snd_kcontrol_new alc883_targa_mixer
[] = {
9077 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9078 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9080 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9081 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9082 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
9083 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9084 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9085 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9086 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
9087 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9088 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9089 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9090 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9092 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9093 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9097 static const struct snd_kcontrol_new alc883_targa_2ch_mixer
[] = {
9098 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9099 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9100 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9101 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9102 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9103 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9104 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9105 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9106 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9107 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9108 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9109 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9113 static const struct snd_kcontrol_new alc883_targa_8ch_mixer
[] = {
9114 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9115 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
9116 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9117 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9118 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9122 static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
9123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9124 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9125 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9126 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
9127 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9129 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9134 static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
9135 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9136 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
9137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9138 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9139 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9141 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9142 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9143 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9147 static const struct snd_kcontrol_new alc883_medion_wim2160_mixer
[] = {
9148 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9149 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9150 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9151 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT
),
9152 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT
),
9153 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT
),
9157 static const struct hda_verb alc883_medion_wim2160_verbs
[] = {
9158 /* Unmute front mixer */
9159 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9160 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9162 /* Set speaker pin to front mixer */
9163 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9165 /* Init headphone pin */
9166 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9167 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9168 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
9169 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9174 /* toggle speaker-output according to the hp-jack state */
9175 static void alc883_medion_wim2160_setup(struct hda_codec
*codec
)
9177 struct alc_spec
*spec
= codec
->spec
;
9179 spec
->autocfg
.hp_pins
[0] = 0x1a;
9180 spec
->autocfg
.speaker_pins
[0] = 0x15;
9182 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9185 static const struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
9186 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9187 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9188 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9189 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9190 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9191 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9192 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9197 static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer
[] = {
9198 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9199 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9200 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9201 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9202 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9203 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9205 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9206 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9210 static const struct snd_kcontrol_new alc888_lenovo_sky_mixer
[] = {
9211 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9212 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9213 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
9214 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
9215 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9216 0x0d, 1, 0x0, HDA_OUTPUT
),
9217 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
9218 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
9219 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
9220 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
9221 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
9222 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9223 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9224 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9225 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9226 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9227 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9228 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9229 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9230 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9231 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9235 static const struct snd_kcontrol_new alc889A_mb31_mixer
[] = {
9237 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
9238 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
9239 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
9240 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
9241 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9243 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT
),
9244 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT
),
9245 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT
),
9246 /* Output switches */
9247 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT
),
9248 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT
),
9249 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT
),
9251 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT
),
9252 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT
),
9254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
9255 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
9256 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9257 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9261 static const struct snd_kcontrol_new alc883_vaiott_mixer
[] = {
9262 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9263 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9264 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9265 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9266 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
9267 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9271 static const struct hda_bind_ctls alc883_bind_cap_vol
= {
9272 .ops
= &snd_hda_bind_vol
,
9274 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
9275 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
9280 static const struct hda_bind_ctls alc883_bind_cap_switch
= {
9281 .ops
= &snd_hda_bind_sw
,
9283 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
9284 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
9289 static const struct snd_kcontrol_new alc883_asus_eee1601_mixer
[] = {
9290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9291 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
9292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9293 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9294 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9296 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
9297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9301 static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer
[] = {
9302 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol
),
9303 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch
),
9305 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9306 /* .name = "Capture Source", */
9307 .name
= "Input Source",
9309 .info
= alc_mux_enum_info
,
9310 .get
= alc_mux_enum_get
,
9311 .put
= alc_mux_enum_put
,
9316 static const struct snd_kcontrol_new alc883_chmode_mixer
[] = {
9318 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9319 .name
= "Channel Mode",
9320 .info
= alc_ch_mode_info
,
9321 .get
= alc_ch_mode_get
,
9322 .put
= alc_ch_mode_put
,
9327 /* toggle speaker-output according to the hp-jack state */
9328 static void alc883_mitac_setup(struct hda_codec
*codec
)
9330 struct alc_spec
*spec
= codec
->spec
;
9332 spec
->autocfg
.hp_pins
[0] = 0x15;
9333 spec
->autocfg
.speaker_pins
[0] = 0x14;
9334 spec
->autocfg
.speaker_pins
[1] = 0x17;
9336 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9339 static const struct hda_verb alc883_mitac_verbs
[] = {
9341 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9344 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
9345 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9347 /* enable unsolicited event */
9348 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9349 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9354 static const struct hda_verb alc883_clevo_m540r_verbs
[] = {
9356 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9357 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9359 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9361 /* enable unsolicited event */
9363 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9364 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9370 static const struct hda_verb alc883_clevo_m720_verbs
[] = {
9372 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9373 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9375 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
9376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9378 /* enable unsolicited event */
9379 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9380 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9385 static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
9387 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9388 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9390 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9393 /* enable unsolicited event */
9394 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9399 static const struct hda_verb alc883_targa_verbs
[] = {
9400 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9403 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9404 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9406 /* Connect Line-Out side jack (SPDIF) to Side */
9407 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9408 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9409 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
9410 /* Connect Mic jack to CLFE */
9411 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9412 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9413 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
9414 /* Connect Line-in jack to Surround */
9415 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9416 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9417 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
9418 /* Connect HP out jack to Front */
9419 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9420 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9421 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9423 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9428 static const struct hda_verb alc883_lenovo_101e_verbs
[] = {
9429 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9430 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
9431 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
9435 static const struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
9436 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9438 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9439 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9443 static const struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
9444 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9445 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9446 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9447 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
9448 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9452 static const struct hda_verb alc883_haier_w66_verbs
[] = {
9453 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9456 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9458 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9459 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9460 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9461 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9465 static const struct hda_verb alc888_lenovo_sky_verbs
[] = {
9466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9469 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9470 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9471 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9472 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
9473 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9477 static const struct hda_verb alc888_6st_dell_verbs
[] = {
9478 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9482 static const struct hda_verb alc883_vaiott_verbs
[] = {
9484 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9487 /* enable unsolicited event */
9488 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9493 static void alc888_3st_hp_setup(struct hda_codec
*codec
)
9495 struct alc_spec
*spec
= codec
->spec
;
9497 spec
->autocfg
.hp_pins
[0] = 0x1b;
9498 spec
->autocfg
.speaker_pins
[0] = 0x14;
9499 spec
->autocfg
.speaker_pins
[1] = 0x16;
9500 spec
->autocfg
.speaker_pins
[2] = 0x18;
9502 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9505 static const struct hda_verb alc888_3st_hp_verbs
[] = {
9506 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
9507 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
9508 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
9509 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9516 static const struct hda_verb alc888_3st_hp_2ch_init
[] = {
9517 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9518 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9519 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
9520 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9527 static const struct hda_verb alc888_3st_hp_4ch_init
[] = {
9528 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9529 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9530 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9531 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9532 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9539 static const struct hda_verb alc888_3st_hp_6ch_init
[] = {
9540 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9541 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9542 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
9543 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9544 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9545 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9549 static const struct hda_channel_mode alc888_3st_hp_modes
[3] = {
9550 { 2, alc888_3st_hp_2ch_init
},
9551 { 4, alc888_3st_hp_4ch_init
},
9552 { 6, alc888_3st_hp_6ch_init
},
9555 static void alc888_lenovo_ms7195_setup(struct hda_codec
*codec
)
9557 struct alc_spec
*spec
= codec
->spec
;
9559 spec
->autocfg
.hp_pins
[0] = 0x1b;
9560 spec
->autocfg
.line_out_pins
[0] = 0x14;
9561 spec
->autocfg
.speaker_pins
[0] = 0x15;
9563 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9566 /* toggle speaker-output according to the hp-jack state */
9567 static void alc883_lenovo_nb0763_setup(struct hda_codec
*codec
)
9569 struct alc_spec
*spec
= codec
->spec
;
9571 spec
->autocfg
.hp_pins
[0] = 0x14;
9572 spec
->autocfg
.speaker_pins
[0] = 0x15;
9574 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9577 /* toggle speaker-output according to the hp-jack state */
9578 #define alc883_targa_init_hook alc882_targa_init_hook
9579 #define alc883_targa_unsol_event alc882_targa_unsol_event
9581 static void alc883_clevo_m720_setup(struct hda_codec
*codec
)
9583 struct alc_spec
*spec
= codec
->spec
;
9585 spec
->autocfg
.hp_pins
[0] = 0x15;
9586 spec
->autocfg
.speaker_pins
[0] = 0x14;
9588 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9591 static void alc883_clevo_m720_init_hook(struct hda_codec
*codec
)
9593 alc_hp_automute(codec
);
9594 alc88x_simple_mic_automute(codec
);
9597 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
9600 switch (res
>> 26) {
9601 case ALC880_MIC_EVENT
:
9602 alc88x_simple_mic_automute(codec
);
9605 alc_sku_unsol_event(codec
, res
);
9610 /* toggle speaker-output according to the hp-jack state */
9611 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec
*codec
)
9613 struct alc_spec
*spec
= codec
->spec
;
9615 spec
->autocfg
.hp_pins
[0] = 0x14;
9616 spec
->autocfg
.speaker_pins
[0] = 0x15;
9618 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9621 static void alc883_haier_w66_setup(struct hda_codec
*codec
)
9623 struct alc_spec
*spec
= codec
->spec
;
9625 spec
->autocfg
.hp_pins
[0] = 0x1b;
9626 spec
->autocfg
.speaker_pins
[0] = 0x14;
9628 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9631 static void alc883_lenovo_101e_setup(struct hda_codec
*codec
)
9633 struct alc_spec
*spec
= codec
->spec
;
9635 spec
->autocfg
.hp_pins
[0] = 0x1b;
9636 spec
->autocfg
.line_out_pins
[0] = 0x14;
9637 spec
->autocfg
.speaker_pins
[0] = 0x15;
9639 spec
->detect_line
= 1;
9640 spec
->automute_lines
= 1;
9641 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9644 /* toggle speaker-output according to the hp-jack state */
9645 static void alc883_acer_aspire_setup(struct hda_codec
*codec
)
9647 struct alc_spec
*spec
= codec
->spec
;
9649 spec
->autocfg
.hp_pins
[0] = 0x14;
9650 spec
->autocfg
.speaker_pins
[0] = 0x15;
9651 spec
->autocfg
.speaker_pins
[1] = 0x16;
9653 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9656 static const struct hda_verb alc883_acer_eapd_verbs
[] = {
9657 /* HP Pin: output 0 (0x0c) */
9658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9659 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9660 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9661 /* Front Pin: output 0 (0x0c) */
9662 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9663 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9664 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9665 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
9666 /* eanable EAPD on medion laptop */
9667 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9668 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9669 /* enable unsolicited event */
9670 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9674 static void alc888_6st_dell_setup(struct hda_codec
*codec
)
9676 struct alc_spec
*spec
= codec
->spec
;
9678 spec
->autocfg
.hp_pins
[0] = 0x1b;
9679 spec
->autocfg
.speaker_pins
[0] = 0x14;
9680 spec
->autocfg
.speaker_pins
[1] = 0x15;
9681 spec
->autocfg
.speaker_pins
[2] = 0x16;
9682 spec
->autocfg
.speaker_pins
[3] = 0x17;
9684 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9687 static void alc888_lenovo_sky_setup(struct hda_codec
*codec
)
9689 struct alc_spec
*spec
= codec
->spec
;
9691 spec
->autocfg
.hp_pins
[0] = 0x1b;
9692 spec
->autocfg
.speaker_pins
[0] = 0x14;
9693 spec
->autocfg
.speaker_pins
[1] = 0x15;
9694 spec
->autocfg
.speaker_pins
[2] = 0x16;
9695 spec
->autocfg
.speaker_pins
[3] = 0x17;
9696 spec
->autocfg
.speaker_pins
[4] = 0x1a;
9698 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9701 static void alc883_vaiott_setup(struct hda_codec
*codec
)
9703 struct alc_spec
*spec
= codec
->spec
;
9705 spec
->autocfg
.hp_pins
[0] = 0x15;
9706 spec
->autocfg
.speaker_pins
[0] = 0x14;
9707 spec
->autocfg
.speaker_pins
[1] = 0x17;
9709 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9712 static const struct hda_verb alc888_asus_m90v_verbs
[] = {
9713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9714 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9715 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9716 /* enable unsolicited event */
9717 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9718 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9722 static void alc883_mode2_setup(struct hda_codec
*codec
)
9724 struct alc_spec
*spec
= codec
->spec
;
9726 spec
->autocfg
.hp_pins
[0] = 0x1b;
9727 spec
->autocfg
.speaker_pins
[0] = 0x14;
9728 spec
->autocfg
.speaker_pins
[1] = 0x15;
9729 spec
->autocfg
.speaker_pins
[2] = 0x16;
9730 spec
->ext_mic
.pin
= 0x18;
9731 spec
->int_mic
.pin
= 0x19;
9732 spec
->ext_mic
.mux_idx
= 0;
9733 spec
->int_mic
.mux_idx
= 1;
9736 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
9739 static const struct hda_verb alc888_asus_eee1601_verbs
[] = {
9740 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9741 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9742 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9743 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9744 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9745 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
9746 {0x20, AC_VERB_SET_PROC_COEF
, 0x0838},
9747 /* enable unsolicited event */
9748 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9752 static void alc883_eee1601_inithook(struct hda_codec
*codec
)
9754 struct alc_spec
*spec
= codec
->spec
;
9756 spec
->autocfg
.hp_pins
[0] = 0x14;
9757 spec
->autocfg
.speaker_pins
[0] = 0x1b;
9758 alc_hp_automute(codec
);
9761 static const struct hda_verb alc889A_mb31_verbs
[] = {
9762 /* Init rear pin (used as headphone output) */
9763 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4}, /* Apple Headphones */
9764 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Connect to front */
9765 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9766 /* Init line pin (used as output in 4ch and 6ch mode) */
9767 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Connect to CLFE */
9768 /* Init line 2 pin (used as headphone out by default) */
9769 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Use as input */
9770 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Mute output */
9774 /* Mute speakers according to the headphone jack state */
9775 static void alc889A_mb31_automute(struct hda_codec
*codec
)
9777 unsigned int present
;
9779 /* Mute only in 2ch or 4ch mode */
9780 if (snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_CONNECT_SEL
, 0)
9782 present
= snd_hda_jack_detect(codec
, 0x15);
9783 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9784 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9785 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9786 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9790 static void alc889A_mb31_unsol_event(struct hda_codec
*codec
, unsigned int res
)
9792 if ((res
>> 26) == ALC880_HP_EVENT
)
9793 alc889A_mb31_automute(codec
);
9797 #ifdef CONFIG_SND_HDA_POWER_SAVE
9798 #define alc882_loopbacks alc880_loopbacks
9801 /* pcm configuration: identical with ALC880 */
9802 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9803 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9804 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9805 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9807 static const hda_nid_t alc883_slave_dig_outs
[] = {
9808 ALC1200_DIGOUT_NID
, 0,
9811 static const hda_nid_t alc1200_slave_dig_outs
[] = {
9812 ALC883_DIGOUT_NID
, 0,
9816 * configuration and preset
9818 static const char * const alc882_models
[ALC882_MODEL_LAST
] = {
9819 [ALC882_3ST_DIG
] = "3stack-dig",
9820 [ALC882_6ST_DIG
] = "6stack-dig",
9821 [ALC882_ARIMA
] = "arima",
9822 [ALC882_W2JC
] = "w2jc",
9823 [ALC882_TARGA
] = "targa",
9824 [ALC882_ASUS_A7J
] = "asus-a7j",
9825 [ALC882_ASUS_A7M
] = "asus-a7m",
9826 [ALC885_MACPRO
] = "macpro",
9827 [ALC885_MB5
] = "mb5",
9828 [ALC885_MACMINI3
] = "macmini3",
9829 [ALC885_MBA21
] = "mba21",
9830 [ALC885_MBP3
] = "mbp3",
9831 [ALC885_IMAC24
] = "imac24",
9832 [ALC885_IMAC91
] = "imac91",
9833 [ALC883_3ST_2ch_DIG
] = "3stack-2ch-dig",
9834 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
9835 [ALC883_3ST_6ch
] = "3stack-6ch",
9836 [ALC883_6ST_DIG
] = "alc883-6stack-dig",
9837 [ALC883_TARGA_DIG
] = "targa-dig",
9838 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
9839 [ALC883_TARGA_8ch_DIG
] = "targa-8ch-dig",
9840 [ALC883_ACER
] = "acer",
9841 [ALC883_ACER_ASPIRE
] = "acer-aspire",
9842 [ALC888_ACER_ASPIRE_4930G
] = "acer-aspire-4930g",
9843 [ALC888_ACER_ASPIRE_6530G
] = "acer-aspire-6530g",
9844 [ALC888_ACER_ASPIRE_8930G
] = "acer-aspire-8930g",
9845 [ALC888_ACER_ASPIRE_7730G
] = "acer-aspire-7730g",
9846 [ALC883_MEDION
] = "medion",
9847 [ALC883_MEDION_WIM2160
] = "medion-wim2160",
9848 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
9849 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
9850 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
9851 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
9852 [ALC888_LENOVO_SKY
] = "lenovo-sky",
9853 [ALC883_HAIER_W66
] = "haier-w66",
9854 [ALC888_3ST_HP
] = "3stack-hp",
9855 [ALC888_6ST_DELL
] = "6stack-dell",
9856 [ALC883_MITAC
] = "mitac",
9857 [ALC883_CLEVO_M540R
] = "clevo-m540r",
9858 [ALC883_CLEVO_M720
] = "clevo-m720",
9859 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
9860 [ALC888_FUJITSU_XA3530
] = "fujitsu-xa3530",
9861 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
9862 [ALC889A_INTEL
] = "intel-alc889a",
9863 [ALC889_INTEL
] = "intel-x58",
9864 [ALC1200_ASUS_P5Q
] = "asus-p5q",
9865 [ALC889A_MB31
] = "mb31",
9866 [ALC883_SONY_VAIO_TT
] = "sony-vaio-tt",
9867 [ALC882_AUTO
] = "auto",
9870 static const struct snd_pci_quirk alc882_cfg_tbl
[] = {
9871 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
9873 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
9874 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE
),
9875 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE
),
9876 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
9877 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
9878 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
9879 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9880 ALC888_ACER_ASPIRE_4930G
),
9881 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9882 ALC888_ACER_ASPIRE_4930G
),
9883 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9884 ALC888_ACER_ASPIRE_8930G
),
9885 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9886 ALC888_ACER_ASPIRE_8930G
),
9887 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO
),
9888 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO
),
9889 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9890 ALC888_ACER_ASPIRE_6530G
),
9891 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9892 ALC888_ACER_ASPIRE_6530G
),
9893 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9894 ALC888_ACER_ASPIRE_7730G
),
9895 /* default Acer -- disabled as it causes more problems.
9896 * model=auto should work fine now
9898 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9900 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
9902 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG
),
9903 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
9904 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
9905 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
9906 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP
),
9907 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP
),
9909 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
9910 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
9911 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
9912 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V
),
9913 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
9914 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
9915 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
9916 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
9917 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG
),
9918 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q
),
9919 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601
),
9921 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT
),
9922 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
9923 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
9924 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC
),
9925 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
9926 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
9927 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL
),
9928 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
9929 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
9931 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
9932 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
9933 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
9934 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
9935 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO
),
9936 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
9937 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
9938 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
9939 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
9940 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
9941 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
9942 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
9943 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
9944 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
9945 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG
),
9946 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
9947 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
9948 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
9949 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG
),
9950 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG
),
9951 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
9952 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
9953 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
9954 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG
),
9955 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
9956 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
9957 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
9958 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG
),
9959 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG
),
9960 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
9961 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG
),
9963 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
9964 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG
),
9965 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
9966 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
9967 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R
),
9968 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD
),
9969 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
9970 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9971 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
9972 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9973 ALC883_FUJITSU_PI2515
),
9974 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9975 ALC888_FUJITSU_XA3530
),
9976 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
9977 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9978 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9979 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9980 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY
),
9981 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG
),
9982 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
9983 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
9985 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
9986 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
9987 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC
),
9988 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL
),
9989 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL
),
9990 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL
),
9991 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG
),
9996 /* codec SSID table for Intel Mac */
9997 static const struct snd_pci_quirk alc882_ssid_cfg_tbl
[] = {
9998 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3
),
9999 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3
),
10000 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3
),
10001 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO
),
10002 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24
),
10003 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24
),
10004 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3
),
10005 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31
),
10006 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M
),
10007 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3
),
10008 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21
),
10009 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31
),
10010 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3
),
10011 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24
),
10012 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91
),
10013 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5
),
10014 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5
),
10015 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10016 * so apparently no perfect solution yet
10018 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5
),
10019 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5
),
10020 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3
),
10021 {} /* terminator */
10024 static const struct alc_config_preset alc882_presets
[] = {
10025 [ALC882_3ST_DIG
] = {
10026 .mixers
= { alc882_base_mixer
},
10027 .init_verbs
= { alc882_base_init_verbs
,
10028 alc882_adc1_init_verbs
},
10029 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10030 .dac_nids
= alc882_dac_nids
,
10031 .dig_out_nid
= ALC882_DIGOUT_NID
,
10032 .dig_in_nid
= ALC882_DIGIN_NID
,
10033 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10034 .channel_mode
= alc882_ch_modes
,
10036 .input_mux
= &alc882_capture_source
,
10038 [ALC882_6ST_DIG
] = {
10039 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
10040 .init_verbs
= { alc882_base_init_verbs
,
10041 alc882_adc1_init_verbs
},
10042 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10043 .dac_nids
= alc882_dac_nids
,
10044 .dig_out_nid
= ALC882_DIGOUT_NID
,
10045 .dig_in_nid
= ALC882_DIGIN_NID
,
10046 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
10047 .channel_mode
= alc882_sixstack_modes
,
10048 .input_mux
= &alc882_capture_source
,
10051 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
10052 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10053 alc882_eapd_verbs
},
10054 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10055 .dac_nids
= alc882_dac_nids
,
10056 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
10057 .channel_mode
= alc882_sixstack_modes
,
10058 .input_mux
= &alc882_capture_source
,
10061 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
10062 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10063 alc882_eapd_verbs
, alc880_gpio1_init_verbs
},
10064 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10065 .dac_nids
= alc882_dac_nids
,
10066 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
10067 .channel_mode
= alc880_threestack_modes
,
10069 .input_mux
= &alc882_capture_source
,
10070 .dig_out_nid
= ALC882_DIGOUT_NID
,
10073 .mixers
= { alc885_mba21_mixer
},
10074 .init_verbs
= { alc885_mba21_init_verbs
, alc880_gpio1_init_verbs
},
10076 .dac_nids
= alc882_dac_nids
,
10077 .channel_mode
= alc885_mba21_ch_modes
,
10078 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
10079 .input_mux
= &alc882_capture_source
,
10080 .unsol_event
= alc_sku_unsol_event
,
10081 .setup
= alc885_mba21_setup
,
10082 .init_hook
= alc_hp_automute
,
10085 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
10086 .init_verbs
= { alc885_mbp3_init_verbs
,
10087 alc880_gpio1_init_verbs
},
10089 .dac_nids
= alc882_dac_nids
,
10091 .channel_mode
= alc885_mbp_4ch_modes
,
10092 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_4ch_modes
),
10093 .input_mux
= &alc882_capture_source
,
10094 .dig_out_nid
= ALC882_DIGOUT_NID
,
10095 .dig_in_nid
= ALC882_DIGIN_NID
,
10096 .unsol_event
= alc_sku_unsol_event
,
10097 .setup
= alc885_mbp3_setup
,
10098 .init_hook
= alc_hp_automute
,
10101 .mixers
= { alc885_mb5_mixer
, alc882_chmode_mixer
},
10102 .init_verbs
= { alc885_mb5_init_verbs
,
10103 alc880_gpio1_init_verbs
},
10104 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10105 .dac_nids
= alc882_dac_nids
,
10106 .channel_mode
= alc885_mb5_6ch_modes
,
10107 .num_channel_mode
= ARRAY_SIZE(alc885_mb5_6ch_modes
),
10108 .input_mux
= &mb5_capture_source
,
10109 .dig_out_nid
= ALC882_DIGOUT_NID
,
10110 .dig_in_nid
= ALC882_DIGIN_NID
,
10111 .unsol_event
= alc_sku_unsol_event
,
10112 .setup
= alc885_mb5_setup
,
10113 .init_hook
= alc_hp_automute
,
10115 [ALC885_MACMINI3
] = {
10116 .mixers
= { alc885_macmini3_mixer
, alc882_chmode_mixer
},
10117 .init_verbs
= { alc885_macmini3_init_verbs
,
10118 alc880_gpio1_init_verbs
},
10119 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10120 .dac_nids
= alc882_dac_nids
,
10121 .channel_mode
= alc885_macmini3_6ch_modes
,
10122 .num_channel_mode
= ARRAY_SIZE(alc885_macmini3_6ch_modes
),
10123 .input_mux
= &macmini3_capture_source
,
10124 .dig_out_nid
= ALC882_DIGOUT_NID
,
10125 .dig_in_nid
= ALC882_DIGIN_NID
,
10126 .unsol_event
= alc_sku_unsol_event
,
10127 .setup
= alc885_macmini3_setup
,
10128 .init_hook
= alc_hp_automute
,
10130 [ALC885_MACPRO
] = {
10131 .mixers
= { alc882_macpro_mixer
},
10132 .init_verbs
= { alc882_macpro_init_verbs
},
10133 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10134 .dac_nids
= alc882_dac_nids
,
10135 .dig_out_nid
= ALC882_DIGOUT_NID
,
10136 .dig_in_nid
= ALC882_DIGIN_NID
,
10137 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10138 .channel_mode
= alc882_ch_modes
,
10139 .input_mux
= &alc882_capture_source
,
10140 .init_hook
= alc885_macpro_init_hook
,
10142 [ALC885_IMAC24
] = {
10143 .mixers
= { alc885_imac24_mixer
},
10144 .init_verbs
= { alc885_imac24_init_verbs
},
10145 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10146 .dac_nids
= alc882_dac_nids
,
10147 .dig_out_nid
= ALC882_DIGOUT_NID
,
10148 .dig_in_nid
= ALC882_DIGIN_NID
,
10149 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
10150 .channel_mode
= alc882_ch_modes
,
10151 .input_mux
= &alc882_capture_source
,
10152 .unsol_event
= alc_sku_unsol_event
,
10153 .setup
= alc885_imac24_setup
,
10154 .init_hook
= alc885_imac24_init_hook
,
10156 [ALC885_IMAC91
] = {
10157 .mixers
= {alc885_imac91_mixer
},
10158 .init_verbs
= { alc885_imac91_init_verbs
,
10159 alc880_gpio1_init_verbs
},
10160 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10161 .dac_nids
= alc882_dac_nids
,
10162 .channel_mode
= alc885_mba21_ch_modes
,
10163 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
10164 .input_mux
= &alc889A_imac91_capture_source
,
10165 .dig_out_nid
= ALC882_DIGOUT_NID
,
10166 .dig_in_nid
= ALC882_DIGIN_NID
,
10167 .unsol_event
= alc_sku_unsol_event
,
10168 .setup
= alc885_imac91_setup
,
10169 .init_hook
= alc_hp_automute
,
10172 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
},
10173 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10174 alc880_gpio3_init_verbs
, alc882_targa_verbs
},
10175 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10176 .dac_nids
= alc882_dac_nids
,
10177 .dig_out_nid
= ALC882_DIGOUT_NID
,
10178 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
10179 .adc_nids
= alc882_adc_nids
,
10180 .capsrc_nids
= alc882_capsrc_nids
,
10181 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
10182 .channel_mode
= alc882_3ST_6ch_modes
,
10184 .input_mux
= &alc882_capture_source
,
10185 .unsol_event
= alc_sku_unsol_event
,
10186 .setup
= alc882_targa_setup
,
10187 .init_hook
= alc882_targa_automute
,
10189 [ALC882_ASUS_A7J
] = {
10190 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
},
10191 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10192 alc882_asus_a7j_verbs
},
10193 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10194 .dac_nids
= alc882_dac_nids
,
10195 .dig_out_nid
= ALC882_DIGOUT_NID
,
10196 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
10197 .adc_nids
= alc882_adc_nids
,
10198 .capsrc_nids
= alc882_capsrc_nids
,
10199 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
10200 .channel_mode
= alc882_3ST_6ch_modes
,
10202 .input_mux
= &alc882_capture_source
,
10204 [ALC882_ASUS_A7M
] = {
10205 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
10206 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
10207 alc882_eapd_verbs
, alc880_gpio1_init_verbs
,
10208 alc882_asus_a7m_verbs
},
10209 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
10210 .dac_nids
= alc882_dac_nids
,
10211 .dig_out_nid
= ALC882_DIGOUT_NID
,
10212 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
10213 .channel_mode
= alc880_threestack_modes
,
10215 .input_mux
= &alc882_capture_source
,
10217 [ALC883_3ST_2ch_DIG
] = {
10218 .mixers
= { alc883_3ST_2ch_mixer
},
10219 .init_verbs
= { alc883_init_verbs
},
10220 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10221 .dac_nids
= alc883_dac_nids
,
10222 .dig_out_nid
= ALC883_DIGOUT_NID
,
10223 .dig_in_nid
= ALC883_DIGIN_NID
,
10224 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10225 .channel_mode
= alc883_3ST_2ch_modes
,
10226 .input_mux
= &alc883_capture_source
,
10228 [ALC883_3ST_6ch_DIG
] = {
10229 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10230 .init_verbs
= { alc883_init_verbs
},
10231 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10232 .dac_nids
= alc883_dac_nids
,
10233 .dig_out_nid
= ALC883_DIGOUT_NID
,
10234 .dig_in_nid
= ALC883_DIGIN_NID
,
10235 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10236 .channel_mode
= alc883_3ST_6ch_modes
,
10238 .input_mux
= &alc883_capture_source
,
10240 [ALC883_3ST_6ch
] = {
10241 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10242 .init_verbs
= { alc883_init_verbs
},
10243 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10244 .dac_nids
= alc883_dac_nids
,
10245 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10246 .channel_mode
= alc883_3ST_6ch_modes
,
10248 .input_mux
= &alc883_capture_source
,
10250 [ALC883_3ST_6ch_INTEL
] = {
10251 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
10252 .init_verbs
= { alc883_init_verbs
},
10253 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10254 .dac_nids
= alc883_dac_nids
,
10255 .dig_out_nid
= ALC883_DIGOUT_NID
,
10256 .dig_in_nid
= ALC883_DIGIN_NID
,
10257 .slave_dig_outs
= alc883_slave_dig_outs
,
10258 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
10259 .channel_mode
= alc883_3ST_6ch_intel_modes
,
10261 .input_mux
= &alc883_3stack_6ch_intel
,
10263 [ALC889A_INTEL
] = {
10264 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
10265 .init_verbs
= { alc885_init_verbs
, alc885_init_input_verbs
,
10266 alc_hp15_unsol_verbs
},
10267 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10268 .dac_nids
= alc883_dac_nids
,
10269 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10270 .adc_nids
= alc889_adc_nids
,
10271 .dig_out_nid
= ALC883_DIGOUT_NID
,
10272 .dig_in_nid
= ALC883_DIGIN_NID
,
10273 .slave_dig_outs
= alc883_slave_dig_outs
,
10274 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
10275 .channel_mode
= alc889_8ch_intel_modes
,
10276 .capsrc_nids
= alc889_capsrc_nids
,
10277 .input_mux
= &alc889_capture_source
,
10278 .setup
= alc889_automute_setup
,
10279 .init_hook
= alc_hp_automute
,
10280 .unsol_event
= alc_sku_unsol_event
,
10284 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
10285 .init_verbs
= { alc885_init_verbs
, alc889_init_input_verbs
,
10286 alc889_eapd_verbs
, alc_hp15_unsol_verbs
},
10287 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10288 .dac_nids
= alc883_dac_nids
,
10289 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10290 .adc_nids
= alc889_adc_nids
,
10291 .dig_out_nid
= ALC883_DIGOUT_NID
,
10292 .dig_in_nid
= ALC883_DIGIN_NID
,
10293 .slave_dig_outs
= alc883_slave_dig_outs
,
10294 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
10295 .channel_mode
= alc889_8ch_intel_modes
,
10296 .capsrc_nids
= alc889_capsrc_nids
,
10297 .input_mux
= &alc889_capture_source
,
10298 .setup
= alc889_automute_setup
,
10299 .init_hook
= alc889_intel_init_hook
,
10300 .unsol_event
= alc_sku_unsol_event
,
10303 [ALC883_6ST_DIG
] = {
10304 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10305 .init_verbs
= { alc883_init_verbs
},
10306 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10307 .dac_nids
= alc883_dac_nids
,
10308 .dig_out_nid
= ALC883_DIGOUT_NID
,
10309 .dig_in_nid
= ALC883_DIGIN_NID
,
10310 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10311 .channel_mode
= alc883_sixstack_modes
,
10312 .input_mux
= &alc883_capture_source
,
10314 [ALC883_TARGA_DIG
] = {
10315 .mixers
= { alc883_targa_mixer
, alc883_chmode_mixer
},
10316 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10317 alc883_targa_verbs
},
10318 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10319 .dac_nids
= alc883_dac_nids
,
10320 .dig_out_nid
= ALC883_DIGOUT_NID
,
10321 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10322 .channel_mode
= alc883_3ST_6ch_modes
,
10324 .input_mux
= &alc883_capture_source
,
10325 .unsol_event
= alc883_targa_unsol_event
,
10326 .setup
= alc882_targa_setup
,
10327 .init_hook
= alc882_targa_automute
,
10329 [ALC883_TARGA_2ch_DIG
] = {
10330 .mixers
= { alc883_targa_2ch_mixer
},
10331 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10332 alc883_targa_verbs
},
10333 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10334 .dac_nids
= alc883_dac_nids
,
10335 .adc_nids
= alc883_adc_nids_alt
,
10336 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10337 .capsrc_nids
= alc883_capsrc_nids
,
10338 .dig_out_nid
= ALC883_DIGOUT_NID
,
10339 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10340 .channel_mode
= alc883_3ST_2ch_modes
,
10341 .input_mux
= &alc883_capture_source
,
10342 .unsol_event
= alc883_targa_unsol_event
,
10343 .setup
= alc882_targa_setup
,
10344 .init_hook
= alc882_targa_automute
,
10346 [ALC883_TARGA_8ch_DIG
] = {
10347 .mixers
= { alc883_targa_mixer
, alc883_targa_8ch_mixer
,
10348 alc883_chmode_mixer
},
10349 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
10350 alc883_targa_verbs
},
10351 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10352 .dac_nids
= alc883_dac_nids
,
10353 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10354 .adc_nids
= alc883_adc_nids_rev
,
10355 .capsrc_nids
= alc883_capsrc_nids_rev
,
10356 .dig_out_nid
= ALC883_DIGOUT_NID
,
10357 .dig_in_nid
= ALC883_DIGIN_NID
,
10358 .num_channel_mode
= ARRAY_SIZE(alc883_4ST_8ch_modes
),
10359 .channel_mode
= alc883_4ST_8ch_modes
,
10361 .input_mux
= &alc883_capture_source
,
10362 .unsol_event
= alc883_targa_unsol_event
,
10363 .setup
= alc882_targa_setup
,
10364 .init_hook
= alc882_targa_automute
,
10367 .mixers
= { alc883_base_mixer
},
10368 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10369 * and the headphone jack. Turn this on and rely on the
10370 * standard mute methods whenever the user wants to turn
10371 * these outputs off.
10373 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
10374 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10375 .dac_nids
= alc883_dac_nids
,
10376 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10377 .channel_mode
= alc883_3ST_2ch_modes
,
10378 .input_mux
= &alc883_capture_source
,
10380 [ALC883_ACER_ASPIRE
] = {
10381 .mixers
= { alc883_acer_aspire_mixer
},
10382 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
10383 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10384 .dac_nids
= alc883_dac_nids
,
10385 .dig_out_nid
= ALC883_DIGOUT_NID
,
10386 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10387 .channel_mode
= alc883_3ST_2ch_modes
,
10388 .input_mux
= &alc883_capture_source
,
10389 .unsol_event
= alc_sku_unsol_event
,
10390 .setup
= alc883_acer_aspire_setup
,
10391 .init_hook
= alc_hp_automute
,
10393 [ALC888_ACER_ASPIRE_4930G
] = {
10394 .mixers
= { alc888_acer_aspire_4930g_mixer
,
10395 alc883_chmode_mixer
},
10396 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10397 alc888_acer_aspire_4930g_verbs
},
10398 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10399 .dac_nids
= alc883_dac_nids
,
10400 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10401 .adc_nids
= alc883_adc_nids_rev
,
10402 .capsrc_nids
= alc883_capsrc_nids_rev
,
10403 .dig_out_nid
= ALC883_DIGOUT_NID
,
10404 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10405 .channel_mode
= alc883_3ST_6ch_modes
,
10407 .const_channel_count
= 6,
10409 ARRAY_SIZE(alc888_2_capture_sources
),
10410 .input_mux
= alc888_2_capture_sources
,
10411 .unsol_event
= alc_sku_unsol_event
,
10412 .setup
= alc888_acer_aspire_4930g_setup
,
10413 .init_hook
= alc_hp_automute
,
10415 [ALC888_ACER_ASPIRE_6530G
] = {
10416 .mixers
= { alc888_acer_aspire_6530_mixer
},
10417 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10418 alc888_acer_aspire_6530g_verbs
},
10419 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10420 .dac_nids
= alc883_dac_nids
,
10421 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10422 .adc_nids
= alc883_adc_nids_rev
,
10423 .capsrc_nids
= alc883_capsrc_nids_rev
,
10424 .dig_out_nid
= ALC883_DIGOUT_NID
,
10425 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10426 .channel_mode
= alc883_3ST_2ch_modes
,
10428 ARRAY_SIZE(alc888_2_capture_sources
),
10429 .input_mux
= alc888_acer_aspire_6530_sources
,
10430 .unsol_event
= alc_sku_unsol_event
,
10431 .setup
= alc888_acer_aspire_6530g_setup
,
10432 .init_hook
= alc_hp_automute
,
10434 [ALC888_ACER_ASPIRE_8930G
] = {
10435 .mixers
= { alc889_acer_aspire_8930g_mixer
,
10436 alc883_chmode_mixer
},
10437 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10438 alc889_acer_aspire_8930g_verbs
,
10439 alc889_eapd_verbs
},
10440 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10441 .dac_nids
= alc883_dac_nids
,
10442 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
10443 .adc_nids
= alc889_adc_nids
,
10444 .capsrc_nids
= alc889_capsrc_nids
,
10445 .dig_out_nid
= ALC883_DIGOUT_NID
,
10446 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10447 .channel_mode
= alc883_3ST_6ch_modes
,
10449 .const_channel_count
= 6,
10451 ARRAY_SIZE(alc889_capture_sources
),
10452 .input_mux
= alc889_capture_sources
,
10453 .unsol_event
= alc_sku_unsol_event
,
10454 .setup
= alc889_acer_aspire_8930g_setup
,
10455 .init_hook
= alc_hp_automute
,
10456 #ifdef CONFIG_SND_HDA_POWER_SAVE
10457 .power_hook
= alc_power_eapd
,
10460 [ALC888_ACER_ASPIRE_7730G
] = {
10461 .mixers
= { alc883_3ST_6ch_mixer
,
10462 alc883_chmode_mixer
},
10463 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
10464 alc888_acer_aspire_7730G_verbs
},
10465 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10466 .dac_nids
= alc883_dac_nids
,
10467 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10468 .adc_nids
= alc883_adc_nids_rev
,
10469 .capsrc_nids
= alc883_capsrc_nids_rev
,
10470 .dig_out_nid
= ALC883_DIGOUT_NID
,
10471 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10472 .channel_mode
= alc883_3ST_6ch_modes
,
10474 .const_channel_count
= 6,
10475 .input_mux
= &alc883_capture_source
,
10476 .unsol_event
= alc_sku_unsol_event
,
10477 .setup
= alc888_acer_aspire_7730g_setup
,
10478 .init_hook
= alc_hp_automute
,
10480 [ALC883_MEDION
] = {
10481 .mixers
= { alc883_fivestack_mixer
,
10482 alc883_chmode_mixer
},
10483 .init_verbs
= { alc883_init_verbs
,
10484 alc883_medion_eapd_verbs
},
10485 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10486 .dac_nids
= alc883_dac_nids
,
10487 .adc_nids
= alc883_adc_nids_alt
,
10488 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10489 .capsrc_nids
= alc883_capsrc_nids
,
10490 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10491 .channel_mode
= alc883_sixstack_modes
,
10492 .input_mux
= &alc883_capture_source
,
10494 [ALC883_MEDION_WIM2160
] = {
10495 .mixers
= { alc883_medion_wim2160_mixer
},
10496 .init_verbs
= { alc883_init_verbs
, alc883_medion_wim2160_verbs
},
10497 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10498 .dac_nids
= alc883_dac_nids
,
10499 .dig_out_nid
= ALC883_DIGOUT_NID
,
10500 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10501 .adc_nids
= alc883_adc_nids
,
10502 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10503 .channel_mode
= alc883_3ST_2ch_modes
,
10504 .input_mux
= &alc883_capture_source
,
10505 .unsol_event
= alc_sku_unsol_event
,
10506 .setup
= alc883_medion_wim2160_setup
,
10507 .init_hook
= alc_hp_automute
,
10509 [ALC883_LAPTOP_EAPD
] = {
10510 .mixers
= { alc883_base_mixer
},
10511 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
10512 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10513 .dac_nids
= alc883_dac_nids
,
10514 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10515 .channel_mode
= alc883_3ST_2ch_modes
,
10516 .input_mux
= &alc883_capture_source
,
10518 [ALC883_CLEVO_M540R
] = {
10519 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10520 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m540r_verbs
},
10521 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10522 .dac_nids
= alc883_dac_nids
,
10523 .dig_out_nid
= ALC883_DIGOUT_NID
,
10524 .dig_in_nid
= ALC883_DIGIN_NID
,
10525 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_clevo_modes
),
10526 .channel_mode
= alc883_3ST_6ch_clevo_modes
,
10528 .input_mux
= &alc883_capture_source
,
10529 /* This machine has the hardware HP auto-muting, thus
10530 * we need no software mute via unsol event
10533 [ALC883_CLEVO_M720
] = {
10534 .mixers
= { alc883_clevo_m720_mixer
},
10535 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
10536 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10537 .dac_nids
= alc883_dac_nids
,
10538 .dig_out_nid
= ALC883_DIGOUT_NID
,
10539 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10540 .channel_mode
= alc883_3ST_2ch_modes
,
10541 .input_mux
= &alc883_capture_source
,
10542 .unsol_event
= alc883_clevo_m720_unsol_event
,
10543 .setup
= alc883_clevo_m720_setup
,
10544 .init_hook
= alc883_clevo_m720_init_hook
,
10546 [ALC883_LENOVO_101E_2ch
] = {
10547 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
10548 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
10549 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10550 .dac_nids
= alc883_dac_nids
,
10551 .adc_nids
= alc883_adc_nids_alt
,
10552 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10553 .capsrc_nids
= alc883_capsrc_nids
,
10554 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10555 .channel_mode
= alc883_3ST_2ch_modes
,
10556 .input_mux
= &alc883_lenovo_101e_capture_source
,
10557 .setup
= alc883_lenovo_101e_setup
,
10558 .unsol_event
= alc_sku_unsol_event
,
10559 .init_hook
= alc_inithook
,
10561 [ALC883_LENOVO_NB0763
] = {
10562 .mixers
= { alc883_lenovo_nb0763_mixer
},
10563 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
10564 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10565 .dac_nids
= alc883_dac_nids
,
10566 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10567 .channel_mode
= alc883_3ST_2ch_modes
,
10569 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
10570 .unsol_event
= alc_sku_unsol_event
,
10571 .setup
= alc883_lenovo_nb0763_setup
,
10572 .init_hook
= alc_hp_automute
,
10574 [ALC888_LENOVO_MS7195_DIG
] = {
10575 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10576 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
10577 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10578 .dac_nids
= alc883_dac_nids
,
10579 .dig_out_nid
= ALC883_DIGOUT_NID
,
10580 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10581 .channel_mode
= alc883_3ST_6ch_modes
,
10583 .input_mux
= &alc883_capture_source
,
10584 .unsol_event
= alc_sku_unsol_event
,
10585 .setup
= alc888_lenovo_ms7195_setup
,
10586 .init_hook
= alc_inithook
,
10588 [ALC883_HAIER_W66
] = {
10589 .mixers
= { alc883_targa_2ch_mixer
},
10590 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
10591 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10592 .dac_nids
= alc883_dac_nids
,
10593 .dig_out_nid
= ALC883_DIGOUT_NID
,
10594 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10595 .channel_mode
= alc883_3ST_2ch_modes
,
10596 .input_mux
= &alc883_capture_source
,
10597 .unsol_event
= alc_sku_unsol_event
,
10598 .setup
= alc883_haier_w66_setup
,
10599 .init_hook
= alc_hp_automute
,
10601 [ALC888_3ST_HP
] = {
10602 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10603 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
10604 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10605 .dac_nids
= alc883_dac_nids
,
10606 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
10607 .channel_mode
= alc888_3st_hp_modes
,
10609 .input_mux
= &alc883_capture_source
,
10610 .unsol_event
= alc_sku_unsol_event
,
10611 .setup
= alc888_3st_hp_setup
,
10612 .init_hook
= alc_hp_automute
,
10614 [ALC888_6ST_DELL
] = {
10615 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10616 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
10617 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10618 .dac_nids
= alc883_dac_nids
,
10619 .dig_out_nid
= ALC883_DIGOUT_NID
,
10620 .dig_in_nid
= ALC883_DIGIN_NID
,
10621 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10622 .channel_mode
= alc883_sixstack_modes
,
10623 .input_mux
= &alc883_capture_source
,
10624 .unsol_event
= alc_sku_unsol_event
,
10625 .setup
= alc888_6st_dell_setup
,
10626 .init_hook
= alc_hp_automute
,
10629 .mixers
= { alc883_mitac_mixer
},
10630 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
10631 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10632 .dac_nids
= alc883_dac_nids
,
10633 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10634 .channel_mode
= alc883_3ST_2ch_modes
,
10635 .input_mux
= &alc883_capture_source
,
10636 .unsol_event
= alc_sku_unsol_event
,
10637 .setup
= alc883_mitac_setup
,
10638 .init_hook
= alc_hp_automute
,
10640 [ALC883_FUJITSU_PI2515
] = {
10641 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
10642 .init_verbs
= { alc883_init_verbs
,
10643 alc883_2ch_fujitsu_pi2515_verbs
},
10644 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10645 .dac_nids
= alc883_dac_nids
,
10646 .dig_out_nid
= ALC883_DIGOUT_NID
,
10647 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10648 .channel_mode
= alc883_3ST_2ch_modes
,
10649 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10650 .unsol_event
= alc_sku_unsol_event
,
10651 .setup
= alc883_2ch_fujitsu_pi2515_setup
,
10652 .init_hook
= alc_hp_automute
,
10654 [ALC888_FUJITSU_XA3530
] = {
10655 .mixers
= { alc888_base_mixer
, alc883_chmode_mixer
},
10656 .init_verbs
= { alc883_init_verbs
,
10657 alc888_fujitsu_xa3530_verbs
},
10658 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10659 .dac_nids
= alc883_dac_nids
,
10660 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10661 .adc_nids
= alc883_adc_nids_rev
,
10662 .capsrc_nids
= alc883_capsrc_nids_rev
,
10663 .dig_out_nid
= ALC883_DIGOUT_NID
,
10664 .num_channel_mode
= ARRAY_SIZE(alc888_4ST_8ch_intel_modes
),
10665 .channel_mode
= alc888_4ST_8ch_intel_modes
,
10667 ARRAY_SIZE(alc888_2_capture_sources
),
10668 .input_mux
= alc888_2_capture_sources
,
10669 .unsol_event
= alc_sku_unsol_event
,
10670 .setup
= alc888_fujitsu_xa3530_setup
,
10671 .init_hook
= alc_hp_automute
,
10673 [ALC888_LENOVO_SKY
] = {
10674 .mixers
= { alc888_lenovo_sky_mixer
, alc883_chmode_mixer
},
10675 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_sky_verbs
},
10676 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10677 .dac_nids
= alc883_dac_nids
,
10678 .dig_out_nid
= ALC883_DIGOUT_NID
,
10679 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10680 .channel_mode
= alc883_sixstack_modes
,
10682 .input_mux
= &alc883_lenovo_sky_capture_source
,
10683 .unsol_event
= alc_sku_unsol_event
,
10684 .setup
= alc888_lenovo_sky_setup
,
10685 .init_hook
= alc_hp_automute
,
10687 [ALC888_ASUS_M90V
] = {
10688 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10689 .init_verbs
= { alc883_init_verbs
, alc888_asus_m90v_verbs
},
10690 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10691 .dac_nids
= alc883_dac_nids
,
10692 .dig_out_nid
= ALC883_DIGOUT_NID
,
10693 .dig_in_nid
= ALC883_DIGIN_NID
,
10694 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10695 .channel_mode
= alc883_3ST_6ch_modes
,
10697 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10698 .unsol_event
= alc_sku_unsol_event
,
10699 .setup
= alc883_mode2_setup
,
10700 .init_hook
= alc_inithook
,
10702 [ALC888_ASUS_EEE1601
] = {
10703 .mixers
= { alc883_asus_eee1601_mixer
},
10704 .cap_mixer
= alc883_asus_eee1601_cap_mixer
,
10705 .init_verbs
= { alc883_init_verbs
, alc888_asus_eee1601_verbs
},
10706 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10707 .dac_nids
= alc883_dac_nids
,
10708 .dig_out_nid
= ALC883_DIGOUT_NID
,
10709 .dig_in_nid
= ALC883_DIGIN_NID
,
10710 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10711 .channel_mode
= alc883_3ST_2ch_modes
,
10713 .input_mux
= &alc883_asus_eee1601_capture_source
,
10714 .unsol_event
= alc_sku_unsol_event
,
10715 .init_hook
= alc883_eee1601_inithook
,
10717 [ALC1200_ASUS_P5Q
] = {
10718 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10719 .init_verbs
= { alc883_init_verbs
},
10720 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10721 .dac_nids
= alc883_dac_nids
,
10722 .dig_out_nid
= ALC1200_DIGOUT_NID
,
10723 .dig_in_nid
= ALC883_DIGIN_NID
,
10724 .slave_dig_outs
= alc1200_slave_dig_outs
,
10725 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10726 .channel_mode
= alc883_sixstack_modes
,
10727 .input_mux
= &alc883_capture_source
,
10730 .mixers
= { alc889A_mb31_mixer
, alc883_chmode_mixer
},
10731 .init_verbs
= { alc883_init_verbs
, alc889A_mb31_verbs
,
10732 alc880_gpio1_init_verbs
},
10733 .adc_nids
= alc883_adc_nids
,
10734 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10735 .capsrc_nids
= alc883_capsrc_nids
,
10736 .dac_nids
= alc883_dac_nids
,
10737 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10738 .channel_mode
= alc889A_mb31_6ch_modes
,
10739 .num_channel_mode
= ARRAY_SIZE(alc889A_mb31_6ch_modes
),
10740 .input_mux
= &alc889A_mb31_capture_source
,
10741 .dig_out_nid
= ALC883_DIGOUT_NID
,
10742 .unsol_event
= alc889A_mb31_unsol_event
,
10743 .init_hook
= alc889A_mb31_automute
,
10745 [ALC883_SONY_VAIO_TT
] = {
10746 .mixers
= { alc883_vaiott_mixer
},
10747 .init_verbs
= { alc883_init_verbs
, alc883_vaiott_verbs
},
10748 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10749 .dac_nids
= alc883_dac_nids
,
10750 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10751 .channel_mode
= alc883_3ST_2ch_modes
,
10752 .input_mux
= &alc883_capture_source
,
10753 .unsol_event
= alc_sku_unsol_event
,
10754 .setup
= alc883_vaiott_setup
,
10755 .init_hook
= alc_hp_automute
,
10764 PINFIX_ABIT_AW9D_MAX
,
10765 PINFIX_LENOVO_Y530
,
10767 PINFIX_ACER_ASPIRE_7736
,
10770 static const struct alc_fixup alc882_fixups
[] = {
10771 [PINFIX_ABIT_AW9D_MAX
] = {
10772 .type
= ALC_FIXUP_PINS
,
10773 .v
.pins
= (const struct alc_pincfg
[]) {
10774 { 0x15, 0x01080104 }, /* side */
10775 { 0x16, 0x01011012 }, /* rear */
10776 { 0x17, 0x01016011 }, /* clfe */
10780 [PINFIX_LENOVO_Y530
] = {
10781 .type
= ALC_FIXUP_PINS
,
10782 .v
.pins
= (const struct alc_pincfg
[]) {
10783 { 0x15, 0x99130112 }, /* rear int speakers */
10784 { 0x16, 0x99130111 }, /* subwoofer */
10788 [PINFIX_PB_M5210
] = {
10789 .type
= ALC_FIXUP_VERBS
,
10790 .v
.verbs
= (const struct hda_verb
[]) {
10791 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
10795 [PINFIX_ACER_ASPIRE_7736
] = {
10796 .type
= ALC_FIXUP_SKU
,
10797 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
10801 static const struct snd_pci_quirk alc882_fixup_tbl
[] = {
10802 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210
),
10803 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530
),
10804 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
10805 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736
),
10810 * BIOS auto configuration
10812 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
10814 struct alc_spec
*spec
= codec
->spec
;
10817 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
10818 hda_nid_t nid
= spec
->capsrc_nids
[c
];
10819 unsigned int mux_idx
;
10820 const struct hda_input_mux
*imux
;
10821 int conns
, mute
, idx
, item
;
10822 unsigned int wid_type
;
10825 if (query_amp_caps(codec
, spec
->adc_nids
[c
], HDA_INPUT
) &
10827 snd_hda_codec_write(codec
, spec
->adc_nids
[c
], 0,
10828 AC_VERB_SET_AMP_GAIN_MUTE
,
10830 else if (query_amp_caps(codec
, nid
, HDA_OUTPUT
) &
10832 snd_hda_codec_write(codec
, nid
, 0,
10833 AC_VERB_SET_AMP_GAIN_MUTE
,
10836 conns
= snd_hda_get_conn_list(codec
, nid
, NULL
);
10839 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
10840 imux
= &spec
->input_mux
[mux_idx
];
10841 if (!imux
->num_items
&& mux_idx
> 0)
10842 imux
= &spec
->input_mux
[0];
10843 wid_type
= get_wcaps_type(get_wcaps(codec
, nid
));
10844 for (idx
= 0; idx
< conns
; idx
++) {
10845 /* if the current connection is the selected one,
10846 * unmute it as default - otherwise mute it
10848 mute
= AMP_IN_MUTE(idx
);
10849 for (item
= 0; item
< imux
->num_items
; item
++) {
10850 if (imux
->items
[item
].index
== idx
) {
10851 if (spec
->cur_mux
[c
] == item
)
10852 mute
= AMP_IN_UNMUTE(idx
);
10856 /* initialize the mute status if mute-amp is present */
10857 if (query_amp_caps(codec
, nid
, HDA_INPUT
) & AC_AMPCAP_MUTE
)
10858 snd_hda_codec_write(codec
, nid
, 0,
10859 AC_VERB_SET_AMP_GAIN_MUTE
,
10861 if (wid_type
== AC_WID_AUD_SEL
&&
10862 mute
!= AMP_IN_MUTE(idx
))
10863 snd_hda_codec_write(codec
, nid
, 0,
10864 AC_VERB_SET_CONNECT_SEL
,
10870 /* add mic boosts if needed */
10871 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
10873 struct alc_spec
*spec
= codec
->spec
;
10874 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
10878 const char *prev_label
= NULL
;
10880 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
10881 if (cfg
->inputs
[i
].type
> AUTO_PIN_MIC
)
10883 nid
= cfg
->inputs
[i
].pin
;
10884 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
) {
10886 char boost_label
[32];
10888 label
= hda_get_autocfg_input_label(codec
, cfg
, i
);
10889 if (prev_label
&& !strcmp(label
, prev_label
))
10893 prev_label
= label
;
10895 snprintf(boost_label
, sizeof(boost_label
),
10896 "%s Boost Volume", label
);
10897 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10898 boost_label
, type_idx
,
10899 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
10907 /* almost identical with ALC880 parser... */
10908 static int alc882_parse_auto_config(struct hda_codec
*codec
)
10910 struct alc_spec
*spec
= codec
->spec
;
10911 static const hda_nid_t alc882_ignore
[] = { 0x1d, 0 };
10914 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10918 if (!spec
->autocfg
.line_outs
)
10919 return 0; /* can't find valid BIOS pin config */
10921 err
= alc_auto_fill_dac_nids(codec
);
10924 err
= alc_auto_add_multi_channel_mode(codec
, alc_auto_fill_dac_nids
);
10927 err
= alc_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
10930 err
= alc_auto_create_hp_out(codec
);
10933 err
= alc_auto_create_speaker_out(codec
);
10936 err
= alc_auto_create_input_ctls(codec
);
10940 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
10942 alc_auto_parse_digital(codec
);
10944 if (spec
->kctls
.list
)
10945 add_mixer(spec
, spec
->kctls
.list
);
10947 spec
->num_mux_defs
= 1;
10948 spec
->input_mux
= &spec
->private_imux
[0];
10950 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
10952 err
= alc_auto_add_mic_boost(codec
);
10956 return 1; /* config found */
10959 /* additional initialization for auto-configuration model */
10960 static void alc882_auto_init(struct hda_codec
*codec
)
10962 struct alc_spec
*spec
= codec
->spec
;
10963 alc_auto_init_multi_out(codec
);
10964 alc_auto_init_extra_out(codec
);
10965 alc_auto_init_analog_input(codec
);
10966 alc882_auto_init_input_src(codec
);
10967 alc_auto_init_digital(codec
);
10968 if (spec
->unsol_event
)
10969 alc_inithook(codec
);
10972 static int patch_alc882(struct hda_codec
*codec
)
10974 struct alc_spec
*spec
;
10975 int err
, board_config
;
10977 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10981 codec
->spec
= spec
;
10983 spec
->mixer_nid
= 0x0b;
10985 switch (codec
->vendor_id
) {
10990 /* ALC883 and variants */
10991 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
10995 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
10999 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
)
11000 board_config
= snd_hda_check_board_codec_sid_config(codec
,
11001 ALC882_MODEL_LAST
, alc882_models
, alc882_ssid_cfg_tbl
);
11003 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
11004 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
11006 board_config
= ALC882_AUTO
;
11009 if (board_config
== ALC882_AUTO
) {
11010 alc_pick_fixup(codec
, NULL
, alc882_fixup_tbl
, alc882_fixups
);
11011 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
11014 alc_auto_parse_customize_define(codec
);
11016 if (board_config
== ALC882_AUTO
) {
11017 /* automatic parse from the BIOS config */
11018 err
= alc882_parse_auto_config(codec
);
11024 "hda_codec: Cannot set up configuration "
11025 "from BIOS. Using base mode...\n");
11026 board_config
= ALC882_3ST_DIG
;
11030 if (has_cdefine_beep(codec
)) {
11031 err
= snd_hda_attach_beep_device(codec
, 0x1);
11038 if (board_config
!= ALC882_AUTO
)
11039 setup_preset(codec
, &alc882_presets
[board_config
]);
11041 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
11042 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
11043 /* FIXME: setup DAC5 */
11044 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11045 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
11047 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
11048 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
11050 if (!spec
->adc_nids
&& spec
->input_mux
) {
11052 spec
->num_adc_nids
= 0;
11053 for (i
= 0; i
< ARRAY_SIZE(alc882_adc_nids
); i
++) {
11054 const struct hda_input_mux
*imux
= spec
->input_mux
;
11056 hda_nid_t nid
= alc882_adc_nids
[i
];
11057 unsigned int wcap
= get_wcaps(codec
, nid
);
11059 wcap
= get_wcaps_type(wcap
);
11060 if (wcap
!= AC_WID_AUD_IN
)
11062 spec
->private_adc_nids
[spec
->num_adc_nids
] = nid
;
11063 err
= snd_hda_get_connections(codec
, nid
, &cap
, 1);
11066 err
= snd_hda_get_conn_list(codec
, cap
, NULL
);
11069 for (j
= 0; j
< imux
->num_items
; j
++)
11070 if (imux
->items
[j
].index
>= err
)
11072 if (j
< imux
->num_items
)
11074 spec
->private_capsrc_nids
[spec
->num_adc_nids
] = cap
;
11075 spec
->num_adc_nids
++;
11077 spec
->adc_nids
= spec
->private_adc_nids
;
11078 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
11081 set_capture_mixer(codec
);
11083 if (has_cdefine_beep(codec
))
11084 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
11086 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
11088 spec
->vmaster_nid
= 0x0c;
11090 codec
->patch_ops
= alc_patch_ops
;
11091 if (board_config
== ALC882_AUTO
)
11092 spec
->init_hook
= alc882_auto_init
;
11094 alc_init_jacks(codec
);
11095 #ifdef CONFIG_SND_HDA_POWER_SAVE
11096 if (!spec
->loopback
.amplist
)
11097 spec
->loopback
.amplist
= alc882_loopbacks
;
11108 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11109 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11111 #define alc262_dac_nids alc260_dac_nids
11112 #define alc262_adc_nids alc882_adc_nids
11113 #define alc262_adc_nids_alt alc882_adc_nids_alt
11114 #define alc262_capsrc_nids alc882_capsrc_nids
11115 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11117 #define alc262_modes alc260_modes
11118 #define alc262_capture_source alc882_capture_source
11120 static const hda_nid_t alc262_dmic_adc_nids
[1] = {
11125 static const hda_nid_t alc262_dmic_capsrc_nids
[1] = { 0x22 };
11127 static const struct snd_kcontrol_new alc262_base_mixer
[] = {
11128 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11129 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11130 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11131 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11133 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11136 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11137 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11138 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11139 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11140 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
11141 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11142 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
11143 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
11147 /* update HP, line and mono-out pins according to the master switch */
11148 #define alc262_hp_master_update alc260_hp_master_update
11150 static void alc262_hp_bpc_setup(struct hda_codec
*codec
)
11152 struct alc_spec
*spec
= codec
->spec
;
11154 spec
->autocfg
.hp_pins
[0] = 0x1b;
11155 spec
->autocfg
.speaker_pins
[0] = 0x16;
11156 spec
->automute
= 1;
11157 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11160 static void alc262_hp_wildwest_setup(struct hda_codec
*codec
)
11162 struct alc_spec
*spec
= codec
->spec
;
11164 spec
->autocfg
.hp_pins
[0] = 0x15;
11165 spec
->autocfg
.speaker_pins
[0] = 0x16;
11166 spec
->automute
= 1;
11167 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11170 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11171 #define alc262_hp_master_sw_put alc260_hp_master_sw_put
11173 #define ALC262_HP_MASTER_SWITCH \
11175 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11176 .name = "Master Playback Switch", \
11177 .info = snd_ctl_boolean_mono_info, \
11178 .get = alc262_hp_master_sw_get, \
11179 .put = alc262_hp_master_sw_put, \
11182 .iface = NID_MAPPING, \
11183 .name = "Master Playback Switch", \
11184 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11188 static const struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
11189 ALC262_HP_MASTER_SWITCH
,
11190 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11191 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11193 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11195 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11199 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11200 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11201 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11202 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11203 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11204 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11205 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11206 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11207 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11208 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11212 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
11213 ALC262_HP_MASTER_SWITCH
,
11214 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11215 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11216 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11218 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11220 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11222 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11223 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11224 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT
),
11225 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11226 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11227 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11228 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11232 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
11233 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11234 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11235 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11239 /* mute/unmute internal speaker according to the hp jack and mute state */
11240 static void alc262_hp_t5735_setup(struct hda_codec
*codec
)
11242 struct alc_spec
*spec
= codec
->spec
;
11244 spec
->autocfg
.hp_pins
[0] = 0x15;
11245 spec
->autocfg
.speaker_pins
[0] = 0x14;
11246 spec
->automute
= 1;
11247 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11250 static const struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
11251 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11252 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11253 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11254 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11255 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11256 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11257 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11261 static const struct hda_verb alc262_hp_t5735_verbs
[] = {
11262 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11263 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11265 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11269 static const struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
11270 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11271 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11272 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
11273 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
11274 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11275 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11279 static const struct hda_verb alc262_hp_rp5700_verbs
[] = {
11280 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11281 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11282 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11283 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11284 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11285 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11286 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11287 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11288 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
11289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
11293 static const struct hda_input_mux alc262_hp_rp5700_capture_source
= {
11300 /* bind hp and internal speaker mute (with plug check) as master switch */
11301 #define alc262_hippo_master_update alc262_hp_master_update
11302 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11303 #define alc262_hippo_master_sw_put alc262_hp_master_sw_put
11305 #define ALC262_HIPPO_MASTER_SWITCH \
11307 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11308 .name = "Master Playback Switch", \
11309 .info = snd_ctl_boolean_mono_info, \
11310 .get = alc262_hippo_master_sw_get, \
11311 .put = alc262_hippo_master_sw_put, \
11314 .iface = NID_MAPPING, \
11315 .name = "Master Playback Switch", \
11316 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11317 (SUBDEV_SPEAKER(0) << 16), \
11320 static const struct snd_kcontrol_new alc262_hippo_mixer
[] = {
11321 ALC262_HIPPO_MASTER_SWITCH
,
11322 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11323 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11324 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11325 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11326 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11329 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11330 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11331 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11332 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11333 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11337 static const struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
11338 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11339 ALC262_HIPPO_MASTER_SWITCH
,
11340 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11341 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11342 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11343 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11344 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11345 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11346 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11347 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11348 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11349 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11353 /* mute/unmute internal speaker according to the hp jack and mute state */
11354 static void alc262_hippo_setup(struct hda_codec
*codec
)
11356 struct alc_spec
*spec
= codec
->spec
;
11358 spec
->autocfg
.hp_pins
[0] = 0x15;
11359 spec
->autocfg
.speaker_pins
[0] = 0x14;
11360 spec
->automute
= 1;
11361 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11364 static void alc262_hippo1_setup(struct hda_codec
*codec
)
11366 struct alc_spec
*spec
= codec
->spec
;
11368 spec
->autocfg
.hp_pins
[0] = 0x1b;
11369 spec
->autocfg
.speaker_pins
[0] = 0x14;
11370 spec
->automute
= 1;
11371 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11375 static const struct snd_kcontrol_new alc262_sony_mixer
[] = {
11376 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11377 ALC262_HIPPO_MASTER_SWITCH
,
11378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11380 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11381 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11385 static const struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
11386 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11387 ALC262_HIPPO_MASTER_SWITCH
,
11388 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11391 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11392 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11396 static const struct snd_kcontrol_new alc262_tyan_mixer
[] = {
11397 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11398 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
11399 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11400 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11401 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11402 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11403 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11404 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11405 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11406 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11407 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11408 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11412 static const struct hda_verb alc262_tyan_verbs
[] = {
11413 /* Headphone automute */
11414 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11415 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11416 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11418 /* P11 AUX_IN, white 4-pin connector */
11419 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11420 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
, 0xe1},
11421 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
, 0x93},
11422 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
, 0x19},
11427 /* unsolicited event for HP jack sensing */
11428 static void alc262_tyan_setup(struct hda_codec
*codec
)
11430 struct alc_spec
*spec
= codec
->spec
;
11432 spec
->autocfg
.hp_pins
[0] = 0x1b;
11433 spec
->autocfg
.speaker_pins
[0] = 0x15;
11434 spec
->automute
= 1;
11435 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11439 #define alc262_capture_mixer alc882_capture_mixer
11440 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11443 * generic initialization of ADC, input mixers and output mixers
11445 static const struct hda_verb alc262_init_verbs
[] = {
11447 * Unmute ADC0-2 and set the default input to mic-in
11449 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11450 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11451 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11452 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11453 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11454 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11456 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11458 * Note: PASD motherboards uses the Line In 2 as the input for
11459 * front panel mic (mic 2)
11461 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11463 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11464 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11465 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11466 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11469 * Set up output mixers (0x0c - 0x0e)
11471 /* set vol=0 to output mixers */
11472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11473 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11474 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11475 /* set up input amps for analog loopback */
11476 /* Amp Indices: DAC = 0, mixer = 1 */
11477 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11478 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11479 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11480 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11486 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11487 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11488 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11489 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11491 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11492 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11493 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11494 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11495 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11497 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11498 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11500 /* FIXME: use matrix-type input source selection */
11501 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11502 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11503 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11504 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11505 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11506 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11508 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11511 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11521 static const struct hda_verb alc262_eapd_verbs
[] = {
11522 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11523 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11527 static const struct hda_verb alc262_hippo1_unsol_verbs
[] = {
11528 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11529 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11530 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11532 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11533 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11537 static const struct hda_verb alc262_sony_unsol_verbs
[] = {
11538 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11539 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11540 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
11542 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11543 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11547 static const struct snd_kcontrol_new alc262_toshiba_s06_mixer
[] = {
11548 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11549 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11550 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11552 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11556 static const struct hda_verb alc262_toshiba_s06_verbs
[] = {
11557 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11558 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11559 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11560 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11561 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x09},
11562 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11563 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11564 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11568 static void alc262_toshiba_s06_setup(struct hda_codec
*codec
)
11570 struct alc_spec
*spec
= codec
->spec
;
11572 spec
->autocfg
.hp_pins
[0] = 0x15;
11573 spec
->autocfg
.speaker_pins
[0] = 0x14;
11574 spec
->ext_mic
.pin
= 0x18;
11575 spec
->ext_mic
.mux_idx
= 0;
11576 spec
->int_mic
.pin
= 0x12;
11577 spec
->int_mic
.mux_idx
= 9;
11578 spec
->auto_mic
= 1;
11579 spec
->automute
= 1;
11580 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
11586 * 0x16 = internal speaker
11587 * 0x18 = external mic
11590 static const struct snd_kcontrol_new alc262_nec_mixer
[] = {
11591 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
11592 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
11594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11595 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11596 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11598 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11599 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11603 static const struct hda_verb alc262_nec_verbs
[] = {
11604 /* Unmute Speaker */
11605 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11608 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11611 /* External mic to headphone */
11612 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11613 /* External mic to speaker */
11614 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11620 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11621 * 0x1b = port replicator headphone out
11624 #define ALC_HP_EVENT ALC880_HP_EVENT
11626 static const struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
11627 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11628 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11629 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11630 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11634 static const struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
11635 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11636 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11640 static const struct hda_verb alc262_lenovo_3000_init_verbs
[] = {
11641 /* Front Mic pin: input vref at 50% */
11642 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11643 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11647 static const struct hda_input_mux alc262_fujitsu_capture_source
= {
11651 { "Internal Mic", 0x1 },
11656 static const struct hda_input_mux alc262_HP_capture_source
= {
11660 { "Front Mic", 0x1 },
11667 static const struct hda_input_mux alc262_HP_D7000_capture_source
= {
11671 { "Front Mic", 0x2 },
11677 static void alc262_fujitsu_setup(struct hda_codec
*codec
)
11679 struct alc_spec
*spec
= codec
->spec
;
11681 spec
->autocfg
.hp_pins
[0] = 0x14;
11682 spec
->autocfg
.hp_pins
[1] = 0x1b;
11683 spec
->autocfg
.speaker_pins
[0] = 0x15;
11684 spec
->automute
= 1;
11685 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11688 /* bind volumes of both NID 0x0c and 0x0d */
11689 static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
11690 .ops
= &snd_hda_bind_vol
,
11692 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
11693 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
11698 static const struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
11699 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11701 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11702 .name
= "Master Playback Switch",
11703 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x14,
11704 .info
= snd_ctl_boolean_mono_info
,
11705 .get
= alc262_hp_master_sw_get
,
11706 .put
= alc262_hp_master_sw_put
,
11709 .iface
= NID_MAPPING
,
11710 .name
= "Master Playback Switch",
11711 .private_value
= 0x1b,
11713 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11714 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11715 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11716 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11717 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11718 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11719 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11720 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11724 static void alc262_lenovo_3000_setup(struct hda_codec
*codec
)
11726 struct alc_spec
*spec
= codec
->spec
;
11728 spec
->autocfg
.hp_pins
[0] = 0x1b;
11729 spec
->autocfg
.speaker_pins
[0] = 0x14;
11730 spec
->autocfg
.speaker_pins
[1] = 0x16;
11731 spec
->automute
= 1;
11732 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
11735 static const struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
11736 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11738 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11739 .name
= "Master Playback Switch",
11740 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x1b,
11741 .info
= snd_ctl_boolean_mono_info
,
11742 .get
= alc262_hp_master_sw_get
,
11743 .put
= alc262_hp_master_sw_put
,
11745 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11746 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11747 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11749 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11750 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11751 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11752 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11756 static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer
[] = {
11757 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11758 ALC262_HIPPO_MASTER_SWITCH
,
11759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11761 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
11762 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11763 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11764 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11768 /* additional init verbs for Benq laptops */
11769 static const struct hda_verb alc262_EAPD_verbs
[] = {
11770 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
11771 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
11775 static const struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
11776 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11777 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11779 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
11780 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
11784 /* Samsung Q1 Ultra Vista model setup */
11785 static const struct snd_kcontrol_new alc262_ultra_mixer
[] = {
11786 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11787 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
11788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11789 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11790 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT
),
11791 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT
),
11795 static const struct hda_verb alc262_ultra_verbs
[] = {
11797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11798 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11801 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11802 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11803 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11804 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11807 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11809 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11810 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11812 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11813 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11814 /* ADC, choose mic */
11815 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11816 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11817 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11818 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11819 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11820 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11821 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
11822 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
11823 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
11824 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
11828 /* mute/unmute internal speaker according to the hp jack and mute state */
11829 static void alc262_ultra_automute(struct hda_codec
*codec
)
11831 struct alc_spec
*spec
= codec
->spec
;
11835 /* auto-mute only when HP is used as HP */
11836 if (!spec
->cur_mux
[0]) {
11837 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
11838 if (spec
->jack_present
)
11839 mute
= HDA_AMP_MUTE
;
11841 /* mute/unmute internal speaker */
11842 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11843 HDA_AMP_MUTE
, mute
);
11844 /* mute/unmute HP */
11845 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
11846 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
11849 /* unsolicited event for HP jack sensing */
11850 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
11853 if ((res
>> 26) != ALC880_HP_EVENT
)
11855 alc262_ultra_automute(codec
);
11858 static const struct hda_input_mux alc262_ultra_capture_source
= {
11862 { "Headphone", 0x7 },
11866 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
11867 struct snd_ctl_elem_value
*ucontrol
)
11869 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11870 struct alc_spec
*spec
= codec
->spec
;
11873 ret
= alc_mux_enum_put(kcontrol
, ucontrol
);
11876 /* reprogram the HP pin as mic or HP according to the input source */
11877 snd_hda_codec_write_cache(codec
, 0x15, 0,
11878 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11879 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
11880 alc262_ultra_automute(codec
); /* mute/unmute HP */
11884 static const struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
11885 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
11886 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
11888 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11889 .name
= "Capture Source",
11890 .info
= alc_mux_enum_info
,
11891 .get
= alc_mux_enum_get
,
11892 .put
= alc262_ultra_mux_enum_put
,
11895 .iface
= NID_MAPPING
,
11896 .name
= "Capture Source",
11897 .private_value
= 0x15,
11902 /* We use two mixers depending on the output pin; 0x16 is a mono output
11903 * and thus it's bound with a different mixer.
11904 * This function returns which mixer amp should be used.
11906 static int alc262_check_volbit(hda_nid_t nid
)
11910 else if (nid
== 0x16)
11916 static int alc262_add_out_vol_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
11917 const char *pfx
, int *vbits
, int idx
)
11922 vbit
= alc262_check_volbit(nid
);
11925 if (*vbits
& vbit
) /* a volume control for this mixer already there */
11929 val
= HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
);
11931 val
= HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
);
11932 return __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, idx
, val
);
11935 static int alc262_add_out_sw_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
11936 const char *pfx
, int idx
)
11943 val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
11945 val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
11946 return __add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
, val
);
11949 /* add playback controls from the parsed DAC table */
11950 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11951 const struct auto_pin_cfg
*cfg
)
11957 spec
->multiout
.num_dacs
= 1; /* only use one dac */
11958 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
11959 spec
->private_dac_nids
[0] = 2;
11961 for (i
= 0; i
< 2; i
++) {
11962 pfx
= alc_get_line_out_pfx(spec
, i
, true, &index
);
11965 err
= alc262_add_out_sw_ctl(spec
, cfg
->line_out_pins
[i
], pfx
,
11969 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
11970 err
= alc262_add_out_sw_ctl(spec
, cfg
->speaker_pins
[i
],
11975 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
) {
11976 err
= alc262_add_out_sw_ctl(spec
, cfg
->hp_pins
[i
],
11983 vbits
= alc262_check_volbit(cfg
->line_out_pins
[0]) |
11984 alc262_check_volbit(cfg
->speaker_pins
[0]) |
11985 alc262_check_volbit(cfg
->hp_pins
[0]);
11987 for (i
= 0; i
< 2; i
++) {
11988 pfx
= alc_get_line_out_pfx(spec
, i
, true, &index
);
11991 err
= alc262_add_out_vol_ctl(spec
, cfg
->line_out_pins
[i
], pfx
,
11995 if (cfg
->line_out_type
!= AUTO_PIN_SPEAKER_OUT
) {
11996 err
= alc262_add_out_vol_ctl(spec
, cfg
->speaker_pins
[i
],
11997 "Speaker", &vbits
, i
);
12001 if (cfg
->line_out_type
!= AUTO_PIN_HP_OUT
) {
12002 err
= alc262_add_out_vol_ctl(spec
, cfg
->hp_pins
[i
],
12003 "Headphone", &vbits
, i
);
12011 static const struct hda_verb alc262_HP_BPC_init_verbs
[] = {
12013 * Unmute ADC0-2 and set the default input to mic-in
12015 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12016 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12017 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12018 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12019 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12020 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12022 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12024 * Note: PASD motherboards uses the Line In 2 as the input for
12025 * front panel mic (mic 2)
12027 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12028 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12034 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12037 * Set up output mixers (0x0c - 0x0e)
12039 /* set vol=0 to output mixers */
12040 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12041 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12042 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12044 /* set up input amps for analog loopback */
12045 /* Amp Indices: DAC = 0, mixer = 1 */
12046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12049 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12050 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12051 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12053 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12055 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12057 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12060 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12061 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12063 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12064 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12065 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12066 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12067 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12069 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12070 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12071 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12073 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12074 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12077 /* FIXME: use matrix-type input source selection */
12078 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12079 /* Input mixer1: only unmute Mic */
12080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12088 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12090 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12091 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12097 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12098 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
12102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
12103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
12104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
12105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
12106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
12107 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
12108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
12110 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12115 static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
12117 * Unmute ADC0-2 and set the default input to mic-in
12119 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
12120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12121 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12122 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12123 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12126 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12128 * Note: PASD motherboards uses the Line In 2 as the input for front
12129 * panel mic (mic 2)
12131 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
12139 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
12141 * Set up output mixers (0x0c - 0x0e)
12143 /* set vol=0 to output mixers */
12144 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12145 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12146 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12148 /* set up input amps for analog loopback */
12149 /* Amp Indices: DAC = 0, mixer = 1 */
12150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12151 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12152 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12153 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12154 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12158 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
12159 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
12160 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
12161 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
12162 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
12163 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
12164 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
12166 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12167 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12169 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12170 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12172 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12173 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12174 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12175 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
12176 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12177 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
12179 /* FIXME: use matrix-type input source selection */
12180 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12181 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
12184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
12185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
12186 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
12187 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12188 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
12190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12191 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
12192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
12193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
12194 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
12195 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12196 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
12198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
12199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
12200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
12201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
12202 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
12203 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
12206 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12211 static const struct hda_verb alc262_toshiba_rx1_unsol_verbs
[] = {
12213 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Front Speaker */
12214 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12215 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
12217 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* MIC jack */
12218 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
12219 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
12220 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
12222 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP jack */
12223 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12224 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12236 static const struct alc_fixup alc262_fixups
[] = {
12237 [PINFIX_FSC_H270
] = {
12238 .type
= ALC_FIXUP_PINS
,
12239 .v
.pins
= (const struct alc_pincfg
[]) {
12240 { 0x14, 0x99130110 }, /* speaker */
12241 { 0x15, 0x0221142f }, /* front HP */
12242 { 0x1b, 0x0121141f }, /* rear HP */
12246 [PINFIX_HP_Z200
] = {
12247 .type
= ALC_FIXUP_PINS
,
12248 .v
.pins
= (const struct alc_pincfg
[]) {
12249 { 0x16, 0x99130120 }, /* internal speaker */
12255 static const struct snd_pci_quirk alc262_fixup_tbl
[] = {
12256 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", PINFIX_HP_Z200
),
12257 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270
),
12262 #ifdef CONFIG_SND_HDA_POWER_SAVE
12263 #define alc262_loopbacks alc880_loopbacks
12266 /* pcm configuration: identical with ALC880 */
12267 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12268 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12269 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12270 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12273 * BIOS auto configuration
12275 static int alc262_parse_auto_config(struct hda_codec
*codec
)
12277 struct alc_spec
*spec
= codec
->spec
;
12279 static const hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
12281 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12285 if (!spec
->autocfg
.line_outs
) {
12286 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
12287 spec
->multiout
.max_channels
= 2;
12288 spec
->no_analog
= 1;
12291 return 0; /* can't find valid BIOS pin config */
12293 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12296 err
= alc_auto_create_input_ctls(codec
);
12300 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12303 alc_auto_parse_digital(codec
);
12305 if (spec
->kctls
.list
)
12306 add_mixer(spec
, spec
->kctls
.list
);
12308 spec
->num_mux_defs
= 1;
12309 spec
->input_mux
= &spec
->private_imux
[0];
12311 err
= alc_auto_add_mic_boost(codec
);
12315 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
12320 #define alc262_auto_init_input_src alc882_auto_init_input_src
12323 /* init callback for auto-configuration model -- overriding the default init */
12324 static void alc262_auto_init(struct hda_codec
*codec
)
12326 struct alc_spec
*spec
= codec
->spec
;
12327 alc_auto_init_multi_out(codec
);
12328 alc_auto_init_extra_out(codec
);
12329 alc_auto_init_analog_input(codec
);
12330 alc262_auto_init_input_src(codec
);
12331 alc_auto_init_digital(codec
);
12332 if (spec
->unsol_event
)
12333 alc_inithook(codec
);
12337 * configuration and preset
12339 static const char * const alc262_models
[ALC262_MODEL_LAST
] = {
12340 [ALC262_BASIC
] = "basic",
12341 [ALC262_HIPPO
] = "hippo",
12342 [ALC262_HIPPO_1
] = "hippo_1",
12343 [ALC262_FUJITSU
] = "fujitsu",
12344 [ALC262_HP_BPC
] = "hp-bpc",
12345 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
12346 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
12347 [ALC262_HP_RP5700
] = "hp-rp5700",
12348 [ALC262_BENQ_ED8
] = "benq",
12349 [ALC262_BENQ_T31
] = "benq-t31",
12350 [ALC262_SONY_ASSAMD
] = "sony-assamd",
12351 [ALC262_TOSHIBA_S06
] = "toshiba-s06",
12352 [ALC262_TOSHIBA_RX1
] = "toshiba-rx1",
12353 [ALC262_ULTRA
] = "ultra",
12354 [ALC262_LENOVO_3000
] = "lenovo-3000",
12355 [ALC262_NEC
] = "nec",
12356 [ALC262_TYAN
] = "tyan",
12357 [ALC262_AUTO
] = "auto",
12360 static const struct snd_pci_quirk alc262_cfg_tbl
[] = {
12361 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
12362 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
12363 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12365 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12367 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12369 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200",
12371 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12373 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12374 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12375 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12376 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12377 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12378 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12379 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12380 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12381 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
12382 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
12383 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
12384 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12385 ALC262_HP_TC_T5735
),
12386 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
12387 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12388 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
12389 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12390 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO
), /* dig-only */
12391 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06
),
12392 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO
),
12393 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO
),
12394 #if 0 /* disable the quirk since model=auto works better in recent versions */
12395 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12396 ALC262_SONY_ASSAMD
),
12398 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12399 ALC262_TOSHIBA_RX1
),
12400 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06
),
12401 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
12402 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
12403 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN
),
12404 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12406 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO
),
12407 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
12408 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
12409 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
12410 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
12414 static const struct alc_config_preset alc262_presets
[] = {
12416 .mixers
= { alc262_base_mixer
},
12417 .init_verbs
= { alc262_init_verbs
},
12418 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12419 .dac_nids
= alc262_dac_nids
,
12421 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12422 .channel_mode
= alc262_modes
,
12423 .input_mux
= &alc262_capture_source
,
12426 .mixers
= { alc262_hippo_mixer
},
12427 .init_verbs
= { alc262_init_verbs
, alc_hp15_unsol_verbs
},
12428 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12429 .dac_nids
= alc262_dac_nids
,
12431 .dig_out_nid
= ALC262_DIGOUT_NID
,
12432 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12433 .channel_mode
= alc262_modes
,
12434 .input_mux
= &alc262_capture_source
,
12435 .unsol_event
= alc_sku_unsol_event
,
12436 .setup
= alc262_hippo_setup
,
12437 .init_hook
= alc_inithook
,
12439 [ALC262_HIPPO_1
] = {
12440 .mixers
= { alc262_hippo1_mixer
},
12441 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
12442 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12443 .dac_nids
= alc262_dac_nids
,
12445 .dig_out_nid
= ALC262_DIGOUT_NID
,
12446 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12447 .channel_mode
= alc262_modes
,
12448 .input_mux
= &alc262_capture_source
,
12449 .unsol_event
= alc_sku_unsol_event
,
12450 .setup
= alc262_hippo1_setup
,
12451 .init_hook
= alc_inithook
,
12453 [ALC262_FUJITSU
] = {
12454 .mixers
= { alc262_fujitsu_mixer
},
12455 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12456 alc262_fujitsu_unsol_verbs
},
12457 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12458 .dac_nids
= alc262_dac_nids
,
12460 .dig_out_nid
= ALC262_DIGOUT_NID
,
12461 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12462 .channel_mode
= alc262_modes
,
12463 .input_mux
= &alc262_fujitsu_capture_source
,
12464 .unsol_event
= alc_sku_unsol_event
,
12465 .setup
= alc262_fujitsu_setup
,
12466 .init_hook
= alc_inithook
,
12468 [ALC262_HP_BPC
] = {
12469 .mixers
= { alc262_HP_BPC_mixer
},
12470 .init_verbs
= { alc262_HP_BPC_init_verbs
},
12471 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12472 .dac_nids
= alc262_dac_nids
,
12474 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12475 .channel_mode
= alc262_modes
,
12476 .input_mux
= &alc262_HP_capture_source
,
12477 .unsol_event
= alc_sku_unsol_event
,
12478 .setup
= alc262_hp_bpc_setup
,
12479 .init_hook
= alc_inithook
,
12481 [ALC262_HP_BPC_D7000_WF
] = {
12482 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
12483 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12484 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12485 .dac_nids
= alc262_dac_nids
,
12487 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12488 .channel_mode
= alc262_modes
,
12489 .input_mux
= &alc262_HP_D7000_capture_source
,
12490 .unsol_event
= alc_sku_unsol_event
,
12491 .setup
= alc262_hp_wildwest_setup
,
12492 .init_hook
= alc_inithook
,
12494 [ALC262_HP_BPC_D7000_WL
] = {
12495 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
12496 alc262_HP_BPC_WildWest_option_mixer
},
12497 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12498 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12499 .dac_nids
= alc262_dac_nids
,
12501 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12502 .channel_mode
= alc262_modes
,
12503 .input_mux
= &alc262_HP_D7000_capture_source
,
12504 .unsol_event
= alc_sku_unsol_event
,
12505 .setup
= alc262_hp_wildwest_setup
,
12506 .init_hook
= alc_inithook
,
12508 [ALC262_HP_TC_T5735
] = {
12509 .mixers
= { alc262_hp_t5735_mixer
},
12510 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
12511 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12512 .dac_nids
= alc262_dac_nids
,
12514 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12515 .channel_mode
= alc262_modes
,
12516 .input_mux
= &alc262_capture_source
,
12517 .unsol_event
= alc_sku_unsol_event
,
12518 .setup
= alc262_hp_t5735_setup
,
12519 .init_hook
= alc_inithook
,
12521 [ALC262_HP_RP5700
] = {
12522 .mixers
= { alc262_hp_rp5700_mixer
},
12523 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
12524 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12525 .dac_nids
= alc262_dac_nids
,
12526 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12527 .channel_mode
= alc262_modes
,
12528 .input_mux
= &alc262_hp_rp5700_capture_source
,
12530 [ALC262_BENQ_ED8
] = {
12531 .mixers
= { alc262_base_mixer
},
12532 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
12533 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12534 .dac_nids
= alc262_dac_nids
,
12536 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12537 .channel_mode
= alc262_modes
,
12538 .input_mux
= &alc262_capture_source
,
12540 [ALC262_SONY_ASSAMD
] = {
12541 .mixers
= { alc262_sony_mixer
},
12542 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
12543 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12544 .dac_nids
= alc262_dac_nids
,
12546 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12547 .channel_mode
= alc262_modes
,
12548 .input_mux
= &alc262_capture_source
,
12549 .unsol_event
= alc_sku_unsol_event
,
12550 .setup
= alc262_hippo_setup
,
12551 .init_hook
= alc_inithook
,
12553 [ALC262_BENQ_T31
] = {
12554 .mixers
= { alc262_benq_t31_mixer
},
12555 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
,
12556 alc_hp15_unsol_verbs
},
12557 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12558 .dac_nids
= alc262_dac_nids
,
12560 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12561 .channel_mode
= alc262_modes
,
12562 .input_mux
= &alc262_capture_source
,
12563 .unsol_event
= alc_sku_unsol_event
,
12564 .setup
= alc262_hippo_setup
,
12565 .init_hook
= alc_inithook
,
12568 .mixers
= { alc262_ultra_mixer
},
12569 .cap_mixer
= alc262_ultra_capture_mixer
,
12570 .init_verbs
= { alc262_ultra_verbs
},
12571 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12572 .dac_nids
= alc262_dac_nids
,
12573 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12574 .channel_mode
= alc262_modes
,
12575 .input_mux
= &alc262_ultra_capture_source
,
12576 .adc_nids
= alc262_adc_nids
, /* ADC0 */
12577 .capsrc_nids
= alc262_capsrc_nids
,
12578 .num_adc_nids
= 1, /* single ADC */
12579 .unsol_event
= alc262_ultra_unsol_event
,
12580 .init_hook
= alc262_ultra_automute
,
12582 [ALC262_LENOVO_3000
] = {
12583 .mixers
= { alc262_lenovo_3000_mixer
},
12584 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12585 alc262_lenovo_3000_unsol_verbs
,
12586 alc262_lenovo_3000_init_verbs
},
12587 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12588 .dac_nids
= alc262_dac_nids
,
12590 .dig_out_nid
= ALC262_DIGOUT_NID
,
12591 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12592 .channel_mode
= alc262_modes
,
12593 .input_mux
= &alc262_fujitsu_capture_source
,
12594 .unsol_event
= alc_sku_unsol_event
,
12595 .setup
= alc262_lenovo_3000_setup
,
12596 .init_hook
= alc_inithook
,
12599 .mixers
= { alc262_nec_mixer
},
12600 .init_verbs
= { alc262_nec_verbs
},
12601 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12602 .dac_nids
= alc262_dac_nids
,
12604 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12605 .channel_mode
= alc262_modes
,
12606 .input_mux
= &alc262_capture_source
,
12608 [ALC262_TOSHIBA_S06
] = {
12609 .mixers
= { alc262_toshiba_s06_mixer
},
12610 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_s06_verbs
,
12611 alc262_eapd_verbs
},
12612 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12613 .capsrc_nids
= alc262_dmic_capsrc_nids
,
12614 .dac_nids
= alc262_dac_nids
,
12615 .adc_nids
= alc262_dmic_adc_nids
, /* ADC0 */
12616 .num_adc_nids
= 1, /* single ADC */
12617 .dig_out_nid
= ALC262_DIGOUT_NID
,
12618 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12619 .channel_mode
= alc262_modes
,
12620 .unsol_event
= alc_sku_unsol_event
,
12621 .setup
= alc262_toshiba_s06_setup
,
12622 .init_hook
= alc_inithook
,
12624 [ALC262_TOSHIBA_RX1
] = {
12625 .mixers
= { alc262_toshiba_rx1_mixer
},
12626 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_rx1_unsol_verbs
},
12627 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12628 .dac_nids
= alc262_dac_nids
,
12630 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12631 .channel_mode
= alc262_modes
,
12632 .input_mux
= &alc262_capture_source
,
12633 .unsol_event
= alc_sku_unsol_event
,
12634 .setup
= alc262_hippo_setup
,
12635 .init_hook
= alc_inithook
,
12638 .mixers
= { alc262_tyan_mixer
},
12639 .init_verbs
= { alc262_init_verbs
, alc262_tyan_verbs
},
12640 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12641 .dac_nids
= alc262_dac_nids
,
12643 .dig_out_nid
= ALC262_DIGOUT_NID
,
12644 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12645 .channel_mode
= alc262_modes
,
12646 .input_mux
= &alc262_capture_source
,
12647 .unsol_event
= alc_sku_unsol_event
,
12648 .setup
= alc262_tyan_setup
,
12649 .init_hook
= alc_hp_automute
,
12653 static int patch_alc262(struct hda_codec
*codec
)
12655 struct alc_spec
*spec
;
12659 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12663 codec
->spec
= spec
;
12665 spec
->mixer_nid
= 0x0b;
12668 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12673 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
12674 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
12675 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
12676 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
12679 alc_auto_parse_customize_define(codec
);
12681 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
12683 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
12687 if (board_config
< 0) {
12688 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
12690 board_config
= ALC262_AUTO
;
12693 if (board_config
== ALC262_AUTO
) {
12694 alc_pick_fixup(codec
, NULL
, alc262_fixup_tbl
, alc262_fixups
);
12695 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
12698 if (board_config
== ALC262_AUTO
) {
12699 /* automatic parse from the BIOS config */
12700 err
= alc262_parse_auto_config(codec
);
12706 "hda_codec: Cannot set up configuration "
12707 "from BIOS. Using base mode...\n");
12708 board_config
= ALC262_BASIC
;
12712 if (!spec
->no_analog
&& has_cdefine_beep(codec
)) {
12713 err
= snd_hda_attach_beep_device(codec
, 0x1);
12720 if (board_config
!= ALC262_AUTO
)
12721 setup_preset(codec
, &alc262_presets
[board_config
]);
12723 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
12724 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
12726 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
12727 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
12729 if (!spec
->adc_nids
&& spec
->input_mux
) {
12731 /* check whether the digital-mic has to be supported */
12732 for (i
= 0; i
< spec
->input_mux
->num_items
; i
++) {
12733 if (spec
->input_mux
->items
[i
].index
>= 9)
12736 if (i
< spec
->input_mux
->num_items
) {
12737 /* use only ADC0 */
12738 spec
->adc_nids
= alc262_dmic_adc_nids
;
12739 spec
->num_adc_nids
= 1;
12740 spec
->capsrc_nids
= alc262_dmic_capsrc_nids
;
12742 /* all analog inputs */
12743 /* check whether NID 0x07 is valid */
12744 unsigned int wcap
= get_wcaps(codec
, 0x07);
12747 wcap
= get_wcaps_type(wcap
);
12748 if (wcap
!= AC_WID_AUD_IN
) {
12749 spec
->adc_nids
= alc262_adc_nids_alt
;
12750 spec
->num_adc_nids
=
12751 ARRAY_SIZE(alc262_adc_nids_alt
);
12752 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
12754 spec
->adc_nids
= alc262_adc_nids
;
12755 spec
->num_adc_nids
=
12756 ARRAY_SIZE(alc262_adc_nids
);
12757 spec
->capsrc_nids
= alc262_capsrc_nids
;
12761 if (!spec
->cap_mixer
&& !spec
->no_analog
)
12762 set_capture_mixer(codec
);
12763 if (!spec
->no_analog
&& has_cdefine_beep(codec
))
12764 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
12766 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
12768 spec
->vmaster_nid
= 0x0c;
12770 codec
->patch_ops
= alc_patch_ops
;
12771 if (board_config
== ALC262_AUTO
)
12772 spec
->init_hook
= alc262_auto_init
;
12773 spec
->shutup
= alc_eapd_shutup
;
12775 alc_init_jacks(codec
);
12776 #ifdef CONFIG_SND_HDA_POWER_SAVE
12777 if (!spec
->loopback
.amplist
)
12778 spec
->loopback
.amplist
= alc262_loopbacks
;
12785 * ALC268 channel source setting (2 channel)
12787 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12788 #define alc268_modes alc260_modes
12790 static const hda_nid_t alc268_dac_nids
[2] = {
12795 static const hda_nid_t alc268_adc_nids
[2] = {
12800 static const hda_nid_t alc268_adc_nids_alt
[1] = {
12805 static const hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
12807 static const struct snd_kcontrol_new alc268_base_mixer
[] = {
12808 /* output mixer control */
12809 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
12810 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12811 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
12812 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12813 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12814 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12815 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
12819 static const struct snd_kcontrol_new alc268_toshiba_mixer
[] = {
12820 /* output mixer control */
12821 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
12822 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
12823 ALC262_HIPPO_MASTER_SWITCH
,
12824 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12825 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12826 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
12830 /* bind Beep switches of both NID 0x0f and 0x10 */
12831 static const struct hda_bind_ctls alc268_bind_beep_sw
= {
12832 .ops
= &snd_hda_bind_sw
,
12834 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
12835 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
12840 static const struct snd_kcontrol_new alc268_beep_mixer
[] = {
12841 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
12842 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
12846 static const struct hda_verb alc268_eapd_verbs
[] = {
12847 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12848 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12852 /* Toshiba specific */
12853 static const struct hda_verb alc268_toshiba_verbs
[] = {
12854 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12858 /* Acer specific */
12859 /* bind volumes of both NID 0x02 and 0x03 */
12860 static const struct hda_bind_ctls alc268_acer_bind_master_vol
= {
12861 .ops
= &snd_hda_bind_vol
,
12863 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
12864 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
12869 static void alc268_acer_setup(struct hda_codec
*codec
)
12871 struct alc_spec
*spec
= codec
->spec
;
12873 spec
->autocfg
.hp_pins
[0] = 0x14;
12874 spec
->autocfg
.speaker_pins
[0] = 0x15;
12875 spec
->automute
= 1;
12876 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
12879 #define alc268_acer_master_sw_get alc262_hp_master_sw_get
12880 #define alc268_acer_master_sw_put alc262_hp_master_sw_put
12882 static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer
[] = {
12883 /* output mixer control */
12884 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12886 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12887 .name
= "Master Playback Switch",
12888 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x15,
12889 .info
= snd_ctl_boolean_mono_info
,
12890 .get
= alc268_acer_master_sw_get
,
12891 .put
= alc268_acer_master_sw_put
,
12893 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT
),
12897 static const struct snd_kcontrol_new alc268_acer_mixer
[] = {
12898 /* output mixer control */
12899 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12901 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12902 .name
= "Master Playback Switch",
12903 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x14,
12904 .info
= snd_ctl_boolean_mono_info
,
12905 .get
= alc268_acer_master_sw_get
,
12906 .put
= alc268_acer_master_sw_put
,
12908 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12909 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12910 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
12914 static const struct snd_kcontrol_new alc268_acer_dmic_mixer
[] = {
12915 /* output mixer control */
12916 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12918 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12919 .name
= "Master Playback Switch",
12920 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x14,
12921 .info
= snd_ctl_boolean_mono_info
,
12922 .get
= alc268_acer_master_sw_get
,
12923 .put
= alc268_acer_master_sw_put
,
12925 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12926 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT
),
12930 static const struct hda_verb alc268_acer_aspire_one_verbs
[] = {
12931 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12932 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12933 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12934 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12935 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x06},
12936 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, 0xa017},
12940 static const struct hda_verb alc268_acer_verbs
[] = {
12941 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
12942 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12943 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12944 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12945 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12947 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12951 /* unsolicited event for HP jack sensing */
12952 #define alc268_toshiba_setup alc262_hippo_setup
12954 static void alc268_acer_lc_setup(struct hda_codec
*codec
)
12956 struct alc_spec
*spec
= codec
->spec
;
12957 spec
->autocfg
.hp_pins
[0] = 0x15;
12958 spec
->autocfg
.speaker_pins
[0] = 0x14;
12959 spec
->automute
= 1;
12960 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
12961 spec
->ext_mic
.pin
= 0x18;
12962 spec
->ext_mic
.mux_idx
= 0;
12963 spec
->int_mic
.pin
= 0x12;
12964 spec
->int_mic
.mux_idx
= 6;
12965 spec
->auto_mic
= 1;
12968 static const struct snd_kcontrol_new alc268_dell_mixer
[] = {
12969 /* output mixer control */
12970 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12971 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12972 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12973 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12974 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
12975 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
12979 static const struct hda_verb alc268_dell_verbs
[] = {
12980 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12981 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12982 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12983 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
12987 /* mute/unmute internal speaker according to the hp jack and mute state */
12988 static void alc268_dell_setup(struct hda_codec
*codec
)
12990 struct alc_spec
*spec
= codec
->spec
;
12992 spec
->autocfg
.hp_pins
[0] = 0x15;
12993 spec
->autocfg
.speaker_pins
[0] = 0x14;
12994 spec
->ext_mic
.pin
= 0x18;
12995 spec
->ext_mic
.mux_idx
= 0;
12996 spec
->int_mic
.pin
= 0x19;
12997 spec
->int_mic
.mux_idx
= 1;
12998 spec
->auto_mic
= 1;
12999 spec
->automute
= 1;
13000 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
13003 static const struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
13004 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13005 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13006 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13008 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13009 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
13010 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13011 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13015 static const struct hda_verb alc267_quanta_il1_verbs
[] = {
13016 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13017 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
13021 static void alc267_quanta_il1_setup(struct hda_codec
*codec
)
13023 struct alc_spec
*spec
= codec
->spec
;
13024 spec
->autocfg
.hp_pins
[0] = 0x15;
13025 spec
->autocfg
.speaker_pins
[0] = 0x14;
13026 spec
->ext_mic
.pin
= 0x18;
13027 spec
->ext_mic
.mux_idx
= 0;
13028 spec
->int_mic
.pin
= 0x19;
13029 spec
->int_mic
.mux_idx
= 1;
13030 spec
->auto_mic
= 1;
13031 spec
->automute
= 1;
13032 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
13036 * generic initialization of ADC, input mixers and output mixers
13038 static const struct hda_verb alc268_base_init_verbs
[] = {
13039 /* Unmute DAC0-1 and set vol = 0 */
13040 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13041 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13044 * Set up output mixers (0x0c - 0x0e)
13046 /* set vol=0 to output mixers */
13047 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13048 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
13050 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13051 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13053 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
13054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
13055 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
13056 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13057 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13058 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13059 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13060 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13062 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13063 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13064 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13065 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13066 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13068 /* set PCBEEP vol = 0, mute connections */
13069 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13070 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13071 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13073 /* Unmute Selector 23h,24h and set the default input to mic-in */
13075 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
13076 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13077 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
13078 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13083 /* only for model=test */
13084 #ifdef CONFIG_SND_DEBUG
13086 * generic initialization of ADC, input mixers and output mixers
13088 static const struct hda_verb alc268_volume_init_verbs
[] = {
13089 /* set output DAC */
13090 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13091 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13093 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13094 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
13095 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13096 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13097 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
13099 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13100 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13101 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13103 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13104 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13107 #endif /* CONFIG_SND_DEBUG */
13109 /* set PCBEEP vol = 0, mute connections */
13110 static const struct hda_verb alc268_beep_init_verbs
[] = {
13111 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13112 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13113 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13117 static const struct snd_kcontrol_new alc268_capture_nosrc_mixer
[] = {
13118 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13119 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13123 static const struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
13124 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13125 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13130 static const struct snd_kcontrol_new alc268_capture_mixer
[] = {
13131 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13132 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
13133 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
13134 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
13139 static const struct hda_input_mux alc268_capture_source
= {
13143 { "Front Mic", 0x1 },
13149 static const struct hda_input_mux alc268_acer_capture_source
= {
13153 { "Internal Mic", 0x1 },
13158 static const struct hda_input_mux alc268_acer_dmic_capture_source
= {
13162 { "Internal Mic", 0x6 },
13167 #ifdef CONFIG_SND_DEBUG
13168 static const struct snd_kcontrol_new alc268_test_mixer
[] = {
13169 /* Volume widgets */
13170 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13171 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13172 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
13173 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
13174 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
13175 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
13176 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
13177 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
13178 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
13179 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
13180 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
13181 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
13182 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
13183 /* The below appears problematic on some hardwares */
13184 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13185 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
13186 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
13187 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
13188 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
13190 /* Modes for retasking pin widgets */
13191 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
13192 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
13193 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
13194 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
13196 /* Controls for GPIO pins, assuming they are configured as outputs */
13197 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13198 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13199 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13200 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13202 /* Switches to allow the digital SPDIF output pin to be enabled.
13203 * The ALC268 does not have an SPDIF input.
13205 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13207 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13208 * this output to turn on an external amplifier.
13210 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13211 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13217 /* create input playback/capture controls for the given pin */
13218 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
13219 const char *ctlname
, int idx
)
13230 case 0x1a: /* ALC259/269 only */
13231 case 0x1b: /* ALC259/269 only */
13232 case 0x21: /* ALC269vb has this pin, too */
13236 snd_printd(KERN_WARNING
"hda_codec: "
13237 "ignoring pin 0x%x as unknown\n", nid
);
13240 if (spec
->multiout
.dac_nids
[0] != dac
&&
13241 spec
->multiout
.dac_nids
[1] != dac
) {
13242 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
13243 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
13247 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
13251 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13252 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
13254 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13255 HDA_COMPOSE_AMP_VAL(nid
, 2, idx
, HDA_OUTPUT
));
13261 /* add playback controls from the parsed DAC table */
13262 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13263 const struct auto_pin_cfg
*cfg
)
13268 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
13270 nid
= cfg
->line_out_pins
[0];
13274 name
= alc_get_line_out_pfx(spec
, 0, true, &index
);
13275 err
= alc268_new_analog_output(spec
, nid
, name
, 0);
13280 nid
= cfg
->speaker_pins
[0];
13282 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, "Speaker",
13283 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
13287 err
= alc268_new_analog_output(spec
, nid
, "Speaker", 0);
13291 nid
= cfg
->hp_pins
[0];
13293 err
= alc268_new_analog_output(spec
, nid
, "Headphone", 0);
13298 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
13300 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, "Mono",
13301 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
));
13308 static void alc268_auto_set_output_and_unmute(struct hda_codec
*codec
,
13309 hda_nid_t nid
, int pin_type
)
13313 alc_set_pin_output(codec
, nid
, pin_type
);
13314 if (snd_hda_get_conn_list(codec
, nid
, NULL
) <= 1)
13316 if (nid
== 0x14 || nid
== 0x16)
13320 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
13323 static void alc268_auto_init_dac(struct hda_codec
*codec
, hda_nid_t nid
)
13327 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13331 static void alc268_auto_init_multi_out(struct hda_codec
*codec
)
13333 struct alc_spec
*spec
= codec
->spec
;
13336 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
13337 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13338 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13339 alc268_auto_set_output_and_unmute(codec
, nid
, pin_type
);
13342 for (i
= 0; i
< spec
->multiout
.num_dacs
; i
++)
13343 alc268_auto_init_dac(codec
, spec
->multiout
.dac_nids
[i
]);
13346 static void alc268_auto_init_hp_out(struct hda_codec
*codec
)
13348 struct alc_spec
*spec
= codec
->spec
;
13352 for (i
= 0; i
< spec
->autocfg
.hp_outs
; i
++) {
13353 pin
= spec
->autocfg
.hp_pins
[i
];
13354 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
13356 for (i
= 0; i
< spec
->autocfg
.speaker_outs
; i
++) {
13357 pin
= spec
->autocfg
.speaker_pins
[i
];
13358 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
13360 if (spec
->autocfg
.mono_out_pin
)
13361 snd_hda_codec_write(codec
, spec
->autocfg
.mono_out_pin
, 0,
13362 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13364 alc268_auto_init_dac(codec
, spec
->multiout
.hp_nid
);
13365 for (i
= 0; i
< ARRAY_SIZE(spec
->multiout
.extra_out_nid
); i
++)
13366 alc268_auto_init_dac(codec
, spec
->multiout
.extra_out_nid
[i
]);
13369 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
13371 struct alc_spec
*spec
= codec
->spec
;
13372 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
13373 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
13374 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
13375 unsigned int dac_vol1
, dac_vol2
;
13377 if (line_nid
== 0x1d || speaker_nid
== 0x1d) {
13378 snd_hda_codec_write(codec
, speaker_nid
, 0,
13379 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13380 /* mute mixer inputs from 0x1d */
13381 snd_hda_codec_write(codec
, 0x0f, 0,
13382 AC_VERB_SET_AMP_GAIN_MUTE
,
13384 snd_hda_codec_write(codec
, 0x10, 0,
13385 AC_VERB_SET_AMP_GAIN_MUTE
,
13388 /* unmute mixer inputs from 0x1d */
13389 snd_hda_codec_write(codec
, 0x0f, 0,
13390 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13391 snd_hda_codec_write(codec
, 0x10, 0,
13392 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13395 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
13396 if (line_nid
== 0x14)
13397 dac_vol2
= AMP_OUT_ZERO
;
13398 else if (line_nid
== 0x15)
13399 dac_vol1
= AMP_OUT_ZERO
;
13400 if (hp_nid
== 0x14)
13401 dac_vol2
= AMP_OUT_ZERO
;
13402 else if (hp_nid
== 0x15)
13403 dac_vol1
= AMP_OUT_ZERO
;
13404 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
13405 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
13406 spec
->autocfg
.line_out_pins
[2] != 0x16)
13407 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
13409 snd_hda_codec_write(codec
, 0x02, 0,
13410 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
13411 snd_hda_codec_write(codec
, 0x03, 0,
13412 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
13415 /* pcm configuration: identical with ALC880 */
13416 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13417 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13418 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13419 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13422 * BIOS auto configuration
13424 static int alc268_parse_auto_config(struct hda_codec
*codec
)
13426 struct alc_spec
*spec
= codec
->spec
;
13428 static const hda_nid_t alc268_ignore
[] = { 0 };
13430 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13434 if (!spec
->autocfg
.line_outs
) {
13435 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
13436 spec
->multiout
.max_channels
= 2;
13437 spec
->no_analog
= 1;
13440 return 0; /* can't find valid BIOS pin config */
13442 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13445 err
= alc_auto_create_input_ctls(codec
);
13449 spec
->multiout
.max_channels
= 2;
13452 /* digital only support output */
13453 alc_auto_parse_digital(codec
);
13454 if (spec
->kctls
.list
)
13455 add_mixer(spec
, spec
->kctls
.list
);
13457 if (!spec
->no_analog
&& spec
->autocfg
.speaker_pins
[0] != 0x1d) {
13458 add_mixer(spec
, alc268_beep_mixer
);
13459 add_verb(spec
, alc268_beep_init_verbs
);
13462 spec
->num_mux_defs
= 2;
13463 spec
->input_mux
= &spec
->private_imux
[0];
13465 err
= alc_auto_add_mic_boost(codec
);
13469 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
13474 #define alc268_auto_init_input_src alc882_auto_init_input_src
13476 /* init callback for auto-configuration model -- overriding the default init */
13477 static void alc268_auto_init(struct hda_codec
*codec
)
13479 struct alc_spec
*spec
= codec
->spec
;
13480 alc268_auto_init_multi_out(codec
);
13481 alc268_auto_init_hp_out(codec
);
13482 alc268_auto_init_mono_speaker_out(codec
);
13483 alc_auto_init_analog_input(codec
);
13484 alc268_auto_init_input_src(codec
);
13485 alc_auto_init_digital(codec
);
13486 if (spec
->unsol_event
)
13487 alc_inithook(codec
);
13491 * configuration and preset
13493 static const char * const alc268_models
[ALC268_MODEL_LAST
] = {
13494 [ALC267_QUANTA_IL1
] = "quanta-il1",
13495 [ALC268_3ST
] = "3stack",
13496 [ALC268_TOSHIBA
] = "toshiba",
13497 [ALC268_ACER
] = "acer",
13498 [ALC268_ACER_DMIC
] = "acer-dmic",
13499 [ALC268_ACER_ASPIRE_ONE
] = "acer-aspire",
13500 [ALC268_DELL
] = "dell",
13501 [ALC268_ZEPTO
] = "zepto",
13502 #ifdef CONFIG_SND_DEBUG
13503 [ALC268_TEST
] = "test",
13505 [ALC268_AUTO
] = "auto",
13508 static const struct snd_pci_quirk alc268_cfg_tbl
[] = {
13509 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
13510 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
13511 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
13512 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
13513 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
13514 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13515 ALC268_ACER_ASPIRE_ONE
),
13516 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
13517 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO
),
13518 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13519 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL
),
13520 /* almost compatible with toshiba but with optional digital outs;
13521 * auto-probing seems working fine
13523 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13525 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
13526 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
13527 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
13528 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
13532 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13533 static const struct snd_pci_quirk alc268_ssid_cfg_tbl
[] = {
13534 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO
),
13535 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO
),
13536 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13541 static const struct alc_config_preset alc268_presets
[] = {
13542 [ALC267_QUANTA_IL1
] = {
13543 .mixers
= { alc267_quanta_il1_mixer
, alc268_beep_mixer
,
13544 alc268_capture_nosrc_mixer
},
13545 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13546 alc267_quanta_il1_verbs
},
13547 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13548 .dac_nids
= alc268_dac_nids
,
13549 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13550 .adc_nids
= alc268_adc_nids_alt
,
13552 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13553 .channel_mode
= alc268_modes
,
13554 .unsol_event
= alc_sku_unsol_event
,
13555 .setup
= alc267_quanta_il1_setup
,
13556 .init_hook
= alc_inithook
,
13559 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
13560 alc268_beep_mixer
},
13561 .init_verbs
= { alc268_base_init_verbs
},
13562 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13563 .dac_nids
= alc268_dac_nids
,
13564 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13565 .adc_nids
= alc268_adc_nids_alt
,
13566 .capsrc_nids
= alc268_capsrc_nids
,
13568 .dig_out_nid
= ALC268_DIGOUT_NID
,
13569 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13570 .channel_mode
= alc268_modes
,
13571 .input_mux
= &alc268_capture_source
,
13573 [ALC268_TOSHIBA
] = {
13574 .mixers
= { alc268_toshiba_mixer
, alc268_capture_alt_mixer
,
13575 alc268_beep_mixer
},
13576 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13577 alc268_toshiba_verbs
},
13578 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13579 .dac_nids
= alc268_dac_nids
,
13580 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13581 .adc_nids
= alc268_adc_nids_alt
,
13582 .capsrc_nids
= alc268_capsrc_nids
,
13584 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13585 .channel_mode
= alc268_modes
,
13586 .input_mux
= &alc268_capture_source
,
13587 .unsol_event
= alc_sku_unsol_event
,
13588 .setup
= alc268_toshiba_setup
,
13589 .init_hook
= alc_inithook
,
13592 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
13593 alc268_beep_mixer
},
13594 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13595 alc268_acer_verbs
},
13596 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13597 .dac_nids
= alc268_dac_nids
,
13598 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13599 .adc_nids
= alc268_adc_nids_alt
,
13600 .capsrc_nids
= alc268_capsrc_nids
,
13602 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13603 .channel_mode
= alc268_modes
,
13604 .input_mux
= &alc268_acer_capture_source
,
13605 .unsol_event
= alc_sku_unsol_event
,
13606 .setup
= alc268_acer_setup
,
13607 .init_hook
= alc_inithook
,
13609 [ALC268_ACER_DMIC
] = {
13610 .mixers
= { alc268_acer_dmic_mixer
, alc268_capture_alt_mixer
,
13611 alc268_beep_mixer
},
13612 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13613 alc268_acer_verbs
},
13614 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13615 .dac_nids
= alc268_dac_nids
,
13616 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13617 .adc_nids
= alc268_adc_nids_alt
,
13618 .capsrc_nids
= alc268_capsrc_nids
,
13620 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13621 .channel_mode
= alc268_modes
,
13622 .input_mux
= &alc268_acer_dmic_capture_source
,
13623 .unsol_event
= alc_sku_unsol_event
,
13624 .setup
= alc268_acer_setup
,
13625 .init_hook
= alc_inithook
,
13627 [ALC268_ACER_ASPIRE_ONE
] = {
13628 .mixers
= { alc268_acer_aspire_one_mixer
,
13630 alc268_capture_nosrc_mixer
},
13631 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13632 alc268_acer_aspire_one_verbs
},
13633 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13634 .dac_nids
= alc268_dac_nids
,
13635 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13636 .adc_nids
= alc268_adc_nids_alt
,
13637 .capsrc_nids
= alc268_capsrc_nids
,
13639 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13640 .channel_mode
= alc268_modes
,
13641 .unsol_event
= alc_sku_unsol_event
,
13642 .setup
= alc268_acer_lc_setup
,
13643 .init_hook
= alc_inithook
,
13646 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
,
13647 alc268_capture_nosrc_mixer
},
13648 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13649 alc268_dell_verbs
},
13650 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13651 .dac_nids
= alc268_dac_nids
,
13652 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13653 .adc_nids
= alc268_adc_nids_alt
,
13654 .capsrc_nids
= alc268_capsrc_nids
,
13656 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13657 .channel_mode
= alc268_modes
,
13658 .unsol_event
= alc_sku_unsol_event
,
13659 .setup
= alc268_dell_setup
,
13660 .init_hook
= alc_inithook
,
13663 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
13664 alc268_beep_mixer
},
13665 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13666 alc268_toshiba_verbs
},
13667 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13668 .dac_nids
= alc268_dac_nids
,
13669 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13670 .adc_nids
= alc268_adc_nids_alt
,
13671 .capsrc_nids
= alc268_capsrc_nids
,
13673 .dig_out_nid
= ALC268_DIGOUT_NID
,
13674 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13675 .channel_mode
= alc268_modes
,
13676 .input_mux
= &alc268_capture_source
,
13677 .unsol_event
= alc_sku_unsol_event
,
13678 .setup
= alc268_toshiba_setup
,
13679 .init_hook
= alc_inithook
,
13681 #ifdef CONFIG_SND_DEBUG
13683 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
13684 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13685 alc268_volume_init_verbs
,
13686 alc268_beep_init_verbs
},
13687 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13688 .dac_nids
= alc268_dac_nids
,
13689 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13690 .adc_nids
= alc268_adc_nids_alt
,
13691 .capsrc_nids
= alc268_capsrc_nids
,
13693 .dig_out_nid
= ALC268_DIGOUT_NID
,
13694 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13695 .channel_mode
= alc268_modes
,
13696 .input_mux
= &alc268_capture_source
,
13701 static int patch_alc268(struct hda_codec
*codec
)
13703 struct alc_spec
*spec
;
13705 int i
, has_beep
, err
;
13707 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13711 codec
->spec
= spec
;
13713 /* ALC268 has no aa-loopback mixer */
13715 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
13719 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
)
13720 board_config
= snd_hda_check_board_codec_sid_config(codec
,
13721 ALC268_MODEL_LAST
, alc268_models
, alc268_ssid_cfg_tbl
);
13723 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
13724 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
13726 board_config
= ALC268_AUTO
;
13729 if (board_config
== ALC268_AUTO
) {
13730 /* automatic parse from the BIOS config */
13731 err
= alc268_parse_auto_config(codec
);
13737 "hda_codec: Cannot set up configuration "
13738 "from BIOS. Using base mode...\n");
13739 board_config
= ALC268_3ST
;
13743 if (board_config
!= ALC268_AUTO
)
13744 setup_preset(codec
, &alc268_presets
[board_config
]);
13746 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
13747 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
13748 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
13750 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
13753 for (i
= 0; i
< spec
->num_mixers
; i
++) {
13754 if (spec
->mixers
[i
] == alc268_beep_mixer
) {
13761 err
= snd_hda_attach_beep_device(codec
, 0x1);
13766 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
13767 /* override the amp caps for beep generator */
13768 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
13769 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
13770 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
13771 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
13772 (0 << AC_AMPCAP_MUTE_SHIFT
));
13775 if (!spec
->no_analog
&& !spec
->adc_nids
&& spec
->input_mux
) {
13776 /* check whether NID 0x07 is valid */
13777 unsigned int wcap
= get_wcaps(codec
, 0x07);
13779 spec
->capsrc_nids
= alc268_capsrc_nids
;
13781 wcap
= get_wcaps_type(wcap
);
13782 if (spec
->auto_mic
||
13783 wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
13784 spec
->adc_nids
= alc268_adc_nids_alt
;
13785 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
13786 if (spec
->auto_mic
)
13787 fixup_automic_adc(codec
);
13788 if (spec
->auto_mic
|| spec
->input_mux
->num_items
== 1)
13789 add_mixer(spec
, alc268_capture_nosrc_mixer
);
13791 add_mixer(spec
, alc268_capture_alt_mixer
);
13793 spec
->adc_nids
= alc268_adc_nids
;
13794 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
13795 add_mixer(spec
, alc268_capture_mixer
);
13799 spec
->vmaster_nid
= 0x02;
13801 codec
->patch_ops
= alc_patch_ops
;
13802 if (board_config
== ALC268_AUTO
)
13803 spec
->init_hook
= alc268_auto_init
;
13804 spec
->shutup
= alc_eapd_shutup
;
13806 alc_init_jacks(codec
);
13812 * ALC269 channel source setting (2 channel)
13814 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13816 #define alc269_dac_nids alc260_dac_nids
13818 static const hda_nid_t alc269_adc_nids
[1] = {
13823 static const hda_nid_t alc269_capsrc_nids
[1] = {
13827 static const hda_nid_t alc269vb_adc_nids
[1] = {
13832 static const hda_nid_t alc269vb_capsrc_nids
[1] = {
13836 static const hda_nid_t alc269_adc_candidates
[] = {
13837 0x08, 0x09, 0x07, 0x11,
13840 #define alc269_modes alc260_modes
13841 #define alc269_capture_source alc880_lg_lw_capture_source
13843 static const struct snd_kcontrol_new alc269_base_mixer
[] = {
13844 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13845 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13846 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13847 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13850 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13851 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
13852 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
13853 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13855 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
13859 static const struct snd_kcontrol_new alc269_quanta_fl1_mixer
[] = {
13860 /* output mixer control */
13861 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13863 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13864 .name
= "Master Playback Switch",
13865 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
13866 .info
= snd_hda_mixer_amp_switch_info
,
13867 .get
= snd_hda_mixer_amp_switch_get
,
13868 .put
= alc268_acer_master_sw_put
,
13869 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
13871 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13872 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13873 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13874 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
13875 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
13876 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13880 static const struct snd_kcontrol_new alc269_lifebook_mixer
[] = {
13881 /* output mixer control */
13882 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13884 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13885 .name
= "Master Playback Switch",
13886 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
13887 .info
= snd_hda_mixer_amp_switch_info
,
13888 .get
= snd_hda_mixer_amp_switch_get
,
13889 .put
= alc268_acer_master_sw_put
,
13890 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
13892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13894 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13895 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
13896 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
13897 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13898 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT
),
13899 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT
),
13900 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT
),
13904 static const struct snd_kcontrol_new alc269_laptop_mixer
[] = {
13905 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13906 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13907 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13908 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13912 static const struct snd_kcontrol_new alc269vb_laptop_mixer
[] = {
13913 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13914 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13916 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13920 static const struct snd_kcontrol_new alc269_asus_mixer
[] = {
13921 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13922 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT
),
13926 /* capture mixer elements */
13927 static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer
[] = {
13928 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
13929 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
13930 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13931 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13935 static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer
[] = {
13936 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
13937 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
13938 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13942 static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer
[] = {
13943 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
13944 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
13945 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13946 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
13950 static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer
[] = {
13951 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
13952 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
13953 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
13958 #define alc269_fujitsu_mixer alc269_laptop_mixer
13960 static const struct hda_verb alc269_quanta_fl1_verbs
[] = {
13961 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13962 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13964 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13965 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13966 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13970 static const struct hda_verb alc269_lifebook_verbs
[] = {
13971 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13972 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
13973 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13975 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13976 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13978 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13979 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13980 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13984 /* toggle speaker-output according to the hp-jack state */
13985 static void alc269_quanta_fl1_speaker_automute(struct hda_codec
*codec
)
13987 alc_hp_automute(codec
);
13989 snd_hda_codec_write(codec
, 0x20, 0,
13990 AC_VERB_SET_COEF_INDEX
, 0x0c);
13991 snd_hda_codec_write(codec
, 0x20, 0,
13992 AC_VERB_SET_PROC_COEF
, 0x680);
13994 snd_hda_codec_write(codec
, 0x20, 0,
13995 AC_VERB_SET_COEF_INDEX
, 0x0c);
13996 snd_hda_codec_write(codec
, 0x20, 0,
13997 AC_VERB_SET_PROC_COEF
, 0x480);
14000 #define alc269_lifebook_speaker_automute \
14001 alc269_quanta_fl1_speaker_automute
14003 static void alc269_lifebook_mic_autoswitch(struct hda_codec
*codec
)
14005 unsigned int present_laptop
;
14006 unsigned int present_dock
;
14008 present_laptop
= snd_hda_jack_detect(codec
, 0x18);
14009 present_dock
= snd_hda_jack_detect(codec
, 0x1b);
14011 /* Laptop mic port overrides dock mic port, design decision */
14013 snd_hda_codec_write(codec
, 0x23, 0,
14014 AC_VERB_SET_CONNECT_SEL
, 0x3);
14015 if (present_laptop
)
14016 snd_hda_codec_write(codec
, 0x23, 0,
14017 AC_VERB_SET_CONNECT_SEL
, 0x0);
14018 if (!present_dock
&& !present_laptop
)
14019 snd_hda_codec_write(codec
, 0x23, 0,
14020 AC_VERB_SET_CONNECT_SEL
, 0x1);
14023 static void alc269_quanta_fl1_unsol_event(struct hda_codec
*codec
,
14026 switch (res
>> 26) {
14027 case ALC880_HP_EVENT
:
14028 alc269_quanta_fl1_speaker_automute(codec
);
14030 case ALC880_MIC_EVENT
:
14031 alc_mic_automute(codec
);
14036 static void alc269_lifebook_unsol_event(struct hda_codec
*codec
,
14039 if ((res
>> 26) == ALC880_HP_EVENT
)
14040 alc269_lifebook_speaker_automute(codec
);
14041 if ((res
>> 26) == ALC880_MIC_EVENT
)
14042 alc269_lifebook_mic_autoswitch(codec
);
14045 static void alc269_quanta_fl1_setup(struct hda_codec
*codec
)
14047 struct alc_spec
*spec
= codec
->spec
;
14048 spec
->autocfg
.hp_pins
[0] = 0x15;
14049 spec
->autocfg
.speaker_pins
[0] = 0x14;
14050 spec
->automute_mixer_nid
[0] = 0x0c;
14051 spec
->automute
= 1;
14052 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14053 spec
->ext_mic
.pin
= 0x18;
14054 spec
->ext_mic
.mux_idx
= 0;
14055 spec
->int_mic
.pin
= 0x19;
14056 spec
->int_mic
.mux_idx
= 1;
14057 spec
->auto_mic
= 1;
14060 static void alc269_quanta_fl1_init_hook(struct hda_codec
*codec
)
14062 alc269_quanta_fl1_speaker_automute(codec
);
14063 alc_mic_automute(codec
);
14066 static void alc269_lifebook_setup(struct hda_codec
*codec
)
14068 struct alc_spec
*spec
= codec
->spec
;
14069 spec
->autocfg
.hp_pins
[0] = 0x15;
14070 spec
->autocfg
.hp_pins
[1] = 0x1a;
14071 spec
->autocfg
.speaker_pins
[0] = 0x14;
14072 spec
->automute_mixer_nid
[0] = 0x0c;
14073 spec
->automute
= 1;
14074 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14077 static void alc269_lifebook_init_hook(struct hda_codec
*codec
)
14079 alc269_lifebook_speaker_automute(codec
);
14080 alc269_lifebook_mic_autoswitch(codec
);
14083 static const struct hda_verb alc269_laptop_dmic_init_verbs
[] = {
14084 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14085 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
14086 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14087 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14088 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14089 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14090 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14094 static const struct hda_verb alc269_laptop_amic_init_verbs
[] = {
14095 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14096 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
14097 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14098 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
14099 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14100 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14104 static const struct hda_verb alc269vb_laptop_dmic_init_verbs
[] = {
14105 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
14106 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x06},
14107 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14108 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14109 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14110 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14111 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14115 static const struct hda_verb alc269vb_laptop_amic_init_verbs
[] = {
14116 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
14117 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x01},
14118 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
14119 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
14120 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14121 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14122 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14126 static const struct hda_verb alc271_acer_dmic_verbs
[] = {
14127 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0d},
14128 {0x20, AC_VERB_SET_PROC_COEF
, 0x4000},
14129 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14130 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14131 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14132 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14133 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00},
14134 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14135 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14136 {0x22, AC_VERB_SET_CONNECT_SEL
, 6},
14140 static void alc269_laptop_amic_setup(struct hda_codec
*codec
)
14142 struct alc_spec
*spec
= codec
->spec
;
14143 spec
->autocfg
.hp_pins
[0] = 0x15;
14144 spec
->autocfg
.speaker_pins
[0] = 0x14;
14145 spec
->automute_mixer_nid
[0] = 0x0c;
14146 spec
->automute
= 1;
14147 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14148 spec
->ext_mic
.pin
= 0x18;
14149 spec
->ext_mic
.mux_idx
= 0;
14150 spec
->int_mic
.pin
= 0x19;
14151 spec
->int_mic
.mux_idx
= 1;
14152 spec
->auto_mic
= 1;
14155 static void alc269_laptop_dmic_setup(struct hda_codec
*codec
)
14157 struct alc_spec
*spec
= codec
->spec
;
14158 spec
->autocfg
.hp_pins
[0] = 0x15;
14159 spec
->autocfg
.speaker_pins
[0] = 0x14;
14160 spec
->automute_mixer_nid
[0] = 0x0c;
14161 spec
->automute
= 1;
14162 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14163 spec
->ext_mic
.pin
= 0x18;
14164 spec
->ext_mic
.mux_idx
= 0;
14165 spec
->int_mic
.pin
= 0x12;
14166 spec
->int_mic
.mux_idx
= 5;
14167 spec
->auto_mic
= 1;
14170 static void alc269vb_laptop_amic_setup(struct hda_codec
*codec
)
14172 struct alc_spec
*spec
= codec
->spec
;
14173 spec
->autocfg
.hp_pins
[0] = 0x21;
14174 spec
->autocfg
.speaker_pins
[0] = 0x14;
14175 spec
->automute_mixer_nid
[0] = 0x0c;
14176 spec
->automute
= 1;
14177 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14178 spec
->ext_mic
.pin
= 0x18;
14179 spec
->ext_mic
.mux_idx
= 0;
14180 spec
->int_mic
.pin
= 0x19;
14181 spec
->int_mic
.mux_idx
= 1;
14182 spec
->auto_mic
= 1;
14185 static void alc269vb_laptop_dmic_setup(struct hda_codec
*codec
)
14187 struct alc_spec
*spec
= codec
->spec
;
14188 spec
->autocfg
.hp_pins
[0] = 0x21;
14189 spec
->autocfg
.speaker_pins
[0] = 0x14;
14190 spec
->automute_mixer_nid
[0] = 0x0c;
14191 spec
->automute
= 1;
14192 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
14193 spec
->ext_mic
.pin
= 0x18;
14194 spec
->ext_mic
.mux_idx
= 0;
14195 spec
->int_mic
.pin
= 0x12;
14196 spec
->int_mic
.mux_idx
= 6;
14197 spec
->auto_mic
= 1;
14201 * generic initialization of ADC, input mixers and output mixers
14203 static const struct hda_verb alc269_init_verbs
[] = {
14205 * Unmute ADC0 and set the default input to mic-in
14207 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14210 * Set up output mixers (0x02 - 0x03)
14212 /* set vol=0 to output mixers */
14213 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14214 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14216 /* set up input amps for analog loopback */
14217 /* Amp Indices: DAC = 0, mixer = 1 */
14218 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14220 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14221 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14222 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14223 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14225 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14226 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14227 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14228 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14229 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14230 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14231 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14233 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14234 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14236 /* FIXME: use Mux-type input source selection */
14237 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14238 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14239 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
14242 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14246 static const struct hda_verb alc269vb_init_verbs
[] = {
14248 * Unmute ADC0 and set the default input to mic-in
14250 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14253 * Set up output mixers (0x02 - 0x03)
14255 /* set vol=0 to output mixers */
14256 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14257 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14259 /* set up input amps for analog loopback */
14260 /* Amp Indices: DAC = 0, mixer = 1 */
14261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14263 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14264 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14265 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14266 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14269 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14270 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14271 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14272 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14273 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14274 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14276 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14277 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14279 /* FIXME: use Mux-type input source selection */
14280 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14281 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14282 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x00},
14285 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14289 #define alc269_auto_create_multi_out_ctls \
14290 alc268_auto_create_multi_out_ctls
14292 #ifdef CONFIG_SND_HDA_POWER_SAVE
14293 #define alc269_loopbacks alc880_loopbacks
14296 /* pcm configuration: identical with ALC880 */
14297 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14298 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14299 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14300 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14302 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback
= {
14306 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14307 /* NID is set in alc_build_pcms */
14309 .open
= alc880_playback_pcm_open
,
14310 .prepare
= alc880_playback_pcm_prepare
,
14311 .cleanup
= alc880_playback_pcm_cleanup
14315 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture
= {
14319 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14320 /* NID is set in alc_build_pcms */
14323 #ifdef CONFIG_SND_HDA_POWER_SAVE
14324 static int alc269_mic2_for_mute_led(struct hda_codec
*codec
)
14326 switch (codec
->subsystem_id
) {
14333 static int alc269_mic2_mute_check_ps(struct hda_codec
*codec
, hda_nid_t nid
)
14335 /* update mute-LED according to the speaker mute state */
14336 if (nid
== 0x01 || nid
== 0x14) {
14338 if (snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0) &
14343 /* mic2 vref pin is used for mute LED control */
14344 snd_hda_codec_update_cache(codec
, 0x19, 0,
14345 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14348 return alc_check_power_status(codec
, nid
);
14350 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14352 static int alc275_setup_dual_adc(struct hda_codec
*codec
)
14354 struct alc_spec
*spec
= codec
->spec
;
14356 if (codec
->vendor_id
!= 0x10ec0275 || !spec
->auto_mic
)
14358 if ((spec
->ext_mic
.pin
>= 0x18 && spec
->int_mic
.pin
<= 0x13) ||
14359 (spec
->ext_mic
.pin
<= 0x12 && spec
->int_mic
.pin
>= 0x18)) {
14360 if (spec
->ext_mic
.pin
<= 0x12) {
14361 spec
->private_adc_nids
[0] = 0x08;
14362 spec
->private_adc_nids
[1] = 0x11;
14363 spec
->private_capsrc_nids
[0] = 0x23;
14364 spec
->private_capsrc_nids
[1] = 0x22;
14366 spec
->private_adc_nids
[0] = 0x11;
14367 spec
->private_adc_nids
[1] = 0x08;
14368 spec
->private_capsrc_nids
[0] = 0x22;
14369 spec
->private_capsrc_nids
[1] = 0x23;
14371 spec
->adc_nids
= spec
->private_adc_nids
;
14372 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
14373 spec
->num_adc_nids
= 2;
14374 spec
->dual_adc_switch
= 1;
14375 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14376 spec
->adc_nids
[0], spec
->adc_nids
[1]);
14382 /* different alc269-variants */
14384 ALC269_TYPE_ALC269VA
,
14385 ALC269_TYPE_ALC269VB
,
14386 ALC269_TYPE_ALC269VC
,
14390 * BIOS auto configuration
14392 static int alc269_parse_auto_config(struct hda_codec
*codec
)
14394 struct alc_spec
*spec
= codec
->spec
;
14396 static const hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
14398 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14403 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14406 err
= alc_auto_create_input_ctls(codec
);
14410 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14412 alc_auto_parse_digital(codec
);
14414 if (spec
->kctls
.list
)
14415 add_mixer(spec
, spec
->kctls
.list
);
14417 if (spec
->codec_variant
!= ALC269_TYPE_ALC269VA
)
14418 alc_ssid_check(codec
, 0, 0x1b, 0x14, 0x21);
14420 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
14422 spec
->num_mux_defs
= 1;
14423 spec
->input_mux
= &spec
->private_imux
[0];
14425 if (!alc275_setup_dual_adc(codec
))
14426 fillup_priv_adc_nids(codec
, alc269_adc_candidates
,
14427 sizeof(alc269_adc_candidates
));
14429 err
= alc_auto_add_mic_boost(codec
);
14433 if (!spec
->cap_mixer
&& !spec
->no_analog
)
14434 set_capture_mixer(codec
);
14439 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14440 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14441 #define alc269_auto_init_input_src alc882_auto_init_input_src
14444 /* init callback for auto-configuration model -- overriding the default init */
14445 static void alc269_auto_init(struct hda_codec
*codec
)
14447 struct alc_spec
*spec
= codec
->spec
;
14448 alc269_auto_init_multi_out(codec
);
14449 alc269_auto_init_hp_out(codec
);
14450 alc_auto_init_analog_input(codec
);
14451 if (!spec
->dual_adc_switch
)
14452 alc269_auto_init_input_src(codec
);
14453 alc_auto_init_digital(codec
);
14454 if (spec
->unsol_event
)
14455 alc_inithook(codec
);
14458 static void alc269_toggle_power_output(struct hda_codec
*codec
, int power_up
)
14460 int val
= alc_read_coef_idx(codec
, 0x04);
14465 alc_write_coef_idx(codec
, 0x04, val
);
14468 static void alc269_shutup(struct hda_codec
*codec
)
14470 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017)
14471 alc269_toggle_power_output(codec
, 0);
14472 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14473 alc269_toggle_power_output(codec
, 0);
14478 #ifdef SND_HDA_NEEDS_RESUME
14479 static int alc269_resume(struct hda_codec
*codec
)
14481 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14482 alc269_toggle_power_output(codec
, 0);
14486 codec
->patch_ops
.init(codec
);
14488 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017) {
14489 alc269_toggle_power_output(codec
, 1);
14493 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018)
14494 alc269_toggle_power_output(codec
, 1);
14496 snd_hda_codec_resume_amp(codec
);
14497 snd_hda_codec_resume_cache(codec
);
14498 hda_call_check_power_status(codec
, 0x01);
14501 #endif /* SND_HDA_NEEDS_RESUME */
14503 static void alc269_fixup_hweq(struct hda_codec
*codec
,
14504 const struct alc_fixup
*fix
, int action
)
14508 if (action
!= ALC_FIXUP_ACT_INIT
)
14510 coef
= alc_read_coef_idx(codec
, 0x1e);
14511 alc_write_coef_idx(codec
, 0x1e, coef
| 0x80);
14514 static void alc271_fixup_dmic(struct hda_codec
*codec
,
14515 const struct alc_fixup
*fix
, int action
)
14517 static const struct hda_verb verbs
[] = {
14518 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0d},
14519 {0x20, AC_VERB_SET_PROC_COEF
, 0x4000},
14524 if (strcmp(codec
->chip_name
, "ALC271X"))
14526 cfg
= snd_hda_codec_get_pincfg(codec
, 0x12);
14527 if (get_defcfg_connect(cfg
) == AC_JACK_PORT_FIXED
)
14528 snd_hda_sequence_write(codec
, verbs
);
14532 ALC269_FIXUP_SONY_VAIO
,
14533 ALC275_FIXUP_SONY_VAIO_GPIO2
,
14534 ALC269_FIXUP_DELL_M101Z
,
14535 ALC269_FIXUP_SKU_IGNORE
,
14536 ALC269_FIXUP_ASUS_G73JW
,
14537 ALC269_FIXUP_LENOVO_EAPD
,
14538 ALC275_FIXUP_SONY_HWEQ
,
14542 static const struct alc_fixup alc269_fixups
[] = {
14543 [ALC269_FIXUP_SONY_VAIO
] = {
14544 .type
= ALC_FIXUP_VERBS
,
14545 .v
.verbs
= (const struct hda_verb
[]) {
14546 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREFGRD
},
14550 [ALC275_FIXUP_SONY_VAIO_GPIO2
] = {
14551 .type
= ALC_FIXUP_VERBS
,
14552 .v
.verbs
= (const struct hda_verb
[]) {
14553 {0x01, AC_VERB_SET_GPIO_MASK
, 0x04},
14554 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x04},
14555 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
14559 .chain_id
= ALC269_FIXUP_SONY_VAIO
14561 [ALC269_FIXUP_DELL_M101Z
] = {
14562 .type
= ALC_FIXUP_VERBS
,
14563 .v
.verbs
= (const struct hda_verb
[]) {
14564 /* Enables internal speaker */
14565 {0x20, AC_VERB_SET_COEF_INDEX
, 13},
14566 {0x20, AC_VERB_SET_PROC_COEF
, 0x4040},
14570 [ALC269_FIXUP_SKU_IGNORE
] = {
14571 .type
= ALC_FIXUP_SKU
,
14572 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
14574 [ALC269_FIXUP_ASUS_G73JW
] = {
14575 .type
= ALC_FIXUP_PINS
,
14576 .v
.pins
= (const struct alc_pincfg
[]) {
14577 { 0x17, 0x99130111 }, /* subwoofer */
14581 [ALC269_FIXUP_LENOVO_EAPD
] = {
14582 .type
= ALC_FIXUP_VERBS
,
14583 .v
.verbs
= (const struct hda_verb
[]) {
14584 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
14588 [ALC275_FIXUP_SONY_HWEQ
] = {
14589 .type
= ALC_FIXUP_FUNC
,
14590 .v
.func
= alc269_fixup_hweq
,
14592 .chain_id
= ALC275_FIXUP_SONY_VAIO_GPIO2
14594 [ALC271_FIXUP_DMIC
] = {
14595 .type
= ALC_FIXUP_FUNC
,
14596 .v
.func
= alc271_fixup_dmic
,
14600 static const struct snd_pci_quirk alc269_fixup_tbl
[] = {
14601 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2
),
14602 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ
),
14603 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ
),
14604 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO
),
14605 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z
),
14606 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC
),
14607 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE
),
14608 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE
),
14609 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE
),
14610 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE
),
14611 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE
),
14612 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW
),
14613 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD
),
14619 * configuration and preset
14621 static const char * const alc269_models
[ALC269_MODEL_LAST
] = {
14622 [ALC269_BASIC
] = "basic",
14623 [ALC269_QUANTA_FL1
] = "quanta",
14624 [ALC269_AMIC
] = "laptop-amic",
14625 [ALC269_DMIC
] = "laptop-dmic",
14626 [ALC269_FUJITSU
] = "fujitsu",
14627 [ALC269_LIFEBOOK
] = "lifebook",
14628 [ALC269_AUTO
] = "auto",
14631 static const struct snd_pci_quirk alc269_cfg_tbl
[] = {
14632 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1
),
14633 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER
),
14634 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14636 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC
),
14637 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC
),
14638 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC
),
14639 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC
),
14640 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC
),
14641 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC
),
14642 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC
),
14643 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC
),
14644 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC
),
14645 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC
),
14646 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC
),
14647 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC
),
14648 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC
),
14649 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC
),
14650 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC
),
14651 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC
),
14652 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC
),
14653 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC
),
14654 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC
),
14655 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC
),
14656 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC
),
14657 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC
),
14658 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC
),
14659 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC
),
14660 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC
),
14661 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC
),
14662 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC
),
14663 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC
),
14664 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC
),
14665 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC
),
14666 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC
),
14667 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC
),
14668 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC
),
14669 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC
),
14670 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC
),
14671 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC
),
14672 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14674 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14676 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC
),
14677 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC
),
14678 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO
),
14679 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK
),
14680 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC
),
14681 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU
),
14682 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC
),
14683 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC
),
14684 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC
),
14685 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC
),
14689 static const struct alc_config_preset alc269_presets
[] = {
14691 .mixers
= { alc269_base_mixer
},
14692 .init_verbs
= { alc269_init_verbs
},
14693 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14694 .dac_nids
= alc269_dac_nids
,
14696 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14697 .channel_mode
= alc269_modes
,
14698 .input_mux
= &alc269_capture_source
,
14700 [ALC269_QUANTA_FL1
] = {
14701 .mixers
= { alc269_quanta_fl1_mixer
},
14702 .init_verbs
= { alc269_init_verbs
, alc269_quanta_fl1_verbs
},
14703 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14704 .dac_nids
= alc269_dac_nids
,
14706 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14707 .channel_mode
= alc269_modes
,
14708 .input_mux
= &alc269_capture_source
,
14709 .unsol_event
= alc269_quanta_fl1_unsol_event
,
14710 .setup
= alc269_quanta_fl1_setup
,
14711 .init_hook
= alc269_quanta_fl1_init_hook
,
14714 .mixers
= { alc269_laptop_mixer
},
14715 .cap_mixer
= alc269_laptop_analog_capture_mixer
,
14716 .init_verbs
= { alc269_init_verbs
,
14717 alc269_laptop_amic_init_verbs
},
14718 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14719 .dac_nids
= alc269_dac_nids
,
14721 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14722 .channel_mode
= alc269_modes
,
14723 .unsol_event
= alc_sku_unsol_event
,
14724 .setup
= alc269_laptop_amic_setup
,
14725 .init_hook
= alc_inithook
,
14728 .mixers
= { alc269_laptop_mixer
},
14729 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
14730 .init_verbs
= { alc269_init_verbs
,
14731 alc269_laptop_dmic_init_verbs
},
14732 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14733 .dac_nids
= alc269_dac_nids
,
14735 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14736 .channel_mode
= alc269_modes
,
14737 .unsol_event
= alc_sku_unsol_event
,
14738 .setup
= alc269_laptop_dmic_setup
,
14739 .init_hook
= alc_inithook
,
14741 [ALC269VB_AMIC
] = {
14742 .mixers
= { alc269vb_laptop_mixer
},
14743 .cap_mixer
= alc269vb_laptop_analog_capture_mixer
,
14744 .init_verbs
= { alc269vb_init_verbs
,
14745 alc269vb_laptop_amic_init_verbs
},
14746 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14747 .dac_nids
= alc269_dac_nids
,
14749 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14750 .channel_mode
= alc269_modes
,
14751 .unsol_event
= alc_sku_unsol_event
,
14752 .setup
= alc269vb_laptop_amic_setup
,
14753 .init_hook
= alc_inithook
,
14755 [ALC269VB_DMIC
] = {
14756 .mixers
= { alc269vb_laptop_mixer
},
14757 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
14758 .init_verbs
= { alc269vb_init_verbs
,
14759 alc269vb_laptop_dmic_init_verbs
},
14760 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14761 .dac_nids
= alc269_dac_nids
,
14763 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14764 .channel_mode
= alc269_modes
,
14765 .unsol_event
= alc_sku_unsol_event
,
14766 .setup
= alc269vb_laptop_dmic_setup
,
14767 .init_hook
= alc_inithook
,
14769 [ALC269_FUJITSU
] = {
14770 .mixers
= { alc269_fujitsu_mixer
},
14771 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
14772 .init_verbs
= { alc269_init_verbs
,
14773 alc269_laptop_dmic_init_verbs
},
14774 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14775 .dac_nids
= alc269_dac_nids
,
14777 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14778 .channel_mode
= alc269_modes
,
14779 .unsol_event
= alc_sku_unsol_event
,
14780 .setup
= alc269_laptop_dmic_setup
,
14781 .init_hook
= alc_inithook
,
14783 [ALC269_LIFEBOOK
] = {
14784 .mixers
= { alc269_lifebook_mixer
},
14785 .init_verbs
= { alc269_init_verbs
, alc269_lifebook_verbs
},
14786 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14787 .dac_nids
= alc269_dac_nids
,
14789 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14790 .channel_mode
= alc269_modes
,
14791 .input_mux
= &alc269_capture_source
,
14792 .unsol_event
= alc269_lifebook_unsol_event
,
14793 .setup
= alc269_lifebook_setup
,
14794 .init_hook
= alc269_lifebook_init_hook
,
14797 .mixers
= { alc269_asus_mixer
},
14798 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
14799 .init_verbs
= { alc269_init_verbs
, alc271_acer_dmic_verbs
},
14800 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14801 .dac_nids
= alc269_dac_nids
,
14802 .adc_nids
= alc262_dmic_adc_nids
,
14803 .num_adc_nids
= ARRAY_SIZE(alc262_dmic_adc_nids
),
14804 .capsrc_nids
= alc262_dmic_capsrc_nids
,
14805 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14806 .channel_mode
= alc269_modes
,
14807 .input_mux
= &alc269_capture_source
,
14808 .dig_out_nid
= ALC880_DIGOUT_NID
,
14809 .unsol_event
= alc_sku_unsol_event
,
14810 .setup
= alc269vb_laptop_dmic_setup
,
14811 .init_hook
= alc_inithook
,
14815 static int alc269_fill_coef(struct hda_codec
*codec
)
14819 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) < 0x015) {
14820 alc_write_coef_idx(codec
, 0xf, 0x960b);
14821 alc_write_coef_idx(codec
, 0xe, 0x8817);
14824 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x016) {
14825 alc_write_coef_idx(codec
, 0xf, 0x960b);
14826 alc_write_coef_idx(codec
, 0xe, 0x8814);
14829 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x017) {
14830 val
= alc_read_coef_idx(codec
, 0x04);
14831 /* Power up output pin */
14832 alc_write_coef_idx(codec
, 0x04, val
| (1<<11));
14835 if ((alc_read_coef_idx(codec
, 0) & 0x00ff) == 0x018) {
14836 val
= alc_read_coef_idx(codec
, 0xd);
14837 if ((val
& 0x0c00) >> 10 != 0x1) {
14838 /* Capless ramp up clock control */
14839 alc_write_coef_idx(codec
, 0xd, val
| (1<<10));
14841 val
= alc_read_coef_idx(codec
, 0x17);
14842 if ((val
& 0x01c0) >> 6 != 0x4) {
14843 /* Class D power on reset */
14844 alc_write_coef_idx(codec
, 0x17, val
| (1<<7));
14848 val
= alc_read_coef_idx(codec
, 0xd); /* Class D */
14849 alc_write_coef_idx(codec
, 0xd, val
| (1<<14));
14851 val
= alc_read_coef_idx(codec
, 0x4); /* HP */
14852 alc_write_coef_idx(codec
, 0x4, val
| (1<<11));
14857 static int patch_alc269(struct hda_codec
*codec
)
14859 struct alc_spec
*spec
;
14860 int board_config
, coef
;
14863 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14867 codec
->spec
= spec
;
14869 spec
->mixer_nid
= 0x0b;
14871 alc_auto_parse_customize_define(codec
);
14873 if (codec
->vendor_id
== 0x10ec0269) {
14874 spec
->codec_variant
= ALC269_TYPE_ALC269VA
;
14875 coef
= alc_read_coef_idx(codec
, 0);
14876 if ((coef
& 0x00f0) == 0x0010) {
14877 if (codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
14878 spec
->cdefine
.platform_type
== 1) {
14879 alc_codec_rename(codec
, "ALC271X");
14880 } else if ((coef
& 0xf000) == 0x2000) {
14881 alc_codec_rename(codec
, "ALC259");
14882 } else if ((coef
& 0xf000) == 0x3000) {
14883 alc_codec_rename(codec
, "ALC258");
14884 } else if ((coef
& 0xfff0) == 0x3010) {
14885 alc_codec_rename(codec
, "ALC277");
14887 alc_codec_rename(codec
, "ALC269VB");
14889 spec
->codec_variant
= ALC269_TYPE_ALC269VB
;
14890 } else if ((coef
& 0x00f0) == 0x0020) {
14891 if (coef
== 0xa023)
14892 alc_codec_rename(codec
, "ALC259");
14893 else if (coef
== 0x6023)
14894 alc_codec_rename(codec
, "ALC281X");
14895 else if (codec
->bus
->pci
->subsystem_vendor
== 0x17aa &&
14896 codec
->bus
->pci
->subsystem_device
== 0x21f3)
14897 alc_codec_rename(codec
, "ALC3202");
14899 alc_codec_rename(codec
, "ALC269VC");
14900 spec
->codec_variant
= ALC269_TYPE_ALC269VC
;
14902 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
14903 alc269_fill_coef(codec
);
14906 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
14910 if (board_config
< 0) {
14911 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
14913 board_config
= ALC269_AUTO
;
14916 if (board_config
== ALC269_AUTO
) {
14917 alc_pick_fixup(codec
, NULL
, alc269_fixup_tbl
, alc269_fixups
);
14918 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
14921 if (board_config
== ALC269_AUTO
) {
14922 /* automatic parse from the BIOS config */
14923 err
= alc269_parse_auto_config(codec
);
14929 "hda_codec: Cannot set up configuration "
14930 "from BIOS. Using base mode...\n");
14931 board_config
= ALC269_BASIC
;
14935 if (has_cdefine_beep(codec
)) {
14936 err
= snd_hda_attach_beep_device(codec
, 0x1);
14943 if (board_config
!= ALC269_AUTO
)
14944 setup_preset(codec
, &alc269_presets
[board_config
]);
14946 if (board_config
== ALC269_QUANTA_FL1
) {
14947 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14948 * fix the sample rate of analog I/O to 44.1kHz
14950 spec
->stream_analog_playback
= &alc269_44k_pcm_analog_playback
;
14951 spec
->stream_analog_capture
= &alc269_44k_pcm_analog_capture
;
14952 } else if (spec
->dual_adc_switch
) {
14953 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
14954 /* switch ADC dynamically */
14955 spec
->stream_analog_capture
= &dualmic_pcm_analog_capture
;
14957 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
14958 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
14960 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
14961 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
14963 if (!spec
->adc_nids
) { /* wasn't filled automatically? use default */
14964 if (spec
->codec_variant
== ALC269_TYPE_ALC269VA
) {
14965 spec
->adc_nids
= alc269_adc_nids
;
14966 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
14967 spec
->capsrc_nids
= alc269_capsrc_nids
;
14969 spec
->adc_nids
= alc269vb_adc_nids
;
14970 spec
->num_adc_nids
= ARRAY_SIZE(alc269vb_adc_nids
);
14971 spec
->capsrc_nids
= alc269vb_capsrc_nids
;
14975 if (!spec
->cap_mixer
)
14976 set_capture_mixer(codec
);
14977 if (has_cdefine_beep(codec
))
14978 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
14980 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
14982 spec
->vmaster_nid
= 0x02;
14984 codec
->patch_ops
= alc_patch_ops
;
14985 #ifdef SND_HDA_NEEDS_RESUME
14986 codec
->patch_ops
.resume
= alc269_resume
;
14988 if (board_config
== ALC269_AUTO
)
14989 spec
->init_hook
= alc269_auto_init
;
14990 spec
->shutup
= alc269_shutup
;
14992 alc_init_jacks(codec
);
14993 #ifdef CONFIG_SND_HDA_POWER_SAVE
14994 if (!spec
->loopback
.amplist
)
14995 spec
->loopback
.amplist
= alc269_loopbacks
;
14996 if (alc269_mic2_for_mute_led(codec
))
14997 codec
->patch_ops
.check_power_status
= alc269_mic2_mute_check_ps
;
15004 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15008 * set the path ways for 2 channel output
15009 * need to set the codec line out and mic 1 pin widgets to inputs
15011 static const struct hda_verb alc861_threestack_ch2_init
[] = {
15012 /* set pin widget 1Ah (line in) for input */
15013 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15014 /* set pin widget 18h (mic1/2) for input, for mic also enable
15017 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15019 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
15021 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15022 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
15028 * need to set the codec line out and mic 1 pin widgets to outputs
15030 static const struct hda_verb alc861_threestack_ch6_init
[] = {
15031 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15032 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15033 /* set pin widget 18h (mic1) for output (CLFE)*/
15034 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15036 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15037 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15039 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
15041 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15042 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
15047 static const struct hda_channel_mode alc861_threestack_modes
[2] = {
15048 { 2, alc861_threestack_ch2_init
},
15049 { 6, alc861_threestack_ch6_init
},
15051 /* Set mic1 as input and unmute the mixer */
15052 static const struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
15053 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15054 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15057 /* Set mic1 as output and mute mixer */
15058 static const struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
15059 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15060 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15064 static const struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
15065 { 2, alc861_uniwill_m31_ch2_init
},
15066 { 4, alc861_uniwill_m31_ch4_init
},
15069 /* Set mic1 and line-in as input and unmute the mixer */
15070 static const struct hda_verb alc861_asus_ch2_init
[] = {
15071 /* set pin widget 1Ah (line in) for input */
15072 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15073 /* set pin widget 18h (mic1/2) for input, for mic also enable
15076 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15078 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
15080 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
15081 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
15085 /* Set mic1 nad line-in as output and mute mixer */
15086 static const struct hda_verb alc861_asus_ch6_init
[] = {
15087 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15088 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15089 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15090 /* set pin widget 18h (mic1) for output (CLFE)*/
15091 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15092 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15093 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15094 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15096 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
15098 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
15099 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
15104 static const struct hda_channel_mode alc861_asus_modes
[2] = {
15105 { 2, alc861_asus_ch2_init
},
15106 { 6, alc861_asus_ch6_init
},
15111 static const struct snd_kcontrol_new alc861_base_mixer
[] = {
15112 /* output mixer control */
15113 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15114 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15115 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15116 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15117 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
15119 /*Input mixer control */
15120 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15121 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15122 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15123 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15124 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15125 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15127 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15128 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15134 static const struct snd_kcontrol_new alc861_3ST_mixer
[] = {
15135 /* output mixer control */
15136 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15137 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15138 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15139 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15140 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15142 /* Input mixer control */
15143 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15144 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15145 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15146 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15147 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15148 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15150 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15151 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15152 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15155 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15156 .name
= "Channel Mode",
15157 .info
= alc_ch_mode_info
,
15158 .get
= alc_ch_mode_get
,
15159 .put
= alc_ch_mode_put
,
15160 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
15165 static const struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
15166 /* output mixer control */
15167 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15169 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15174 static const struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
15175 /* output mixer control */
15176 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15177 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15178 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15179 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15180 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15182 /* Input mixer control */
15183 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15184 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15185 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15186 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15187 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15188 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15189 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15190 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15191 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
15195 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15196 .name
= "Channel Mode",
15197 .info
= alc_ch_mode_info
,
15198 .get
= alc_ch_mode_get
,
15199 .put
= alc_ch_mode_put
,
15200 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
15205 static const struct snd_kcontrol_new alc861_asus_mixer
[] = {
15206 /* output mixer control */
15207 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
15208 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
15209 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
15210 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
15211 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
15213 /* Input mixer control */
15214 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
15215 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15216 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15217 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15218 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
15219 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
15220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
15221 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
15222 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
15223 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
15226 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15227 .name
= "Channel Mode",
15228 .info
= alc_ch_mode_info
,
15229 .get
= alc_ch_mode_get
,
15230 .put
= alc_ch_mode_put
,
15231 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
15236 /* additional mixer */
15237 static const struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
15238 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
15239 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
15244 * generic initialization of ADC, input mixers and output mixers
15246 static const struct hda_verb alc861_base_init_verbs
[] = {
15248 * Unmute ADC0 and set the default input to mic-in
15250 /* port-A for surround (rear panel) */
15251 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15252 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15253 /* port-B for mic-in (rear panel) with vref */
15254 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15255 /* port-C for line-in (rear panel) */
15256 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15257 /* port-D for Front */
15258 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15259 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15260 /* port-E for HP out (front panel) */
15261 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
15262 /* route front PCM to HP */
15263 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15264 /* port-F for mic-in (front panel) with vref */
15265 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15266 /* port-G for CLFE (rear panel) */
15267 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15268 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15269 /* port-H for side (rear panel) */
15270 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15271 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15273 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15274 /* route front mic to ADC1*/
15275 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15276 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15278 /* Unmute DAC0~3 & spdif out*/
15279 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15280 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15281 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15282 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15283 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15285 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15286 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15287 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15288 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15289 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15291 /* Unmute Stereo Mixer 15 */
15292 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15293 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15295 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15297 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15298 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15299 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15300 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15301 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15302 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15303 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15304 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15305 /* hp used DAC 3 (Front) */
15306 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15307 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15312 static const struct hda_verb alc861_threestack_init_verbs
[] = {
15314 * Unmute ADC0 and set the default input to mic-in
15316 /* port-A for surround (rear panel) */
15317 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15318 /* port-B for mic-in (rear panel) with vref */
15319 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15320 /* port-C for line-in (rear panel) */
15321 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15322 /* port-D for Front */
15323 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15324 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15325 /* port-E for HP out (front panel) */
15326 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
15327 /* route front PCM to HP */
15328 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15329 /* port-F for mic-in (front panel) with vref */
15330 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15331 /* port-G for CLFE (rear panel) */
15332 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15333 /* port-H for side (rear panel) */
15334 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15336 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15337 /* route front mic to ADC1*/
15338 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15339 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15340 /* Unmute DAC0~3 & spdif out*/
15341 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15342 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15343 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15344 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15345 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15347 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15348 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15349 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15350 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15351 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15353 /* Unmute Stereo Mixer 15 */
15354 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15355 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15357 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15359 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15360 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15361 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15362 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15363 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15364 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15365 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15366 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15367 /* hp used DAC 3 (Front) */
15368 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15369 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15373 static const struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
15375 * Unmute ADC0 and set the default input to mic-in
15377 /* port-A for surround (rear panel) */
15378 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15379 /* port-B for mic-in (rear panel) with vref */
15380 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15381 /* port-C for line-in (rear panel) */
15382 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15383 /* port-D for Front */
15384 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15385 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15386 /* port-E for HP out (front panel) */
15387 /* this has to be set to VREF80 */
15388 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15389 /* route front PCM to HP */
15390 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15391 /* port-F for mic-in (front panel) with vref */
15392 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15393 /* port-G for CLFE (rear panel) */
15394 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15395 /* port-H for side (rear panel) */
15396 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15398 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15399 /* route front mic to ADC1*/
15400 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15401 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15402 /* Unmute DAC0~3 & spdif out*/
15403 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15404 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15405 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15406 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15409 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15410 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15411 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15412 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15413 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15415 /* Unmute Stereo Mixer 15 */
15416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15417 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15418 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15419 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15421 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15422 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15423 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15424 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15425 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15426 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15427 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15428 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15429 /* hp used DAC 3 (Front) */
15430 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15431 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15435 static const struct hda_verb alc861_asus_init_verbs
[] = {
15437 * Unmute ADC0 and set the default input to mic-in
15439 /* port-A for surround (rear panel)
15440 * according to codec#0 this is the HP jack
15442 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
15443 /* route front PCM to HP */
15444 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
15445 /* port-B for mic-in (rear panel) with vref */
15446 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15447 /* port-C for line-in (rear panel) */
15448 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15449 /* port-D for Front */
15450 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15451 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15452 /* port-E for HP out (front panel) */
15453 /* this has to be set to VREF80 */
15454 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15455 /* route front PCM to HP */
15456 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
15457 /* port-F for mic-in (front panel) with vref */
15458 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
15459 /* port-G for CLFE (rear panel) */
15460 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15461 /* port-H for side (rear panel) */
15462 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
15464 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
15465 /* route front mic to ADC1*/
15466 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
15467 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15468 /* Unmute DAC0~3 & spdif out*/
15469 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15470 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15471 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15472 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15474 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15475 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15476 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15477 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15478 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15480 /* Unmute Stereo Mixer 15 */
15481 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15482 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15483 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
15486 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15487 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15488 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15489 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15490 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15491 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15492 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15493 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15494 /* hp used DAC 3 (Front) */
15495 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15496 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15500 /* additional init verbs for ASUS laptops */
15501 static const struct hda_verb alc861_asus_laptop_init_verbs
[] = {
15502 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
15503 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
15507 static const struct hda_verb alc861_toshiba_init_verbs
[] = {
15508 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15513 /* toggle speaker-output according to the hp-jack state */
15514 static void alc861_toshiba_automute(struct hda_codec
*codec
)
15516 unsigned int present
= snd_hda_jack_detect(codec
, 0x0f);
15518 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
15519 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
15520 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
15521 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
15524 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
15527 if ((res
>> 26) == ALC880_HP_EVENT
)
15528 alc861_toshiba_automute(codec
);
15531 /* pcm configuration: identical with ALC880 */
15532 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15533 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15534 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15535 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15538 #define ALC861_DIGOUT_NID 0x07
15540 static const struct hda_channel_mode alc861_8ch_modes
[1] = {
15544 static const hda_nid_t alc861_dac_nids
[4] = {
15545 /* front, surround, clfe, side */
15546 0x03, 0x06, 0x05, 0x04
15549 static const hda_nid_t alc660_dac_nids
[3] = {
15550 /* front, clfe, surround */
15554 static const hda_nid_t alc861_adc_nids
[1] = {
15559 static const struct hda_input_mux alc861_capture_source
= {
15563 { "Front Mic", 0x3 },
15570 static hda_nid_t
alc861_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
15572 struct alc_spec
*spec
= codec
->spec
;
15573 hda_nid_t mix
, srcs
[5];
15576 if (snd_hda_get_connections(codec
, pin
, &mix
, 1) != 1)
15578 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
15581 for (i
= 0; i
< num
; i
++) {
15583 type
= get_wcaps_type(get_wcaps(codec
, srcs
[i
]));
15584 if (type
!= AC_WID_AUD_OUT
)
15586 if (!found_in_nid_list(srcs
[i
], spec
->multiout
.dac_nids
,
15587 spec
->multiout
.num_dacs
))
15593 /* fill in the dac_nids table from the parsed pin configuration */
15594 static int alc861_auto_fill_dac_nids(struct hda_codec
*codec
)
15596 struct alc_spec
*spec
= codec
->spec
;
15597 const struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
15599 hda_nid_t nid
, dac
;
15601 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
15602 for (i
= 0; i
< cfg
->line_outs
; i
++) {
15603 nid
= cfg
->line_out_pins
[i
];
15604 dac
= alc861_look_for_dac(codec
, nid
);
15607 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
15612 static int __alc861_create_out_sw(struct hda_codec
*codec
, const char *pfx
,
15613 hda_nid_t nid
, int idx
, unsigned int chs
)
15615 return __add_pb_sw_ctrl(codec
->spec
, ALC_CTL_WIDGET_MUTE
, pfx
, idx
,
15616 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
15619 #define alc861_create_out_sw(codec, pfx, nid, chs) \
15620 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
15622 /* add playback controls from the parsed DAC table */
15623 static int alc861_auto_create_multi_out_ctls(struct hda_codec
*codec
,
15624 const struct auto_pin_cfg
*cfg
)
15626 struct alc_spec
*spec
= codec
->spec
;
15628 int i
, err
, noutputs
;
15630 noutputs
= cfg
->line_outs
;
15631 if (spec
->multi_ios
> 0)
15632 noutputs
+= spec
->multi_ios
;
15634 for (i
= 0; i
< noutputs
; i
++) {
15637 nid
= spec
->multiout
.dac_nids
[i
];
15640 name
= alc_get_line_out_pfx(spec
, i
, true, &index
);
15643 err
= alc861_create_out_sw(codec
, "Center", nid
, 1);
15646 err
= alc861_create_out_sw(codec
, "LFE", nid
, 2);
15650 err
= __alc861_create_out_sw(codec
, name
, nid
, index
, 3);
15658 static int alc861_auto_create_hp_ctls(struct hda_codec
*codec
, hda_nid_t pin
)
15660 struct alc_spec
*spec
= codec
->spec
;
15667 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
15668 nid
= alc861_look_for_dac(codec
, pin
);
15670 err
= alc861_create_out_sw(codec
, "Headphone", nid
, 3);
15673 spec
->multiout
.hp_nid
= nid
;
15679 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
15681 int pin_type
, hda_nid_t dac
)
15683 hda_nid_t mix
, srcs
[5];
15686 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
15688 snd_hda_codec_write(codec
, dac
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15690 if (snd_hda_get_connections(codec
, nid
, &mix
, 1) != 1)
15692 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
15695 for (i
= 0; i
< num
; i
++) {
15697 if (srcs
[i
] == dac
|| srcs
[i
] == 0x15)
15698 mute
= AMP_IN_UNMUTE(i
);
15700 mute
= AMP_IN_MUTE(i
);
15701 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15706 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
15708 struct alc_spec
*spec
= codec
->spec
;
15711 for (i
= 0; i
< spec
->autocfg
.line_outs
+ spec
->multi_ios
; i
++) {
15712 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
15713 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
15715 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
15716 spec
->multiout
.dac_nids
[i
]);
15720 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
15722 struct alc_spec
*spec
= codec
->spec
;
15724 if (spec
->autocfg
.hp_outs
)
15725 alc861_auto_set_output_and_unmute(codec
,
15726 spec
->autocfg
.hp_pins
[0],
15728 spec
->multiout
.hp_nid
);
15729 if (spec
->autocfg
.speaker_outs
)
15730 alc861_auto_set_output_and_unmute(codec
,
15731 spec
->autocfg
.speaker_pins
[0],
15733 spec
->multiout
.dac_nids
[0]);
15736 /* parse the BIOS configuration and set up the alc_spec */
15737 /* return 1 if successful, 0 if the proper config is not found,
15738 * or a negative error code
15740 static int alc861_parse_auto_config(struct hda_codec
*codec
)
15742 struct alc_spec
*spec
= codec
->spec
;
15744 static const hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
15746 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
15750 if (!spec
->autocfg
.line_outs
)
15751 return 0; /* can't find valid BIOS pin config */
15753 err
= alc861_auto_fill_dac_nids(codec
);
15756 err
= alc_auto_add_multi_channel_mode(codec
, alc861_auto_fill_dac_nids
);
15759 err
= alc861_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
15762 err
= alc861_auto_create_hp_ctls(codec
, spec
->autocfg
.hp_pins
[0]);
15765 err
= alc_auto_create_input_ctls(codec
);
15769 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
15771 alc_auto_parse_digital(codec
);
15773 if (spec
->kctls
.list
)
15774 add_mixer(spec
, spec
->kctls
.list
);
15776 spec
->num_mux_defs
= 1;
15777 spec
->input_mux
= &spec
->private_imux
[0];
15779 spec
->adc_nids
= alc861_adc_nids
;
15780 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
15781 set_capture_mixer(codec
);
15783 alc_ssid_check(codec
, 0x0e, 0x0f, 0x0b, 0);
15788 /* additional initialization for auto-configuration model */
15789 static void alc861_auto_init(struct hda_codec
*codec
)
15791 struct alc_spec
*spec
= codec
->spec
;
15792 alc861_auto_init_multi_out(codec
);
15793 alc861_auto_init_hp_out(codec
);
15794 alc_auto_init_analog_input(codec
);
15795 alc_auto_init_digital(codec
);
15796 if (spec
->unsol_event
)
15797 alc_inithook(codec
);
15800 #ifdef CONFIG_SND_HDA_POWER_SAVE
15801 static const struct hda_amp_list alc861_loopbacks
[] = {
15802 { 0x15, HDA_INPUT
, 0 },
15803 { 0x15, HDA_INPUT
, 1 },
15804 { 0x15, HDA_INPUT
, 2 },
15805 { 0x15, HDA_INPUT
, 3 },
15812 * configuration and preset
15814 static const char * const alc861_models
[ALC861_MODEL_LAST
] = {
15815 [ALC861_3ST
] = "3stack",
15816 [ALC660_3ST
] = "3stack-660",
15817 [ALC861_3ST_DIG
] = "3stack-dig",
15818 [ALC861_6ST_DIG
] = "6stack-dig",
15819 [ALC861_UNIWILL_M31
] = "uniwill-m31",
15820 [ALC861_TOSHIBA
] = "toshiba",
15821 [ALC861_ASUS
] = "asus",
15822 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
15823 [ALC861_AUTO
] = "auto",
15826 static const struct snd_pci_quirk alc861_cfg_tbl
[] = {
15827 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
15828 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
15829 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
15830 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
15831 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
15832 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
15833 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
15834 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15835 * Any other models that need this preset?
15837 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15838 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
15839 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
15840 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
15841 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
15842 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
15843 /* FIXME: the below seems conflict */
15844 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15845 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
15846 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
15850 static const struct alc_config_preset alc861_presets
[] = {
15852 .mixers
= { alc861_3ST_mixer
},
15853 .init_verbs
= { alc861_threestack_init_verbs
},
15854 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15855 .dac_nids
= alc861_dac_nids
,
15856 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
15857 .channel_mode
= alc861_threestack_modes
,
15859 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15860 .adc_nids
= alc861_adc_nids
,
15861 .input_mux
= &alc861_capture_source
,
15863 [ALC861_3ST_DIG
] = {
15864 .mixers
= { alc861_base_mixer
},
15865 .init_verbs
= { alc861_threestack_init_verbs
},
15866 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15867 .dac_nids
= alc861_dac_nids
,
15868 .dig_out_nid
= ALC861_DIGOUT_NID
,
15869 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
15870 .channel_mode
= alc861_threestack_modes
,
15872 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15873 .adc_nids
= alc861_adc_nids
,
15874 .input_mux
= &alc861_capture_source
,
15876 [ALC861_6ST_DIG
] = {
15877 .mixers
= { alc861_base_mixer
},
15878 .init_verbs
= { alc861_base_init_verbs
},
15879 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15880 .dac_nids
= alc861_dac_nids
,
15881 .dig_out_nid
= ALC861_DIGOUT_NID
,
15882 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
15883 .channel_mode
= alc861_8ch_modes
,
15884 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15885 .adc_nids
= alc861_adc_nids
,
15886 .input_mux
= &alc861_capture_source
,
15889 .mixers
= { alc861_3ST_mixer
},
15890 .init_verbs
= { alc861_threestack_init_verbs
},
15891 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
15892 .dac_nids
= alc660_dac_nids
,
15893 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
15894 .channel_mode
= alc861_threestack_modes
,
15896 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15897 .adc_nids
= alc861_adc_nids
,
15898 .input_mux
= &alc861_capture_source
,
15900 [ALC861_UNIWILL_M31
] = {
15901 .mixers
= { alc861_uniwill_m31_mixer
},
15902 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
15903 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15904 .dac_nids
= alc861_dac_nids
,
15905 .dig_out_nid
= ALC861_DIGOUT_NID
,
15906 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
15907 .channel_mode
= alc861_uniwill_m31_modes
,
15909 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15910 .adc_nids
= alc861_adc_nids
,
15911 .input_mux
= &alc861_capture_source
,
15913 [ALC861_TOSHIBA
] = {
15914 .mixers
= { alc861_toshiba_mixer
},
15915 .init_verbs
= { alc861_base_init_verbs
,
15916 alc861_toshiba_init_verbs
},
15917 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15918 .dac_nids
= alc861_dac_nids
,
15919 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
15920 .channel_mode
= alc883_3ST_2ch_modes
,
15921 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15922 .adc_nids
= alc861_adc_nids
,
15923 .input_mux
= &alc861_capture_source
,
15924 .unsol_event
= alc861_toshiba_unsol_event
,
15925 .init_hook
= alc861_toshiba_automute
,
15928 .mixers
= { alc861_asus_mixer
},
15929 .init_verbs
= { alc861_asus_init_verbs
},
15930 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15931 .dac_nids
= alc861_dac_nids
,
15932 .dig_out_nid
= ALC861_DIGOUT_NID
,
15933 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
15934 .channel_mode
= alc861_asus_modes
,
15937 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15938 .adc_nids
= alc861_adc_nids
,
15939 .input_mux
= &alc861_capture_source
,
15941 [ALC861_ASUS_LAPTOP
] = {
15942 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
15943 .init_verbs
= { alc861_asus_init_verbs
,
15944 alc861_asus_laptop_init_verbs
},
15945 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15946 .dac_nids
= alc861_dac_nids
,
15947 .dig_out_nid
= ALC861_DIGOUT_NID
,
15948 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
15949 .channel_mode
= alc883_3ST_2ch_modes
,
15951 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15952 .adc_nids
= alc861_adc_nids
,
15953 .input_mux
= &alc861_capture_source
,
15957 /* Pin config fixes */
15959 PINFIX_FSC_AMILO_PI1505
,
15962 static const struct alc_fixup alc861_fixups
[] = {
15963 [PINFIX_FSC_AMILO_PI1505
] = {
15964 .type
= ALC_FIXUP_PINS
,
15965 .v
.pins
= (const struct alc_pincfg
[]) {
15966 { 0x0b, 0x0221101f }, /* HP */
15967 { 0x0f, 0x90170310 }, /* speaker */
15973 static const struct snd_pci_quirk alc861_fixup_tbl
[] = {
15974 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505
),
15978 static int patch_alc861(struct hda_codec
*codec
)
15980 struct alc_spec
*spec
;
15984 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
15988 codec
->spec
= spec
;
15990 spec
->mixer_nid
= 0x15;
15992 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
15996 if (board_config
< 0) {
15997 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
15999 board_config
= ALC861_AUTO
;
16002 if (board_config
== ALC861_AUTO
) {
16003 alc_pick_fixup(codec
, NULL
, alc861_fixup_tbl
, alc861_fixups
);
16004 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
16007 if (board_config
== ALC861_AUTO
) {
16008 /* automatic parse from the BIOS config */
16009 err
= alc861_parse_auto_config(codec
);
16015 "hda_codec: Cannot set up configuration "
16016 "from BIOS. Using base mode...\n");
16017 board_config
= ALC861_3ST_DIG
;
16021 err
= snd_hda_attach_beep_device(codec
, 0x23);
16027 if (board_config
!= ALC861_AUTO
)
16028 setup_preset(codec
, &alc861_presets
[board_config
]);
16030 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
16031 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
16033 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
16034 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
16036 if (!spec
->cap_mixer
)
16037 set_capture_mixer(codec
);
16038 set_beep_amp(spec
, 0x23, 0, HDA_OUTPUT
);
16040 spec
->vmaster_nid
= 0x03;
16042 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
16044 codec
->patch_ops
= alc_patch_ops
;
16045 if (board_config
== ALC861_AUTO
) {
16046 spec
->init_hook
= alc861_auto_init
;
16047 #ifdef CONFIG_SND_HDA_POWER_SAVE
16048 spec
->power_hook
= alc_power_eapd
;
16051 #ifdef CONFIG_SND_HDA_POWER_SAVE
16052 if (!spec
->loopback
.amplist
)
16053 spec
->loopback
.amplist
= alc861_loopbacks
;
16060 * ALC861-VD support
16064 * In addition, an independent DAC
16066 #define ALC861VD_DIGOUT_NID 0x06
16068 static const hda_nid_t alc861vd_dac_nids
[4] = {
16069 /* front, surr, clfe, side surr */
16070 0x02, 0x03, 0x04, 0x05
16073 /* dac_nids for ALC660vd are in a different order - according to
16074 * Realtek's driver.
16075 * This should probably result in a different mixer for 6stack models
16076 * of ALC660vd codecs, but for now there is only 3stack mixer
16077 * - and it is the same as in 861vd.
16078 * adc_nids in ALC660vd are (is) the same as in 861vd
16080 static const hda_nid_t alc660vd_dac_nids
[3] = {
16081 /* front, rear, clfe, rear_surr */
16085 static const hda_nid_t alc861vd_adc_nids
[1] = {
16090 static const hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
16093 /* FIXME: should be a matrix-type input source selection */
16094 static const struct hda_input_mux alc861vd_capture_source
= {
16098 { "Front Mic", 0x1 },
16104 static const struct hda_input_mux alc861vd_dallas_capture_source
= {
16108 { "Internal Mic", 0x1 },
16112 static const struct hda_input_mux alc861vd_hp_capture_source
= {
16115 { "Front Mic", 0x0 },
16116 { "ATAPI Mic", 0x1 },
16123 static const struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
16130 static const struct hda_verb alc861vd_6stack_ch6_init
[] = {
16131 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
16132 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16133 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16134 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16141 static const struct hda_verb alc861vd_6stack_ch8_init
[] = {
16142 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16143 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16144 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16145 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16149 static const struct hda_channel_mode alc861vd_6stack_modes
[2] = {
16150 { 6, alc861vd_6stack_ch6_init
},
16151 { 8, alc861vd_6stack_ch8_init
},
16154 static const struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
16156 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
16157 .name
= "Channel Mode",
16158 .info
= alc_ch_mode_info
,
16159 .get
= alc_ch_mode_get
,
16160 .put
= alc_ch_mode_put
,
16165 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16166 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16168 static const struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
16169 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16170 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16172 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16173 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
16175 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16177 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16179 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
16180 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
16182 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
16183 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
16185 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16187 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16191 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16192 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16193 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16198 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16199 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16204 static const struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
16205 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16206 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16208 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16210 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16214 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16215 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16216 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16218 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16219 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16221 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16222 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16227 static const struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
16228 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16229 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16230 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
16232 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16234 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16238 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16239 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16240 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16242 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16243 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16248 /* Pin assignment: Speaker=0x14, HP = 0x15,
16249 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16251 static const struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
16252 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16253 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
16254 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16255 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
16256 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
16257 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16258 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16259 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
16260 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16261 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16265 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16266 * Front Mic=0x18, ATAPI Mic = 0x19,
16268 static const struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
16269 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16270 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
16271 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16272 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
16273 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16274 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16275 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16276 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16282 * generic initialization of ADC, input mixers and output mixers
16284 static const struct hda_verb alc861vd_volume_init_verbs
[] = {
16286 * Unmute ADC0 and set the default input to mic-in
16288 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16289 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16291 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16292 * the analog-loopback mixer widget
16294 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16297 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16299 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16301 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
16305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
16308 * Set up output mixers (0x02 - 0x05)
16310 /* set vol=0 to output mixers */
16311 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16312 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16313 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16314 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16316 /* set up input amps for analog loopback */
16317 /* Amp Indices: DAC = 0, mixer = 1 */
16318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16319 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16320 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16321 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16322 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16323 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16325 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16331 * 3-stack pin configuration:
16332 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16334 static const struct hda_verb alc861vd_3stack_init_verbs
[] = {
16336 * Set pin mode and muting
16338 /* set front pin widgets 0x14 for output */
16339 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16340 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16341 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
16343 /* Mic (rear) pin: input vref at 80% */
16344 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16345 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16346 /* Front Mic pin: input vref at 80% */
16347 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16348 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16349 /* Line In pin: input */
16350 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16351 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16352 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16353 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16354 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16355 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16356 /* CD pin widget for input */
16357 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16363 * 6-stack pin configuration:
16365 static const struct hda_verb alc861vd_6stack_init_verbs
[] = {
16367 * Set pin mode and muting
16369 /* set front pin widgets 0x14 for output */
16370 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16371 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16372 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
16374 /* Rear Pin: output 1 (0x0d) */
16375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16376 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16377 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
16378 /* CLFE Pin: output 2 (0x0e) */
16379 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16380 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16381 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
16382 /* Side Pin: output 3 (0x0f) */
16383 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16384 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16385 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
16387 /* Mic (rear) pin: input vref at 80% */
16388 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16389 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16390 /* Front Mic pin: input vref at 80% */
16391 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16392 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16393 /* Line In pin: input */
16394 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16395 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16396 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16397 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16398 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16399 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16400 /* CD pin widget for input */
16401 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16406 static const struct hda_verb alc861vd_eapd_verbs
[] = {
16407 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16411 static const struct hda_verb alc660vd_eapd_verbs
[] = {
16412 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16413 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16417 static const struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
16418 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
16421 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16422 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16426 static void alc861vd_lenovo_setup(struct hda_codec
*codec
)
16428 struct alc_spec
*spec
= codec
->spec
;
16429 spec
->autocfg
.hp_pins
[0] = 0x1b;
16430 spec
->autocfg
.speaker_pins
[0] = 0x14;
16431 spec
->automute
= 1;
16432 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
16435 static void alc861vd_lenovo_init_hook(struct hda_codec
*codec
)
16437 alc_hp_automute(codec
);
16438 alc88x_simple_mic_automute(codec
);
16441 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
16444 switch (res
>> 26) {
16445 case ALC880_MIC_EVENT
:
16446 alc88x_simple_mic_automute(codec
);
16449 alc_sku_unsol_event(codec
, res
);
16454 static const struct hda_verb alc861vd_dallas_verbs
[] = {
16455 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16456 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16457 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16458 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16465 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16466 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16467 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16469 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16470 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16471 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16472 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16473 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16474 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16475 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16476 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16478 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16479 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16480 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16481 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16482 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16483 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16484 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16485 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16487 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16488 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16490 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16493 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16494 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16499 /* toggle speaker-output according to the hp-jack state */
16500 static void alc861vd_dallas_setup(struct hda_codec
*codec
)
16502 struct alc_spec
*spec
= codec
->spec
;
16504 spec
->autocfg
.hp_pins
[0] = 0x15;
16505 spec
->autocfg
.speaker_pins
[0] = 0x14;
16506 spec
->automute
= 1;
16507 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
16510 #ifdef CONFIG_SND_HDA_POWER_SAVE
16511 #define alc861vd_loopbacks alc880_loopbacks
16514 /* pcm configuration: identical with ALC880 */
16515 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16516 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16517 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16518 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16521 * configuration and preset
16523 static const char * const alc861vd_models
[ALC861VD_MODEL_LAST
] = {
16524 [ALC660VD_3ST
] = "3stack-660",
16525 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
16526 [ALC660VD_ASUS_V1S
] = "asus-v1s",
16527 [ALC861VD_3ST
] = "3stack",
16528 [ALC861VD_3ST_DIG
] = "3stack-digout",
16529 [ALC861VD_6ST_DIG
] = "6stack-digout",
16530 [ALC861VD_LENOVO
] = "lenovo",
16531 [ALC861VD_DALLAS
] = "dallas",
16532 [ALC861VD_HP
] = "hp",
16533 [ALC861VD_AUTO
] = "auto",
16536 static const struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
16537 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
16538 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
16539 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
16540 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16541 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S
),
16542 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
16543 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
16544 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
16545 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16546 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO
),
16547 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
16548 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
16549 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
16550 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO
),
16551 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
16555 static const struct alc_config_preset alc861vd_presets
[] = {
16557 .mixers
= { alc861vd_3st_mixer
},
16558 .init_verbs
= { alc861vd_volume_init_verbs
,
16559 alc861vd_3stack_init_verbs
},
16560 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16561 .dac_nids
= alc660vd_dac_nids
,
16562 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16563 .channel_mode
= alc861vd_3stack_2ch_modes
,
16564 .input_mux
= &alc861vd_capture_source
,
16566 [ALC660VD_3ST_DIG
] = {
16567 .mixers
= { alc861vd_3st_mixer
},
16568 .init_verbs
= { alc861vd_volume_init_verbs
,
16569 alc861vd_3stack_init_verbs
},
16570 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16571 .dac_nids
= alc660vd_dac_nids
,
16572 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16573 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16574 .channel_mode
= alc861vd_3stack_2ch_modes
,
16575 .input_mux
= &alc861vd_capture_source
,
16578 .mixers
= { alc861vd_3st_mixer
},
16579 .init_verbs
= { alc861vd_volume_init_verbs
,
16580 alc861vd_3stack_init_verbs
},
16581 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16582 .dac_nids
= alc861vd_dac_nids
,
16583 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16584 .channel_mode
= alc861vd_3stack_2ch_modes
,
16585 .input_mux
= &alc861vd_capture_source
,
16587 [ALC861VD_3ST_DIG
] = {
16588 .mixers
= { alc861vd_3st_mixer
},
16589 .init_verbs
= { alc861vd_volume_init_verbs
,
16590 alc861vd_3stack_init_verbs
},
16591 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16592 .dac_nids
= alc861vd_dac_nids
,
16593 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16594 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16595 .channel_mode
= alc861vd_3stack_2ch_modes
,
16596 .input_mux
= &alc861vd_capture_source
,
16598 [ALC861VD_6ST_DIG
] = {
16599 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
16600 .init_verbs
= { alc861vd_volume_init_verbs
,
16601 alc861vd_6stack_init_verbs
},
16602 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16603 .dac_nids
= alc861vd_dac_nids
,
16604 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16605 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
16606 .channel_mode
= alc861vd_6stack_modes
,
16607 .input_mux
= &alc861vd_capture_source
,
16609 [ALC861VD_LENOVO
] = {
16610 .mixers
= { alc861vd_lenovo_mixer
},
16611 .init_verbs
= { alc861vd_volume_init_verbs
,
16612 alc861vd_3stack_init_verbs
,
16613 alc861vd_eapd_verbs
,
16614 alc861vd_lenovo_unsol_verbs
},
16615 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16616 .dac_nids
= alc660vd_dac_nids
,
16617 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16618 .channel_mode
= alc861vd_3stack_2ch_modes
,
16619 .input_mux
= &alc861vd_capture_source
,
16620 .unsol_event
= alc861vd_lenovo_unsol_event
,
16621 .setup
= alc861vd_lenovo_setup
,
16622 .init_hook
= alc861vd_lenovo_init_hook
,
16624 [ALC861VD_DALLAS
] = {
16625 .mixers
= { alc861vd_dallas_mixer
},
16626 .init_verbs
= { alc861vd_dallas_verbs
},
16627 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16628 .dac_nids
= alc861vd_dac_nids
,
16629 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16630 .channel_mode
= alc861vd_3stack_2ch_modes
,
16631 .input_mux
= &alc861vd_dallas_capture_source
,
16632 .unsol_event
= alc_sku_unsol_event
,
16633 .setup
= alc861vd_dallas_setup
,
16634 .init_hook
= alc_hp_automute
,
16637 .mixers
= { alc861vd_hp_mixer
},
16638 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
16639 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16640 .dac_nids
= alc861vd_dac_nids
,
16641 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16642 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16643 .channel_mode
= alc861vd_3stack_2ch_modes
,
16644 .input_mux
= &alc861vd_hp_capture_source
,
16645 .unsol_event
= alc_sku_unsol_event
,
16646 .setup
= alc861vd_dallas_setup
,
16647 .init_hook
= alc_hp_automute
,
16649 [ALC660VD_ASUS_V1S
] = {
16650 .mixers
= { alc861vd_lenovo_mixer
},
16651 .init_verbs
= { alc861vd_volume_init_verbs
,
16652 alc861vd_3stack_init_verbs
,
16653 alc861vd_eapd_verbs
,
16654 alc861vd_lenovo_unsol_verbs
},
16655 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16656 .dac_nids
= alc660vd_dac_nids
,
16657 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16658 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16659 .channel_mode
= alc861vd_3stack_2ch_modes
,
16660 .input_mux
= &alc861vd_capture_source
,
16661 .unsol_event
= alc861vd_lenovo_unsol_event
,
16662 .setup
= alc861vd_lenovo_setup
,
16663 .init_hook
= alc861vd_lenovo_init_hook
,
16668 * BIOS auto configuration
16670 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16672 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16673 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16675 /* add playback controls from the parsed DAC table */
16676 /* Based on ALC880 version. But ALC861VD has separate,
16677 * different NIDs for mute/unmute switch and volume control */
16678 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
16679 const struct auto_pin_cfg
*cfg
)
16681 hda_nid_t nid_v
, nid_s
;
16682 int i
, err
, noutputs
;
16684 noutputs
= cfg
->line_outs
;
16685 if (spec
->multi_ios
> 0)
16686 noutputs
+= spec
->multi_ios
;
16688 for (i
= 0; i
< noutputs
; i
++) {
16691 if (!spec
->multiout
.dac_nids
[i
])
16693 nid_v
= alc861vd_idx_to_mixer_vol(
16695 spec
->multiout
.dac_nids
[i
]));
16696 nid_s
= alc861vd_idx_to_mixer_switch(
16698 spec
->multiout
.dac_nids
[i
]));
16700 name
= alc_get_line_out_pfx(spec
, i
, true, &index
);
16703 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
16705 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
16709 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
16711 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
16715 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
16717 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
16721 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
16723 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
16728 err
= __add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
16730 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
16734 err
= __add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
16736 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
16745 /* add playback controls for speaker and HP outputs */
16746 /* Based on ALC880 version. But ALC861VD has separate,
16747 * different NIDs for mute/unmute switch and volume control */
16748 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
16749 hda_nid_t pin
, const char *pfx
)
16751 hda_nid_t nid_v
, nid_s
;
16757 if (alc880_is_fixed_pin(pin
)) {
16758 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
16759 /* specify the DAC as the extra output */
16760 if (!spec
->multiout
.hp_nid
)
16761 spec
->multiout
.hp_nid
= nid_v
;
16763 spec
->multiout
.extra_out_nid
[0] = nid_v
;
16764 /* control HP volume/switch on the output mixer amp */
16765 nid_v
= alc861vd_idx_to_mixer_vol(
16766 alc880_fixed_pin_idx(pin
));
16767 nid_s
= alc861vd_idx_to_mixer_switch(
16768 alc880_fixed_pin_idx(pin
));
16770 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
16771 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
16774 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
16775 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
16778 } else if (alc880_is_multi_pin(pin
)) {
16779 /* set manual connection */
16780 /* we have only a switch on HP-out PIN */
16781 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
16782 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
16789 /* parse the BIOS configuration and set up the alc_spec
16790 * return 1 if successful, 0 if the proper config is not found,
16791 * or a negative error code
16792 * Based on ALC880 version - had to change it to override
16793 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16794 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
16796 struct alc_spec
*spec
= codec
->spec
;
16798 static const hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
16800 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
16804 if (!spec
->autocfg
.line_outs
)
16805 return 0; /* can't find valid BIOS pin config */
16807 err
= alc_auto_fill_dac_nids(codec
);
16810 err
= alc_auto_add_multi_channel_mode(codec
, alc_auto_fill_dac_nids
);
16813 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
16816 err
= alc861vd_auto_create_extra_out(spec
,
16817 spec
->autocfg
.speaker_pins
[0],
16821 err
= alc861vd_auto_create_extra_out(spec
,
16822 spec
->autocfg
.hp_pins
[0],
16826 err
= alc_auto_create_input_ctls(codec
);
16830 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
16832 alc_auto_parse_digital(codec
);
16834 if (spec
->kctls
.list
)
16835 add_mixer(spec
, spec
->kctls
.list
);
16837 spec
->num_mux_defs
= 1;
16838 spec
->input_mux
= &spec
->private_imux
[0];
16840 err
= alc_auto_add_mic_boost(codec
);
16844 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
16849 /* additional initialization for auto-configuration model */
16850 static void alc861vd_auto_init(struct hda_codec
*codec
)
16852 struct alc_spec
*spec
= codec
->spec
;
16853 alc_auto_init_multi_out(codec
);
16854 alc_auto_init_extra_out(codec
);
16855 alc_auto_init_analog_input(codec
);
16856 alc861vd_auto_init_input_src(codec
);
16857 alc_auto_init_digital(codec
);
16858 if (spec
->unsol_event
)
16859 alc_inithook(codec
);
16863 ALC660VD_FIX_ASUS_GPIO1
16867 static const struct alc_fixup alc861vd_fixups
[] = {
16868 [ALC660VD_FIX_ASUS_GPIO1
] = {
16869 .type
= ALC_FIXUP_VERBS
,
16870 .v
.verbs
= (const struct hda_verb
[]) {
16871 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
16872 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
16873 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
16879 static const struct snd_pci_quirk alc861vd_fixup_tbl
[] = {
16880 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1
),
16884 static int patch_alc861vd(struct hda_codec
*codec
)
16886 struct alc_spec
*spec
;
16887 int err
, board_config
;
16889 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
16893 codec
->spec
= spec
;
16895 spec
->mixer_nid
= 0x0b;
16897 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
16901 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
16902 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
16904 board_config
= ALC861VD_AUTO
;
16907 if (board_config
== ALC861VD_AUTO
) {
16908 alc_pick_fixup(codec
, NULL
, alc861vd_fixup_tbl
, alc861vd_fixups
);
16909 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
16912 if (board_config
== ALC861VD_AUTO
) {
16913 /* automatic parse from the BIOS config */
16914 err
= alc861vd_parse_auto_config(codec
);
16920 "hda_codec: Cannot set up configuration "
16921 "from BIOS. Using base mode...\n");
16922 board_config
= ALC861VD_3ST
;
16926 err
= snd_hda_attach_beep_device(codec
, 0x23);
16932 if (board_config
!= ALC861VD_AUTO
)
16933 setup_preset(codec
, &alc861vd_presets
[board_config
]);
16935 if (codec
->vendor_id
== 0x10ec0660) {
16936 /* always turn on EAPD */
16937 add_verb(spec
, alc660vd_eapd_verbs
);
16940 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
16941 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
16943 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
16944 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
16946 if (!spec
->adc_nids
) {
16947 spec
->adc_nids
= alc861vd_adc_nids
;
16948 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
16950 if (!spec
->capsrc_nids
)
16951 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
16953 set_capture_mixer(codec
);
16954 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
16956 spec
->vmaster_nid
= 0x02;
16958 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
16960 codec
->patch_ops
= alc_patch_ops
;
16962 if (board_config
== ALC861VD_AUTO
)
16963 spec
->init_hook
= alc861vd_auto_init
;
16964 spec
->shutup
= alc_eapd_shutup
;
16965 #ifdef CONFIG_SND_HDA_POWER_SAVE
16966 if (!spec
->loopback
.amplist
)
16967 spec
->loopback
.amplist
= alc861vd_loopbacks
;
16976 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16977 * configuration. Each pin widget can choose any input DACs and a mixer.
16978 * Each ADC is connected from a mixer of all inputs. This makes possible
16979 * 6-channel independent captures.
16981 * In addition, an independent DAC for the multi-playback (not used in this
16984 #define ALC662_DIGOUT_NID 0x06
16985 #define ALC662_DIGIN_NID 0x0a
16987 static const hda_nid_t alc662_dac_nids
[3] = {
16988 /* front, rear, clfe */
16992 static const hda_nid_t alc272_dac_nids
[2] = {
16996 static const hda_nid_t alc662_adc_nids
[2] = {
17001 static const hda_nid_t alc272_adc_nids
[1] = {
17006 static const hda_nid_t alc662_capsrc_nids
[2] = { 0x22, 0x23 };
17007 static const hda_nid_t alc272_capsrc_nids
[1] = { 0x23 };
17011 /* FIXME: should be a matrix-type input source selection */
17012 static const struct hda_input_mux alc662_capture_source
= {
17016 { "Front Mic", 0x1 },
17022 static const struct hda_input_mux alc662_lenovo_101e_capture_source
= {
17030 static const struct hda_input_mux alc663_capture_source
= {
17034 { "Front Mic", 0x1 },
17039 #if 0 /* set to 1 for testing other input sources below */
17040 static const struct hda_input_mux alc272_nc10_capture_source
= {
17043 { "Autoselect Mic", 0x0 },
17044 { "Internal Mic", 0x1 },
17045 { "In-0x02", 0x2 },
17046 { "In-0x03", 0x3 },
17047 { "In-0x04", 0x4 },
17048 { "In-0x05", 0x5 },
17049 { "In-0x06", 0x6 },
17050 { "In-0x07", 0x7 },
17051 { "In-0x08", 0x8 },
17052 { "In-0x09", 0x9 },
17053 { "In-0x0a", 0x0a },
17054 { "In-0x0b", 0x0b },
17055 { "In-0x0c", 0x0c },
17056 { "In-0x0d", 0x0d },
17057 { "In-0x0e", 0x0e },
17058 { "In-0x0f", 0x0f },
17066 static const struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
17073 static const struct hda_verb alc662_3ST_ch2_init
[] = {
17074 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17075 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17076 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17077 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17084 static const struct hda_verb alc662_3ST_ch6_init
[] = {
17085 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17086 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17087 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
17088 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17089 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17090 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
17094 static const struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
17095 { 2, alc662_3ST_ch2_init
},
17096 { 6, alc662_3ST_ch6_init
},
17102 static const struct hda_verb alc662_sixstack_ch6_init
[] = {
17103 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
17104 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
17105 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17112 static const struct hda_verb alc662_sixstack_ch8_init
[] = {
17113 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17114 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17115 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17119 static const struct hda_channel_mode alc662_5stack_modes
[2] = {
17120 { 2, alc662_sixstack_ch6_init
},
17121 { 6, alc662_sixstack_ch8_init
},
17124 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17125 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17128 static const struct snd_kcontrol_new alc662_base_mixer
[] = {
17129 /* output mixer control */
17130 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
17131 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17132 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
17133 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
17134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17135 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17136 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
17137 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
17138 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17140 /*Input mixer control */
17141 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
17142 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
17143 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
17144 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
17145 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
17146 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
17147 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
17148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
17152 static const struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
17153 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17154 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17155 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17156 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
17157 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
17158 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17159 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17160 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17161 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17162 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17163 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17167 static const struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
17168 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17169 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
17170 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17171 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
17172 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17173 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17174 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
17175 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
17176 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17177 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
17178 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
17179 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17180 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17183 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17184 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17188 static const struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
17189 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17190 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
17191 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17192 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
17193 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17194 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17195 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17201 static const struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
17202 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17203 ALC262_HIPPO_MASTER_SWITCH
,
17205 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
17206 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17207 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17209 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
17210 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17211 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17215 static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
17216 ALC262_HIPPO_MASTER_SWITCH
,
17217 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17218 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17219 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
17220 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
17221 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
17222 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17223 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17224 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17229 static const struct hda_bind_ctls alc663_asus_bind_master_vol
= {
17230 .ops
= &snd_hda_bind_vol
,
17232 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
17233 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
17238 static const struct hda_bind_ctls alc663_asus_one_bind_switch
= {
17239 .ops
= &snd_hda_bind_sw
,
17241 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17242 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17247 static const struct snd_kcontrol_new alc663_m51va_mixer
[] = {
17248 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17249 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch
),
17250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17255 static const struct hda_bind_ctls alc663_asus_tree_bind_switch
= {
17256 .ops
= &snd_hda_bind_sw
,
17258 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17259 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17260 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17265 static const struct snd_kcontrol_new alc663_two_hp_m1_mixer
[] = {
17266 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17267 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch
),
17268 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17269 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17270 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17271 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17276 static const struct hda_bind_ctls alc663_asus_four_bind_switch
= {
17277 .ops
= &snd_hda_bind_sw
,
17279 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17280 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17281 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17286 static const struct snd_kcontrol_new alc663_two_hp_m2_mixer
[] = {
17287 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17288 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch
),
17289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17290 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17291 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17292 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17296 static const struct snd_kcontrol_new alc662_1bjd_mixer
[] = {
17297 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17298 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17299 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17302 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17303 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17307 static const struct hda_bind_ctls alc663_asus_two_bind_master_vol
= {
17308 .ops
= &snd_hda_bind_vol
,
17310 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
17311 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT
),
17316 static const struct hda_bind_ctls alc663_asus_two_bind_switch
= {
17317 .ops
= &snd_hda_bind_sw
,
17319 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17320 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT
),
17325 static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer
[] = {
17326 HDA_BIND_VOL("Master Playback Volume",
17327 &alc663_asus_two_bind_master_vol
),
17328 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
17329 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17330 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17332 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17336 static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer
[] = {
17337 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
17338 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
17339 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17340 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17342 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17346 static const struct snd_kcontrol_new alc663_g71v_mixer
[] = {
17347 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17348 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17349 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17350 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17355 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17356 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17360 static const struct snd_kcontrol_new alc663_g50v_mixer
[] = {
17361 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17362 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17363 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17367 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17368 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17369 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17370 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17374 static const struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch
= {
17375 .ops
= &snd_hda_bind_sw
,
17377 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17378 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17379 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17380 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17381 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17386 static const struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch
= {
17387 .ops
= &snd_hda_bind_sw
,
17389 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17390 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17395 static const struct snd_kcontrol_new alc663_mode7_mixer
[] = {
17396 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17397 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17398 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17399 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17400 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17401 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17402 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17403 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17404 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17408 static const struct snd_kcontrol_new alc663_mode8_mixer
[] = {
17409 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17410 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17411 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17412 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17413 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17414 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17415 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17420 static const struct snd_kcontrol_new alc662_chmode_mixer
[] = {
17422 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
17423 .name
= "Channel Mode",
17424 .info
= alc_ch_mode_info
,
17425 .get
= alc_ch_mode_get
,
17426 .put
= alc_ch_mode_put
,
17431 static const struct hda_verb alc662_init_verbs
[] = {
17432 /* ADC: mute amp left and right */
17433 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17434 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
17436 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17437 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17438 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17439 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17440 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17441 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17443 /* Front Pin: output 0 (0x0c) */
17444 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17447 /* Rear Pin: output 1 (0x0d) */
17448 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17449 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17451 /* CLFE Pin: output 2 (0x0e) */
17452 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17453 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17455 /* Mic (rear) pin: input vref at 80% */
17456 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17457 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17458 /* Front Mic pin: input vref at 80% */
17459 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17460 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17461 /* Line In pin: input */
17462 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17463 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17464 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17465 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17466 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17467 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
17468 /* CD pin widget for input */
17469 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17471 /* FIXME: use matrix-type input source selection */
17472 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17474 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17480 static const struct hda_verb alc662_eapd_init_verbs
[] = {
17481 /* always trun on EAPD */
17482 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17483 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17487 static const struct hda_verb alc662_sue_init_verbs
[] = {
17488 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
17489 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
17493 static const struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
17494 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17495 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17499 /* Set Unsolicited Event*/
17500 static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
17501 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17502 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17506 static const struct hda_verb alc663_m51va_init_verbs
[] = {
17507 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17508 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17509 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17510 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17511 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17514 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17515 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17519 static const struct hda_verb alc663_21jd_amic_init_verbs
[] = {
17520 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17521 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17522 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17523 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17524 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17525 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17526 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17530 static const struct hda_verb alc662_1bjd_amic_init_verbs
[] = {
17531 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17532 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17533 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17534 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
17535 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17536 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17537 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17538 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17542 static const struct hda_verb alc663_15jd_amic_init_verbs
[] = {
17543 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17544 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17545 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17546 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17548 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17549 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17553 static const struct hda_verb alc663_two_hp_amic_m1_init_verbs
[] = {
17554 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17555 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17556 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17557 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
17558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17560 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
17561 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17562 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17563 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17564 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17565 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17569 static const struct hda_verb alc663_two_hp_amic_m2_init_verbs
[] = {
17570 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17571 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17572 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17573 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17574 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17575 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17576 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17577 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17579 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17580 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17581 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17585 static const struct hda_verb alc663_g71v_init_verbs
[] = {
17586 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17587 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17588 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17590 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17591 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17592 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
17594 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
17595 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
17596 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
17600 static const struct hda_verb alc663_g50v_init_verbs
[] = {
17601 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17602 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17603 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
17605 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17606 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17610 static const struct hda_verb alc662_ecs_init_verbs
[] = {
17611 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
17612 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17613 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17614 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17618 static const struct hda_verb alc272_dell_zm1_init_verbs
[] = {
17619 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17620 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17622 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17623 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17624 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17625 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17626 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17627 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17628 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17629 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17633 static const struct hda_verb alc272_dell_init_verbs
[] = {
17634 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17635 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17637 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17638 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17639 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17640 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17641 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17642 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17643 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17644 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17648 static const struct hda_verb alc663_mode7_init_verbs
[] = {
17649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17650 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17651 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17652 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17653 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17654 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17655 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
17656 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17657 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17658 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17661 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17662 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17663 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17667 static const struct hda_verb alc663_mode8_init_verbs
[] = {
17668 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17671 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
17672 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17673 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17674 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17675 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17676 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17677 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17678 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17679 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17681 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17682 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17683 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17687 static const struct snd_kcontrol_new alc662_auto_capture_mixer
[] = {
17688 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
17689 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
17693 static const struct snd_kcontrol_new alc272_auto_capture_mixer
[] = {
17694 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
17695 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
17699 static void alc662_lenovo_101e_setup(struct hda_codec
*codec
)
17701 struct alc_spec
*spec
= codec
->spec
;
17703 spec
->autocfg
.hp_pins
[0] = 0x1b;
17704 spec
->autocfg
.line_out_pins
[0] = 0x14;
17705 spec
->autocfg
.speaker_pins
[0] = 0x15;
17706 spec
->automute
= 1;
17707 spec
->detect_line
= 1;
17708 spec
->automute_lines
= 1;
17709 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
17712 static void alc662_eeepc_setup(struct hda_codec
*codec
)
17714 struct alc_spec
*spec
= codec
->spec
;
17716 alc262_hippo1_setup(codec
);
17717 spec
->ext_mic
.pin
= 0x18;
17718 spec
->ext_mic
.mux_idx
= 0;
17719 spec
->int_mic
.pin
= 0x19;
17720 spec
->int_mic
.mux_idx
= 1;
17721 spec
->auto_mic
= 1;
17724 static void alc662_eeepc_ep20_setup(struct hda_codec
*codec
)
17726 struct alc_spec
*spec
= codec
->spec
;
17728 spec
->autocfg
.hp_pins
[0] = 0x14;
17729 spec
->autocfg
.speaker_pins
[0] = 0x1b;
17730 spec
->automute
= 1;
17731 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
17734 static void alc663_m51va_setup(struct hda_codec
*codec
)
17736 struct alc_spec
*spec
= codec
->spec
;
17737 spec
->autocfg
.hp_pins
[0] = 0x21;
17738 spec
->autocfg
.speaker_pins
[0] = 0x14;
17739 spec
->automute_mixer_nid
[0] = 0x0c;
17740 spec
->automute
= 1;
17741 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
17742 spec
->ext_mic
.pin
= 0x18;
17743 spec
->ext_mic
.mux_idx
= 0;
17744 spec
->int_mic
.pin
= 0x12;
17745 spec
->int_mic
.mux_idx
= 9;
17746 spec
->auto_mic
= 1;
17749 /* ***************** Mode1 ******************************/
17750 static void alc663_mode1_setup(struct hda_codec
*codec
)
17752 struct alc_spec
*spec
= codec
->spec
;
17753 spec
->autocfg
.hp_pins
[0] = 0x21;
17754 spec
->autocfg
.speaker_pins
[0] = 0x14;
17755 spec
->automute_mixer_nid
[0] = 0x0c;
17756 spec
->automute
= 1;
17757 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
17758 spec
->ext_mic
.pin
= 0x18;
17759 spec
->ext_mic
.mux_idx
= 0;
17760 spec
->int_mic
.pin
= 0x19;
17761 spec
->int_mic
.mux_idx
= 1;
17762 spec
->auto_mic
= 1;
17765 /* ***************** Mode2 ******************************/
17766 static void alc662_mode2_setup(struct hda_codec
*codec
)
17768 struct alc_spec
*spec
= codec
->spec
;
17769 spec
->autocfg
.hp_pins
[0] = 0x1b;
17770 spec
->autocfg
.speaker_pins
[0] = 0x14;
17771 spec
->automute
= 1;
17772 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
17773 spec
->ext_mic
.pin
= 0x18;
17774 spec
->ext_mic
.mux_idx
= 0;
17775 spec
->int_mic
.pin
= 0x19;
17776 spec
->int_mic
.mux_idx
= 1;
17777 spec
->auto_mic
= 1;
17780 /* ***************** Mode3 ******************************/
17781 static void alc663_mode3_setup(struct hda_codec
*codec
)
17783 struct alc_spec
*spec
= codec
->spec
;
17784 spec
->autocfg
.hp_pins
[0] = 0x21;
17785 spec
->autocfg
.hp_pins
[0] = 0x15;
17786 spec
->autocfg
.speaker_pins
[0] = 0x14;
17787 spec
->automute
= 1;
17788 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
17789 spec
->ext_mic
.pin
= 0x18;
17790 spec
->ext_mic
.mux_idx
= 0;
17791 spec
->int_mic
.pin
= 0x19;
17792 spec
->int_mic
.mux_idx
= 1;
17793 spec
->auto_mic
= 1;
17796 /* ***************** Mode4 ******************************/
17797 static void alc663_mode4_setup(struct hda_codec
*codec
)
17799 struct alc_spec
*spec
= codec
->spec
;
17800 spec
->autocfg
.hp_pins
[0] = 0x21;
17801 spec
->autocfg
.speaker_pins
[0] = 0x14;
17802 spec
->autocfg
.speaker_pins
[1] = 0x16;
17803 spec
->automute_mixer_nid
[0] = 0x0c;
17804 spec
->automute_mixer_nid
[1] = 0x0e;
17805 spec
->automute
= 1;
17806 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
17807 spec
->ext_mic
.pin
= 0x18;
17808 spec
->ext_mic
.mux_idx
= 0;
17809 spec
->int_mic
.pin
= 0x19;
17810 spec
->int_mic
.mux_idx
= 1;
17811 spec
->auto_mic
= 1;
17814 /* ***************** Mode5 ******************************/
17815 static void alc663_mode5_setup(struct hda_codec
*codec
)
17817 struct alc_spec
*spec
= codec
->spec
;
17818 spec
->autocfg
.hp_pins
[0] = 0x15;
17819 spec
->autocfg
.speaker_pins
[0] = 0x14;
17820 spec
->autocfg
.speaker_pins
[1] = 0x16;
17821 spec
->automute_mixer_nid
[0] = 0x0c;
17822 spec
->automute_mixer_nid
[1] = 0x0e;
17823 spec
->automute
= 1;
17824 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
17825 spec
->ext_mic
.pin
= 0x18;
17826 spec
->ext_mic
.mux_idx
= 0;
17827 spec
->int_mic
.pin
= 0x19;
17828 spec
->int_mic
.mux_idx
= 1;
17829 spec
->auto_mic
= 1;
17832 /* ***************** Mode6 ******************************/
17833 static void alc663_mode6_setup(struct hda_codec
*codec
)
17835 struct alc_spec
*spec
= codec
->spec
;
17836 spec
->autocfg
.hp_pins
[0] = 0x1b;
17837 spec
->autocfg
.hp_pins
[0] = 0x15;
17838 spec
->autocfg
.speaker_pins
[0] = 0x14;
17839 spec
->automute_mixer_nid
[0] = 0x0c;
17840 spec
->automute
= 1;
17841 spec
->automute_mode
= ALC_AUTOMUTE_MIXER
;
17842 spec
->ext_mic
.pin
= 0x18;
17843 spec
->ext_mic
.mux_idx
= 0;
17844 spec
->int_mic
.pin
= 0x19;
17845 spec
->int_mic
.mux_idx
= 1;
17846 spec
->auto_mic
= 1;
17849 /* ***************** Mode7 ******************************/
17850 static void alc663_mode7_setup(struct hda_codec
*codec
)
17852 struct alc_spec
*spec
= codec
->spec
;
17853 spec
->autocfg
.hp_pins
[0] = 0x1b;
17854 spec
->autocfg
.hp_pins
[0] = 0x21;
17855 spec
->autocfg
.speaker_pins
[0] = 0x14;
17856 spec
->autocfg
.speaker_pins
[0] = 0x17;
17857 spec
->automute
= 1;
17858 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
17859 spec
->ext_mic
.pin
= 0x18;
17860 spec
->ext_mic
.mux_idx
= 0;
17861 spec
->int_mic
.pin
= 0x19;
17862 spec
->int_mic
.mux_idx
= 1;
17863 spec
->auto_mic
= 1;
17866 /* ***************** Mode8 ******************************/
17867 static void alc663_mode8_setup(struct hda_codec
*codec
)
17869 struct alc_spec
*spec
= codec
->spec
;
17870 spec
->autocfg
.hp_pins
[0] = 0x21;
17871 spec
->autocfg
.hp_pins
[1] = 0x15;
17872 spec
->autocfg
.speaker_pins
[0] = 0x14;
17873 spec
->autocfg
.speaker_pins
[0] = 0x17;
17874 spec
->automute
= 1;
17875 spec
->automute_mode
= ALC_AUTOMUTE_PIN
;
17876 spec
->ext_mic
.pin
= 0x18;
17877 spec
->ext_mic
.mux_idx
= 0;
17878 spec
->int_mic
.pin
= 0x12;
17879 spec
->int_mic
.mux_idx
= 9;
17880 spec
->auto_mic
= 1;
17883 static void alc663_g71v_setup(struct hda_codec
*codec
)
17885 struct alc_spec
*spec
= codec
->spec
;
17886 spec
->autocfg
.hp_pins
[0] = 0x21;
17887 spec
->autocfg
.line_out_pins
[0] = 0x15;
17888 spec
->autocfg
.speaker_pins
[0] = 0x14;
17889 spec
->automute
= 1;
17890 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
17891 spec
->detect_line
= 1;
17892 spec
->automute_lines
= 1;
17893 spec
->ext_mic
.pin
= 0x18;
17894 spec
->ext_mic
.mux_idx
= 0;
17895 spec
->int_mic
.pin
= 0x12;
17896 spec
->int_mic
.mux_idx
= 9;
17897 spec
->auto_mic
= 1;
17900 #define alc663_g50v_setup alc663_m51va_setup
17902 static const struct snd_kcontrol_new alc662_ecs_mixer
[] = {
17903 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17904 ALC262_HIPPO_MASTER_SWITCH
,
17906 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT
),
17907 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17908 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17910 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
17911 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17912 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17916 static const struct snd_kcontrol_new alc272_nc10_mixer
[] = {
17917 /* Master Playback automatically created from Speaker and Headphone */
17918 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17919 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17920 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17921 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17923 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17924 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17925 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
17927 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17928 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17929 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT
),
17933 #ifdef CONFIG_SND_HDA_POWER_SAVE
17934 #define alc662_loopbacks alc880_loopbacks
17938 /* pcm configuration: identical with ALC880 */
17939 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17940 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17941 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17942 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17945 * configuration and preset
17947 static const char * const alc662_models
[ALC662_MODEL_LAST
] = {
17948 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
17949 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
17950 [ALC662_3ST_6ch
] = "3stack-6ch",
17951 [ALC662_5ST_DIG
] = "5stack-dig",
17952 [ALC662_LENOVO_101E
] = "lenovo-101e",
17953 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
17954 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
17955 [ALC662_ECS
] = "ecs",
17956 [ALC663_ASUS_M51VA
] = "m51va",
17957 [ALC663_ASUS_G71V
] = "g71v",
17958 [ALC663_ASUS_H13
] = "h13",
17959 [ALC663_ASUS_G50V
] = "g50v",
17960 [ALC663_ASUS_MODE1
] = "asus-mode1",
17961 [ALC662_ASUS_MODE2
] = "asus-mode2",
17962 [ALC663_ASUS_MODE3
] = "asus-mode3",
17963 [ALC663_ASUS_MODE4
] = "asus-mode4",
17964 [ALC663_ASUS_MODE5
] = "asus-mode5",
17965 [ALC663_ASUS_MODE6
] = "asus-mode6",
17966 [ALC663_ASUS_MODE7
] = "asus-mode7",
17967 [ALC663_ASUS_MODE8
] = "asus-mode8",
17968 [ALC272_DELL
] = "dell",
17969 [ALC272_DELL_ZM1
] = "dell-zm1",
17970 [ALC272_SAMSUNG_NC10
] = "samsung-nc10",
17971 [ALC662_AUTO
] = "auto",
17974 static const struct snd_pci_quirk alc662_cfg_tbl
[] = {
17975 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS
),
17976 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL
),
17977 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1
),
17978 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1
),
17979 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3
),
17980 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1
),
17981 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3
),
17982 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1
),
17983 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2
),
17984 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1
),
17985 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1
),
17986 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1
),
17987 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2
),
17988 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7
),
17989 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7
),
17990 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8
),
17991 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3
),
17992 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1
),
17993 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2
),
17994 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2
),
17995 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1
),
17996 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2
),
17997 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6
),
17998 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6
),
17999 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2
),
18000 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1
),
18001 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3
),
18002 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA
),
18003 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2
),
18004 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2
),
18005 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5
),
18006 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6
),
18007 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2
),
18008 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1
),
18009 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2
),
18010 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2
),
18011 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
18012 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18013 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3
),
18014 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3
),
18015 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1
),
18016 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1
),
18017 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1
),
18018 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1
),
18019 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1
),
18020 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2
),
18021 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2
),
18022 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1
),
18023 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1
),
18024 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3
),
18025 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1
),
18026 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1
),
18027 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V
),
18028 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18029 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1
),
18030 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2
),
18031 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA
),
18032 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1
),
18033 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4
),
18034 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
18035 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
18036 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
18037 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS
),
18038 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18039 ALC662_3ST_6ch_DIG
),
18040 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO
),
18041 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10
),
18042 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18043 ALC662_3ST_6ch_DIG
),
18044 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13
),
18045 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG
),
18046 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA
),
18047 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
18048 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18049 ALC662_3ST_6ch_DIG
),
18050 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18052 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E
),
18056 static const struct alc_config_preset alc662_presets
[] = {
18057 [ALC662_3ST_2ch_DIG
] = {
18058 .mixers
= { alc662_3ST_2ch_mixer
},
18059 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18060 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18061 .dac_nids
= alc662_dac_nids
,
18062 .dig_out_nid
= ALC662_DIGOUT_NID
,
18063 .dig_in_nid
= ALC662_DIGIN_NID
,
18064 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18065 .channel_mode
= alc662_3ST_2ch_modes
,
18066 .input_mux
= &alc662_capture_source
,
18068 [ALC662_3ST_6ch_DIG
] = {
18069 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18070 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18071 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18072 .dac_nids
= alc662_dac_nids
,
18073 .dig_out_nid
= ALC662_DIGOUT_NID
,
18074 .dig_in_nid
= ALC662_DIGIN_NID
,
18075 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18076 .channel_mode
= alc662_3ST_6ch_modes
,
18078 .input_mux
= &alc662_capture_source
,
18080 [ALC662_3ST_6ch
] = {
18081 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18082 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18083 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18084 .dac_nids
= alc662_dac_nids
,
18085 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18086 .channel_mode
= alc662_3ST_6ch_modes
,
18088 .input_mux
= &alc662_capture_source
,
18090 [ALC662_5ST_DIG
] = {
18091 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
},
18092 .init_verbs
= { alc662_init_verbs
, alc662_eapd_init_verbs
},
18093 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18094 .dac_nids
= alc662_dac_nids
,
18095 .dig_out_nid
= ALC662_DIGOUT_NID
,
18096 .dig_in_nid
= ALC662_DIGIN_NID
,
18097 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
18098 .channel_mode
= alc662_5stack_modes
,
18099 .input_mux
= &alc662_capture_source
,
18101 [ALC662_LENOVO_101E
] = {
18102 .mixers
= { alc662_lenovo_101e_mixer
},
18103 .init_verbs
= { alc662_init_verbs
,
18104 alc662_eapd_init_verbs
,
18105 alc662_sue_init_verbs
},
18106 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18107 .dac_nids
= alc662_dac_nids
,
18108 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18109 .channel_mode
= alc662_3ST_2ch_modes
,
18110 .input_mux
= &alc662_lenovo_101e_capture_source
,
18111 .unsol_event
= alc_sku_unsol_event
,
18112 .setup
= alc662_lenovo_101e_setup
,
18113 .init_hook
= alc_inithook
,
18115 [ALC662_ASUS_EEEPC_P701
] = {
18116 .mixers
= { alc662_eeepc_p701_mixer
},
18117 .init_verbs
= { alc662_init_verbs
,
18118 alc662_eapd_init_verbs
,
18119 alc662_eeepc_sue_init_verbs
},
18120 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18121 .dac_nids
= alc662_dac_nids
,
18122 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18123 .channel_mode
= alc662_3ST_2ch_modes
,
18124 .unsol_event
= alc_sku_unsol_event
,
18125 .setup
= alc662_eeepc_setup
,
18126 .init_hook
= alc_inithook
,
18128 [ALC662_ASUS_EEEPC_EP20
] = {
18129 .mixers
= { alc662_eeepc_ep20_mixer
,
18130 alc662_chmode_mixer
},
18131 .init_verbs
= { alc662_init_verbs
,
18132 alc662_eapd_init_verbs
,
18133 alc662_eeepc_ep20_sue_init_verbs
},
18134 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18135 .dac_nids
= alc662_dac_nids
,
18136 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18137 .channel_mode
= alc662_3ST_6ch_modes
,
18138 .input_mux
= &alc662_lenovo_101e_capture_source
,
18139 .unsol_event
= alc_sku_unsol_event
,
18140 .setup
= alc662_eeepc_ep20_setup
,
18141 .init_hook
= alc_inithook
,
18144 .mixers
= { alc662_ecs_mixer
},
18145 .init_verbs
= { alc662_init_verbs
,
18146 alc662_eapd_init_verbs
,
18147 alc662_ecs_init_verbs
},
18148 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18149 .dac_nids
= alc662_dac_nids
,
18150 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18151 .channel_mode
= alc662_3ST_2ch_modes
,
18152 .unsol_event
= alc_sku_unsol_event
,
18153 .setup
= alc662_eeepc_setup
,
18154 .init_hook
= alc_inithook
,
18156 [ALC663_ASUS_M51VA
] = {
18157 .mixers
= { alc663_m51va_mixer
},
18158 .init_verbs
= { alc662_init_verbs
,
18159 alc662_eapd_init_verbs
,
18160 alc663_m51va_init_verbs
},
18161 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18162 .dac_nids
= alc662_dac_nids
,
18163 .dig_out_nid
= ALC662_DIGOUT_NID
,
18164 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18165 .channel_mode
= alc662_3ST_2ch_modes
,
18166 .unsol_event
= alc_sku_unsol_event
,
18167 .setup
= alc663_m51va_setup
,
18168 .init_hook
= alc_inithook
,
18170 [ALC663_ASUS_G71V
] = {
18171 .mixers
= { alc663_g71v_mixer
},
18172 .init_verbs
= { alc662_init_verbs
,
18173 alc662_eapd_init_verbs
,
18174 alc663_g71v_init_verbs
},
18175 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18176 .dac_nids
= alc662_dac_nids
,
18177 .dig_out_nid
= ALC662_DIGOUT_NID
,
18178 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18179 .channel_mode
= alc662_3ST_2ch_modes
,
18180 .unsol_event
= alc_sku_unsol_event
,
18181 .setup
= alc663_g71v_setup
,
18182 .init_hook
= alc_inithook
,
18184 [ALC663_ASUS_H13
] = {
18185 .mixers
= { alc663_m51va_mixer
},
18186 .init_verbs
= { alc662_init_verbs
,
18187 alc662_eapd_init_verbs
,
18188 alc663_m51va_init_verbs
},
18189 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18190 .dac_nids
= alc662_dac_nids
,
18191 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18192 .channel_mode
= alc662_3ST_2ch_modes
,
18193 .setup
= alc663_m51va_setup
,
18194 .unsol_event
= alc_sku_unsol_event
,
18195 .init_hook
= alc_inithook
,
18197 [ALC663_ASUS_G50V
] = {
18198 .mixers
= { alc663_g50v_mixer
},
18199 .init_verbs
= { alc662_init_verbs
,
18200 alc662_eapd_init_verbs
,
18201 alc663_g50v_init_verbs
},
18202 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18203 .dac_nids
= alc662_dac_nids
,
18204 .dig_out_nid
= ALC662_DIGOUT_NID
,
18205 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18206 .channel_mode
= alc662_3ST_6ch_modes
,
18207 .input_mux
= &alc663_capture_source
,
18208 .unsol_event
= alc_sku_unsol_event
,
18209 .setup
= alc663_g50v_setup
,
18210 .init_hook
= alc_inithook
,
18212 [ALC663_ASUS_MODE1
] = {
18213 .mixers
= { alc663_m51va_mixer
},
18214 .cap_mixer
= alc662_auto_capture_mixer
,
18215 .init_verbs
= { alc662_init_verbs
,
18216 alc662_eapd_init_verbs
,
18217 alc663_21jd_amic_init_verbs
},
18218 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18220 .dac_nids
= alc662_dac_nids
,
18221 .dig_out_nid
= ALC662_DIGOUT_NID
,
18222 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18223 .channel_mode
= alc662_3ST_2ch_modes
,
18224 .unsol_event
= alc_sku_unsol_event
,
18225 .setup
= alc663_mode1_setup
,
18226 .init_hook
= alc_inithook
,
18228 [ALC662_ASUS_MODE2
] = {
18229 .mixers
= { alc662_1bjd_mixer
},
18230 .cap_mixer
= alc662_auto_capture_mixer
,
18231 .init_verbs
= { alc662_init_verbs
,
18232 alc662_eapd_init_verbs
,
18233 alc662_1bjd_amic_init_verbs
},
18234 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18235 .dac_nids
= alc662_dac_nids
,
18236 .dig_out_nid
= ALC662_DIGOUT_NID
,
18237 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18238 .channel_mode
= alc662_3ST_2ch_modes
,
18239 .unsol_event
= alc_sku_unsol_event
,
18240 .setup
= alc662_mode2_setup
,
18241 .init_hook
= alc_inithook
,
18243 [ALC663_ASUS_MODE3
] = {
18244 .mixers
= { alc663_two_hp_m1_mixer
},
18245 .cap_mixer
= alc662_auto_capture_mixer
,
18246 .init_verbs
= { alc662_init_verbs
,
18247 alc662_eapd_init_verbs
,
18248 alc663_two_hp_amic_m1_init_verbs
},
18249 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18251 .dac_nids
= alc662_dac_nids
,
18252 .dig_out_nid
= ALC662_DIGOUT_NID
,
18253 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18254 .channel_mode
= alc662_3ST_2ch_modes
,
18255 .unsol_event
= alc_sku_unsol_event
,
18256 .setup
= alc663_mode3_setup
,
18257 .init_hook
= alc_inithook
,
18259 [ALC663_ASUS_MODE4
] = {
18260 .mixers
= { alc663_asus_21jd_clfe_mixer
},
18261 .cap_mixer
= alc662_auto_capture_mixer
,
18262 .init_verbs
= { alc662_init_verbs
,
18263 alc662_eapd_init_verbs
,
18264 alc663_21jd_amic_init_verbs
},
18265 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18267 .dac_nids
= alc662_dac_nids
,
18268 .dig_out_nid
= ALC662_DIGOUT_NID
,
18269 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18270 .channel_mode
= alc662_3ST_2ch_modes
,
18271 .unsol_event
= alc_sku_unsol_event
,
18272 .setup
= alc663_mode4_setup
,
18273 .init_hook
= alc_inithook
,
18275 [ALC663_ASUS_MODE5
] = {
18276 .mixers
= { alc663_asus_15jd_clfe_mixer
},
18277 .cap_mixer
= alc662_auto_capture_mixer
,
18278 .init_verbs
= { alc662_init_verbs
,
18279 alc662_eapd_init_verbs
,
18280 alc663_15jd_amic_init_verbs
},
18281 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18283 .dac_nids
= alc662_dac_nids
,
18284 .dig_out_nid
= ALC662_DIGOUT_NID
,
18285 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18286 .channel_mode
= alc662_3ST_2ch_modes
,
18287 .unsol_event
= alc_sku_unsol_event
,
18288 .setup
= alc663_mode5_setup
,
18289 .init_hook
= alc_inithook
,
18291 [ALC663_ASUS_MODE6
] = {
18292 .mixers
= { alc663_two_hp_m2_mixer
},
18293 .cap_mixer
= alc662_auto_capture_mixer
,
18294 .init_verbs
= { alc662_init_verbs
,
18295 alc662_eapd_init_verbs
,
18296 alc663_two_hp_amic_m2_init_verbs
},
18297 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18299 .dac_nids
= alc662_dac_nids
,
18300 .dig_out_nid
= ALC662_DIGOUT_NID
,
18301 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18302 .channel_mode
= alc662_3ST_2ch_modes
,
18303 .unsol_event
= alc_sku_unsol_event
,
18304 .setup
= alc663_mode6_setup
,
18305 .init_hook
= alc_inithook
,
18307 [ALC663_ASUS_MODE7
] = {
18308 .mixers
= { alc663_mode7_mixer
},
18309 .cap_mixer
= alc662_auto_capture_mixer
,
18310 .init_verbs
= { alc662_init_verbs
,
18311 alc662_eapd_init_verbs
,
18312 alc663_mode7_init_verbs
},
18313 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18315 .dac_nids
= alc662_dac_nids
,
18316 .dig_out_nid
= ALC662_DIGOUT_NID
,
18317 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18318 .channel_mode
= alc662_3ST_2ch_modes
,
18319 .unsol_event
= alc_sku_unsol_event
,
18320 .setup
= alc663_mode7_setup
,
18321 .init_hook
= alc_inithook
,
18323 [ALC663_ASUS_MODE8
] = {
18324 .mixers
= { alc663_mode8_mixer
},
18325 .cap_mixer
= alc662_auto_capture_mixer
,
18326 .init_verbs
= { alc662_init_verbs
,
18327 alc662_eapd_init_verbs
,
18328 alc663_mode8_init_verbs
},
18329 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18331 .dac_nids
= alc662_dac_nids
,
18332 .dig_out_nid
= ALC662_DIGOUT_NID
,
18333 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18334 .channel_mode
= alc662_3ST_2ch_modes
,
18335 .unsol_event
= alc_sku_unsol_event
,
18336 .setup
= alc663_mode8_setup
,
18337 .init_hook
= alc_inithook
,
18340 .mixers
= { alc663_m51va_mixer
},
18341 .cap_mixer
= alc272_auto_capture_mixer
,
18342 .init_verbs
= { alc662_init_verbs
,
18343 alc662_eapd_init_verbs
,
18344 alc272_dell_init_verbs
},
18345 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18346 .dac_nids
= alc272_dac_nids
,
18347 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18348 .adc_nids
= alc272_adc_nids
,
18349 .num_adc_nids
= ARRAY_SIZE(alc272_adc_nids
),
18350 .capsrc_nids
= alc272_capsrc_nids
,
18351 .channel_mode
= alc662_3ST_2ch_modes
,
18352 .unsol_event
= alc_sku_unsol_event
,
18353 .setup
= alc663_m51va_setup
,
18354 .init_hook
= alc_inithook
,
18356 [ALC272_DELL_ZM1
] = {
18357 .mixers
= { alc663_m51va_mixer
},
18358 .cap_mixer
= alc662_auto_capture_mixer
,
18359 .init_verbs
= { alc662_init_verbs
,
18360 alc662_eapd_init_verbs
,
18361 alc272_dell_zm1_init_verbs
},
18362 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18363 .dac_nids
= alc272_dac_nids
,
18364 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18365 .adc_nids
= alc662_adc_nids
,
18367 .capsrc_nids
= alc662_capsrc_nids
,
18368 .channel_mode
= alc662_3ST_2ch_modes
,
18369 .unsol_event
= alc_sku_unsol_event
,
18370 .setup
= alc663_m51va_setup
,
18371 .init_hook
= alc_inithook
,
18373 [ALC272_SAMSUNG_NC10
] = {
18374 .mixers
= { alc272_nc10_mixer
},
18375 .init_verbs
= { alc662_init_verbs
,
18376 alc662_eapd_init_verbs
,
18377 alc663_21jd_amic_init_verbs
},
18378 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18379 .dac_nids
= alc272_dac_nids
,
18380 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18381 .channel_mode
= alc662_3ST_2ch_modes
,
18382 /*.input_mux = &alc272_nc10_capture_source,*/
18383 .unsol_event
= alc_sku_unsol_event
,
18384 .setup
= alc663_mode4_setup
,
18385 .init_hook
= alc_inithook
,
18391 * BIOS auto configuration
18394 /* convert from MIX nid to DAC */
18395 static hda_nid_t
alc_auto_mix_to_dac(struct hda_codec
*codec
, hda_nid_t nid
)
18400 num
= snd_hda_get_connections(codec
, nid
, list
, ARRAY_SIZE(list
));
18401 for (i
= 0; i
< num
; i
++) {
18402 if (get_wcaps_type(get_wcaps(codec
, list
[i
])) == AC_WID_AUD_OUT
)
18408 /* go down to the selector widget before the mixer */
18409 static hda_nid_t
alc_go_down_to_selector(struct hda_codec
*codec
, hda_nid_t pin
)
18412 int num
= snd_hda_get_connections(codec
, pin
, srcs
,
18415 get_wcaps_type(get_wcaps(codec
, srcs
[0])) != AC_WID_AUD_SEL
)
18420 /* get MIX nid connected to the given pin targeted to DAC */
18421 static hda_nid_t
alc_auto_dac_to_mix(struct hda_codec
*codec
, hda_nid_t pin
,
18427 pin
= alc_go_down_to_selector(codec
, pin
);
18428 num
= snd_hda_get_connections(codec
, pin
, mix
, ARRAY_SIZE(mix
));
18429 for (i
= 0; i
< num
; i
++) {
18430 if (alc_auto_mix_to_dac(codec
, mix
[i
]) == dac
)
18436 /* select the connection from pin to DAC if needed */
18437 static int alc_auto_select_dac(struct hda_codec
*codec
, hda_nid_t pin
,
18443 pin
= alc_go_down_to_selector(codec
, pin
);
18444 num
= snd_hda_get_connections(codec
, pin
, mix
, ARRAY_SIZE(mix
));
18447 for (i
= 0; i
< num
; i
++) {
18448 if (alc_auto_mix_to_dac(codec
, mix
[i
]) == dac
) {
18449 snd_hda_codec_update_cache(codec
, pin
, 0,
18450 AC_VERB_SET_CONNECT_SEL
, i
);
18457 /* look for an empty DAC slot */
18458 static hda_nid_t
alc_auto_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
18460 struct alc_spec
*spec
= codec
->spec
;
18464 pin
= alc_go_down_to_selector(codec
, pin
);
18465 num
= snd_hda_get_connections(codec
, pin
, srcs
, ARRAY_SIZE(srcs
));
18466 for (i
= 0; i
< num
; i
++) {
18467 hda_nid_t nid
= alc_auto_mix_to_dac(codec
, srcs
[i
]);
18470 if (found_in_nid_list(nid
, spec
->multiout
.dac_nids
,
18471 spec
->multiout
.num_dacs
))
18473 if (spec
->multiout
.hp_nid
== nid
)
18475 if (found_in_nid_list(nid
, spec
->multiout
.extra_out_nid
,
18476 ARRAY_SIZE(spec
->multiout
.extra_out_nid
)))
18483 static hda_nid_t
get_dac_if_single(struct hda_codec
*codec
, hda_nid_t pin
)
18485 hda_nid_t sel
= alc_go_down_to_selector(codec
, pin
);
18486 if (snd_hda_get_conn_list(codec
, sel
, NULL
) == 1)
18487 return alc_auto_look_for_dac(codec
, pin
);
18491 /* fill in the dac_nids table from the parsed pin configuration */
18492 static int alc_auto_fill_dac_nids(struct hda_codec
*codec
)
18494 struct alc_spec
*spec
= codec
->spec
;
18495 const struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
18496 bool redone
= false;
18500 spec
->multiout
.num_dacs
= 0;
18501 spec
->multiout
.hp_nid
= 0;
18502 spec
->multiout
.extra_out_nid
[0] = 0;
18503 memset(spec
->private_dac_nids
, 0, sizeof(spec
->private_dac_nids
));
18504 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
18506 /* fill hard-wired DACs first */
18508 for (i
= 0; i
< cfg
->line_outs
; i
++)
18509 spec
->private_dac_nids
[i
] =
18510 get_dac_if_single(codec
, cfg
->line_out_pins
[i
]);
18512 spec
->multiout
.hp_nid
=
18513 get_dac_if_single(codec
, cfg
->hp_pins
[0]);
18514 if (cfg
->speaker_outs
)
18515 spec
->multiout
.extra_out_nid
[0] =
18516 get_dac_if_single(codec
, cfg
->speaker_pins
[0]);
18519 for (i
= 0; i
< cfg
->line_outs
; i
++) {
18520 hda_nid_t pin
= cfg
->line_out_pins
[i
];
18521 if (spec
->private_dac_nids
[i
])
18523 spec
->private_dac_nids
[i
] = alc_auto_look_for_dac(codec
, pin
);
18524 if (!spec
->private_dac_nids
[i
] && !redone
) {
18525 /* if we can't find primary DACs, re-probe without
18526 * checking the hard-wired DACs
18533 for (i
= 0; i
< cfg
->line_outs
; i
++) {
18534 if (spec
->private_dac_nids
[i
])
18535 spec
->multiout
.num_dacs
++;
18537 memmove(spec
->private_dac_nids
+ i
,
18538 spec
->private_dac_nids
+ i
+ 1,
18539 sizeof(hda_nid_t
) * (cfg
->line_outs
- i
- 1));
18542 if (cfg
->hp_outs
&& !spec
->multiout
.hp_nid
)
18543 spec
->multiout
.hp_nid
=
18544 alc_auto_look_for_dac(codec
, cfg
->hp_pins
[0]);
18545 if (cfg
->speaker_outs
&& !spec
->multiout
.extra_out_nid
[0])
18546 spec
->multiout
.extra_out_nid
[0] =
18547 alc_auto_look_for_dac(codec
, cfg
->speaker_pins
[0]);
18552 static int alc_auto_add_vol_ctl(struct hda_codec
*codec
,
18553 const char *pfx
, int cidx
,
18554 hda_nid_t nid
, unsigned int chs
)
18556 return __add_pb_vol_ctrl(codec
->spec
, ALC_CTL_WIDGET_VOL
, pfx
, cidx
,
18557 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
18560 #define alc_auto_add_stereo_vol(codec, pfx, cidx, nid) \
18561 alc_auto_add_vol_ctl(codec, pfx, cidx, nid, 3)
18563 /* create a mute-switch for the given mixer widget;
18564 * if it has multiple sources (e.g. DAC and loopback), create a bind-mute
18566 static int alc_auto_add_sw_ctl(struct hda_codec
*codec
,
18567 const char *pfx
, int cidx
,
18568 hda_nid_t nid
, unsigned int chs
)
18572 if (snd_hda_get_conn_list(codec
, nid
, NULL
) == 1) {
18573 type
= ALC_CTL_WIDGET_MUTE
;
18574 val
= HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_INPUT
);
18576 type
= ALC_CTL_BIND_MUTE
;
18577 val
= HDA_COMPOSE_AMP_VAL(nid
, chs
, 2, HDA_INPUT
);
18579 return __add_pb_sw_ctrl(codec
->spec
, type
, pfx
, cidx
, val
);
18582 #define alc_auto_add_stereo_sw(codec, pfx, cidx, nid) \
18583 alc_auto_add_sw_ctl(codec, pfx, cidx, nid, 3)
18585 /* add playback controls from the parsed DAC table */
18586 static int alc_auto_create_multi_out_ctls(struct hda_codec
*codec
,
18587 const struct auto_pin_cfg
*cfg
)
18589 struct alc_spec
*spec
= codec
->spec
;
18590 hda_nid_t nid
, mix
, pin
;
18591 int i
, err
, noutputs
;
18593 noutputs
= cfg
->line_outs
;
18594 if (spec
->multi_ios
> 0)
18595 noutputs
+= spec
->multi_ios
;
18597 for (i
= 0; i
< noutputs
; i
++) {
18600 nid
= spec
->multiout
.dac_nids
[i
];
18603 if (i
>= cfg
->line_outs
)
18604 pin
= spec
->multi_io
[i
- 1].pin
;
18606 pin
= cfg
->line_out_pins
[i
];
18607 mix
= alc_auto_dac_to_mix(codec
, pin
, nid
);
18610 name
= alc_get_line_out_pfx(spec
, i
, true, &index
);
18613 err
= alc_auto_add_vol_ctl(codec
, "Center", 0, nid
, 1);
18616 err
= alc_auto_add_vol_ctl(codec
, "LFE", 0, nid
, 2);
18619 err
= alc_auto_add_sw_ctl(codec
, "Center", 0, mix
, 1);
18622 err
= alc_auto_add_sw_ctl(codec
, "LFE", 0, mix
, 2);
18626 err
= alc_auto_add_stereo_vol(codec
, name
, index
, nid
);
18629 err
= alc_auto_add_stereo_sw(codec
, name
, index
, mix
);
18637 /* add playback controls for speaker and HP outputs */
18638 static int alc_auto_create_extra_out(struct hda_codec
*codec
, hda_nid_t pin
,
18639 hda_nid_t dac
, const char *pfx
)
18641 struct alc_spec
*spec
= codec
->spec
;
18648 /* the corresponding DAC is already occupied */
18649 if (!(get_wcaps(codec
, pin
) & AC_WCAP_OUT_AMP
))
18650 return 0; /* no way */
18651 /* create a switch only */
18652 return add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
18653 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
18656 mix
= alc_auto_dac_to_mix(codec
, pin
, dac
);
18659 err
= alc_auto_add_stereo_vol(codec
, pfx
, 0, dac
);
18662 err
= alc_auto_add_stereo_sw(codec
, pfx
, 0, mix
);
18668 static int alc_auto_create_hp_out(struct hda_codec
*codec
)
18670 struct alc_spec
*spec
= codec
->spec
;
18671 return alc_auto_create_extra_out(codec
, spec
->autocfg
.hp_pins
[0],
18672 spec
->multiout
.hp_nid
,
18676 static int alc_auto_create_speaker_out(struct hda_codec
*codec
)
18678 struct alc_spec
*spec
= codec
->spec
;
18679 return alc_auto_create_extra_out(codec
, spec
->autocfg
.speaker_pins
[0],
18680 spec
->multiout
.extra_out_nid
[0],
18684 static void alc_auto_set_output_and_unmute(struct hda_codec
*codec
,
18685 hda_nid_t nid
, int pin_type
,
18690 hda_nid_t srcs
[HDA_MAX_CONNECTIONS
];
18692 alc_set_pin_output(codec
, nid
, pin_type
);
18693 nid
= alc_go_down_to_selector(codec
, nid
);
18694 num
= snd_hda_get_connections(codec
, nid
, srcs
, ARRAY_SIZE(srcs
));
18695 for (i
= 0; i
< num
; i
++) {
18696 if (alc_auto_mix_to_dac(codec
, srcs
[i
]) != dac
)
18704 /* need the manual connection? */
18706 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, i
);
18707 /* unmute mixer widget inputs */
18708 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
18710 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
18712 /* initialize volume */
18713 if (query_amp_caps(codec
, dac
, HDA_OUTPUT
) & AC_AMPCAP_NUM_STEPS
)
18715 else if (query_amp_caps(codec
, mix
, HDA_OUTPUT
) & AC_AMPCAP_NUM_STEPS
)
18719 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
18723 static void alc_auto_init_multi_out(struct hda_codec
*codec
)
18725 struct alc_spec
*spec
= codec
->spec
;
18726 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
18729 for (i
= 0; i
<= HDA_SIDE
; i
++) {
18730 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
18732 alc_auto_set_output_and_unmute(codec
, nid
, pin_type
,
18733 spec
->multiout
.dac_nids
[i
]);
18737 static void alc_auto_init_extra_out(struct hda_codec
*codec
)
18739 struct alc_spec
*spec
= codec
->spec
;
18742 pin
= spec
->autocfg
.hp_pins
[0];
18744 alc_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
18745 spec
->multiout
.hp_nid
);
18746 pin
= spec
->autocfg
.speaker_pins
[0];
18748 alc_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
,
18749 spec
->multiout
.extra_out_nid
[0]);
18752 #define alc662_auto_init_input_src alc882_auto_init_input_src
18757 static int alc_auto_fill_multi_ios(struct hda_codec
*codec
,
18758 unsigned int location
)
18760 struct alc_spec
*spec
= codec
->spec
;
18761 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
18762 int type
, i
, num_pins
= 0;
18764 for (type
= AUTO_PIN_LINE_IN
; type
>= AUTO_PIN_MIC
; type
--) {
18765 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
18766 hda_nid_t nid
= cfg
->inputs
[i
].pin
;
18768 unsigned int defcfg
, caps
;
18769 if (cfg
->inputs
[i
].type
!= type
)
18771 defcfg
= snd_hda_codec_get_pincfg(codec
, nid
);
18772 if (get_defcfg_connect(defcfg
) != AC_JACK_PORT_COMPLEX
)
18774 if (location
&& get_defcfg_location(defcfg
) != location
)
18776 caps
= snd_hda_query_pin_caps(codec
, nid
);
18777 if (!(caps
& AC_PINCAP_OUT
))
18779 dac
= alc_auto_look_for_dac(codec
, nid
);
18782 spec
->multi_io
[num_pins
].pin
= nid
;
18783 spec
->multi_io
[num_pins
].dac
= dac
;
18785 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
18788 spec
->multiout
.num_dacs
= 1;
18794 static int alc_auto_ch_mode_info(struct snd_kcontrol
*kcontrol
,
18795 struct snd_ctl_elem_info
*uinfo
)
18797 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
18798 struct alc_spec
*spec
= codec
->spec
;
18800 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
18802 uinfo
->value
.enumerated
.items
= spec
->multi_ios
+ 1;
18803 if (uinfo
->value
.enumerated
.item
> spec
->multi_ios
)
18804 uinfo
->value
.enumerated
.item
= spec
->multi_ios
;
18805 sprintf(uinfo
->value
.enumerated
.name
, "%dch",
18806 (uinfo
->value
.enumerated
.item
+ 1) * 2);
18810 static int alc_auto_ch_mode_get(struct snd_kcontrol
*kcontrol
,
18811 struct snd_ctl_elem_value
*ucontrol
)
18813 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
18814 struct alc_spec
*spec
= codec
->spec
;
18815 ucontrol
->value
.enumerated
.item
[0] = (spec
->ext_channel_count
- 1) / 2;
18819 static int alc_set_multi_io(struct hda_codec
*codec
, int idx
, bool output
)
18821 struct alc_spec
*spec
= codec
->spec
;
18822 hda_nid_t nid
= spec
->multi_io
[idx
].pin
;
18824 if (!spec
->multi_io
[idx
].ctl_in
)
18825 spec
->multi_io
[idx
].ctl_in
=
18826 snd_hda_codec_read(codec
, nid
, 0,
18827 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
18829 snd_hda_codec_update_cache(codec
, nid
, 0,
18830 AC_VERB_SET_PIN_WIDGET_CONTROL
,
18832 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
18833 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
18835 alc_auto_select_dac(codec
, nid
, spec
->multi_io
[idx
].dac
);
18837 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
18838 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
18839 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
18840 snd_hda_codec_update_cache(codec
, nid
, 0,
18841 AC_VERB_SET_PIN_WIDGET_CONTROL
,
18842 spec
->multi_io
[idx
].ctl_in
);
18847 static int alc_auto_ch_mode_put(struct snd_kcontrol
*kcontrol
,
18848 struct snd_ctl_elem_value
*ucontrol
)
18850 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
18851 struct alc_spec
*spec
= codec
->spec
;
18854 ch
= ucontrol
->value
.enumerated
.item
[0];
18855 if (ch
< 0 || ch
> spec
->multi_ios
)
18857 if (ch
== (spec
->ext_channel_count
- 1) / 2)
18859 spec
->ext_channel_count
= (ch
+ 1) * 2;
18860 for (i
= 0; i
< spec
->multi_ios
; i
++)
18861 alc_set_multi_io(codec
, i
, i
< ch
);
18862 spec
->multiout
.max_channels
= spec
->ext_channel_count
;
18866 static const struct snd_kcontrol_new alc_auto_channel_mode_enum
= {
18867 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
18868 .name
= "Channel Mode",
18869 .info
= alc_auto_ch_mode_info
,
18870 .get
= alc_auto_ch_mode_get
,
18871 .put
= alc_auto_ch_mode_put
,
18874 static int alc_auto_add_multi_channel_mode(struct hda_codec
*codec
,
18875 int (*fill_dac
)(struct hda_codec
*))
18877 struct alc_spec
*spec
= codec
->spec
;
18878 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
18879 unsigned int location
, defcfg
;
18882 if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
&& cfg
->hp_outs
== 1) {
18883 /* use HP as primary out */
18884 cfg
->speaker_outs
= cfg
->line_outs
;
18885 memcpy(cfg
->speaker_pins
, cfg
->line_out_pins
,
18886 sizeof(cfg
->speaker_pins
));
18887 cfg
->line_outs
= cfg
->hp_outs
;
18888 memcpy(cfg
->line_out_pins
, cfg
->hp_pins
, sizeof(cfg
->hp_pins
));
18890 memset(cfg
->hp_pins
, 0, sizeof(cfg
->hp_pins
));
18891 cfg
->line_out_type
= AUTO_PIN_HP_OUT
;
18895 if (cfg
->line_outs
!= 1 ||
18896 cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
18899 defcfg
= snd_hda_codec_get_pincfg(codec
, cfg
->line_out_pins
[0]);
18900 location
= get_defcfg_location(defcfg
);
18902 num_pins
= alc_auto_fill_multi_ios(codec
, location
);
18903 if (num_pins
> 0) {
18904 struct snd_kcontrol_new
*knew
;
18906 knew
= alc_kcontrol_new(spec
);
18909 *knew
= alc_auto_channel_mode_enum
;
18910 knew
->name
= kstrdup("Channel Mode", GFP_KERNEL
);
18914 spec
->multi_ios
= num_pins
;
18915 spec
->ext_channel_count
= 2;
18916 spec
->multiout
.num_dacs
= num_pins
+ 1;
18921 static int alc662_parse_auto_config(struct hda_codec
*codec
)
18923 struct alc_spec
*spec
= codec
->spec
;
18925 static const hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
18927 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
18931 if (!spec
->autocfg
.line_outs
)
18932 return 0; /* can't find valid BIOS pin config */
18934 err
= alc_auto_fill_dac_nids(codec
);
18937 err
= alc_auto_add_multi_channel_mode(codec
, alc_auto_fill_dac_nids
);
18940 err
= alc_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
18943 err
= alc_auto_create_extra_out(codec
,
18944 spec
->autocfg
.speaker_pins
[0],
18945 spec
->multiout
.extra_out_nid
[0],
18949 err
= alc_auto_create_extra_out(codec
, spec
->autocfg
.hp_pins
[0],
18950 spec
->multiout
.hp_nid
,
18954 err
= alc_auto_create_input_ctls(codec
);
18958 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
18960 alc_auto_parse_digital(codec
);
18962 if (spec
->kctls
.list
)
18963 add_mixer(spec
, spec
->kctls
.list
);
18965 spec
->num_mux_defs
= 1;
18966 spec
->input_mux
= &spec
->private_imux
[0];
18968 err
= alc_auto_add_mic_boost(codec
);
18972 if (codec
->vendor_id
== 0x10ec0272 || codec
->vendor_id
== 0x10ec0663 ||
18973 codec
->vendor_id
== 0x10ec0665 || codec
->vendor_id
== 0x10ec0670)
18974 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0x21);
18976 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
18981 /* additional initialization for auto-configuration model */
18982 static void alc662_auto_init(struct hda_codec
*codec
)
18984 struct alc_spec
*spec
= codec
->spec
;
18985 alc_auto_init_multi_out(codec
);
18986 alc_auto_init_extra_out(codec
);
18987 alc_auto_init_analog_input(codec
);
18988 alc662_auto_init_input_src(codec
);
18989 alc_auto_init_digital(codec
);
18990 if (spec
->unsol_event
)
18991 alc_inithook(codec
);
18994 static void alc272_fixup_mario(struct hda_codec
*codec
,
18995 const struct alc_fixup
*fix
, int action
)
18997 if (action
!= ALC_FIXUP_ACT_PROBE
)
18999 if (snd_hda_override_amp_caps(codec
, 0x2, HDA_OUTPUT
,
19000 (0x3b << AC_AMPCAP_OFFSET_SHIFT
) |
19001 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT
) |
19002 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
19003 (0 << AC_AMPCAP_MUTE_SHIFT
)))
19004 printk(KERN_WARNING
19005 "hda_codec: failed to override amp caps for NID 0x2\n");
19009 ALC662_FIXUP_ASPIRE
,
19010 ALC662_FIXUP_IDEAPAD
,
19011 ALC272_FIXUP_MARIO
,
19012 ALC662_FIXUP_CZC_P10T
,
19013 ALC662_FIXUP_SKU_IGNORE
,
19016 static const struct alc_fixup alc662_fixups
[] = {
19017 [ALC662_FIXUP_ASPIRE
] = {
19018 .type
= ALC_FIXUP_PINS
,
19019 .v
.pins
= (const struct alc_pincfg
[]) {
19020 { 0x15, 0x99130112 }, /* subwoofer */
19024 [ALC662_FIXUP_IDEAPAD
] = {
19025 .type
= ALC_FIXUP_PINS
,
19026 .v
.pins
= (const struct alc_pincfg
[]) {
19027 { 0x17, 0x99130112 }, /* subwoofer */
19031 [ALC272_FIXUP_MARIO
] = {
19032 .type
= ALC_FIXUP_FUNC
,
19033 .v
.func
= alc272_fixup_mario
,
19035 [ALC662_FIXUP_CZC_P10T
] = {
19036 .type
= ALC_FIXUP_VERBS
,
19037 .v
.verbs
= (const struct hda_verb
[]) {
19038 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0},
19042 [ALC662_FIXUP_SKU_IGNORE
] = {
19043 .type
= ALC_FIXUP_SKU
,
19044 .v
.sku
= ALC_FIXUP_SKU_IGNORE
,
19048 static const struct snd_pci_quirk alc662_fixup_tbl
[] = {
19049 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE
),
19050 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE
),
19051 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE
),
19052 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD
),
19053 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD
),
19054 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD
),
19055 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T
),
19059 static const struct alc_model_fixup alc662_fixup_models
[] = {
19060 {.id
= ALC272_FIXUP_MARIO
, .name
= "mario"},
19065 static int patch_alc662(struct hda_codec
*codec
)
19067 struct alc_spec
*spec
;
19068 int err
, board_config
;
19071 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
19075 codec
->spec
= spec
;
19077 spec
->mixer_nid
= 0x0b;
19079 alc_auto_parse_customize_define(codec
);
19081 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
19083 coef
= alc_read_coef_idx(codec
, 0);
19084 if (coef
== 0x8020 || coef
== 0x8011)
19085 alc_codec_rename(codec
, "ALC661");
19086 else if (coef
& (1 << 14) &&
19087 codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
19088 spec
->cdefine
.platform_type
== 1)
19089 alc_codec_rename(codec
, "ALC272X");
19090 else if (coef
== 0x4011)
19091 alc_codec_rename(codec
, "ALC656");
19093 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
19096 if (board_config
< 0) {
19097 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
19099 board_config
= ALC662_AUTO
;
19102 if (board_config
== ALC662_AUTO
) {
19103 alc_pick_fixup(codec
, alc662_fixup_models
,
19104 alc662_fixup_tbl
, alc662_fixups
);
19105 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PRE_PROBE
);
19106 /* automatic parse from the BIOS config */
19107 err
= alc662_parse_auto_config(codec
);
19113 "hda_codec: Cannot set up configuration "
19114 "from BIOS. Using base mode...\n");
19115 board_config
= ALC662_3ST_2ch_DIG
;
19119 if (has_cdefine_beep(codec
)) {
19120 err
= snd_hda_attach_beep_device(codec
, 0x1);
19127 if (board_config
!= ALC662_AUTO
)
19128 setup_preset(codec
, &alc662_presets
[board_config
]);
19130 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
19131 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
19133 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
19134 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
19136 if (!spec
->adc_nids
) {
19137 spec
->adc_nids
= alc662_adc_nids
;
19138 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
19140 if (!spec
->capsrc_nids
)
19141 spec
->capsrc_nids
= alc662_capsrc_nids
;
19143 if (!spec
->cap_mixer
)
19144 set_capture_mixer(codec
);
19146 if (has_cdefine_beep(codec
)) {
19147 switch (codec
->vendor_id
) {
19149 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
19154 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
19157 set_beep_amp(spec
, 0x0b, 0x03, HDA_INPUT
);
19161 spec
->vmaster_nid
= 0x02;
19163 alc_apply_fixup(codec
, ALC_FIXUP_ACT_PROBE
);
19165 codec
->patch_ops
= alc_patch_ops
;
19166 if (board_config
== ALC662_AUTO
)
19167 spec
->init_hook
= alc662_auto_init
;
19168 spec
->shutup
= alc_eapd_shutup
;
19170 alc_init_jacks(codec
);
19172 #ifdef CONFIG_SND_HDA_POWER_SAVE
19173 if (!spec
->loopback
.amplist
)
19174 spec
->loopback
.amplist
= alc662_loopbacks
;
19180 static int patch_alc888(struct hda_codec
*codec
)
19182 if ((alc_read_coef_idx(codec
, 0) & 0x00f0)==0x0030){
19183 kfree(codec
->chip_name
);
19184 if (codec
->vendor_id
== 0x10ec0887)
19185 codec
->chip_name
= kstrdup("ALC887-VD", GFP_KERNEL
);
19187 codec
->chip_name
= kstrdup("ALC888-VD", GFP_KERNEL
);
19188 if (!codec
->chip_name
) {
19192 return patch_alc662(codec
);
19194 return patch_alc882(codec
);
19197 static int patch_alc899(struct hda_codec
*codec
)
19199 if ((alc_read_coef_idx(codec
, 0) & 0x2000) != 0x2000) {
19200 kfree(codec
->chip_name
);
19201 codec
->chip_name
= kstrdup("ALC898", GFP_KERNEL
);
19203 return patch_alc882(codec
);
19209 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19210 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19211 #define alc680_modes alc260_modes
19213 static const hda_nid_t alc680_dac_nids
[3] = {
19214 /* Lout1, Lout2, hp */
19218 static const hda_nid_t alc680_adc_nids
[3] = {
19220 /* DMIC, MIC, Line-in*/
19225 * Analog capture ADC cgange
19227 static void alc680_rec_autoswitch(struct hda_codec
*codec
)
19229 struct alc_spec
*spec
= codec
->spec
;
19230 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
19232 int type_found
= AUTO_PIN_LAST
;
19236 for (i
= 0; i
< cfg
->num_inputs
; i
++) {
19237 nid
= cfg
->inputs
[i
].pin
;
19238 if (!is_jack_detectable(codec
, nid
))
19240 if (snd_hda_jack_detect(codec
, nid
)) {
19241 if (cfg
->inputs
[i
].type
< type_found
) {
19242 type_found
= cfg
->inputs
[i
].type
;
19250 snd_hda_get_connections(codec
, pin_found
, &nid
, 1);
19252 if (nid
!= spec
->cur_adc
)
19253 __snd_hda_codec_cleanup_stream(codec
, spec
->cur_adc
, 1);
19254 spec
->cur_adc
= nid
;
19255 snd_hda_codec_setup_stream(codec
, nid
, spec
->cur_adc_stream_tag
, 0,
19256 spec
->cur_adc_format
);
19259 static int alc680_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
19260 struct hda_codec
*codec
,
19261 unsigned int stream_tag
,
19262 unsigned int format
,
19263 struct snd_pcm_substream
*substream
)
19265 struct alc_spec
*spec
= codec
->spec
;
19267 spec
->cur_adc
= 0x07;
19268 spec
->cur_adc_stream_tag
= stream_tag
;
19269 spec
->cur_adc_format
= format
;
19271 alc680_rec_autoswitch(codec
);
19275 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
19276 struct hda_codec
*codec
,
19277 struct snd_pcm_substream
*substream
)
19279 snd_hda_codec_cleanup_stream(codec
, 0x07);
19280 snd_hda_codec_cleanup_stream(codec
, 0x08);
19281 snd_hda_codec_cleanup_stream(codec
, 0x09);
19285 static const struct hda_pcm_stream alc680_pcm_analog_auto_capture
= {
19286 .substreams
= 1, /* can be overridden */
19289 /* NID is set in alc_build_pcms */
19291 .prepare
= alc680_capture_pcm_prepare
,
19292 .cleanup
= alc680_capture_pcm_cleanup
19296 static const struct snd_kcontrol_new alc680_base_mixer
[] = {
19297 /* output mixer control */
19298 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
19299 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
19300 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT
),
19301 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
19302 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT
),
19303 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT
),
19304 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT
),
19308 static const struct hda_bind_ctls alc680_bind_cap_vol
= {
19309 .ops
= &snd_hda_bind_vol
,
19311 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT
),
19312 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
19313 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
19318 static const struct hda_bind_ctls alc680_bind_cap_switch
= {
19319 .ops
= &snd_hda_bind_sw
,
19321 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT
),
19322 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
19323 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
19328 static const struct snd_kcontrol_new alc680_master_capture_mixer
[] = {
19329 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol
),
19330 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch
),
19335 * generic initialization of ADC, input mixers and output mixers
19337 static const struct hda_verb alc680_init_verbs
[] = {
19338 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19339 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19340 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
19342 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
19343 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
19344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
19345 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
19346 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
19347 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
19349 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19350 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19351 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19353 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
19355 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
19356 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
19357 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
19362 /* toggle speaker-output according to the hp-jack state */
19363 static void alc680_base_setup(struct hda_codec
*codec
)
19365 struct alc_spec
*spec
= codec
->spec
;
19367 spec
->autocfg
.hp_pins
[0] = 0x16;
19368 spec
->autocfg
.speaker_pins
[0] = 0x14;
19369 spec
->autocfg
.speaker_pins
[1] = 0x15;
19370 spec
->autocfg
.num_inputs
= 2;
19371 spec
->autocfg
.inputs
[0].pin
= 0x18;
19372 spec
->autocfg
.inputs
[0].type
= AUTO_PIN_MIC
;
19373 spec
->autocfg
.inputs
[1].pin
= 0x19;
19374 spec
->autocfg
.inputs
[1].type
= AUTO_PIN_LINE_IN
;
19375 spec
->automute
= 1;
19376 spec
->automute_mode
= ALC_AUTOMUTE_AMP
;
19379 static void alc680_unsol_event(struct hda_codec
*codec
,
19382 if ((res
>> 26) == ALC880_HP_EVENT
)
19383 alc_hp_automute(codec
);
19384 if ((res
>> 26) == ALC880_MIC_EVENT
)
19385 alc680_rec_autoswitch(codec
);
19388 static void alc680_inithook(struct hda_codec
*codec
)
19390 alc_hp_automute(codec
);
19391 alc680_rec_autoswitch(codec
);
19394 /* create input playback/capture controls for the given pin */
19395 static int alc680_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
19396 const char *ctlname
, int idx
)
19414 if (spec
->multiout
.dac_nids
[0] != dac
&&
19415 spec
->multiout
.dac_nids
[1] != dac
) {
19416 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
19417 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
19422 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
19423 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
19427 spec
->private_dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
19433 /* add playback controls from the parsed DAC table */
19434 static int alc680_auto_create_multi_out_ctls(struct alc_spec
*spec
,
19435 const struct auto_pin_cfg
*cfg
)
19440 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
19442 nid
= cfg
->line_out_pins
[0];
19446 name
= alc_get_line_out_pfx(spec
, 0, true, &index
);
19447 err
= alc680_new_analog_output(spec
, nid
, name
, 0);
19452 nid
= cfg
->speaker_pins
[0];
19454 err
= alc680_new_analog_output(spec
, nid
, "Speaker", 0);
19458 nid
= cfg
->hp_pins
[0];
19460 err
= alc680_new_analog_output(spec
, nid
, "Headphone", 0);
19468 static void alc680_auto_set_output_and_unmute(struct hda_codec
*codec
,
19469 hda_nid_t nid
, int pin_type
)
19471 alc_set_pin_output(codec
, nid
, pin_type
);
19474 static void alc680_auto_init_multi_out(struct hda_codec
*codec
)
19476 struct alc_spec
*spec
= codec
->spec
;
19477 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[0];
19479 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
19480 alc680_auto_set_output_and_unmute(codec
, nid
, pin_type
);
19484 static void alc680_auto_init_hp_out(struct hda_codec
*codec
)
19486 struct alc_spec
*spec
= codec
->spec
;
19489 pin
= spec
->autocfg
.hp_pins
[0];
19491 alc680_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
19492 pin
= spec
->autocfg
.speaker_pins
[0];
19494 alc680_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
19497 /* pcm configuration: identical with ALC880 */
19498 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19499 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19500 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19501 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19502 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19505 * BIOS auto configuration
19507 static int alc680_parse_auto_config(struct hda_codec
*codec
)
19509 struct alc_spec
*spec
= codec
->spec
;
19511 static const hda_nid_t alc680_ignore
[] = { 0 };
19513 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
19518 if (!spec
->autocfg
.line_outs
) {
19519 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
19520 spec
->multiout
.max_channels
= 2;
19521 spec
->no_analog
= 1;
19524 return 0; /* can't find valid BIOS pin config */
19526 err
= alc680_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
19530 spec
->multiout
.max_channels
= 2;
19533 /* digital only support output */
19534 alc_auto_parse_digital(codec
);
19535 if (spec
->kctls
.list
)
19536 add_mixer(spec
, spec
->kctls
.list
);
19538 err
= alc_auto_add_mic_boost(codec
);
19545 /* init callback for auto-configuration model -- overriding the default init */
19546 static void alc680_auto_init(struct hda_codec
*codec
)
19548 struct alc_spec
*spec
= codec
->spec
;
19549 alc680_auto_init_multi_out(codec
);
19550 alc680_auto_init_hp_out(codec
);
19551 alc_auto_init_analog_input(codec
);
19552 alc_auto_init_digital(codec
);
19553 if (spec
->unsol_event
)
19554 alc_inithook(codec
);
19558 * configuration and preset
19560 static const char * const alc680_models
[ALC680_MODEL_LAST
] = {
19561 [ALC680_BASE
] = "base",
19562 [ALC680_AUTO
] = "auto",
19565 static const struct snd_pci_quirk alc680_cfg_tbl
[] = {
19566 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE
),
19570 static const struct alc_config_preset alc680_presets
[] = {
19572 .mixers
= { alc680_base_mixer
},
19573 .cap_mixer
= alc680_master_capture_mixer
,
19574 .init_verbs
= { alc680_init_verbs
},
19575 .num_dacs
= ARRAY_SIZE(alc680_dac_nids
),
19576 .dac_nids
= alc680_dac_nids
,
19577 .dig_out_nid
= ALC680_DIGOUT_NID
,
19578 .num_channel_mode
= ARRAY_SIZE(alc680_modes
),
19579 .channel_mode
= alc680_modes
,
19580 .unsol_event
= alc680_unsol_event
,
19581 .setup
= alc680_base_setup
,
19582 .init_hook
= alc680_inithook
,
19587 static int patch_alc680(struct hda_codec
*codec
)
19589 struct alc_spec
*spec
;
19593 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
19597 codec
->spec
= spec
;
19599 /* ALC680 has no aa-loopback mixer */
19601 board_config
= snd_hda_check_board_config(codec
, ALC680_MODEL_LAST
,
19605 if (board_config
< 0 || board_config
>= ALC680_MODEL_LAST
) {
19606 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
19608 board_config
= ALC680_AUTO
;
19611 if (board_config
== ALC680_AUTO
) {
19612 /* automatic parse from the BIOS config */
19613 err
= alc680_parse_auto_config(codec
);
19619 "hda_codec: Cannot set up configuration "
19620 "from BIOS. Using base mode...\n");
19621 board_config
= ALC680_BASE
;
19625 if (board_config
!= ALC680_AUTO
)
19626 setup_preset(codec
, &alc680_presets
[board_config
]);
19628 spec
->stream_analog_playback
= &alc680_pcm_analog_playback
;
19629 spec
->stream_analog_capture
= &alc680_pcm_analog_auto_capture
;
19630 spec
->stream_digital_playback
= &alc680_pcm_digital_playback
;
19631 spec
->stream_digital_capture
= &alc680_pcm_digital_capture
;
19633 if (!spec
->adc_nids
) {
19634 spec
->adc_nids
= alc680_adc_nids
;
19635 spec
->num_adc_nids
= ARRAY_SIZE(alc680_adc_nids
);
19638 if (!spec
->cap_mixer
)
19639 set_capture_mixer(codec
);
19641 spec
->vmaster_nid
= 0x02;
19643 codec
->patch_ops
= alc_patch_ops
;
19644 if (board_config
== ALC680_AUTO
)
19645 spec
->init_hook
= alc680_auto_init
;
19653 static const struct hda_codec_preset snd_hda_preset_realtek
[] = {
19654 { .id
= 0x10ec0221, .name
= "ALC221", .patch
= patch_alc269
},
19655 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
19656 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
19657 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
19658 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
19659 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
19660 { .id
= 0x10ec0270, .name
= "ALC270", .patch
= patch_alc269
},
19661 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
19662 { .id
= 0x10ec0275, .name
= "ALC275", .patch
= patch_alc269
},
19663 { .id
= 0x10ec0276, .name
= "ALC276", .patch
= patch_alc269
},
19664 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
19665 .patch
= patch_alc861
},
19666 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
19667 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
19668 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
19669 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
19670 .patch
= patch_alc882
},
19671 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
19672 .patch
= patch_alc662
},
19673 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
19674 { .id
= 0x10ec0665, .name
= "ALC665", .patch
= patch_alc662
},
19675 { .id
= 0x10ec0670, .name
= "ALC670", .patch
= patch_alc662
},
19676 { .id
= 0x10ec0680, .name
= "ALC680", .patch
= patch_alc680
},
19677 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
19678 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
19679 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc882
},
19680 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
19681 .patch
= patch_alc882
},
19682 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
19683 .patch
= patch_alc882
},
19684 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
19685 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc888
},
19686 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
19687 .patch
= patch_alc882
},
19688 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc888
},
19689 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc882
},
19690 { .id
= 0x10ec0892, .name
= "ALC892", .patch
= patch_alc662
},
19691 { .id
= 0x10ec0899, .name
= "ALC899", .patch
= patch_alc899
},
19692 {} /* terminator */
19695 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19697 MODULE_LICENSE("GPL");
19698 MODULE_DESCRIPTION("Realtek HD-audio codec");
19700 static struct hda_codec_preset_list realtek_list
= {
19701 .preset
= snd_hda_preset_realtek
,
19702 .owner
= THIS_MODULE
,
19705 static int __init
patch_realtek_init(void)
19707 return snd_hda_add_codec_preset(&realtek_list
);
19710 static void __exit
patch_realtek_exit(void)
19712 snd_hda_delete_codec_preset(&realtek_list
);
19715 module_init(patch_realtek_init
)
19716 module_exit(patch_realtek_exit
)