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 "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST
/* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST
/* last tag */
96 ALC262_HP_BPC_D7000_WL
,
97 ALC262_HP_BPC_D7000_WF
,
110 ALC262_MODEL_LAST
/* last tag */
120 ALC268_ACER_ASPIRE_ONE
,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST
/* last tag */
141 ALC269_MODEL_LAST
/* last tag */
158 /* ALC861-VD models */
180 ALC662_ASUS_EEEPC_P701
,
181 ALC662_ASUS_EEEPC_EP20
,
223 ALC883_TARGA_2ch_DIG
,
224 ALC883_TARGA_8ch_DIG
,
227 ALC888_ACER_ASPIRE_4930G
,
228 ALC888_ACER_ASPIRE_6530G
,
229 ALC888_ACER_ASPIRE_8930G
,
230 ALC888_ACER_ASPIRE_7730G
,
233 ALC883_MEDION_WIM2160
,
235 ALC883_LENOVO_101E_2ch
,
236 ALC883_LENOVO_NB0763
,
237 ALC888_LENOVO_MS7195_DIG
,
245 ALC883_FUJITSU_PI2515
,
246 ALC888_FUJITSU_XA3530
,
247 ALC883_3ST_6ch_INTEL
,
260 #define GPIO_MASK 0x03
262 /* extra amp-initialization sequence types */
271 struct alc_mic_route
{
273 unsigned char mux_idx
;
274 unsigned char amix_idx
;
277 #define MUX_IDX_UNDEF ((unsigned char)-1)
279 struct alc_customize_define
{
280 unsigned int sku_cfg
;
281 unsigned char port_connectivity
;
282 unsigned char check_sum
;
283 unsigned char customization
;
284 unsigned char external_amp
;
285 unsigned int enable_pcbeep
:1;
286 unsigned int platform_type
:1;
288 unsigned int override
:1;
292 /* codec parameterization */
293 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
294 unsigned int num_mixers
;
295 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
296 unsigned int beep_amp
; /* beep amp value, set via set_beep_amp() */
298 const struct hda_verb
*init_verbs
[10]; /* initialization verbs
302 unsigned int num_init_verbs
;
304 char stream_name_analog
[32]; /* analog PCM stream */
305 struct hda_pcm_stream
*stream_analog_playback
;
306 struct hda_pcm_stream
*stream_analog_capture
;
307 struct hda_pcm_stream
*stream_analog_alt_playback
;
308 struct hda_pcm_stream
*stream_analog_alt_capture
;
310 char stream_name_digital
[32]; /* digital PCM stream */
311 struct hda_pcm_stream
*stream_digital_playback
;
312 struct hda_pcm_stream
*stream_digital_capture
;
315 struct hda_multi_out multiout
; /* playback set-up
316 * max_channels, dacs must be set
317 * dig_out_nid and hp_nid are optional
319 hda_nid_t alt_dac_nid
;
320 hda_nid_t slave_dig_outs
[3]; /* optional - for auto-parsing */
324 unsigned int num_adc_nids
;
326 hda_nid_t
*capsrc_nids
;
327 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
330 unsigned int num_mux_defs
;
331 const struct hda_input_mux
*input_mux
;
332 unsigned int cur_mux
[3];
333 struct alc_mic_route ext_mic
;
334 struct alc_mic_route int_mic
;
337 const struct hda_channel_mode
*channel_mode
;
338 int num_channel_mode
;
340 int const_channel_count
;
341 int ext_channel_count
;
343 /* PCM information */
344 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
346 /* dynamic controls, init_verbs and input_mux */
347 struct auto_pin_cfg autocfg
;
348 struct alc_customize_define cdefine
;
349 struct snd_array kctls
;
350 struct hda_input_mux private_imux
[3];
351 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
352 hda_nid_t private_adc_nids
[AUTO_CFG_MAX_OUTS
];
353 hda_nid_t private_capsrc_nids
[AUTO_CFG_MAX_OUTS
];
356 void (*init_hook
)(struct hda_codec
*codec
);
357 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
358 #ifdef CONFIG_SND_HDA_POWER_SAVE
359 void (*power_hook
)(struct hda_codec
*codec
);
362 /* for pin sensing */
363 unsigned int sense_updated
: 1;
364 unsigned int jack_present
: 1;
365 unsigned int master_sw
: 1;
366 unsigned int auto_mic
:1;
369 unsigned int no_analog
:1; /* digital I/O only */
372 /* for virtual master */
373 hda_nid_t vmaster_nid
;
374 #ifdef CONFIG_SND_HDA_POWER_SAVE
375 struct hda_loopback_check loopback
;
380 unsigned int pll_coef_idx
, pll_coef_bit
;
384 * configuration template - to be copied to the spec instance
386 struct alc_config_preset
{
387 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
390 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
391 const struct hda_verb
*init_verbs
[5];
392 unsigned int num_dacs
;
394 hda_nid_t dig_out_nid
; /* optional */
395 hda_nid_t hp_nid
; /* optional */
396 hda_nid_t
*slave_dig_outs
;
397 unsigned int num_adc_nids
;
399 hda_nid_t
*capsrc_nids
;
400 hda_nid_t dig_in_nid
;
401 unsigned int num_channel_mode
;
402 const struct hda_channel_mode
*channel_mode
;
404 int const_channel_count
;
405 unsigned int num_mux_defs
;
406 const struct hda_input_mux
*input_mux
;
407 void (*unsol_event
)(struct hda_codec
*, unsigned int);
408 void (*setup
)(struct hda_codec
*);
409 void (*init_hook
)(struct hda_codec
*);
410 #ifdef CONFIG_SND_HDA_POWER_SAVE
411 struct hda_amp_list
*loopbacks
;
412 void (*power_hook
)(struct hda_codec
*codec
);
420 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
421 struct snd_ctl_elem_info
*uinfo
)
423 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
424 struct alc_spec
*spec
= codec
->spec
;
425 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
426 if (mux_idx
>= spec
->num_mux_defs
)
428 if (!spec
->input_mux
[mux_idx
].num_items
&& mux_idx
> 0)
430 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
433 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
434 struct snd_ctl_elem_value
*ucontrol
)
436 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
437 struct alc_spec
*spec
= codec
->spec
;
438 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
440 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
444 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
445 struct snd_ctl_elem_value
*ucontrol
)
447 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
448 struct alc_spec
*spec
= codec
->spec
;
449 const struct hda_input_mux
*imux
;
450 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
451 unsigned int mux_idx
;
452 hda_nid_t nid
= spec
->capsrc_nids
?
453 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
456 mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
457 imux
= &spec
->input_mux
[mux_idx
];
458 if (!imux
->num_items
&& mux_idx
> 0)
459 imux
= &spec
->input_mux
[0];
461 type
= get_wcaps_type(get_wcaps(codec
, nid
));
462 if (type
== AC_WID_AUD_MIX
) {
463 /* Matrix-mixer style (e.g. ALC882) */
464 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
467 idx
= ucontrol
->value
.enumerated
.item
[0];
468 if (idx
>= imux
->num_items
)
469 idx
= imux
->num_items
- 1;
472 for (i
= 0; i
< imux
->num_items
; i
++) {
473 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
474 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
475 imux
->items
[i
].index
,
481 /* MUX style (e.g. ALC880) */
482 return snd_hda_input_mux_put(codec
, imux
, ucontrol
, nid
,
483 &spec
->cur_mux
[adc_idx
]);
488 * channel mode setting
490 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
491 struct snd_ctl_elem_info
*uinfo
)
493 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
494 struct alc_spec
*spec
= codec
->spec
;
495 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
496 spec
->num_channel_mode
);
499 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
500 struct snd_ctl_elem_value
*ucontrol
)
502 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
503 struct alc_spec
*spec
= codec
->spec
;
504 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
505 spec
->num_channel_mode
,
506 spec
->ext_channel_count
);
509 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
510 struct snd_ctl_elem_value
*ucontrol
)
512 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
513 struct alc_spec
*spec
= codec
->spec
;
514 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
515 spec
->num_channel_mode
,
516 &spec
->ext_channel_count
);
517 if (err
>= 0 && !spec
->const_channel_count
) {
518 spec
->multiout
.max_channels
= spec
->ext_channel_count
;
519 if (spec
->need_dac_fix
)
520 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
526 * Control the mode of pin widget settings via the mixer. "pc" is used
527 * instead of "%" to avoid consequences of accidently treating the % as
528 * being part of a format specifier. Maximum allowed length of a value is
529 * 63 characters plus NULL terminator.
531 * Note: some retasking pin complexes seem to ignore requests for input
532 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
533 * are requested. Therefore order this list so that this behaviour will not
534 * cause problems when mixer clients move through the enum sequentially.
535 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
538 static char *alc_pin_mode_names
[] = {
539 "Mic 50pc bias", "Mic 80pc bias",
540 "Line in", "Line out", "Headphone out",
542 static unsigned char alc_pin_mode_values
[] = {
543 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
545 /* The control can present all 5 options, or it can limit the options based
546 * in the pin being assumed to be exclusively an input or an output pin. In
547 * addition, "input" pins may or may not process the mic bias option
548 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
549 * accept requests for bias as of chip versions up to March 2006) and/or
550 * wiring in the computer.
552 #define ALC_PIN_DIR_IN 0x00
553 #define ALC_PIN_DIR_OUT 0x01
554 #define ALC_PIN_DIR_INOUT 0x02
555 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
556 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
558 /* Info about the pin modes supported by the different pin direction modes.
559 * For each direction the minimum and maximum values are given.
561 static signed char alc_pin_mode_dir_info
[5][2] = {
562 { 0, 2 }, /* ALC_PIN_DIR_IN */
563 { 3, 4 }, /* ALC_PIN_DIR_OUT */
564 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
565 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
566 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
568 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
569 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
570 #define alc_pin_mode_n_items(_dir) \
571 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
573 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
574 struct snd_ctl_elem_info
*uinfo
)
576 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
577 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
579 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
581 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
583 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
584 item_num
= alc_pin_mode_min(dir
);
585 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
589 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
590 struct snd_ctl_elem_value
*ucontrol
)
593 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
594 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
595 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
596 long *valp
= ucontrol
->value
.integer
.value
;
597 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
598 AC_VERB_GET_PIN_WIDGET_CONTROL
,
601 /* Find enumerated value for current pinctl setting */
602 i
= alc_pin_mode_min(dir
);
603 while (i
<= alc_pin_mode_max(dir
) && alc_pin_mode_values
[i
] != pinctl
)
605 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
609 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
610 struct snd_ctl_elem_value
*ucontrol
)
613 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
614 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
615 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
616 long val
= *ucontrol
->value
.integer
.value
;
617 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
618 AC_VERB_GET_PIN_WIDGET_CONTROL
,
621 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
622 val
= alc_pin_mode_min(dir
);
624 change
= pinctl
!= alc_pin_mode_values
[val
];
626 /* Set pin mode to that requested */
627 snd_hda_codec_write_cache(codec
, nid
, 0,
628 AC_VERB_SET_PIN_WIDGET_CONTROL
,
629 alc_pin_mode_values
[val
]);
631 /* Also enable the retasking pin's input/output as required
632 * for the requested pin mode. Enum values of 2 or less are
635 * Dynamically switching the input/output buffers probably
636 * reduces noise slightly (particularly on input) so we'll
637 * do it. However, having both input and output buffers
638 * enabled simultaneously doesn't seem to be problematic if
639 * this turns out to be necessary in the future.
642 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
643 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
644 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
647 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
648 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
649 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
656 #define ALC_PIN_MODE(xname, nid, dir) \
657 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
658 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
659 .info = alc_pin_mode_info, \
660 .get = alc_pin_mode_get, \
661 .put = alc_pin_mode_put, \
662 .private_value = nid | (dir<<16) }
664 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
665 * together using a mask with more than one bit set. This control is
666 * currently used only by the ALC260 test model. At this stage they are not
667 * needed for any "production" models.
669 #ifdef CONFIG_SND_DEBUG
670 #define alc_gpio_data_info snd_ctl_boolean_mono_info
672 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
673 struct snd_ctl_elem_value
*ucontrol
)
675 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
676 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
677 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
678 long *valp
= ucontrol
->value
.integer
.value
;
679 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
680 AC_VERB_GET_GPIO_DATA
, 0x00);
682 *valp
= (val
& mask
) != 0;
685 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
686 struct snd_ctl_elem_value
*ucontrol
)
689 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
690 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
691 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
692 long val
= *ucontrol
->value
.integer
.value
;
693 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
694 AC_VERB_GET_GPIO_DATA
,
697 /* Set/unset the masked GPIO bit(s) as needed */
698 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
703 snd_hda_codec_write_cache(codec
, nid
, 0,
704 AC_VERB_SET_GPIO_DATA
, gpio_data
);
708 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
709 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
710 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
711 .info = alc_gpio_data_info, \
712 .get = alc_gpio_data_get, \
713 .put = alc_gpio_data_put, \
714 .private_value = nid | (mask<<16) }
715 #endif /* CONFIG_SND_DEBUG */
717 /* A switch control to allow the enabling of the digital IO pins on the
718 * ALC260. This is incredibly simplistic; the intention of this control is
719 * to provide something in the test model allowing digital outputs to be
720 * identified if present. If models are found which can utilise these
721 * outputs a more complete mixer control can be devised for those models if
724 #ifdef CONFIG_SND_DEBUG
725 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
727 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
728 struct snd_ctl_elem_value
*ucontrol
)
730 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
731 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
732 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
733 long *valp
= ucontrol
->value
.integer
.value
;
734 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
735 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
737 *valp
= (val
& mask
) != 0;
740 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
741 struct snd_ctl_elem_value
*ucontrol
)
744 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
745 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
746 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
747 long val
= *ucontrol
->value
.integer
.value
;
748 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
749 AC_VERB_GET_DIGI_CONVERT_1
,
752 /* Set/unset the masked control bit(s) as needed */
753 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
758 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
763 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
764 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
765 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
766 .info = alc_spdif_ctrl_info, \
767 .get = alc_spdif_ctrl_get, \
768 .put = alc_spdif_ctrl_put, \
769 .private_value = nid | (mask<<16) }
770 #endif /* CONFIG_SND_DEBUG */
772 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
773 * Again, this is only used in the ALC26x test models to help identify when
774 * the EAPD line must be asserted for features to work.
776 #ifdef CONFIG_SND_DEBUG
777 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
779 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
780 struct snd_ctl_elem_value
*ucontrol
)
782 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
783 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
784 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
785 long *valp
= ucontrol
->value
.integer
.value
;
786 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
787 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
789 *valp
= (val
& mask
) != 0;
793 static int alc_eapd_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_EAPD_BTLENABLE
,
805 /* Set/unset the masked control bit(s) as needed */
806 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
811 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
817 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
818 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
819 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
820 .info = alc_eapd_ctrl_info, \
821 .get = alc_eapd_ctrl_get, \
822 .put = alc_eapd_ctrl_put, \
823 .private_value = nid | (mask<<16) }
824 #endif /* CONFIG_SND_DEBUG */
827 * set up the input pin config (depending on the given auto-pin type)
829 static void alc_set_input_pin(struct hda_codec
*codec
, hda_nid_t nid
,
832 unsigned int val
= PIN_IN
;
834 if (auto_pin_type
<= AUTO_PIN_FRONT_MIC
) {
836 pincap
= snd_hda_query_pin_caps(codec
, nid
);
837 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
838 if (pincap
& AC_PINCAP_VREF_80
)
840 else if (pincap
& AC_PINCAP_VREF_50
)
842 else if (pincap
& AC_PINCAP_VREF_100
)
844 else if (pincap
& AC_PINCAP_VREF_GRD
)
847 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, val
);
852 static void add_mixer(struct alc_spec
*spec
, struct snd_kcontrol_new
*mix
)
854 if (snd_BUG_ON(spec
->num_mixers
>= ARRAY_SIZE(spec
->mixers
)))
856 spec
->mixers
[spec
->num_mixers
++] = mix
;
859 static void add_verb(struct alc_spec
*spec
, const struct hda_verb
*verb
)
861 if (snd_BUG_ON(spec
->num_init_verbs
>= ARRAY_SIZE(spec
->init_verbs
)))
863 spec
->init_verbs
[spec
->num_init_verbs
++] = verb
;
867 * set up from the preset table
869 static void setup_preset(struct hda_codec
*codec
,
870 const struct alc_config_preset
*preset
)
872 struct alc_spec
*spec
= codec
->spec
;
875 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
876 add_mixer(spec
, preset
->mixers
[i
]);
877 spec
->cap_mixer
= preset
->cap_mixer
;
878 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
880 add_verb(spec
, preset
->init_verbs
[i
]);
882 spec
->channel_mode
= preset
->channel_mode
;
883 spec
->num_channel_mode
= preset
->num_channel_mode
;
884 spec
->need_dac_fix
= preset
->need_dac_fix
;
885 spec
->const_channel_count
= preset
->const_channel_count
;
887 if (preset
->const_channel_count
)
888 spec
->multiout
.max_channels
= preset
->const_channel_count
;
890 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
891 spec
->ext_channel_count
= spec
->channel_mode
[0].channels
;
893 spec
->multiout
.num_dacs
= preset
->num_dacs
;
894 spec
->multiout
.dac_nids
= preset
->dac_nids
;
895 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
896 spec
->multiout
.slave_dig_outs
= preset
->slave_dig_outs
;
897 spec
->multiout
.hp_nid
= preset
->hp_nid
;
899 spec
->num_mux_defs
= preset
->num_mux_defs
;
900 if (!spec
->num_mux_defs
)
901 spec
->num_mux_defs
= 1;
902 spec
->input_mux
= preset
->input_mux
;
904 spec
->num_adc_nids
= preset
->num_adc_nids
;
905 spec
->adc_nids
= preset
->adc_nids
;
906 spec
->capsrc_nids
= preset
->capsrc_nids
;
907 spec
->dig_in_nid
= preset
->dig_in_nid
;
909 spec
->unsol_event
= preset
->unsol_event
;
910 spec
->init_hook
= preset
->init_hook
;
911 #ifdef CONFIG_SND_HDA_POWER_SAVE
912 spec
->power_hook
= preset
->power_hook
;
913 spec
->loopback
.amplist
= preset
->loopbacks
;
917 preset
->setup(codec
);
920 /* Enable GPIO mask and set output */
921 static struct hda_verb alc_gpio1_init_verbs
[] = {
922 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
923 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
924 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
928 static struct hda_verb alc_gpio2_init_verbs
[] = {
929 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
930 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
931 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
935 static struct hda_verb alc_gpio3_init_verbs
[] = {
936 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
937 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
938 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
943 * Fix hardware PLL issue
944 * On some codecs, the analog PLL gating control must be off while
945 * the default value is 1.
947 static void alc_fix_pll(struct hda_codec
*codec
)
949 struct alc_spec
*spec
= codec
->spec
;
954 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
956 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
957 AC_VERB_GET_PROC_COEF
, 0);
958 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
960 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
961 val
& ~(1 << spec
->pll_coef_bit
));
964 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
965 unsigned int coef_idx
, unsigned int coef_bit
)
967 struct alc_spec
*spec
= codec
->spec
;
969 spec
->pll_coef_idx
= coef_idx
;
970 spec
->pll_coef_bit
= coef_bit
;
974 static void alc_automute_pin(struct hda_codec
*codec
)
976 struct alc_spec
*spec
= codec
->spec
;
977 unsigned int nid
= spec
->autocfg
.hp_pins
[0];
982 spec
->jack_present
= snd_hda_jack_detect(codec
, nid
);
983 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
984 nid
= spec
->autocfg
.speaker_pins
[i
];
987 snd_hda_codec_write(codec
, nid
, 0,
988 AC_VERB_SET_PIN_WIDGET_CONTROL
,
989 spec
->jack_present
? 0 : PIN_OUT
);
993 static int get_connection_index(struct hda_codec
*codec
, hda_nid_t mux
,
996 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
999 nums
= snd_hda_get_connections(codec
, mux
, conn
, ARRAY_SIZE(conn
));
1000 for (i
= 0; i
< nums
; i
++)
1006 static void alc_mic_automute(struct hda_codec
*codec
)
1008 struct alc_spec
*spec
= codec
->spec
;
1009 struct alc_mic_route
*dead
, *alive
;
1010 unsigned int present
, type
;
1013 if (!spec
->auto_mic
)
1015 if (!spec
->int_mic
.pin
|| !spec
->ext_mic
.pin
)
1017 if (snd_BUG_ON(!spec
->adc_nids
))
1020 cap_nid
= spec
->capsrc_nids
? spec
->capsrc_nids
[0] : spec
->adc_nids
[0];
1022 present
= snd_hda_jack_detect(codec
, spec
->ext_mic
.pin
);
1024 alive
= &spec
->ext_mic
;
1025 dead
= &spec
->int_mic
;
1027 alive
= &spec
->int_mic
;
1028 dead
= &spec
->ext_mic
;
1031 type
= get_wcaps_type(get_wcaps(codec
, cap_nid
));
1032 if (type
== AC_WID_AUD_MIX
) {
1033 /* Matrix-mixer style (e.g. ALC882) */
1034 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1037 snd_hda_codec_amp_stereo(codec
, cap_nid
, HDA_INPUT
,
1039 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
1041 /* MUX style (e.g. ALC880) */
1042 snd_hda_codec_write_cache(codec
, cap_nid
, 0,
1043 AC_VERB_SET_CONNECT_SEL
,
1047 /* FIXME: analog mixer */
1050 /* unsolicited event for HP jack sensing */
1051 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1053 if (codec
->vendor_id
== 0x10ec0880)
1058 case ALC880_HP_EVENT
:
1059 alc_automute_pin(codec
);
1061 case ALC880_MIC_EVENT
:
1062 alc_mic_automute(codec
);
1067 static void alc_inithook(struct hda_codec
*codec
)
1069 alc_automute_pin(codec
);
1070 alc_mic_automute(codec
);
1073 /* additional initialization for ALC888 variants */
1074 static void alc888_coef_init(struct hda_codec
*codec
)
1078 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
1079 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1080 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1081 if ((tmp
& 0xf0) == 0x20)
1083 snd_hda_codec_read(codec
, 0x20, 0,
1084 AC_VERB_SET_PROC_COEF
, 0x830);
1087 snd_hda_codec_read(codec
, 0x20, 0,
1088 AC_VERB_SET_PROC_COEF
, 0x3030);
1091 static void alc889_coef_init(struct hda_codec
*codec
)
1095 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1096 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1097 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1098 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_PROC_COEF
, tmp
|0x2010);
1101 /* turn on/off EAPD control (only if available) */
1102 static void set_eapd(struct hda_codec
*codec
, hda_nid_t nid
, int on
)
1104 if (get_wcaps_type(get_wcaps(codec
, nid
)) != AC_WID_PIN
)
1106 if (snd_hda_query_pin_caps(codec
, nid
) & AC_PINCAP_EAPD
)
1107 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
1111 static void alc_auto_init_amp(struct hda_codec
*codec
, int type
)
1116 case ALC_INIT_GPIO1
:
1117 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
1119 case ALC_INIT_GPIO2
:
1120 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
1122 case ALC_INIT_GPIO3
:
1123 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
1125 case ALC_INIT_DEFAULT
:
1126 switch (codec
->vendor_id
) {
1128 set_eapd(codec
, 0x0f, 1);
1129 set_eapd(codec
, 0x10, 1);
1142 set_eapd(codec
, 0x14, 1);
1143 set_eapd(codec
, 0x15, 1);
1146 switch (codec
->vendor_id
) {
1148 snd_hda_codec_write(codec
, 0x1a, 0,
1149 AC_VERB_SET_COEF_INDEX
, 7);
1150 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
1151 AC_VERB_GET_PROC_COEF
, 0);
1152 snd_hda_codec_write(codec
, 0x1a, 0,
1153 AC_VERB_SET_COEF_INDEX
, 7);
1154 snd_hda_codec_write(codec
, 0x1a, 0,
1155 AC_VERB_SET_PROC_COEF
,
1165 alc889_coef_init(codec
);
1168 alc888_coef_init(codec
);
1170 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1173 snd_hda_codec_write(codec
, 0x20, 0,
1174 AC_VERB_SET_COEF_INDEX
, 7);
1175 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1176 AC_VERB_GET_PROC_COEF
, 0);
1177 snd_hda_codec_write(codec
, 0x20, 0,
1178 AC_VERB_SET_COEF_INDEX
, 7);
1179 snd_hda_codec_write(codec
, 0x20, 0,
1180 AC_VERB_SET_PROC_COEF
,
1189 static void alc_init_auto_hp(struct hda_codec
*codec
)
1191 struct alc_spec
*spec
= codec
->spec
;
1193 if (!spec
->autocfg
.hp_pins
[0])
1196 if (!spec
->autocfg
.speaker_pins
[0]) {
1197 if (spec
->autocfg
.line_out_pins
[0] &&
1198 spec
->autocfg
.line_out_type
== AUTO_PIN_SPEAKER_OUT
)
1199 spec
->autocfg
.speaker_pins
[0] =
1200 spec
->autocfg
.line_out_pins
[0];
1205 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1206 spec
->autocfg
.hp_pins
[0]);
1207 snd_hda_codec_write_cache(codec
, spec
->autocfg
.hp_pins
[0], 0,
1208 AC_VERB_SET_UNSOLICITED_ENABLE
,
1209 AC_USRSP_EN
| ALC880_HP_EVENT
);
1210 spec
->unsol_event
= alc_sku_unsol_event
;
1213 static void alc_init_auto_mic(struct hda_codec
*codec
)
1215 struct alc_spec
*spec
= codec
->spec
;
1216 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
1217 hda_nid_t fixed
, ext
;
1220 /* there must be only two mic inputs exclusively */
1221 for (i
= AUTO_PIN_LINE
; i
< AUTO_PIN_LAST
; i
++)
1222 if (cfg
->input_pins
[i
])
1226 for (i
= AUTO_PIN_MIC
; i
<= AUTO_PIN_FRONT_MIC
; i
++) {
1227 hda_nid_t nid
= cfg
->input_pins
[i
];
1228 unsigned int defcfg
;
1231 defcfg
= snd_hda_codec_get_pincfg(codec
, nid
);
1232 switch (get_defcfg_connect(defcfg
)) {
1233 case AC_JACK_PORT_FIXED
:
1235 return; /* already occupied */
1238 case AC_JACK_PORT_COMPLEX
:
1240 return; /* already occupied */
1244 return; /* invalid entry */
1249 if (!(get_wcaps(codec
, ext
) & AC_WCAP_UNSOL_CAP
))
1250 return; /* no unsol support */
1251 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1253 spec
->ext_mic
.pin
= ext
;
1254 spec
->int_mic
.pin
= fixed
;
1255 spec
->ext_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1256 spec
->int_mic
.mux_idx
= MUX_IDX_UNDEF
; /* set later */
1258 snd_hda_codec_write_cache(codec
, spec
->ext_mic
.pin
, 0,
1259 AC_VERB_SET_UNSOLICITED_ENABLE
,
1260 AC_USRSP_EN
| ALC880_MIC_EVENT
);
1261 spec
->unsol_event
= alc_sku_unsol_event
;
1264 static int alc_auto_parse_customize_define(struct hda_codec
*codec
)
1266 unsigned int ass
, tmp
, i
;
1268 struct alc_spec
*spec
= codec
->spec
;
1270 ass
= codec
->subsystem_id
& 0xffff;
1271 if (ass
!= codec
->bus
->pci
->subsystem_device
&& (ass
& 1))
1275 if (codec
->vendor_id
== 0x10ec0260)
1277 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1280 printk(KERN_INFO
"hda_codec: %s: SKU not ready 0x%08x\n",
1281 codec
->chip_name
, ass
);
1287 for (i
= 1; i
< 16; i
++) {
1291 if (((ass
>> 16) & 0xf) != tmp
)
1294 spec
->cdefine
.port_connectivity
= ass
>> 30;
1295 spec
->cdefine
.enable_pcbeep
= (ass
& 0x100000) >> 20;
1296 spec
->cdefine
.check_sum
= (ass
>> 16) & 0xf;
1297 spec
->cdefine
.customization
= ass
>> 8;
1299 spec
->cdefine
.sku_cfg
= ass
;
1300 spec
->cdefine
.external_amp
= (ass
& 0x38) >> 3;
1301 spec
->cdefine
.platform_type
= (ass
& 0x4) >> 2;
1302 spec
->cdefine
.swap
= (ass
& 0x2) >> 1;
1303 spec
->cdefine
.override
= ass
& 0x1;
1305 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1306 nid
, spec
->cdefine
.sku_cfg
);
1307 snd_printd("SKU: port_connectivity=0x%x\n",
1308 spec
->cdefine
.port_connectivity
);
1309 snd_printd("SKU: enable_pcbeep=0x%x\n", spec
->cdefine
.enable_pcbeep
);
1310 snd_printd("SKU: check_sum=0x%08x\n", spec
->cdefine
.check_sum
);
1311 snd_printd("SKU: customization=0x%08x\n", spec
->cdefine
.customization
);
1312 snd_printd("SKU: external_amp=0x%x\n", spec
->cdefine
.external_amp
);
1313 snd_printd("SKU: platform_type=0x%x\n", spec
->cdefine
.platform_type
);
1314 snd_printd("SKU: swap=0x%x\n", spec
->cdefine
.swap
);
1315 snd_printd("SKU: override=0x%x\n", spec
->cdefine
.override
);
1320 /* check subsystem ID and set up device-specific initialization;
1321 * return 1 if initialized, 0 if invalid SSID
1323 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1324 * 31 ~ 16 : Manufacture ID
1326 * 7 ~ 0 : Assembly ID
1327 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1329 static int alc_subsystem_id(struct hda_codec
*codec
,
1330 hda_nid_t porta
, hda_nid_t porte
,
1331 hda_nid_t portd
, hda_nid_t porti
)
1333 unsigned int ass
, tmp
, i
;
1335 struct alc_spec
*spec
= codec
->spec
;
1337 ass
= codec
->subsystem_id
& 0xffff;
1338 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
1341 /* invalid SSID, check the special NID pin defcfg instead */
1343 * 31~30 : port connectivity
1346 * 19~16 : Check sum (15:1)
1351 if (codec
->vendor_id
== 0x10ec0260)
1353 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1354 snd_printd("realtek: No valid SSID, "
1355 "checking pincfg 0x%08x for NID 0x%x\n",
1359 if ((ass
>> 30) != 1) /* no physical connection */
1364 for (i
= 1; i
< 16; i
++) {
1368 if (((ass
>> 16) & 0xf) != tmp
)
1371 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1372 ass
& 0xffff, codec
->vendor_id
);
1376 * 2 : 0 --> Desktop, 1 --> Laptop
1377 * 3~5 : External Amplifier control
1380 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
1383 spec
->init_amp
= ALC_INIT_GPIO1
;
1386 spec
->init_amp
= ALC_INIT_GPIO2
;
1389 spec
->init_amp
= ALC_INIT_GPIO3
;
1392 spec
->init_amp
= ALC_INIT_DEFAULT
;
1396 /* is laptop or Desktop and enable the function "Mute internal speaker
1397 * when the external headphone out jack is plugged"
1399 if (!(ass
& 0x8000))
1402 * 10~8 : Jack location
1403 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1405 * 15 : 1 --> enable the function "Mute internal speaker
1406 * when the external headphone out jack is plugged"
1408 if (!spec
->autocfg
.hp_pins
[0]) {
1410 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
1421 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++)
1422 if (spec
->autocfg
.line_out_pins
[i
] == nid
)
1424 spec
->autocfg
.hp_pins
[0] = nid
;
1427 alc_init_auto_hp(codec
);
1428 alc_init_auto_mic(codec
);
1432 static void alc_ssid_check(struct hda_codec
*codec
,
1433 hda_nid_t porta
, hda_nid_t porte
,
1434 hda_nid_t portd
, hda_nid_t porti
)
1436 if (!alc_subsystem_id(codec
, porta
, porte
, portd
, porti
)) {
1437 struct alc_spec
*spec
= codec
->spec
;
1438 snd_printd("realtek: "
1439 "Enable default setup for auto mode as fallback\n");
1440 spec
->init_amp
= ALC_INIT_DEFAULT
;
1441 alc_init_auto_hp(codec
);
1442 alc_init_auto_mic(codec
);
1447 * Fix-up pin default configurations and add default verbs
1456 const struct alc_pincfg
*pins
;
1457 const struct hda_verb
*verbs
;
1460 static void alc_pick_fixup(struct hda_codec
*codec
,
1461 const struct snd_pci_quirk
*quirk
,
1462 const struct alc_fixup
*fix
,
1465 const struct alc_pincfg
*cfg
;
1467 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
1470 fix
+= quirk
->value
;
1472 if (pre_init
&& cfg
) {
1473 #ifdef CONFIG_SND_DEBUG_VERBOSE
1474 snd_printdd(KERN_INFO
"hda_codec: %s: Apply pincfg for %s\n",
1475 codec
->chip_name
, quirk
->name
);
1477 for (; cfg
->nid
; cfg
++)
1478 snd_hda_codec_set_pincfg(codec
, cfg
->nid
, cfg
->val
);
1480 if (!pre_init
&& fix
->verbs
) {
1481 #ifdef CONFIG_SND_DEBUG_VERBOSE
1482 snd_printdd(KERN_INFO
"hda_codec: %s: Apply fix-verbs for %s\n",
1483 codec
->chip_name
, quirk
->name
);
1485 add_verb(codec
->spec
, fix
->verbs
);
1489 static int alc_read_coef_idx(struct hda_codec
*codec
,
1490 unsigned int coef_idx
)
1493 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
,
1495 val
= snd_hda_codec_read(codec
, 0x20, 0,
1496 AC_VERB_GET_PROC_COEF
, 0);
1507 static struct hda_verb alc888_4ST_ch2_intel_init
[] = {
1508 /* Mic-in jack as mic in */
1509 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1510 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1511 /* Line-in jack as Line in */
1512 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1513 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1514 /* Line-Out as Front */
1515 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1522 static struct hda_verb alc888_4ST_ch4_intel_init
[] = {
1523 /* Mic-in jack as mic in */
1524 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1525 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1526 /* Line-in jack as Surround */
1527 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1528 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1529 /* Line-Out as Front */
1530 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1537 static struct hda_verb alc888_4ST_ch6_intel_init
[] = {
1538 /* Mic-in jack as CLFE */
1539 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1540 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1541 /* Line-in jack as Surround */
1542 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1543 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1544 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1545 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1552 static struct hda_verb alc888_4ST_ch8_intel_init
[] = {
1553 /* Mic-in jack as CLFE */
1554 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1555 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1556 /* Line-in jack as Surround */
1557 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1558 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1559 /* Line-Out as Side */
1560 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1564 static struct hda_channel_mode alc888_4ST_8ch_intel_modes
[4] = {
1565 { 2, alc888_4ST_ch2_intel_init
},
1566 { 4, alc888_4ST_ch4_intel_init
},
1567 { 6, alc888_4ST_ch6_intel_init
},
1568 { 8, alc888_4ST_ch8_intel_init
},
1572 * ALC888 Fujitsu Siemens Amillo xa3530
1575 static struct hda_verb alc888_fujitsu_xa3530_verbs
[] = {
1576 /* Front Mic: set to PIN_IN (empty by default) */
1577 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1578 /* Connect Internal HP to Front */
1579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1580 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1581 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1582 /* Connect Bass HP to Front */
1583 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1584 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1585 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1586 /* Connect Line-Out side jack (SPDIF) to Side */
1587 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1588 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1589 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1590 /* Connect Mic jack to CLFE */
1591 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1592 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1593 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
1594 /* Connect Line-in jack to Surround */
1595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1596 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1597 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
1598 /* Connect HP out jack to Front */
1599 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1600 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1601 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1602 /* Enable unsolicited event for HP jack and Line-out jack */
1603 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1604 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1608 static void alc_automute_amp(struct hda_codec
*codec
)
1610 struct alc_spec
*spec
= codec
->spec
;
1615 spec
->jack_present
= 0;
1616 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.hp_pins
); i
++) {
1617 nid
= spec
->autocfg
.hp_pins
[i
];
1620 if (snd_hda_jack_detect(codec
, nid
)) {
1621 spec
->jack_present
= 1;
1626 mute
= spec
->jack_present
? HDA_AMP_MUTE
: 0;
1627 /* Toggle internal speakers muting */
1628 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
1629 nid
= spec
->autocfg
.speaker_pins
[i
];
1632 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
1633 HDA_AMP_MUTE
, mute
);
1637 static void alc_automute_amp_unsol_event(struct hda_codec
*codec
,
1640 if (codec
->vendor_id
== 0x10ec0880)
1644 if (res
== ALC880_HP_EVENT
)
1645 alc_automute_amp(codec
);
1648 static void alc889_automute_setup(struct hda_codec
*codec
)
1650 struct alc_spec
*spec
= codec
->spec
;
1652 spec
->autocfg
.hp_pins
[0] = 0x15;
1653 spec
->autocfg
.speaker_pins
[0] = 0x14;
1654 spec
->autocfg
.speaker_pins
[1] = 0x16;
1655 spec
->autocfg
.speaker_pins
[2] = 0x17;
1656 spec
->autocfg
.speaker_pins
[3] = 0x19;
1657 spec
->autocfg
.speaker_pins
[4] = 0x1a;
1660 static void alc889_intel_init_hook(struct hda_codec
*codec
)
1662 alc889_coef_init(codec
);
1663 alc_automute_amp(codec
);
1666 static void alc888_fujitsu_xa3530_setup(struct hda_codec
*codec
)
1668 struct alc_spec
*spec
= codec
->spec
;
1670 spec
->autocfg
.hp_pins
[0] = 0x17; /* line-out */
1671 spec
->autocfg
.hp_pins
[1] = 0x1b; /* hp */
1672 spec
->autocfg
.speaker_pins
[0] = 0x14; /* speaker */
1673 spec
->autocfg
.speaker_pins
[1] = 0x15; /* bass */
1677 * ALC888 Acer Aspire 4930G model
1680 static struct hda_verb alc888_acer_aspire_4930g_verbs
[] = {
1681 /* Front Mic: set to PIN_IN (empty by default) */
1682 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1683 /* Unselect Front Mic by default in input mixer 3 */
1684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
1685 /* Enable unsolicited event for HP jack */
1686 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1687 /* Connect Internal HP to front */
1688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1690 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1691 /* Connect HP out to front */
1692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1693 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1694 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1699 * ALC888 Acer Aspire 6530G model
1702 static struct hda_verb alc888_acer_aspire_6530g_verbs
[] = {
1703 /* Route to built-in subwoofer as well as speakers */
1704 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1706 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1707 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1708 /* Bias voltage on for external mic port */
1709 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
1710 /* Front Mic: set to PIN_IN (empty by default) */
1711 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1712 /* Unselect Front Mic by default in input mixer 3 */
1713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
1714 /* Enable unsolicited event for HP jack */
1715 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1716 /* Enable speaker output */
1717 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1718 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1719 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
1720 /* Enable headphone output */
1721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
1722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1723 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1724 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
1729 * ALC889 Acer Aspire 8930G model
1732 static struct hda_verb alc889_acer_aspire_8930g_verbs
[] = {
1733 /* Front Mic: set to PIN_IN (empty by default) */
1734 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1735 /* Unselect Front Mic by default in input mixer 3 */
1736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
1737 /* Enable unsolicited event for HP jack */
1738 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1739 /* Connect Internal Front to Front */
1740 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1741 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1742 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1743 /* Connect Internal Rear to Rear */
1744 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1745 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1746 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
1747 /* Connect Internal CLFE to CLFE */
1748 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1749 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1750 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
1751 /* Connect HP out to Front */
1752 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
1753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1754 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1755 /* Enable all DACs */
1756 /* DAC DISABLE/MUTE 1? */
1757 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1758 {0x20, AC_VERB_SET_COEF_INDEX
, 0x03},
1759 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
1760 /* DAC DISABLE/MUTE 2? */
1761 /* some bit here disables the other DACs. Init=0x4900 */
1762 {0x20, AC_VERB_SET_COEF_INDEX
, 0x08},
1763 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
1765 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1766 * which makes the stereo useless. However, either the mic or the ALC889
1767 * makes the signal become a difference/sum signal instead of standard
1768 * stereo, which is annoying. So instead we flip this bit which makes the
1769 * codec replicate the sum signal to both channels, turning it into a
1772 /* DMIC_CONTROL? Init value = 0x0001 */
1773 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
1774 {0x20, AC_VERB_SET_PROC_COEF
, 0x0003},
1778 static struct hda_input_mux alc888_2_capture_sources
[2] = {
1779 /* Front mic only available on one ADC */
1786 { "Front Mic", 0xb },
1799 static struct hda_input_mux alc888_acer_aspire_6530_sources
[2] = {
1800 /* Interal mic only available on one ADC */
1807 { "Input Mix", 0xa },
1817 { "Input Mix", 0xa },
1822 static struct hda_input_mux alc889_capture_sources
[3] = {
1823 /* Digital mic only available on first "ADC" */
1830 { "Front Mic", 0xb },
1831 { "Input Mix", 0xa },
1840 { "Input Mix", 0xa },
1849 { "Input Mix", 0xa },
1854 static struct snd_kcontrol_new alc888_base_mixer
[] = {
1855 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1856 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1857 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1858 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1859 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1861 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1862 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1863 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1864 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1865 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1866 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1867 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1868 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1869 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1871 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
1872 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1876 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer
[] = {
1877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1878 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1879 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1880 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1883 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1884 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1885 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1886 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1887 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1889 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
1890 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1895 static void alc888_acer_aspire_4930g_setup(struct hda_codec
*codec
)
1897 struct alc_spec
*spec
= codec
->spec
;
1899 spec
->autocfg
.hp_pins
[0] = 0x15;
1900 spec
->autocfg
.speaker_pins
[0] = 0x14;
1901 spec
->autocfg
.speaker_pins
[1] = 0x16;
1902 spec
->autocfg
.speaker_pins
[2] = 0x17;
1905 static void alc888_acer_aspire_6530g_setup(struct hda_codec
*codec
)
1907 struct alc_spec
*spec
= codec
->spec
;
1909 spec
->autocfg
.hp_pins
[0] = 0x15;
1910 spec
->autocfg
.speaker_pins
[0] = 0x14;
1911 spec
->autocfg
.speaker_pins
[1] = 0x16;
1912 spec
->autocfg
.speaker_pins
[2] = 0x17;
1915 static void alc889_acer_aspire_8930g_setup(struct hda_codec
*codec
)
1917 struct alc_spec
*spec
= codec
->spec
;
1919 spec
->autocfg
.hp_pins
[0] = 0x15;
1920 spec
->autocfg
.speaker_pins
[0] = 0x14;
1921 spec
->autocfg
.speaker_pins
[1] = 0x16;
1922 spec
->autocfg
.speaker_pins
[2] = 0x1b;
1926 * ALC880 3-stack model
1928 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1929 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1930 * F-Mic = 0x1b, HP = 0x19
1933 static hda_nid_t alc880_dac_nids
[4] = {
1934 /* front, rear, clfe, rear_surr */
1935 0x02, 0x05, 0x04, 0x03
1938 static hda_nid_t alc880_adc_nids
[3] = {
1943 /* The datasheet says the node 0x07 is connected from inputs,
1944 * but it shows zero connection in the real implementation on some devices.
1945 * Note: this is a 915GAV bug, fixed on 915GLV
1947 static hda_nid_t alc880_adc_nids_alt
[2] = {
1952 #define ALC880_DIGOUT_NID 0x06
1953 #define ALC880_DIGIN_NID 0x0a
1955 static struct hda_input_mux alc880_capture_source
= {
1959 { "Front Mic", 0x3 },
1965 /* channel source setting (2/6 channel selection for 3-stack) */
1967 static struct hda_verb alc880_threestack_ch2_init
[] = {
1968 /* set line-in to input, mute it */
1969 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1970 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1971 /* set mic-in to input vref 80%, mute it */
1972 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1973 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1978 static struct hda_verb alc880_threestack_ch6_init
[] = {
1979 /* set line-in to output, unmute it */
1980 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1981 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1982 /* set mic-in to output, unmute it */
1983 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1984 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1988 static struct hda_channel_mode alc880_threestack_modes
[2] = {
1989 { 2, alc880_threestack_ch2_init
},
1990 { 6, alc880_threestack_ch6_init
},
1993 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
1994 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1995 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1996 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1997 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
1998 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1999 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2000 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2001 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2002 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2003 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2004 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2005 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2007 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2008 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2009 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2010 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
2012 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2013 .name
= "Channel Mode",
2014 .info
= alc_ch_mode_info
,
2015 .get
= alc_ch_mode_get
,
2016 .put
= alc_ch_mode_put
,
2021 /* capture mixer elements */
2022 static int alc_cap_vol_info(struct snd_kcontrol
*kcontrol
,
2023 struct snd_ctl_elem_info
*uinfo
)
2025 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2026 struct alc_spec
*spec
= codec
->spec
;
2029 mutex_lock(&codec
->control_mutex
);
2030 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2032 err
= snd_hda_mixer_amp_volume_info(kcontrol
, uinfo
);
2033 mutex_unlock(&codec
->control_mutex
);
2037 static int alc_cap_vol_tlv(struct snd_kcontrol
*kcontrol
, int op_flag
,
2038 unsigned int size
, unsigned int __user
*tlv
)
2040 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2041 struct alc_spec
*spec
= codec
->spec
;
2044 mutex_lock(&codec
->control_mutex
);
2045 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
2047 err
= snd_hda_mixer_amp_tlv(kcontrol
, op_flag
, size
, tlv
);
2048 mutex_unlock(&codec
->control_mutex
);
2052 typedef int (*getput_call_t
)(struct snd_kcontrol
*kcontrol
,
2053 struct snd_ctl_elem_value
*ucontrol
);
2055 static int alc_cap_getput_caller(struct snd_kcontrol
*kcontrol
,
2056 struct snd_ctl_elem_value
*ucontrol
,
2059 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2060 struct alc_spec
*spec
= codec
->spec
;
2061 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
2064 mutex_lock(&codec
->control_mutex
);
2065 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[adc_idx
],
2067 err
= func(kcontrol
, ucontrol
);
2068 mutex_unlock(&codec
->control_mutex
);
2072 static int alc_cap_vol_get(struct snd_kcontrol
*kcontrol
,
2073 struct snd_ctl_elem_value
*ucontrol
)
2075 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2076 snd_hda_mixer_amp_volume_get
);
2079 static int alc_cap_vol_put(struct snd_kcontrol
*kcontrol
,
2080 struct snd_ctl_elem_value
*ucontrol
)
2082 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2083 snd_hda_mixer_amp_volume_put
);
2086 /* capture mixer elements */
2087 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2089 static int alc_cap_sw_get(struct snd_kcontrol
*kcontrol
,
2090 struct snd_ctl_elem_value
*ucontrol
)
2092 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2093 snd_hda_mixer_amp_switch_get
);
2096 static int alc_cap_sw_put(struct snd_kcontrol
*kcontrol
,
2097 struct snd_ctl_elem_value
*ucontrol
)
2099 return alc_cap_getput_caller(kcontrol
, ucontrol
,
2100 snd_hda_mixer_amp_switch_put
);
2103 #define _DEFINE_CAPMIX(num) \
2105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2106 .name = "Capture Switch", \
2107 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2109 .info = alc_cap_sw_info, \
2110 .get = alc_cap_sw_get, \
2111 .put = alc_cap_sw_put, \
2114 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2115 .name = "Capture Volume", \
2116 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2117 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2118 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2120 .info = alc_cap_vol_info, \
2121 .get = alc_cap_vol_get, \
2122 .put = alc_cap_vol_put, \
2123 .tlv = { .c = alc_cap_vol_tlv }, \
2126 #define _DEFINE_CAPSRC(num) \
2128 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2129 /* .name = "Capture Source", */ \
2130 .name = "Input Source", \
2132 .info = alc_mux_enum_info, \
2133 .get = alc_mux_enum_get, \
2134 .put = alc_mux_enum_put, \
2137 #define DEFINE_CAPMIX(num) \
2138 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2139 _DEFINE_CAPMIX(num), \
2140 _DEFINE_CAPSRC(num), \
2144 #define DEFINE_CAPMIX_NOSRC(num) \
2145 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2146 _DEFINE_CAPMIX(num), \
2150 /* up to three ADCs */
2154 DEFINE_CAPMIX_NOSRC(1);
2155 DEFINE_CAPMIX_NOSRC(2);
2156 DEFINE_CAPMIX_NOSRC(3);
2159 * ALC880 5-stack model
2161 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2163 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2164 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2167 /* additional mixers to alc880_three_stack_mixer */
2168 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
2169 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2170 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
2174 /* channel source setting (6/8 channel selection for 5-stack) */
2176 static struct hda_verb alc880_fivestack_ch6_init
[] = {
2177 /* set line-in to input, mute it */
2178 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2179 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2184 static struct hda_verb alc880_fivestack_ch8_init
[] = {
2185 /* set line-in to output, unmute it */
2186 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2187 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2191 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
2192 { 6, alc880_fivestack_ch6_init
},
2193 { 8, alc880_fivestack_ch8_init
},
2198 * ALC880 6-stack model
2200 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2201 * Side = 0x05 (0x0f)
2202 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2203 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2206 static hda_nid_t alc880_6st_dac_nids
[4] = {
2207 /* front, rear, clfe, rear_surr */
2208 0x02, 0x03, 0x04, 0x05
2211 static struct hda_input_mux alc880_6stack_capture_source
= {
2215 { "Front Mic", 0x1 },
2221 /* fixed 8-channels */
2222 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
2226 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
2227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2228 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2229 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2230 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2231 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2232 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2233 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2234 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2235 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2236 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2237 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2238 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2239 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2240 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2242 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2243 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2244 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2246 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2247 .name
= "Channel Mode",
2248 .info
= alc_ch_mode_info
,
2249 .get
= alc_ch_mode_get
,
2250 .put
= alc_ch_mode_put
,
2259 * W810 has rear IO for:
2262 * Center/LFE (DAC 04)
2265 * The system also has a pair of internal speakers, and a headphone jack.
2266 * These are both connected to Line2 on the codec, hence to DAC 02.
2268 * There is a variable resistor to control the speaker or headphone
2269 * volume. This is a hardware-only device without a software API.
2271 * Plugging headphones in will disable the internal speakers. This is
2272 * implemented in hardware, not via the driver using jack sense. In
2273 * a similar fashion, plugging into the rear socket marked "front" will
2274 * disable both the speakers and headphones.
2276 * For input, there's a microphone jack, and an "audio in" jack.
2277 * These may not do anything useful with this driver yet, because I
2278 * haven't setup any initialization verbs for these yet...
2281 static hda_nid_t alc880_w810_dac_nids
[3] = {
2282 /* front, rear/surround, clfe */
2286 /* fixed 6 channels */
2287 static struct hda_channel_mode alc880_w810_modes
[1] = {
2291 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2292 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
2293 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2294 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2295 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2296 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2297 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2298 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2299 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2300 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2301 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2309 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2310 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2314 static hda_nid_t alc880_z71v_dac_nids
[1] = {
2317 #define ALC880_Z71V_HP_DAC 0x03
2319 /* fixed 2 channels */
2320 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
2324 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
2325 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2326 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2327 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2328 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
2329 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2330 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2332 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2338 * ALC880 F1734 model
2340 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2341 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2344 static hda_nid_t alc880_f1734_dac_nids
[1] = {
2347 #define ALC880_F1734_HP_DAC 0x02
2349 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
2350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2351 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2352 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2353 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2354 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2355 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2361 static struct hda_input_mux alc880_f1734_capture_source
= {
2373 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2374 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2375 * Mic = 0x18, Line = 0x1a
2378 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2379 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2381 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
2382 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2383 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2384 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2385 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2386 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2387 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2388 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2389 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2390 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2391 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2392 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2393 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2394 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2395 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2397 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2398 .name
= "Channel Mode",
2399 .info
= alc_ch_mode_info
,
2400 .get
= alc_ch_mode_get
,
2401 .put
= alc_ch_mode_put
,
2407 * ALC880 ASUS W1V model
2409 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2410 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2411 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2414 /* additional mixers to alc880_asus_mixer */
2415 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
2416 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
2417 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
2422 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
2423 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2424 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
2426 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
2427 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
2428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
2429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
2430 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
2431 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
2436 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
2437 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2438 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2439 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2440 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2441 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2442 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2443 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2444 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2445 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2446 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2447 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2448 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2451 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2452 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2454 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2455 .name
= "Channel Mode",
2456 .info
= alc_ch_mode_info
,
2457 .get
= alc_ch_mode_get
,
2458 .put
= alc_ch_mode_put
,
2463 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
2464 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2465 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2466 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2467 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2468 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2469 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2470 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2471 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2472 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2473 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2477 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
2478 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2479 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2480 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2481 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2482 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2483 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2488 * virtual master controls
2492 * slave controls for virtual master
2494 static const char *alc_slave_vols
[] = {
2495 "Front Playback Volume",
2496 "Surround Playback Volume",
2497 "Center Playback Volume",
2498 "LFE Playback Volume",
2499 "Side Playback Volume",
2500 "Headphone Playback Volume",
2501 "Speaker Playback Volume",
2502 "Mono Playback Volume",
2503 "Line-Out Playback Volume",
2504 "PCM Playback Volume",
2508 static const char *alc_slave_sws
[] = {
2509 "Front Playback Switch",
2510 "Surround Playback Switch",
2511 "Center Playback Switch",
2512 "LFE Playback Switch",
2513 "Side Playback Switch",
2514 "Headphone Playback Switch",
2515 "Speaker Playback Switch",
2516 "Mono Playback Switch",
2517 "IEC958 Playback Switch",
2518 "Line-Out Playback Switch",
2519 "PCM Playback Switch",
2524 * build control elements
2527 #define NID_MAPPING (-1)
2529 #define SUBDEV_SPEAKER_ (0 << 6)
2530 #define SUBDEV_HP_ (1 << 6)
2531 #define SUBDEV_LINE_ (2 << 6)
2532 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2533 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2534 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2536 static void alc_free_kctls(struct hda_codec
*codec
);
2538 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2539 /* additional beep mixers; the actual parameters are overwritten at build */
2540 static struct snd_kcontrol_new alc_beep_mixer
[] = {
2541 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT
),
2542 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT
),
2547 static int alc_build_controls(struct hda_codec
*codec
)
2549 struct alc_spec
*spec
= codec
->spec
;
2550 struct snd_kcontrol
*kctl
;
2551 struct snd_kcontrol_new
*knew
;
2556 for (i
= 0; i
< spec
->num_mixers
; i
++) {
2557 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
2561 if (spec
->cap_mixer
) {
2562 err
= snd_hda_add_new_ctls(codec
, spec
->cap_mixer
);
2566 if (spec
->multiout
.dig_out_nid
) {
2567 err
= snd_hda_create_spdif_out_ctls(codec
,
2568 spec
->multiout
.dig_out_nid
);
2571 if (!spec
->no_analog
) {
2572 err
= snd_hda_create_spdif_share_sw(codec
,
2576 spec
->multiout
.share_spdif
= 1;
2579 if (spec
->dig_in_nid
) {
2580 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
2585 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2586 /* create beep controls if needed */
2587 if (spec
->beep_amp
) {
2588 struct snd_kcontrol_new
*knew
;
2589 for (knew
= alc_beep_mixer
; knew
->name
; knew
++) {
2590 struct snd_kcontrol
*kctl
;
2591 kctl
= snd_ctl_new1(knew
, codec
);
2594 kctl
->private_value
= spec
->beep_amp
;
2595 err
= snd_hda_ctl_add(codec
, 0, kctl
);
2602 /* if we have no master control, let's create it */
2603 if (!spec
->no_analog
&&
2604 !snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
2605 unsigned int vmaster_tlv
[4];
2606 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
2607 HDA_OUTPUT
, vmaster_tlv
);
2608 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
2609 vmaster_tlv
, alc_slave_vols
);
2613 if (!spec
->no_analog
&&
2614 !snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
2615 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
2616 NULL
, alc_slave_sws
);
2621 /* assign Capture Source enums to NID */
2622 if (spec
->capsrc_nids
|| spec
->adc_nids
) {
2623 kctl
= snd_hda_find_mixer_ctl(codec
, "Capture Source");
2625 kctl
= snd_hda_find_mixer_ctl(codec
, "Input Source");
2626 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
2627 hda_nid_t
*nids
= spec
->capsrc_nids
;
2629 nids
= spec
->adc_nids
;
2630 err
= snd_hda_add_nid(codec
, kctl
, i
, nids
[i
]);
2635 if (spec
->cap_mixer
) {
2636 const char *kname
= kctl
? kctl
->id
.name
: NULL
;
2637 for (knew
= spec
->cap_mixer
; knew
->name
; knew
++) {
2638 if (kname
&& strcmp(knew
->name
, kname
) == 0)
2640 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
2641 for (i
= 0; kctl
&& i
< kctl
->count
; i
++) {
2642 err
= snd_hda_add_nid(codec
, kctl
, i
,
2650 /* other nid->control mapping */
2651 for (i
= 0; i
< spec
->num_mixers
; i
++) {
2652 for (knew
= spec
->mixers
[i
]; knew
->name
; knew
++) {
2653 if (knew
->iface
!= NID_MAPPING
)
2655 kctl
= snd_hda_find_mixer_ctl(codec
, knew
->name
);
2658 u
= knew
->subdevice
;
2659 for (j
= 0; j
< 4; j
++, u
>>= 8) {
2664 case SUBDEV_SPEAKER_
:
2665 nid
= spec
->autocfg
.speaker_pins
[nid
];
2668 nid
= spec
->autocfg
.line_out_pins
[nid
];
2671 nid
= spec
->autocfg
.hp_pins
[nid
];
2676 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
2680 u
= knew
->private_value
;
2681 for (j
= 0; j
< 4; j
++, u
>>= 8) {
2685 err
= snd_hda_add_nid(codec
, kctl
, 0, nid
);
2692 alc_free_kctls(codec
); /* no longer needed */
2699 * initialize the codec volumes, etc
2703 * generic initialization of ADC, input mixers and output mixers
2705 static struct hda_verb alc880_volume_init_verbs
[] = {
2707 * Unmute ADC0-2 and set the default input to mic-in
2709 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2710 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2711 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2712 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2713 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2714 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2716 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2718 * Note: PASD motherboards uses the Line In 2 as the input for front
2721 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2722 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
2727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2731 * Set up output mixers (0x0c - 0x0f)
2733 /* set vol=0 to output mixers */
2734 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2735 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2736 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2737 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2738 /* set up input amps for analog loopback */
2739 /* Amp Indices: DAC = 0, mixer = 1 */
2740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2742 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2743 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2744 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2745 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2746 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2747 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2753 * 3-stack pin configuration:
2754 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2756 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
2758 * preset connection lists of input pins
2759 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2761 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2762 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2763 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2766 * Set pin mode and muting
2768 /* set front pin widgets 0x14 for output */
2769 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2770 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2771 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2772 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2773 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2774 /* Mic2 (as headphone out) for HP output */
2775 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2777 /* Line In pin widget for input */
2778 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2779 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2780 /* Line2 (as front mic) pin widget for input and vref at 80% */
2781 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2782 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2783 /* CD pin widget for input */
2784 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2790 * 5-stack pin configuration:
2791 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2792 * line-in/side = 0x1a, f-mic = 0x1b
2794 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
2796 * preset connection lists of input pins
2797 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2799 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2800 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
2803 * Set pin mode and muting
2805 /* set pin widgets 0x14-0x17 for output */
2806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2807 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2808 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2809 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2810 /* unmute pins for output (no gain on this amp) */
2811 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2813 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2814 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2816 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2817 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2818 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2819 /* Mic2 (as headphone out) for HP output */
2820 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2821 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2822 /* Line In pin widget for input */
2823 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2824 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2825 /* Line2 (as front mic) pin widget for input and vref at 80% */
2826 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2827 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2828 /* CD pin widget for input */
2829 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2835 * W810 pin configuration:
2836 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2838 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
2839 /* hphone/speaker input selector: front DAC */
2840 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
2842 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2843 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2844 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2845 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2846 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2847 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2849 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2850 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2856 * Z71V pin configuration:
2857 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2859 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
2860 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2861 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2862 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2863 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2865 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2866 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2867 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2868 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2874 * 6-stack pin configuration:
2875 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2876 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2878 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
2879 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2881 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2885 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2886 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2887 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2888 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2890 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2891 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2892 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2893 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2894 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2895 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2896 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2897 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2898 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2904 * Uniwill pin configuration:
2905 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2908 static struct hda_verb alc880_uniwill_init_verbs
[] = {
2909 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2911 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2913 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2914 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2915 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2916 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2917 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2918 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2920 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2921 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2922 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2923 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2924 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2926 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2927 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2928 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2929 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2930 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2931 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2932 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2933 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2934 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2936 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2937 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
2944 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2946 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
2947 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2949 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2950 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2951 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2952 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2953 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2954 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2957 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2958 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2959 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2960 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2962 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2963 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2964 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2965 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2966 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2967 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2969 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2970 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
2975 static struct hda_verb alc880_beep_init_verbs
[] = {
2976 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
2980 /* auto-toggle front mic */
2981 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
2983 unsigned int present
;
2986 present
= snd_hda_jack_detect(codec
, 0x18);
2987 bits
= present
? HDA_AMP_MUTE
: 0;
2988 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
2991 static void alc880_uniwill_setup(struct hda_codec
*codec
)
2993 struct alc_spec
*spec
= codec
->spec
;
2995 spec
->autocfg
.hp_pins
[0] = 0x14;
2996 spec
->autocfg
.speaker_pins
[0] = 0x15;
2997 spec
->autocfg
.speaker_pins
[0] = 0x16;
3000 static void alc880_uniwill_init_hook(struct hda_codec
*codec
)
3002 alc_automute_amp(codec
);
3003 alc880_uniwill_mic_automute(codec
);
3006 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
3009 /* Looks like the unsol event is incompatible with the standard
3010 * definition. 4bit tag is placed at 28 bit!
3012 switch (res
>> 28) {
3013 case ALC880_MIC_EVENT
:
3014 alc880_uniwill_mic_automute(codec
);
3017 alc_automute_amp_unsol_event(codec
, res
);
3022 static void alc880_uniwill_p53_setup(struct hda_codec
*codec
)
3024 struct alc_spec
*spec
= codec
->spec
;
3026 spec
->autocfg
.hp_pins
[0] = 0x14;
3027 spec
->autocfg
.speaker_pins
[0] = 0x15;
3030 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
3032 unsigned int present
;
3034 present
= snd_hda_codec_read(codec
, 0x21, 0,
3035 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
3036 present
&= HDA_AMP_VOLMASK
;
3037 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
3038 HDA_AMP_VOLMASK
, present
);
3039 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
3040 HDA_AMP_VOLMASK
, present
);
3043 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
3046 /* Looks like the unsol event is incompatible with the standard
3047 * definition. 4bit tag is placed at 28 bit!
3049 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
3050 alc880_uniwill_p53_dcvol_automute(codec
);
3052 alc_automute_amp_unsol_event(codec
, res
);
3056 * F1734 pin configuration:
3057 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3059 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
3060 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
3061 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3062 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3063 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3064 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3066 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3067 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3068 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3071 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3072 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3073 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
3074 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3075 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3076 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3077 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3078 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3079 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3081 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
3082 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
3088 * ASUS pin configuration:
3089 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3091 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
3092 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
3093 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
3094 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
3095 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
3097 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3098 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3099 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3100 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3101 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3102 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3103 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3104 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3106 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3108 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3109 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3110 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3111 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3112 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3113 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3114 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3119 /* Enable GPIO mask and set output */
3120 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3121 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3122 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3124 /* Clevo m520g init */
3125 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
3126 /* headphone output */
3127 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3129 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3130 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3132 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3133 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3135 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3136 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3137 /* Mic1 (rear panel) */
3138 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3139 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3140 /* Mic2 (front panel) */
3141 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3142 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3144 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3145 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3146 /* change to EAPD mode */
3147 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3148 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3153 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
3154 /* change to EAPD mode */
3155 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3156 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3158 /* Headphone output */
3159 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3161 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3162 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
3164 /* Line In pin widget for input */
3165 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3166 /* CD pin widget for input */
3167 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3168 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3169 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3171 /* change to EAPD mode */
3172 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3173 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
3179 * LG m1 express dual
3182 * Rear Line-In/Out (blue): 0x14
3183 * Build-in Mic-In: 0x15
3185 * HP-Out (green): 0x1b
3186 * Mic-In/Out (red): 0x19
3190 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3191 static hda_nid_t alc880_lg_dac_nids
[3] = {
3195 /* seems analog CD is not working */
3196 static struct hda_input_mux alc880_lg_capture_source
= {
3201 { "Internal Mic", 0x6 },
3205 /* 2,4,6 channel modes */
3206 static struct hda_verb alc880_lg_ch2_init
[] = {
3207 /* set line-in and mic-in to input */
3208 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3209 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3213 static struct hda_verb alc880_lg_ch4_init
[] = {
3214 /* set line-in to out and mic-in to input */
3215 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3216 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3220 static struct hda_verb alc880_lg_ch6_init
[] = {
3221 /* set line-in and mic-in to output */
3222 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3223 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3227 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
3228 { 2, alc880_lg_ch2_init
},
3229 { 4, alc880_lg_ch4_init
},
3230 { 6, alc880_lg_ch6_init
},
3233 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
3234 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3235 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
3236 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3237 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
3238 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
3239 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
3240 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
3241 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
3242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3243 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3244 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
3245 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
3246 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
3247 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
3249 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3250 .name
= "Channel Mode",
3251 .info
= alc_ch_mode_info
,
3252 .get
= alc_ch_mode_get
,
3253 .put
= alc_ch_mode_put
,
3258 static struct hda_verb alc880_lg_init_verbs
[] = {
3259 /* set capture source to mic-in */
3260 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3261 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3262 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3263 /* mute all amp mixer inputs */
3264 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
3265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
3266 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3267 /* line-in to input */
3268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3269 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3272 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3274 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3275 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3276 /* mic-in to input */
3277 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
3278 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3279 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3281 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
3282 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3283 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3285 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3289 /* toggle speaker-output according to the hp-jack state */
3290 static void alc880_lg_setup(struct hda_codec
*codec
)
3292 struct alc_spec
*spec
= codec
->spec
;
3294 spec
->autocfg
.hp_pins
[0] = 0x1b;
3295 spec
->autocfg
.speaker_pins
[0] = 0x17;
3304 * Built-in Mic-In: 0x19
3310 static struct hda_input_mux alc880_lg_lw_capture_source
= {
3314 { "Internal Mic", 0x1 },
3319 #define alc880_lg_lw_modes alc880_threestack_modes
3321 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
3322 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3323 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3324 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3325 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
3326 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
3327 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
3328 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
3329 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
3330 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
3331 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
3332 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3333 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3334 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
3335 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
3337 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3338 .name
= "Channel Mode",
3339 .info
= alc_ch_mode_info
,
3340 .get
= alc_ch_mode_get
,
3341 .put
= alc_ch_mode_put
,
3346 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
3347 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3348 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
3349 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
3351 /* set capture source to mic-in */
3352 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3353 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3354 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3355 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3358 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3360 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3361 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3362 /* mic-in to input */
3363 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3364 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3366 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3367 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3369 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3373 /* toggle speaker-output according to the hp-jack state */
3374 static void alc880_lg_lw_setup(struct hda_codec
*codec
)
3376 struct alc_spec
*spec
= codec
->spec
;
3378 spec
->autocfg
.hp_pins
[0] = 0x1b;
3379 spec
->autocfg
.speaker_pins
[0] = 0x14;
3382 static struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
3383 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3384 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
3385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3387 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3388 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3392 static struct hda_input_mux alc880_medion_rim_capture_source
= {
3396 { "Internal Mic", 0x1 },
3400 static struct hda_verb alc880_medion_rim_init_verbs
[] = {
3401 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3403 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3404 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3406 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3407 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3408 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3409 /* Mic2 (as headphone out) for HP output */
3410 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3411 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3412 /* Internal Speaker */
3413 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3414 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3416 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3417 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3419 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3423 /* toggle speaker-output according to the hp-jack state */
3424 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
3426 struct alc_spec
*spec
= codec
->spec
;
3427 alc_automute_amp(codec
);
3429 if (spec
->jack_present
)
3430 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
3432 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
3435 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
3438 /* Looks like the unsol event is incompatible with the standard
3439 * definition. 4bit tag is placed at 28 bit!
3441 if ((res
>> 28) == ALC880_HP_EVENT
)
3442 alc880_medion_rim_automute(codec
);
3445 static void alc880_medion_rim_setup(struct hda_codec
*codec
)
3447 struct alc_spec
*spec
= codec
->spec
;
3449 spec
->autocfg
.hp_pins
[0] = 0x14;
3450 spec
->autocfg
.speaker_pins
[0] = 0x1b;
3453 #ifdef CONFIG_SND_HDA_POWER_SAVE
3454 static struct hda_amp_list alc880_loopbacks
[] = {
3455 { 0x0b, HDA_INPUT
, 0 },
3456 { 0x0b, HDA_INPUT
, 1 },
3457 { 0x0b, HDA_INPUT
, 2 },
3458 { 0x0b, HDA_INPUT
, 3 },
3459 { 0x0b, HDA_INPUT
, 4 },
3463 static struct hda_amp_list alc880_lg_loopbacks
[] = {
3464 { 0x0b, HDA_INPUT
, 1 },
3465 { 0x0b, HDA_INPUT
, 6 },
3466 { 0x0b, HDA_INPUT
, 7 },
3475 static int alc_init(struct hda_codec
*codec
)
3477 struct alc_spec
*spec
= codec
->spec
;
3481 alc_auto_init_amp(codec
, spec
->init_amp
);
3483 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
3484 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
3486 if (spec
->init_hook
)
3487 spec
->init_hook(codec
);
3489 #ifdef CONFIG_SND_HDA_POWER_SAVE
3490 if (codec
->patch_ops
.check_power_status
)
3491 codec
->patch_ops
.check_power_status(codec
, 0x01);
3496 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
3498 struct alc_spec
*spec
= codec
->spec
;
3500 if (spec
->unsol_event
)
3501 spec
->unsol_event(codec
, res
);
3504 #ifdef CONFIG_SND_HDA_POWER_SAVE
3505 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
3507 struct alc_spec
*spec
= codec
->spec
;
3508 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
3513 * Analog playback callbacks
3515 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3516 struct hda_codec
*codec
,
3517 struct snd_pcm_substream
*substream
)
3519 struct alc_spec
*spec
= codec
->spec
;
3520 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
3524 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3525 struct hda_codec
*codec
,
3526 unsigned int stream_tag
,
3527 unsigned int format
,
3528 struct snd_pcm_substream
*substream
)
3530 struct alc_spec
*spec
= codec
->spec
;
3531 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
3532 stream_tag
, format
, substream
);
3535 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3536 struct hda_codec
*codec
,
3537 struct snd_pcm_substream
*substream
)
3539 struct alc_spec
*spec
= codec
->spec
;
3540 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
3546 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3547 struct hda_codec
*codec
,
3548 struct snd_pcm_substream
*substream
)
3550 struct alc_spec
*spec
= codec
->spec
;
3551 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
3554 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3555 struct hda_codec
*codec
,
3556 unsigned int stream_tag
,
3557 unsigned int format
,
3558 struct snd_pcm_substream
*substream
)
3560 struct alc_spec
*spec
= codec
->spec
;
3561 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
3562 stream_tag
, format
, substream
);
3565 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3566 struct hda_codec
*codec
,
3567 struct snd_pcm_substream
*substream
)
3569 struct alc_spec
*spec
= codec
->spec
;
3570 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
3573 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
3574 struct hda_codec
*codec
,
3575 struct snd_pcm_substream
*substream
)
3577 struct alc_spec
*spec
= codec
->spec
;
3578 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
3584 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3585 struct hda_codec
*codec
,
3586 unsigned int stream_tag
,
3587 unsigned int format
,
3588 struct snd_pcm_substream
*substream
)
3590 struct alc_spec
*spec
= codec
->spec
;
3592 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
3593 stream_tag
, 0, format
);
3597 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3598 struct hda_codec
*codec
,
3599 struct snd_pcm_substream
*substream
)
3601 struct alc_spec
*spec
= codec
->spec
;
3603 snd_hda_codec_cleanup_stream(codec
,
3604 spec
->adc_nids
[substream
->number
+ 1]);
3611 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
3615 /* NID is set in alc_build_pcms */
3617 .open
= alc880_playback_pcm_open
,
3618 .prepare
= alc880_playback_pcm_prepare
,
3619 .cleanup
= alc880_playback_pcm_cleanup
3623 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
3627 /* NID is set in alc_build_pcms */
3630 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
3634 /* NID is set in alc_build_pcms */
3637 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
3638 .substreams
= 2, /* can be overridden */
3641 /* NID is set in alc_build_pcms */
3643 .prepare
= alc880_alt_capture_pcm_prepare
,
3644 .cleanup
= alc880_alt_capture_pcm_cleanup
3648 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
3652 /* NID is set in alc_build_pcms */
3654 .open
= alc880_dig_playback_pcm_open
,
3655 .close
= alc880_dig_playback_pcm_close
,
3656 .prepare
= alc880_dig_playback_pcm_prepare
,
3657 .cleanup
= alc880_dig_playback_pcm_cleanup
3661 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
3665 /* NID is set in alc_build_pcms */
3668 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3669 static struct hda_pcm_stream alc_pcm_null_stream
= {
3675 static int alc_build_pcms(struct hda_codec
*codec
)
3677 struct alc_spec
*spec
= codec
->spec
;
3678 struct hda_pcm
*info
= spec
->pcm_rec
;
3681 codec
->num_pcms
= 1;
3682 codec
->pcm_info
= info
;
3684 if (spec
->no_analog
)
3687 snprintf(spec
->stream_name_analog
, sizeof(spec
->stream_name_analog
),
3688 "%s Analog", codec
->chip_name
);
3689 info
->name
= spec
->stream_name_analog
;
3691 if (spec
->stream_analog_playback
) {
3692 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
3694 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
3695 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
3697 if (spec
->stream_analog_capture
) {
3698 if (snd_BUG_ON(!spec
->adc_nids
))
3700 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
3701 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
3704 if (spec
->channel_mode
) {
3705 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
3706 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
3707 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
3708 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
3714 /* SPDIF for stream index #1 */
3715 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
3716 snprintf(spec
->stream_name_digital
,
3717 sizeof(spec
->stream_name_digital
),
3718 "%s Digital", codec
->chip_name
);
3719 codec
->num_pcms
= 2;
3720 codec
->slave_dig_outs
= spec
->multiout
.slave_dig_outs
;
3721 info
= spec
->pcm_rec
+ 1;
3722 info
->name
= spec
->stream_name_digital
;
3723 if (spec
->dig_out_type
)
3724 info
->pcm_type
= spec
->dig_out_type
;
3726 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
3727 if (spec
->multiout
.dig_out_nid
&&
3728 spec
->stream_digital_playback
) {
3729 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
3730 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
3732 if (spec
->dig_in_nid
&&
3733 spec
->stream_digital_capture
) {
3734 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
3735 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
3737 /* FIXME: do we need this for all Realtek codec models? */
3738 codec
->spdif_status_reset
= 1;
3741 if (spec
->no_analog
)
3744 /* If the use of more than one ADC is requested for the current
3745 * model, configure a second analog capture-only PCM.
3747 /* Additional Analaog capture for index #2 */
3748 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
3749 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
3750 codec
->num_pcms
= 3;
3751 info
= spec
->pcm_rec
+ 2;
3752 info
->name
= spec
->stream_name_analog
;
3753 if (spec
->alt_dac_nid
) {
3754 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
3755 *spec
->stream_analog_alt_playback
;
3756 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
3759 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
3760 alc_pcm_null_stream
;
3761 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
3763 if (spec
->num_adc_nids
> 1) {
3764 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
3765 *spec
->stream_analog_alt_capture
;
3766 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
3768 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
3769 spec
->num_adc_nids
- 1;
3771 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
3772 alc_pcm_null_stream
;
3773 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
3780 static inline void alc_shutup(struct hda_codec
*codec
)
3782 snd_hda_shutup_pins(codec
);
3785 static void alc_free_kctls(struct hda_codec
*codec
)
3787 struct alc_spec
*spec
= codec
->spec
;
3789 if (spec
->kctls
.list
) {
3790 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
3792 for (i
= 0; i
< spec
->kctls
.used
; i
++)
3793 kfree(kctl
[i
].name
);
3795 snd_array_free(&spec
->kctls
);
3798 static void alc_free(struct hda_codec
*codec
)
3800 struct alc_spec
*spec
= codec
->spec
;
3806 alc_free_kctls(codec
);
3808 snd_hda_detach_beep_device(codec
);
3811 #ifdef CONFIG_SND_HDA_POWER_SAVE
3812 static void alc_power_eapd(struct hda_codec
*codec
)
3814 /* We currently only handle front, HP */
3815 switch (codec
->vendor_id
) {
3817 set_eapd(codec
, 0x0f, 0);
3818 set_eapd(codec
, 0x10, 0);
3831 set_eapd(codec
, 0x14, 0);
3832 set_eapd(codec
, 0x15, 0);
3837 static int alc_suspend(struct hda_codec
*codec
, pm_message_t state
)
3839 struct alc_spec
*spec
= codec
->spec
;
3841 if (spec
&& spec
->power_hook
)
3842 spec
->power_hook(codec
);
3847 #ifdef SND_HDA_NEEDS_RESUME
3848 static int alc_resume(struct hda_codec
*codec
)
3850 codec
->patch_ops
.init(codec
);
3851 snd_hda_codec_resume_amp(codec
);
3852 snd_hda_codec_resume_cache(codec
);
3853 #ifdef CONFIG_SND_HDA_POWER_SAVE
3854 if (codec
->patch_ops
.check_power_status
)
3855 codec
->patch_ops
.check_power_status(codec
, 0x01);
3863 static struct hda_codec_ops alc_patch_ops
= {
3864 .build_controls
= alc_build_controls
,
3865 .build_pcms
= alc_build_pcms
,
3868 .unsol_event
= alc_unsol_event
,
3869 #ifdef SND_HDA_NEEDS_RESUME
3870 .resume
= alc_resume
,
3872 #ifdef CONFIG_SND_HDA_POWER_SAVE
3873 .suspend
= alc_suspend
,
3874 .check_power_status
= alc_check_power_status
,
3876 .reboot_notify
= alc_shutup
,
3879 /* replace the codec chip_name with the given string */
3880 static int alc_codec_rename(struct hda_codec
*codec
, const char *name
)
3882 kfree(codec
->chip_name
);
3883 codec
->chip_name
= kstrdup(name
, GFP_KERNEL
);
3884 if (!codec
->chip_name
) {
3892 * Test configuration for debugging
3894 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3897 #ifdef CONFIG_SND_DEBUG
3898 static hda_nid_t alc880_test_dac_nids
[4] = {
3899 0x02, 0x03, 0x04, 0x05
3902 static struct hda_input_mux alc880_test_capture_source
= {
3911 { "Surround", 0x6 },
3915 static struct hda_channel_mode alc880_test_modes
[4] = {
3922 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
3923 struct snd_ctl_elem_info
*uinfo
)
3925 static char *texts
[] = {
3926 "N/A", "Line Out", "HP Out",
3927 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3929 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
3931 uinfo
->value
.enumerated
.items
= 8;
3932 if (uinfo
->value
.enumerated
.item
>= 8)
3933 uinfo
->value
.enumerated
.item
= 7;
3934 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
3938 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
3939 struct snd_ctl_elem_value
*ucontrol
)
3941 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3942 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3943 unsigned int pin_ctl
, item
= 0;
3945 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
3946 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3947 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
3948 if (pin_ctl
& AC_PINCTL_HP_EN
)
3952 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
3953 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
3954 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
3955 case AC_PINCTL_VREF_50
: item
= 4; break;
3956 case AC_PINCTL_VREF_GRD
: item
= 5; break;
3957 case AC_PINCTL_VREF_80
: item
= 6; break;
3958 case AC_PINCTL_VREF_100
: item
= 7; break;
3961 ucontrol
->value
.enumerated
.item
[0] = item
;
3965 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
3966 struct snd_ctl_elem_value
*ucontrol
)
3968 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3969 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3970 static unsigned int ctls
[] = {
3971 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
3972 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
3973 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
3974 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
3975 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
3976 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
3978 unsigned int old_ctl
, new_ctl
;
3980 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
3981 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3982 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
3983 if (old_ctl
!= new_ctl
) {
3985 snd_hda_codec_write_cache(codec
, nid
, 0,
3986 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3988 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
3990 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
3997 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
3998 struct snd_ctl_elem_info
*uinfo
)
4000 static char *texts
[] = {
4001 "Front", "Surround", "CLFE", "Side"
4003 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
4005 uinfo
->value
.enumerated
.items
= 4;
4006 if (uinfo
->value
.enumerated
.item
>= 4)
4007 uinfo
->value
.enumerated
.item
= 3;
4008 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
4012 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
4013 struct snd_ctl_elem_value
*ucontrol
)
4015 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4016 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4019 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
4020 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
4024 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
4025 struct snd_ctl_elem_value
*ucontrol
)
4027 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4028 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
4031 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
4032 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
4033 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
4034 snd_hda_codec_write_cache(codec
, nid
, 0,
4035 AC_VERB_SET_CONNECT_SEL
, sel
);
4041 #define PIN_CTL_TEST(xname,nid) { \
4042 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4044 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4045 .info = alc_test_pin_ctl_info, \
4046 .get = alc_test_pin_ctl_get, \
4047 .put = alc_test_pin_ctl_put, \
4048 .private_value = nid \
4051 #define PIN_SRC_TEST(xname,nid) { \
4052 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4054 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4055 .info = alc_test_pin_src_info, \
4056 .get = alc_test_pin_src_get, \
4057 .put = alc_test_pin_src_put, \
4058 .private_value = nid \
4061 static struct snd_kcontrol_new alc880_test_mixer
[] = {
4062 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4063 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4064 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
4065 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
4066 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4067 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4068 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
4069 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
4070 PIN_CTL_TEST("Front Pin Mode", 0x14),
4071 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4072 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4073 PIN_CTL_TEST("Side Pin Mode", 0x17),
4074 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4075 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4076 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4077 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4078 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4079 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4080 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4081 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4082 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4083 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4084 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4085 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4086 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
4087 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
4088 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
4089 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
4090 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
4091 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
4093 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4094 .name
= "Channel Mode",
4095 .info
= alc_ch_mode_info
,
4096 .get
= alc_ch_mode_get
,
4097 .put
= alc_ch_mode_put
,
4102 static struct hda_verb alc880_test_init_verbs
[] = {
4103 /* Unmute inputs of 0x0c - 0x0f */
4104 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4105 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4106 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4107 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4108 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4109 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4110 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4111 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4112 /* Vol output for 0x0c-0x0f */
4113 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4114 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4115 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4116 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4117 /* Set output pins 0x14-0x17 */
4118 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4120 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4121 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4122 /* Unmute output pins 0x14-0x17 */
4123 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4124 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4125 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4126 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4127 /* Set input pins 0x18-0x1c */
4128 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4129 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4130 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4131 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4132 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4133 /* Mute input pins 0x18-0x1b */
4134 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4135 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4136 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4137 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4139 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4140 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4141 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4142 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4143 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4144 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4145 /* Analog input/passthru */
4146 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4147 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4148 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4149 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4150 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4158 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
4159 [ALC880_3ST
] = "3stack",
4160 [ALC880_TCL_S700
] = "tcl",
4161 [ALC880_3ST_DIG
] = "3stack-digout",
4162 [ALC880_CLEVO
] = "clevo",
4163 [ALC880_5ST
] = "5stack",
4164 [ALC880_5ST_DIG
] = "5stack-digout",
4165 [ALC880_W810
] = "w810",
4166 [ALC880_Z71V
] = "z71v",
4167 [ALC880_6ST
] = "6stack",
4168 [ALC880_6ST_DIG
] = "6stack-digout",
4169 [ALC880_ASUS
] = "asus",
4170 [ALC880_ASUS_W1V
] = "asus-w1v",
4171 [ALC880_ASUS_DIG
] = "asus-dig",
4172 [ALC880_ASUS_DIG2
] = "asus-dig2",
4173 [ALC880_UNIWILL_DIG
] = "uniwill",
4174 [ALC880_UNIWILL_P53
] = "uniwill-p53",
4175 [ALC880_FUJITSU
] = "fujitsu",
4176 [ALC880_F1734
] = "F1734",
4178 [ALC880_LG_LW
] = "lg-lw",
4179 [ALC880_MEDION_RIM
] = "medion",
4180 #ifdef CONFIG_SND_DEBUG
4181 [ALC880_TEST
] = "test",
4183 [ALC880_AUTO
] = "auto",
4186 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
4187 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
4188 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
4189 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
4190 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
4191 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
4192 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
4193 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
4194 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
4195 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
4196 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
4197 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
4198 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
4199 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
4200 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
4201 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
4202 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
4203 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
4204 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
4205 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4206 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
4207 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
4208 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
4209 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
4210 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
4211 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
4212 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS
), /* default ASUS */
4213 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
4214 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
4215 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
4216 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
4217 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
4218 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
4219 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
4220 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
4221 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
4222 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
4223 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
4224 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
4225 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
4226 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
4227 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
4228 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
4229 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
4230 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
4231 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
4232 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
4233 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
4234 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
4235 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
4236 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734
),
4237 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
4238 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
4239 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
4240 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
4241 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
4242 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
4243 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
4244 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
4245 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
4246 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
4247 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
4248 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
4249 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
4250 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
4251 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
4252 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
4253 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
4254 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
4256 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST
),
4257 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
4258 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
4263 * ALC880 codec presets
4265 static struct alc_config_preset alc880_presets
[] = {
4267 .mixers
= { alc880_three_stack_mixer
},
4268 .init_verbs
= { alc880_volume_init_verbs
,
4269 alc880_pin_3stack_init_verbs
},
4270 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4271 .dac_nids
= alc880_dac_nids
,
4272 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4273 .channel_mode
= alc880_threestack_modes
,
4275 .input_mux
= &alc880_capture_source
,
4277 [ALC880_3ST_DIG
] = {
4278 .mixers
= { alc880_three_stack_mixer
},
4279 .init_verbs
= { alc880_volume_init_verbs
,
4280 alc880_pin_3stack_init_verbs
},
4281 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4282 .dac_nids
= alc880_dac_nids
,
4283 .dig_out_nid
= ALC880_DIGOUT_NID
,
4284 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4285 .channel_mode
= alc880_threestack_modes
,
4287 .input_mux
= &alc880_capture_source
,
4289 [ALC880_TCL_S700
] = {
4290 .mixers
= { alc880_tcl_s700_mixer
},
4291 .init_verbs
= { alc880_volume_init_verbs
,
4292 alc880_pin_tcl_S700_init_verbs
,
4293 alc880_gpio2_init_verbs
},
4294 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4295 .dac_nids
= alc880_dac_nids
,
4296 .adc_nids
= alc880_adc_nids_alt
, /* FIXME: correct? */
4297 .num_adc_nids
= 1, /* single ADC */
4299 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4300 .channel_mode
= alc880_2_jack_modes
,
4301 .input_mux
= &alc880_capture_source
,
4304 .mixers
= { alc880_three_stack_mixer
,
4305 alc880_five_stack_mixer
},
4306 .init_verbs
= { alc880_volume_init_verbs
,
4307 alc880_pin_5stack_init_verbs
},
4308 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4309 .dac_nids
= alc880_dac_nids
,
4310 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
4311 .channel_mode
= alc880_fivestack_modes
,
4312 .input_mux
= &alc880_capture_source
,
4314 [ALC880_5ST_DIG
] = {
4315 .mixers
= { alc880_three_stack_mixer
,
4316 alc880_five_stack_mixer
},
4317 .init_verbs
= { alc880_volume_init_verbs
,
4318 alc880_pin_5stack_init_verbs
},
4319 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4320 .dac_nids
= alc880_dac_nids
,
4321 .dig_out_nid
= ALC880_DIGOUT_NID
,
4322 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
4323 .channel_mode
= alc880_fivestack_modes
,
4324 .input_mux
= &alc880_capture_source
,
4327 .mixers
= { alc880_six_stack_mixer
},
4328 .init_verbs
= { alc880_volume_init_verbs
,
4329 alc880_pin_6stack_init_verbs
},
4330 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
4331 .dac_nids
= alc880_6st_dac_nids
,
4332 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
4333 .channel_mode
= alc880_sixstack_modes
,
4334 .input_mux
= &alc880_6stack_capture_source
,
4336 [ALC880_6ST_DIG
] = {
4337 .mixers
= { alc880_six_stack_mixer
},
4338 .init_verbs
= { alc880_volume_init_verbs
,
4339 alc880_pin_6stack_init_verbs
},
4340 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
4341 .dac_nids
= alc880_6st_dac_nids
,
4342 .dig_out_nid
= ALC880_DIGOUT_NID
,
4343 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
4344 .channel_mode
= alc880_sixstack_modes
,
4345 .input_mux
= &alc880_6stack_capture_source
,
4348 .mixers
= { alc880_w810_base_mixer
},
4349 .init_verbs
= { alc880_volume_init_verbs
,
4350 alc880_pin_w810_init_verbs
,
4351 alc880_gpio2_init_verbs
},
4352 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
4353 .dac_nids
= alc880_w810_dac_nids
,
4354 .dig_out_nid
= ALC880_DIGOUT_NID
,
4355 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
4356 .channel_mode
= alc880_w810_modes
,
4357 .input_mux
= &alc880_capture_source
,
4360 .mixers
= { alc880_z71v_mixer
},
4361 .init_verbs
= { alc880_volume_init_verbs
,
4362 alc880_pin_z71v_init_verbs
},
4363 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
4364 .dac_nids
= alc880_z71v_dac_nids
,
4365 .dig_out_nid
= ALC880_DIGOUT_NID
,
4367 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4368 .channel_mode
= alc880_2_jack_modes
,
4369 .input_mux
= &alc880_capture_source
,
4372 .mixers
= { alc880_f1734_mixer
},
4373 .init_verbs
= { alc880_volume_init_verbs
,
4374 alc880_pin_f1734_init_verbs
},
4375 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
4376 .dac_nids
= alc880_f1734_dac_nids
,
4378 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4379 .channel_mode
= alc880_2_jack_modes
,
4380 .input_mux
= &alc880_f1734_capture_source
,
4381 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4382 .setup
= alc880_uniwill_p53_setup
,
4383 .init_hook
= alc_automute_amp
,
4386 .mixers
= { alc880_asus_mixer
},
4387 .init_verbs
= { alc880_volume_init_verbs
,
4388 alc880_pin_asus_init_verbs
,
4389 alc880_gpio1_init_verbs
},
4390 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4391 .dac_nids
= alc880_asus_dac_nids
,
4392 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4393 .channel_mode
= alc880_asus_modes
,
4395 .input_mux
= &alc880_capture_source
,
4397 [ALC880_ASUS_DIG
] = {
4398 .mixers
= { alc880_asus_mixer
},
4399 .init_verbs
= { alc880_volume_init_verbs
,
4400 alc880_pin_asus_init_verbs
,
4401 alc880_gpio1_init_verbs
},
4402 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4403 .dac_nids
= alc880_asus_dac_nids
,
4404 .dig_out_nid
= ALC880_DIGOUT_NID
,
4405 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4406 .channel_mode
= alc880_asus_modes
,
4408 .input_mux
= &alc880_capture_source
,
4410 [ALC880_ASUS_DIG2
] = {
4411 .mixers
= { alc880_asus_mixer
},
4412 .init_verbs
= { alc880_volume_init_verbs
,
4413 alc880_pin_asus_init_verbs
,
4414 alc880_gpio2_init_verbs
}, /* use GPIO2 */
4415 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4416 .dac_nids
= alc880_asus_dac_nids
,
4417 .dig_out_nid
= ALC880_DIGOUT_NID
,
4418 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4419 .channel_mode
= alc880_asus_modes
,
4421 .input_mux
= &alc880_capture_source
,
4423 [ALC880_ASUS_W1V
] = {
4424 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
4425 .init_verbs
= { alc880_volume_init_verbs
,
4426 alc880_pin_asus_init_verbs
,
4427 alc880_gpio1_init_verbs
},
4428 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4429 .dac_nids
= alc880_asus_dac_nids
,
4430 .dig_out_nid
= ALC880_DIGOUT_NID
,
4431 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4432 .channel_mode
= alc880_asus_modes
,
4434 .input_mux
= &alc880_capture_source
,
4436 [ALC880_UNIWILL_DIG
] = {
4437 .mixers
= { alc880_asus_mixer
},
4438 .init_verbs
= { alc880_volume_init_verbs
,
4439 alc880_pin_asus_init_verbs
},
4440 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4441 .dac_nids
= alc880_asus_dac_nids
,
4442 .dig_out_nid
= ALC880_DIGOUT_NID
,
4443 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4444 .channel_mode
= alc880_asus_modes
,
4446 .input_mux
= &alc880_capture_source
,
4448 [ALC880_UNIWILL
] = {
4449 .mixers
= { alc880_uniwill_mixer
},
4450 .init_verbs
= { alc880_volume_init_verbs
,
4451 alc880_uniwill_init_verbs
},
4452 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4453 .dac_nids
= alc880_asus_dac_nids
,
4454 .dig_out_nid
= ALC880_DIGOUT_NID
,
4455 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4456 .channel_mode
= alc880_threestack_modes
,
4458 .input_mux
= &alc880_capture_source
,
4459 .unsol_event
= alc880_uniwill_unsol_event
,
4460 .setup
= alc880_uniwill_setup
,
4461 .init_hook
= alc880_uniwill_init_hook
,
4463 [ALC880_UNIWILL_P53
] = {
4464 .mixers
= { alc880_uniwill_p53_mixer
},
4465 .init_verbs
= { alc880_volume_init_verbs
,
4466 alc880_uniwill_p53_init_verbs
},
4467 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4468 .dac_nids
= alc880_asus_dac_nids
,
4469 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
4470 .channel_mode
= alc880_threestack_modes
,
4471 .input_mux
= &alc880_capture_source
,
4472 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4473 .setup
= alc880_uniwill_p53_setup
,
4474 .init_hook
= alc_automute_amp
,
4476 [ALC880_FUJITSU
] = {
4477 .mixers
= { alc880_fujitsu_mixer
},
4478 .init_verbs
= { alc880_volume_init_verbs
,
4479 alc880_uniwill_p53_init_verbs
,
4480 alc880_beep_init_verbs
},
4481 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4482 .dac_nids
= alc880_dac_nids
,
4483 .dig_out_nid
= ALC880_DIGOUT_NID
,
4484 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4485 .channel_mode
= alc880_2_jack_modes
,
4486 .input_mux
= &alc880_capture_source
,
4487 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4488 .setup
= alc880_uniwill_p53_setup
,
4489 .init_hook
= alc_automute_amp
,
4492 .mixers
= { alc880_three_stack_mixer
},
4493 .init_verbs
= { alc880_volume_init_verbs
,
4494 alc880_pin_clevo_init_verbs
},
4495 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4496 .dac_nids
= alc880_dac_nids
,
4498 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4499 .channel_mode
= alc880_threestack_modes
,
4501 .input_mux
= &alc880_capture_source
,
4504 .mixers
= { alc880_lg_mixer
},
4505 .init_verbs
= { alc880_volume_init_verbs
,
4506 alc880_lg_init_verbs
},
4507 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
4508 .dac_nids
= alc880_lg_dac_nids
,
4509 .dig_out_nid
= ALC880_DIGOUT_NID
,
4510 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
4511 .channel_mode
= alc880_lg_ch_modes
,
4513 .input_mux
= &alc880_lg_capture_source
,
4514 .unsol_event
= alc_automute_amp_unsol_event
,
4515 .setup
= alc880_lg_setup
,
4516 .init_hook
= alc_automute_amp
,
4517 #ifdef CONFIG_SND_HDA_POWER_SAVE
4518 .loopbacks
= alc880_lg_loopbacks
,
4522 .mixers
= { alc880_lg_lw_mixer
},
4523 .init_verbs
= { alc880_volume_init_verbs
,
4524 alc880_lg_lw_init_verbs
},
4525 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4526 .dac_nids
= alc880_dac_nids
,
4527 .dig_out_nid
= ALC880_DIGOUT_NID
,
4528 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
4529 .channel_mode
= alc880_lg_lw_modes
,
4530 .input_mux
= &alc880_lg_lw_capture_source
,
4531 .unsol_event
= alc_automute_amp_unsol_event
,
4532 .setup
= alc880_lg_lw_setup
,
4533 .init_hook
= alc_automute_amp
,
4535 [ALC880_MEDION_RIM
] = {
4536 .mixers
= { alc880_medion_rim_mixer
},
4537 .init_verbs
= { alc880_volume_init_verbs
,
4538 alc880_medion_rim_init_verbs
,
4539 alc_gpio2_init_verbs
},
4540 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4541 .dac_nids
= alc880_dac_nids
,
4542 .dig_out_nid
= ALC880_DIGOUT_NID
,
4543 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4544 .channel_mode
= alc880_2_jack_modes
,
4545 .input_mux
= &alc880_medion_rim_capture_source
,
4546 .unsol_event
= alc880_medion_rim_unsol_event
,
4547 .setup
= alc880_medion_rim_setup
,
4548 .init_hook
= alc880_medion_rim_automute
,
4550 #ifdef CONFIG_SND_DEBUG
4552 .mixers
= { alc880_test_mixer
},
4553 .init_verbs
= { alc880_test_init_verbs
},
4554 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
4555 .dac_nids
= alc880_test_dac_nids
,
4556 .dig_out_nid
= ALC880_DIGOUT_NID
,
4557 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
4558 .channel_mode
= alc880_test_modes
,
4559 .input_mux
= &alc880_test_capture_source
,
4565 * Automatic parse of I/O pins from the BIOS configuration
4570 ALC_CTL_WIDGET_MUTE
,
4573 static struct snd_kcontrol_new alc880_control_templates
[] = {
4574 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
4575 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
4576 HDA_BIND_MUTE(NULL
, 0, 0, 0),
4579 /* add dynamic controls */
4580 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
4583 struct snd_kcontrol_new
*knew
;
4585 snd_array_init(&spec
->kctls
, sizeof(*knew
), 32);
4586 knew
= snd_array_new(&spec
->kctls
);
4589 *knew
= alc880_control_templates
[type
];
4590 knew
->name
= kstrdup(name
, GFP_KERNEL
);
4593 if (get_amp_nid_(val
))
4594 knew
->subdevice
= HDA_SUBDEV_AMP_FLAG
;
4595 knew
->private_value
= val
;
4599 static int add_control_with_pfx(struct alc_spec
*spec
, int type
,
4600 const char *pfx
, const char *dir
,
4601 const char *sfx
, unsigned long val
)
4604 snprintf(name
, sizeof(name
), "%s %s %s", pfx
, dir
, sfx
);
4605 return add_control(spec
, type
, name
, val
);
4608 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4609 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4610 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4611 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4613 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4614 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4615 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4616 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4617 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4618 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4619 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4620 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4621 #define ALC880_PIN_CD_NID 0x1c
4623 /* fill in the dac_nids table from the parsed pin configuration */
4624 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
4625 const struct auto_pin_cfg
*cfg
)
4631 memset(assigned
, 0, sizeof(assigned
));
4632 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
4634 /* check the pins hardwired to audio widget */
4635 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4636 nid
= cfg
->line_out_pins
[i
];
4637 if (alc880_is_fixed_pin(nid
)) {
4638 int idx
= alc880_fixed_pin_idx(nid
);
4639 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
4643 /* left pins can be connect to any audio widget */
4644 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4645 nid
= cfg
->line_out_pins
[i
];
4646 if (alc880_is_fixed_pin(nid
))
4648 /* search for an empty channel */
4649 for (j
= 0; j
< cfg
->line_outs
; j
++) {
4651 spec
->multiout
.dac_nids
[i
] =
4652 alc880_idx_to_dac(j
);
4658 spec
->multiout
.num_dacs
= cfg
->line_outs
;
4662 /* add playback controls from the parsed DAC table */
4663 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
4664 const struct auto_pin_cfg
*cfg
)
4666 static const char *chname
[4] = {
4667 "Front", "Surround", NULL
/*CLFE*/, "Side"
4672 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4673 if (!spec
->multiout
.dac_nids
[i
])
4675 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
4678 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
4680 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
4684 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
4686 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
4690 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
4692 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
4696 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
4698 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
4704 if (cfg
->line_outs
== 1 &&
4705 cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
4709 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
4710 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
4714 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
4715 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
4724 /* add playback controls for speaker and HP outputs */
4725 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
4734 if (alc880_is_fixed_pin(pin
)) {
4735 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
4736 /* specify the DAC as the extra output */
4737 if (!spec
->multiout
.hp_nid
)
4738 spec
->multiout
.hp_nid
= nid
;
4740 spec
->multiout
.extra_out_nid
[0] = nid
;
4741 /* control HP volume/switch on the output mixer amp */
4742 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
4743 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
4744 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
4747 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
4748 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
4751 } else if (alc880_is_multi_pin(pin
)) {
4752 /* set manual connection */
4753 /* we have only a switch on HP-out PIN */
4754 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
4755 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
4762 /* create input playback/capture controls for the given pin */
4763 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
4764 const char *ctlname
,
4765 int idx
, hda_nid_t mix_nid
)
4769 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
4770 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
4773 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
4774 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
4780 static int alc_is_input_pin(struct hda_codec
*codec
, hda_nid_t nid
)
4782 unsigned int pincap
= snd_hda_query_pin_caps(codec
, nid
);
4783 return (pincap
& AC_PINCAP_IN
) != 0;
4786 /* create playback/capture controls for input pins */
4787 static int alc_auto_create_input_ctls(struct hda_codec
*codec
,
4788 const struct auto_pin_cfg
*cfg
,
4790 hda_nid_t cap1
, hda_nid_t cap2
)
4792 struct alc_spec
*spec
= codec
->spec
;
4793 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
4796 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4799 pin
= cfg
->input_pins
[i
];
4800 if (!alc_is_input_pin(codec
, pin
))
4804 idx
= get_connection_index(codec
, mixer
, pin
);
4806 err
= new_analog_input(spec
, pin
,
4807 auto_pin_cfg_labels
[i
],
4816 idx
= get_connection_index(codec
, cap1
, pin
);
4817 if (idx
< 0 && cap2
)
4818 idx
= get_connection_index(codec
, cap2
, pin
);
4820 imux
->items
[imux
->num_items
].label
=
4821 auto_pin_cfg_labels
[i
];
4822 imux
->items
[imux
->num_items
].index
= idx
;
4829 static int alc880_auto_create_input_ctls(struct hda_codec
*codec
,
4830 const struct auto_pin_cfg
*cfg
)
4832 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x08, 0x09);
4835 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
4836 unsigned int pin_type
)
4838 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4841 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4845 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
4846 hda_nid_t nid
, int pin_type
,
4849 alc_set_pin_output(codec
, nid
, pin_type
);
4850 /* need the manual connection? */
4851 if (alc880_is_multi_pin(nid
)) {
4852 struct alc_spec
*spec
= codec
->spec
;
4853 int idx
= alc880_multi_pin_idx(nid
);
4854 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
4855 AC_VERB_SET_CONNECT_SEL
,
4856 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
4860 static int get_pin_type(int line_out_type
)
4862 if (line_out_type
== AUTO_PIN_HP_OUT
)
4868 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
4870 struct alc_spec
*spec
= codec
->spec
;
4873 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
4874 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
4875 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
4876 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
4880 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
4882 struct alc_spec
*spec
= codec
->spec
;
4885 pin
= spec
->autocfg
.speaker_pins
[0];
4886 if (pin
) /* connect to front */
4887 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
4888 pin
= spec
->autocfg
.hp_pins
[0];
4889 if (pin
) /* connect to front */
4890 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
4893 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
4895 struct alc_spec
*spec
= codec
->spec
;
4898 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4899 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4900 if (alc_is_input_pin(codec
, nid
)) {
4901 alc_set_input_pin(codec
, nid
, i
);
4902 if (nid
!= ALC880_PIN_CD_NID
&&
4903 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
4904 snd_hda_codec_write(codec
, nid
, 0,
4905 AC_VERB_SET_AMP_GAIN_MUTE
,
4911 static void alc880_auto_init_input_src(struct hda_codec
*codec
)
4913 struct alc_spec
*spec
= codec
->spec
;
4916 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
4917 unsigned int mux_idx
;
4918 const struct hda_input_mux
*imux
;
4919 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
4920 imux
= &spec
->input_mux
[mux_idx
];
4921 if (!imux
->num_items
&& mux_idx
> 0)
4922 imux
= &spec
->input_mux
[0];
4924 snd_hda_codec_write(codec
, spec
->adc_nids
[c
], 0,
4925 AC_VERB_SET_CONNECT_SEL
,
4926 imux
->items
[0].index
);
4930 /* parse the BIOS configuration and set up the alc_spec */
4931 /* return 1 if successful, 0 if the proper config is not found,
4932 * or a negative error code
4934 static int alc880_parse_auto_config(struct hda_codec
*codec
)
4936 struct alc_spec
*spec
= codec
->spec
;
4938 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
4940 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
4944 if (!spec
->autocfg
.line_outs
)
4945 return 0; /* can't find valid BIOS pin config */
4947 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
4950 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
4953 err
= alc880_auto_create_extra_out(spec
,
4954 spec
->autocfg
.speaker_pins
[0],
4958 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
4962 err
= alc880_auto_create_input_ctls(codec
, &spec
->autocfg
);
4966 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
4968 /* check multiple SPDIF-out (for recent codecs) */
4969 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
4971 err
= snd_hda_get_connections(codec
,
4972 spec
->autocfg
.dig_out_pins
[i
],
4977 spec
->multiout
.dig_out_nid
= dig_nid
;
4979 spec
->multiout
.slave_dig_outs
= spec
->slave_dig_outs
;
4980 if (i
>= ARRAY_SIZE(spec
->slave_dig_outs
) - 1)
4982 spec
->slave_dig_outs
[i
- 1] = dig_nid
;
4985 if (spec
->autocfg
.dig_in_pin
)
4986 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
4988 if (spec
->kctls
.list
)
4989 add_mixer(spec
, spec
->kctls
.list
);
4991 add_verb(spec
, alc880_volume_init_verbs
);
4993 spec
->num_mux_defs
= 1;
4994 spec
->input_mux
= &spec
->private_imux
[0];
4996 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
5001 /* additional initialization for auto-configuration model */
5002 static void alc880_auto_init(struct hda_codec
*codec
)
5004 struct alc_spec
*spec
= codec
->spec
;
5005 alc880_auto_init_multi_out(codec
);
5006 alc880_auto_init_extra_out(codec
);
5007 alc880_auto_init_analog_input(codec
);
5008 alc880_auto_init_input_src(codec
);
5009 if (spec
->unsol_event
)
5010 alc_inithook(codec
);
5013 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5014 * one of two digital mic pins, e.g. on ALC272
5016 static void fixup_automic_adc(struct hda_codec
*codec
)
5018 struct alc_spec
*spec
= codec
->spec
;
5021 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5022 hda_nid_t cap
= spec
->capsrc_nids
?
5023 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5026 iidx
= get_connection_index(codec
, cap
, spec
->int_mic
.pin
);
5029 eidx
= get_connection_index(codec
, cap
, spec
->ext_mic
.pin
);
5032 spec
->int_mic
.mux_idx
= iidx
;
5033 spec
->ext_mic
.mux_idx
= eidx
;
5034 if (spec
->capsrc_nids
)
5035 spec
->capsrc_nids
+= i
;
5036 spec
->adc_nids
+= i
;
5037 spec
->num_adc_nids
= 1;
5040 snd_printd(KERN_INFO
"hda_codec: %s: "
5041 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5042 codec
->chip_name
, spec
->int_mic
.pin
, spec
->ext_mic
.pin
);
5043 spec
->auto_mic
= 0; /* disable auto-mic to be sure */
5046 /* choose the ADC/MUX containing the input pin and initialize the setup */
5047 static void fixup_single_adc(struct hda_codec
*codec
)
5049 struct alc_spec
*spec
= codec
->spec
;
5053 /* search for the input pin; there must be only one */
5054 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5055 if (spec
->autocfg
.input_pins
[i
]) {
5056 pin
= spec
->autocfg
.input_pins
[i
];
5063 /* set the default connection to that pin */
5064 for (i
= 0; i
< spec
->num_adc_nids
; i
++) {
5065 hda_nid_t cap
= spec
->capsrc_nids
?
5066 spec
->capsrc_nids
[i
] : spec
->adc_nids
[i
];
5069 idx
= get_connection_index(codec
, cap
, pin
);
5072 /* use only this ADC */
5073 if (spec
->capsrc_nids
)
5074 spec
->capsrc_nids
+= i
;
5075 spec
->adc_nids
+= i
;
5076 spec
->num_adc_nids
= 1;
5077 /* select or unmute this route */
5078 if (get_wcaps_type(get_wcaps(codec
, cap
)) == AC_WID_AUD_MIX
) {
5079 snd_hda_codec_amp_stereo(codec
, cap
, HDA_INPUT
, idx
,
5082 snd_hda_codec_write_cache(codec
, cap
, 0,
5083 AC_VERB_SET_CONNECT_SEL
, idx
);
5089 static void set_capture_mixer(struct hda_codec
*codec
)
5091 struct alc_spec
*spec
= codec
->spec
;
5092 static struct snd_kcontrol_new
*caps
[2][3] = {
5093 { alc_capture_mixer_nosrc1
,
5094 alc_capture_mixer_nosrc2
,
5095 alc_capture_mixer_nosrc3
},
5096 { alc_capture_mixer1
,
5098 alc_capture_mixer3
},
5100 if (spec
->num_adc_nids
> 0 && spec
->num_adc_nids
<= 3) {
5103 fixup_automic_adc(codec
);
5104 else if (spec
->input_mux
) {
5105 if (spec
->input_mux
->num_items
> 1)
5107 else if (spec
->input_mux
->num_items
== 1)
5108 fixup_single_adc(codec
);
5110 spec
->cap_mixer
= caps
[mux
][spec
->num_adc_nids
- 1];
5114 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5115 static void fillup_priv_adc_nids(struct hda_codec
*codec
, hda_nid_t
*nids
,
5118 struct alc_spec
*spec
= codec
->spec
;
5120 hda_nid_t fallback_adc
= 0, fallback_cap
= 0;
5122 for (n
= 0; n
< num_nids
; n
++) {
5124 hda_nid_t conn
[HDA_MAX_NUM_INPUTS
];
5128 if (get_wcaps_type(get_wcaps(codec
, adc
)) != AC_WID_AUD_IN
)
5131 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5135 nconns
= snd_hda_get_connections(codec
, cap
, conn
,
5140 if (!fallback_adc
) {
5144 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5145 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5148 for (j
= 0; j
< nconns
; j
++) {
5155 if (i
>= AUTO_PIN_LAST
) {
5156 int num_adcs
= spec
->num_adc_nids
;
5157 spec
->private_adc_nids
[num_adcs
] = adc
;
5158 spec
->private_capsrc_nids
[num_adcs
] = cap
;
5159 spec
->num_adc_nids
++;
5160 spec
->adc_nids
= spec
->private_adc_nids
;
5162 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
5165 if (!spec
->num_adc_nids
) {
5166 printk(KERN_WARNING
"hda_codec: %s: no valid ADC found;"
5167 " using fallback 0x%x\n",
5168 codec
->chip_name
, fallback_adc
);
5169 spec
->private_adc_nids
[0] = fallback_adc
;
5170 spec
->adc_nids
= spec
->private_adc_nids
;
5171 if (fallback_adc
!= fallback_cap
) {
5172 spec
->private_capsrc_nids
[0] = fallback_cap
;
5173 spec
->capsrc_nids
= spec
->private_adc_nids
;
5178 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5179 #define set_beep_amp(spec, nid, idx, dir) \
5180 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5182 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5186 * OK, here we have finally the patch for ALC880
5189 static int patch_alc880(struct hda_codec
*codec
)
5191 struct alc_spec
*spec
;
5195 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5201 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
5204 if (board_config
< 0) {
5205 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
5207 board_config
= ALC880_AUTO
;
5210 if (board_config
== ALC880_AUTO
) {
5211 /* automatic parse from the BIOS config */
5212 err
= alc880_parse_auto_config(codec
);
5218 "hda_codec: Cannot set up configuration "
5219 "from BIOS. Using 3-stack mode...\n");
5220 board_config
= ALC880_3ST
;
5224 err
= snd_hda_attach_beep_device(codec
, 0x1);
5230 if (board_config
!= ALC880_AUTO
)
5231 setup_preset(codec
, &alc880_presets
[board_config
]);
5233 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
5234 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
5235 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
5237 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
5238 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
5240 if (!spec
->adc_nids
&& spec
->input_mux
) {
5241 /* check whether NID 0x07 is valid */
5242 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
5244 wcap
= get_wcaps_type(wcap
);
5245 if (wcap
!= AC_WID_AUD_IN
) {
5246 spec
->adc_nids
= alc880_adc_nids_alt
;
5247 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
5249 spec
->adc_nids
= alc880_adc_nids
;
5250 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
5253 set_capture_mixer(codec
);
5254 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
5256 spec
->vmaster_nid
= 0x0c;
5258 codec
->patch_ops
= alc_patch_ops
;
5259 if (board_config
== ALC880_AUTO
)
5260 spec
->init_hook
= alc880_auto_init
;
5261 #ifdef CONFIG_SND_HDA_POWER_SAVE
5262 if (!spec
->loopback
.amplist
)
5263 spec
->loopback
.amplist
= alc880_loopbacks
;
5274 static hda_nid_t alc260_dac_nids
[1] = {
5279 static hda_nid_t alc260_adc_nids
[1] = {
5284 static hda_nid_t alc260_adc_nids_alt
[1] = {
5289 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5290 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5292 static hda_nid_t alc260_dual_adc_nids
[2] = {
5297 #define ALC260_DIGOUT_NID 0x03
5298 #define ALC260_DIGIN_NID 0x06
5300 static struct hda_input_mux alc260_capture_source
= {
5304 { "Front Mic", 0x1 },
5310 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5311 * headphone jack and the internal CD lines since these are the only pins at
5312 * which audio can appear. For flexibility, also allow the option of
5313 * recording the mixer output on the second ADC (ADC0 doesn't have a
5314 * connection to the mixer output).
5316 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
5320 { "Mic/Line", 0x0 },
5322 { "Headphone", 0x2 },
5328 { "Mic/Line", 0x0 },
5330 { "Headphone", 0x2 },
5337 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5338 * the Fujitsu S702x, but jacks are marked differently.
5340 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
5347 { "Headphone", 0x5 },
5356 { "Headphone", 0x6 },
5362 /* Maxdata Favorit 100XS */
5363 static struct hda_input_mux alc260_favorit100_capture_sources
[2] = {
5367 { "Line/Mic", 0x0 },
5374 { "Line/Mic", 0x0 },
5382 * This is just place-holder, so there's something for alc_build_pcms to look
5383 * at when it calculates the maximum number of channels. ALC260 has no mixer
5384 * element which allows changing the channel mode, so the verb list is
5387 static struct hda_channel_mode alc260_modes
[1] = {
5392 /* Mixer combinations
5394 * basic: base_output + input + pc_beep + capture
5395 * HP: base_output + input + capture_alt
5396 * HP_3013: hp_3013 + input + capture
5397 * fujitsu: fujitsu + capture
5398 * acer: acer + capture
5401 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
5402 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5403 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
5404 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5405 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
5406 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
5407 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
5411 static struct snd_kcontrol_new alc260_input_mixer
[] = {
5412 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5413 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5414 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5415 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5416 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5417 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5418 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
5419 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
5423 /* update HP, line and mono out pins according to the master switch */
5424 static void alc260_hp_master_update(struct hda_codec
*codec
,
5425 hda_nid_t hp
, hda_nid_t line
,
5428 struct alc_spec
*spec
= codec
->spec
;
5429 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
5430 /* change HP and line-out pins */
5431 snd_hda_codec_write(codec
, hp
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5433 snd_hda_codec_write(codec
, line
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5435 /* mono (speaker) depending on the HP jack sense */
5436 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
5437 snd_hda_codec_write(codec
, mono
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5441 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
5442 struct snd_ctl_elem_value
*ucontrol
)
5444 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5445 struct alc_spec
*spec
= codec
->spec
;
5446 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
5450 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
5451 struct snd_ctl_elem_value
*ucontrol
)
5453 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5454 struct alc_spec
*spec
= codec
->spec
;
5455 int val
= !!*ucontrol
->value
.integer
.value
;
5456 hda_nid_t hp
, line
, mono
;
5458 if (val
== spec
->master_sw
)
5460 spec
->master_sw
= val
;
5461 hp
= (kcontrol
->private_value
>> 16) & 0xff;
5462 line
= (kcontrol
->private_value
>> 8) & 0xff;
5463 mono
= kcontrol
->private_value
& 0xff;
5464 alc260_hp_master_update(codec
, hp
, line
, mono
);
5468 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
5470 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5471 .name
= "Master Playback Switch",
5472 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
5473 .info
= snd_ctl_boolean_mono_info
,
5474 .get
= alc260_hp_master_sw_get
,
5475 .put
= alc260_hp_master_sw_put
,
5476 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
5478 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5479 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
5480 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5481 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
5482 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5484 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
5488 static struct hda_verb alc260_hp_unsol_verbs
[] = {
5489 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5493 static void alc260_hp_automute(struct hda_codec
*codec
)
5495 struct alc_spec
*spec
= codec
->spec
;
5497 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x10);
5498 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
5501 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5503 if ((res
>> 26) == ALC880_HP_EVENT
)
5504 alc260_hp_automute(codec
);
5507 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
5509 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5510 .name
= "Master Playback Switch",
5511 .subdevice
= HDA_SUBDEV_NID_FLAG
| 0x11,
5512 .info
= snd_ctl_boolean_mono_info
,
5513 .get
= alc260_hp_master_sw_get
,
5514 .put
= alc260_hp_master_sw_put
,
5515 .private_value
= (0x15 << 16) | (0x10 << 8) | 0x11
5517 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5518 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
5519 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
5520 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
5521 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5523 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
5524 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
5528 static struct hda_bind_ctls alc260_dc7600_bind_master_vol
= {
5529 .ops
= &snd_hda_bind_vol
,
5531 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT
),
5532 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
5533 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT
),
5538 static struct hda_bind_ctls alc260_dc7600_bind_switch
= {
5539 .ops
= &snd_hda_bind_sw
,
5541 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT
),
5542 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
5547 static struct snd_kcontrol_new alc260_hp_dc7600_mixer
[] = {
5548 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol
),
5549 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch
),
5550 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT
),
5551 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
5555 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
5556 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5560 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
5562 struct alc_spec
*spec
= codec
->spec
;
5564 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
5565 alc260_hp_master_update(codec
, 0x15, 0x10, 0x11);
5568 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
5571 if ((res
>> 26) == ALC880_HP_EVENT
)
5572 alc260_hp_3013_automute(codec
);
5575 static void alc260_hp_3012_automute(struct hda_codec
*codec
)
5577 unsigned int bits
= snd_hda_jack_detect(codec
, 0x10) ? 0 : PIN_OUT
;
5579 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5581 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5583 snd_hda_codec_write(codec
, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5587 static void alc260_hp_3012_unsol_event(struct hda_codec
*codec
,
5590 if ((res
>> 26) == ALC880_HP_EVENT
)
5591 alc260_hp_3012_automute(codec
);
5594 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5595 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5597 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
5598 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5599 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
5600 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
5601 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5602 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5603 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
5604 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
5605 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5606 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5607 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
5611 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5612 * versions of the ALC260 don't act on requests to enable mic bias from NID
5613 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5614 * datasheet doesn't mention this restriction. At this stage it's not clear
5615 * whether this behaviour is intentional or is a hardware bug in chip
5616 * revisions available in early 2006. Therefore for now allow the
5617 * "Headphone Jack Mode" control to span all choices, but if it turns out
5618 * that the lack of mic bias for this NID is intentional we could change the
5619 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5621 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5622 * don't appear to make the mic bias available from the "line" jack, even
5623 * though the NID used for this jack (0x14) can supply it. The theory is
5624 * that perhaps Acer have included blocking capacitors between the ALC260
5625 * and the output jack. If this turns out to be the case for all such
5626 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5627 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5629 * The C20x Tablet series have a mono internal speaker which is controlled
5630 * via the chip's Mono sum widget and pin complex, so include the necessary
5631 * controls for such models. On models without a "mono speaker" the control
5632 * won't do anything.
5634 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
5635 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5636 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
5637 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
5638 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5640 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5642 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5643 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5644 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5645 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5646 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5647 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5648 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5649 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
5653 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5655 static struct snd_kcontrol_new alc260_favorit100_mixer
[] = {
5656 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5657 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
5658 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
5659 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5660 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5661 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5665 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5666 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5668 static struct snd_kcontrol_new alc260_will_mixer
[] = {
5669 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5670 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
5671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5672 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5673 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5674 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5675 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5676 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
5677 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5678 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5682 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5683 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5685 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
5686 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5687 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
5688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5689 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5690 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5691 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
5692 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
5693 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5694 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5695 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
5700 * initialization verbs
5702 static struct hda_verb alc260_init_verbs
[] = {
5703 /* Line In pin widget for input */
5704 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5705 /* CD pin widget for input */
5706 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5707 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5708 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5709 /* Mic2 (front panel) pin widget for input and vref at 80% */
5710 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5711 /* LINE-2 is used for line-out in rear */
5712 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5713 /* select line-out */
5714 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
5716 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5718 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5720 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5721 /* mute capture amp left and right */
5722 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5723 /* set connection select to line in (default select for this ADC) */
5724 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
5725 /* mute capture amp left and right */
5726 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5727 /* set connection select to line in (default select for this ADC) */
5728 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
5729 /* set vol=0 Line-Out mixer amp left and right */
5730 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5731 /* unmute pin widget amp left and right (no gain on this amp) */
5732 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5733 /* set vol=0 HP mixer amp left and right */
5734 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5735 /* unmute pin widget amp left and right (no gain on this amp) */
5736 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5737 /* set vol=0 Mono mixer amp left and right */
5738 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5739 /* unmute pin widget amp left and right (no gain on this amp) */
5740 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5741 /* unmute LINE-2 out pin */
5742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5743 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5746 /* mute analog inputs */
5747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5750 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5752 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5753 /* mute Front out path */
5754 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5755 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5756 /* mute Headphone out path */
5757 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5759 /* mute Mono out path */
5760 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5761 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5765 #if 0 /* should be identical with alc260_init_verbs? */
5766 static struct hda_verb alc260_hp_init_verbs
[] = {
5767 /* Headphone and output */
5768 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5770 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5771 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5772 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5773 /* Mic2 (front panel) pin widget for input and vref at 80% */
5774 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5775 /* Line In pin widget for input */
5776 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5777 /* Line-2 pin widget for output */
5778 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5779 /* CD pin widget for input */
5780 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5781 /* unmute amp left and right */
5782 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
5783 /* set connection select to line in (default select for this ADC) */
5784 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
5785 /* unmute Line-Out mixer amp left and right (volume = 0) */
5786 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5787 /* mute pin widget amp left and right (no gain on this amp) */
5788 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5789 /* unmute HP mixer amp left and right (volume = 0) */
5790 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5791 /* mute pin widget amp left and right (no gain on this amp) */
5792 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5793 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5796 /* mute analog inputs */
5797 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5798 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5800 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5801 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5802 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5803 /* Unmute Front out path */
5804 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5805 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5806 /* Unmute Headphone out path */
5807 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5808 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5809 /* Unmute Mono out path */
5810 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5811 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5816 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
5817 /* Line out and output */
5818 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5820 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5821 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5822 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5823 /* Mic2 (front panel) pin widget for input and vref at 80% */
5824 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5825 /* Line In pin widget for input */
5826 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5827 /* Headphone pin widget for output */
5828 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5829 /* CD pin widget for input */
5830 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5831 /* unmute amp left and right */
5832 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
5833 /* set connection select to line in (default select for this ADC) */
5834 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
5835 /* unmute Line-Out mixer amp left and right (volume = 0) */
5836 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5837 /* mute pin widget amp left and right (no gain on this amp) */
5838 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5839 /* unmute HP mixer amp left and right (volume = 0) */
5840 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5841 /* mute pin widget amp left and right (no gain on this amp) */
5842 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5843 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5846 /* mute analog inputs */
5847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5850 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5852 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5853 /* Unmute Front out path */
5854 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5856 /* Unmute Headphone out path */
5857 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5858 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5859 /* Unmute Mono out path */
5860 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5861 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5865 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5866 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5867 * audio = 0x16, internal speaker = 0x10.
5869 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
5870 /* Disable all GPIOs */
5871 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
5872 /* Internal speaker is connected to headphone pin */
5873 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5874 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5876 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5877 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5878 /* Ensure all other unused pins are disabled and muted. */
5879 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5880 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5881 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5882 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5883 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5884 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5885 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5886 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5888 /* Disable digital (SPDIF) pins */
5889 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5890 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5892 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5893 * when acting as an output.
5895 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5897 /* Start with output sum widgets muted and their output gains at min */
5898 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5899 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5900 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5901 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5902 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5903 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5904 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5905 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5906 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5908 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5909 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5910 /* Unmute Line1 pin widget output buffer since it starts as an output.
5911 * If the pin mode is changed by the user the pin mode control will
5912 * take care of enabling the pin's input/output buffers as needed.
5913 * Therefore there's no need to enable the input buffer at this
5916 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5917 /* Unmute input buffer of pin widget used for Line-in (no equiv
5920 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5922 /* Mute capture amp left and right */
5923 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5924 /* Set ADC connection select to match default mixer setting - line
5927 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5929 /* Do the same for the second ADC: mute capture input amp and
5930 * set ADC connection to line in (on mic1 pin)
5932 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5933 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5935 /* Mute all inputs to mixer widget (even unconnected ones) */
5936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5937 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5948 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5949 * similar laptops (adapted from Fujitsu init verbs).
5951 static struct hda_verb alc260_acer_init_verbs
[] = {
5952 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5953 * the headphone jack. Turn this on and rely on the standard mute
5954 * methods whenever the user wants to turn these outputs off.
5956 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
5957 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
5958 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
5959 /* Internal speaker/Headphone jack is connected to Line-out pin */
5960 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5961 /* Internal microphone/Mic jack is connected to Mic1 pin */
5962 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
5963 /* Line In jack is connected to Line1 pin */
5964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5965 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5966 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5967 /* Ensure all other unused pins are disabled and muted. */
5968 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5969 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5970 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5971 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5972 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5973 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5974 /* Disable digital (SPDIF) pins */
5975 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5976 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5978 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5979 * bus when acting as outputs.
5981 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
5982 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5984 /* Start with output sum widgets muted and their output gains at min */
5985 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5986 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5987 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5988 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5989 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5990 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5991 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5992 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5993 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5995 /* Unmute Line-out pin widget amp left and right
5996 * (no equiv mixer ctrl)
5998 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5999 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6000 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6001 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6002 * inputs. If the pin mode is changed by the user the pin mode control
6003 * will take care of enabling the pin's input/output buffers as needed.
6004 * Therefore there's no need to enable the input buffer at this
6007 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6008 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6010 /* Mute capture amp left and right */
6011 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6012 /* Set ADC connection select to match default mixer setting - mic
6015 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6017 /* Do similar with the second ADC: mute capture input amp and
6018 * set ADC connection to mic to match ALSA's default state.
6020 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6021 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6023 /* Mute all inputs to mixer widget (even unconnected ones) */
6024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6036 /* Initialisation sequence for Maxdata Favorit 100XS
6037 * (adapted from Acer init verbs).
6039 static struct hda_verb alc260_favorit100_init_verbs
[] = {
6040 /* GPIO 0 enables the output jack.
6041 * Turn this on and rely on the standard mute
6042 * methods whenever the user wants to turn these outputs off.
6044 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6045 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6046 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
6047 /* Line/Mic input jack is connected to Mic1 pin */
6048 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
6049 /* Ensure all other unused pins are disabled and muted. */
6050 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6051 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6052 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6053 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6054 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6055 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6056 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6057 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6058 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
6059 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6060 /* Disable digital (SPDIF) pins */
6061 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6062 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6064 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6065 * bus when acting as outputs.
6067 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6068 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6070 /* Start with output sum widgets muted and their output gains at min */
6071 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6072 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6073 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6074 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6075 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6076 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6077 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6078 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6079 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6081 /* Unmute Line-out pin widget amp left and right
6082 * (no equiv mixer ctrl)
6084 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6085 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6086 * inputs. If the pin mode is changed by the user the pin mode control
6087 * will take care of enabling the pin's input/output buffers as needed.
6088 * Therefore there's no need to enable the input buffer at this
6091 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6093 /* Mute capture amp left and right */
6094 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6095 /* Set ADC connection select to match default mixer setting - mic
6098 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6100 /* Do similar with the second ADC: mute capture input amp and
6101 * set ADC connection to mic to match ALSA's default state.
6103 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6104 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6106 /* Mute all inputs to mixer widget (even unconnected ones) */
6107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6119 static struct hda_verb alc260_will_verbs
[] = {
6120 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6121 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6122 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
6123 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6124 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6125 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
6129 static struct hda_verb alc260_replacer_672v_verbs
[] = {
6130 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
6131 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
6132 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
6134 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
6135 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
6136 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
6138 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6142 /* toggle speaker-output according to the hp-jack state */
6143 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
6145 unsigned int present
;
6147 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6148 present
= snd_hda_jack_detect(codec
, 0x0f);
6150 snd_hda_codec_write_cache(codec
, 0x01, 0,
6151 AC_VERB_SET_GPIO_DATA
, 1);
6152 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6153 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6156 snd_hda_codec_write_cache(codec
, 0x01, 0,
6157 AC_VERB_SET_GPIO_DATA
, 0);
6158 snd_hda_codec_write_cache(codec
, 0x0f, 0,
6159 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6164 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
6167 if ((res
>> 26) == ALC880_HP_EVENT
)
6168 alc260_replacer_672v_automute(codec
);
6171 static struct hda_verb alc260_hp_dc7600_verbs
[] = {
6172 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x01},
6173 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6174 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6175 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6176 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6177 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6178 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6179 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6180 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6181 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6185 /* Test configuration for debugging, modelled after the ALC880 test
6188 #ifdef CONFIG_SND_DEBUG
6189 static hda_nid_t alc260_test_dac_nids
[1] = {
6192 static hda_nid_t alc260_test_adc_nids
[2] = {
6195 /* For testing the ALC260, each input MUX needs its own definition since
6196 * the signal assignments are different. This assumes that the first ADC
6199 static struct hda_input_mux alc260_test_capture_sources
[2] = {
6203 { "MIC1 pin", 0x0 },
6204 { "MIC2 pin", 0x1 },
6205 { "LINE1 pin", 0x2 },
6206 { "LINE2 pin", 0x3 },
6208 { "LINE-OUT pin", 0x5 },
6209 { "HP-OUT pin", 0x6 },
6215 { "MIC1 pin", 0x0 },
6216 { "MIC2 pin", 0x1 },
6217 { "LINE1 pin", 0x2 },
6218 { "LINE2 pin", 0x3 },
6221 { "LINE-OUT pin", 0x6 },
6222 { "HP-OUT pin", 0x7 },
6226 static struct snd_kcontrol_new alc260_test_mixer
[] = {
6227 /* Output driver widgets */
6228 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
6229 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
6230 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
6231 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
6232 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
6233 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
6235 /* Modes for retasking pin widgets
6236 * Note: the ALC260 doesn't seem to act on requests to enable mic
6237 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6238 * mention this restriction. At this stage it's not clear whether
6239 * this behaviour is intentional or is a hardware bug in chip
6240 * revisions available at least up until early 2006. Therefore for
6241 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6242 * choices, but if it turns out that the lack of mic bias for these
6243 * NIDs is intentional we could change their modes from
6244 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6246 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
6247 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
6248 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
6249 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
6250 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
6251 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
6253 /* Loopback mixer controls */
6254 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
6255 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
6256 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
6257 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
6258 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
6259 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
6260 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
6261 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
6262 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
6263 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
6264 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
6265 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
6266 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
6267 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
6269 /* Controls for GPIO pins, assuming they are configured as outputs */
6270 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6271 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6272 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6273 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6275 /* Switches to allow the digital IO pins to be enabled. The datasheet
6276 * is ambigious as to which NID is which; testing on laptops which
6277 * make this output available should provide clarification.
6279 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6280 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6282 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6283 * this output to turn on an external amplifier.
6285 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6286 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6290 static struct hda_verb alc260_test_init_verbs
[] = {
6291 /* Enable all GPIOs as outputs with an initial value of 0 */
6292 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
6293 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
6294 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
6296 /* Enable retasking pins as output, initially without power amp */
6297 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6298 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6300 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6301 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6302 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6304 /* Disable digital (SPDIF) pins initially, but users can enable
6305 * them via a mixer switch. In the case of SPDIF-out, this initverb
6306 * payload also sets the generation to 0, output to be in "consumer"
6307 * PCM format, copyright asserted, no pre-emphasis and no validity
6310 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6311 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
6313 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6314 * OUT1 sum bus when acting as an output.
6316 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
6317 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
6318 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
6319 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
6321 /* Start with output sum widgets muted and their output gains at min */
6322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6323 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6324 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6325 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6326 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6327 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6328 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6329 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6330 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6332 /* Unmute retasking pin widget output buffers since the default
6333 * state appears to be output. As the pin mode is changed by the
6334 * user the pin mode control will take care of enabling the pin's
6335 * input/output buffers as needed.
6337 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6338 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6339 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6340 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6341 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6342 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6343 /* Also unmute the mono-out pin widget */
6344 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6346 /* Mute capture amp left and right */
6347 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6348 /* Set ADC connection select to match default mixer setting (mic1
6351 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6353 /* Do the same for the second ADC: mute capture input amp and
6354 * set ADC connection to mic1 pin
6356 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6357 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6359 /* Mute all inputs to mixer widget (even unconnected ones) */
6360 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
6361 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
6362 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
6363 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
6364 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
6365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6366 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
6367 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
6373 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6374 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6376 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6377 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6380 * for BIOS auto-configuration
6383 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
6384 const char *pfx
, int *vol_bits
)
6387 unsigned long vol_val
, sw_val
;
6390 if (nid
>= 0x0f && nid
< 0x11) {
6391 nid_vol
= nid
- 0x7;
6392 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
6393 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
6394 } else if (nid
== 0x11) {
6395 nid_vol
= nid
- 0x7;
6396 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
6397 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
6398 } else if (nid
>= 0x12 && nid
<= 0x15) {
6400 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
6401 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
6405 if (!(*vol_bits
& (1 << nid_vol
))) {
6406 /* first control for the volume widget */
6407 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, vol_val
);
6410 *vol_bits
|= (1 << nid_vol
);
6412 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, sw_val
);
6418 /* add playback controls from the parsed DAC table */
6419 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
6420 const struct auto_pin_cfg
*cfg
)
6426 spec
->multiout
.num_dacs
= 1;
6427 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
6428 spec
->multiout
.dac_nids
[0] = 0x02;
6430 nid
= cfg
->line_out_pins
[0];
6433 if (!cfg
->speaker_pins
[0] && !cfg
->hp_pins
[0])
6435 else if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
6439 err
= alc260_add_playback_controls(spec
, nid
, pfx
, &vols
);
6444 nid
= cfg
->speaker_pins
[0];
6446 err
= alc260_add_playback_controls(spec
, nid
, "Speaker", &vols
);
6451 nid
= cfg
->hp_pins
[0];
6453 err
= alc260_add_playback_controls(spec
, nid
, "Headphone",
6461 /* create playback/capture controls for input pins */
6462 static int alc260_auto_create_input_ctls(struct hda_codec
*codec
,
6463 const struct auto_pin_cfg
*cfg
)
6465 return alc_auto_create_input_ctls(codec
, cfg
, 0x07, 0x04, 0x05);
6468 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
6469 hda_nid_t nid
, int pin_type
,
6472 alc_set_pin_output(codec
, nid
, pin_type
);
6473 /* need the manual connection? */
6475 int idx
= nid
- 0x12;
6476 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
6477 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
6481 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
6483 struct alc_spec
*spec
= codec
->spec
;
6486 nid
= spec
->autocfg
.line_out_pins
[0];
6488 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
6489 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
6492 nid
= spec
->autocfg
.speaker_pins
[0];
6494 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
6496 nid
= spec
->autocfg
.hp_pins
[0];
6498 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
6501 #define ALC260_PIN_CD_NID 0x16
6502 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
6504 struct alc_spec
*spec
= codec
->spec
;
6507 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
6508 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
6510 alc_set_input_pin(codec
, nid
, i
);
6511 if (nid
!= ALC260_PIN_CD_NID
&&
6512 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
6513 snd_hda_codec_write(codec
, nid
, 0,
6514 AC_VERB_SET_AMP_GAIN_MUTE
,
6520 #define alc260_auto_init_input_src alc880_auto_init_input_src
6523 * generic initialization of ADC, input mixers and output mixers
6525 static struct hda_verb alc260_volume_init_verbs
[] = {
6527 * Unmute ADC0-1 and set the default input to mic-in
6529 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
6530 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6531 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
6532 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6534 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6536 * Note: PASD motherboards uses the Line In 2 as the input for
6537 * front panel mic (mic 2)
6539 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6540 /* mute analog inputs */
6541 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6542 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6548 * Set up output mixers (0x08 - 0x0a)
6550 /* set vol=0 to output mixers */
6551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6552 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6553 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6554 /* set up input amps for analog loopback */
6555 /* Amp Indices: DAC = 0, mixer = 1 */
6556 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6557 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6558 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6559 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6560 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6561 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6566 static int alc260_parse_auto_config(struct hda_codec
*codec
)
6568 struct alc_spec
*spec
= codec
->spec
;
6570 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
6572 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
6576 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
6579 if (!spec
->kctls
.list
)
6580 return 0; /* can't find valid BIOS pin config */
6581 err
= alc260_auto_create_input_ctls(codec
, &spec
->autocfg
);
6585 spec
->multiout
.max_channels
= 2;
6587 if (spec
->autocfg
.dig_outs
)
6588 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
6589 if (spec
->kctls
.list
)
6590 add_mixer(spec
, spec
->kctls
.list
);
6592 add_verb(spec
, alc260_volume_init_verbs
);
6594 spec
->num_mux_defs
= 1;
6595 spec
->input_mux
= &spec
->private_imux
[0];
6597 alc_ssid_check(codec
, 0x10, 0x15, 0x0f, 0);
6602 /* additional initialization for auto-configuration model */
6603 static void alc260_auto_init(struct hda_codec
*codec
)
6605 struct alc_spec
*spec
= codec
->spec
;
6606 alc260_auto_init_multi_out(codec
);
6607 alc260_auto_init_analog_input(codec
);
6608 alc260_auto_init_input_src(codec
);
6609 if (spec
->unsol_event
)
6610 alc_inithook(codec
);
6613 #ifdef CONFIG_SND_HDA_POWER_SAVE
6614 static struct hda_amp_list alc260_loopbacks
[] = {
6615 { 0x07, HDA_INPUT
, 0 },
6616 { 0x07, HDA_INPUT
, 1 },
6617 { 0x07, HDA_INPUT
, 2 },
6618 { 0x07, HDA_INPUT
, 3 },
6619 { 0x07, HDA_INPUT
, 4 },
6625 * ALC260 configurations
6627 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
6628 [ALC260_BASIC
] = "basic",
6630 [ALC260_HP_3013
] = "hp-3013",
6631 [ALC260_HP_DC7600
] = "hp-dc7600",
6632 [ALC260_FUJITSU_S702X
] = "fujitsu",
6633 [ALC260_ACER
] = "acer",
6634 [ALC260_WILL
] = "will",
6635 [ALC260_REPLACER_672V
] = "replacer",
6636 [ALC260_FAVORIT100
] = "favorit100",
6637 #ifdef CONFIG_SND_DEBUG
6638 [ALC260_TEST
] = "test",
6640 [ALC260_AUTO
] = "auto",
6643 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
6644 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
6645 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL
),
6646 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
6647 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100
),
6648 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
6649 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO
), /* no quirk */
6650 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
6651 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
6652 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600
),
6653 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
6654 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
6655 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
6656 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
6657 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
6658 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
6659 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
6660 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
6661 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
6662 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
6663 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
6667 static struct alc_config_preset alc260_presets
[] = {
6669 .mixers
= { alc260_base_output_mixer
,
6670 alc260_input_mixer
},
6671 .init_verbs
= { alc260_init_verbs
},
6672 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6673 .dac_nids
= alc260_dac_nids
,
6674 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6675 .adc_nids
= alc260_dual_adc_nids
,
6676 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6677 .channel_mode
= alc260_modes
,
6678 .input_mux
= &alc260_capture_source
,
6681 .mixers
= { alc260_hp_output_mixer
,
6682 alc260_input_mixer
},
6683 .init_verbs
= { alc260_init_verbs
,
6684 alc260_hp_unsol_verbs
},
6685 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6686 .dac_nids
= alc260_dac_nids
,
6687 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
6688 .adc_nids
= alc260_adc_nids_alt
,
6689 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6690 .channel_mode
= alc260_modes
,
6691 .input_mux
= &alc260_capture_source
,
6692 .unsol_event
= alc260_hp_unsol_event
,
6693 .init_hook
= alc260_hp_automute
,
6695 [ALC260_HP_DC7600
] = {
6696 .mixers
= { alc260_hp_dc7600_mixer
,
6697 alc260_input_mixer
},
6698 .init_verbs
= { alc260_init_verbs
,
6699 alc260_hp_dc7600_verbs
},
6700 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6701 .dac_nids
= alc260_dac_nids
,
6702 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
6703 .adc_nids
= alc260_adc_nids_alt
,
6704 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6705 .channel_mode
= alc260_modes
,
6706 .input_mux
= &alc260_capture_source
,
6707 .unsol_event
= alc260_hp_3012_unsol_event
,
6708 .init_hook
= alc260_hp_3012_automute
,
6710 [ALC260_HP_3013
] = {
6711 .mixers
= { alc260_hp_3013_mixer
,
6712 alc260_input_mixer
},
6713 .init_verbs
= { alc260_hp_3013_init_verbs
,
6714 alc260_hp_3013_unsol_verbs
},
6715 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6716 .dac_nids
= alc260_dac_nids
,
6717 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
6718 .adc_nids
= alc260_adc_nids_alt
,
6719 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6720 .channel_mode
= alc260_modes
,
6721 .input_mux
= &alc260_capture_source
,
6722 .unsol_event
= alc260_hp_3013_unsol_event
,
6723 .init_hook
= alc260_hp_3013_automute
,
6725 [ALC260_FUJITSU_S702X
] = {
6726 .mixers
= { alc260_fujitsu_mixer
},
6727 .init_verbs
= { alc260_fujitsu_init_verbs
},
6728 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6729 .dac_nids
= alc260_dac_nids
,
6730 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6731 .adc_nids
= alc260_dual_adc_nids
,
6732 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6733 .channel_mode
= alc260_modes
,
6734 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
6735 .input_mux
= alc260_fujitsu_capture_sources
,
6738 .mixers
= { alc260_acer_mixer
},
6739 .init_verbs
= { alc260_acer_init_verbs
},
6740 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6741 .dac_nids
= alc260_dac_nids
,
6742 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6743 .adc_nids
= alc260_dual_adc_nids
,
6744 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6745 .channel_mode
= alc260_modes
,
6746 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
6747 .input_mux
= alc260_acer_capture_sources
,
6749 [ALC260_FAVORIT100
] = {
6750 .mixers
= { alc260_favorit100_mixer
},
6751 .init_verbs
= { alc260_favorit100_init_verbs
},
6752 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6753 .dac_nids
= alc260_dac_nids
,
6754 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6755 .adc_nids
= alc260_dual_adc_nids
,
6756 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6757 .channel_mode
= alc260_modes
,
6758 .num_mux_defs
= ARRAY_SIZE(alc260_favorit100_capture_sources
),
6759 .input_mux
= alc260_favorit100_capture_sources
,
6762 .mixers
= { alc260_will_mixer
},
6763 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
6764 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6765 .dac_nids
= alc260_dac_nids
,
6766 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
6767 .adc_nids
= alc260_adc_nids
,
6768 .dig_out_nid
= ALC260_DIGOUT_NID
,
6769 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6770 .channel_mode
= alc260_modes
,
6771 .input_mux
= &alc260_capture_source
,
6773 [ALC260_REPLACER_672V
] = {
6774 .mixers
= { alc260_replacer_672v_mixer
},
6775 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
6776 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6777 .dac_nids
= alc260_dac_nids
,
6778 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
6779 .adc_nids
= alc260_adc_nids
,
6780 .dig_out_nid
= ALC260_DIGOUT_NID
,
6781 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6782 .channel_mode
= alc260_modes
,
6783 .input_mux
= &alc260_capture_source
,
6784 .unsol_event
= alc260_replacer_672v_unsol_event
,
6785 .init_hook
= alc260_replacer_672v_automute
,
6787 #ifdef CONFIG_SND_DEBUG
6789 .mixers
= { alc260_test_mixer
},
6790 .init_verbs
= { alc260_test_init_verbs
},
6791 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
6792 .dac_nids
= alc260_test_dac_nids
,
6793 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
6794 .adc_nids
= alc260_test_adc_nids
,
6795 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6796 .channel_mode
= alc260_modes
,
6797 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
6798 .input_mux
= alc260_test_capture_sources
,
6803 static int patch_alc260(struct hda_codec
*codec
)
6805 struct alc_spec
*spec
;
6806 int err
, board_config
;
6808 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6814 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
6817 if (board_config
< 0) {
6818 snd_printd(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
6820 board_config
= ALC260_AUTO
;
6823 if (board_config
== ALC260_AUTO
) {
6824 /* automatic parse from the BIOS config */
6825 err
= alc260_parse_auto_config(codec
);
6831 "hda_codec: Cannot set up configuration "
6832 "from BIOS. Using base mode...\n");
6833 board_config
= ALC260_BASIC
;
6837 err
= snd_hda_attach_beep_device(codec
, 0x1);
6843 if (board_config
!= ALC260_AUTO
)
6844 setup_preset(codec
, &alc260_presets
[board_config
]);
6846 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
6847 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
6849 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
6850 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
6852 if (!spec
->adc_nids
&& spec
->input_mux
) {
6853 /* check whether NID 0x04 is valid */
6854 unsigned int wcap
= get_wcaps(codec
, 0x04);
6855 wcap
= get_wcaps_type(wcap
);
6857 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
6858 spec
->adc_nids
= alc260_adc_nids_alt
;
6859 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
6861 spec
->adc_nids
= alc260_adc_nids
;
6862 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
6865 set_capture_mixer(codec
);
6866 set_beep_amp(spec
, 0x07, 0x05, HDA_INPUT
);
6868 spec
->vmaster_nid
= 0x08;
6870 codec
->patch_ops
= alc_patch_ops
;
6871 if (board_config
== ALC260_AUTO
)
6872 spec
->init_hook
= alc260_auto_init
;
6873 #ifdef CONFIG_SND_HDA_POWER_SAVE
6874 if (!spec
->loopback
.amplist
)
6875 spec
->loopback
.amplist
= alc260_loopbacks
;
6883 * ALC882/883/885/888/889 support
6885 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6886 * configuration. Each pin widget can choose any input DACs and a mixer.
6887 * Each ADC is connected from a mixer of all inputs. This makes possible
6888 * 6-channel independent captures.
6890 * In addition, an independent DAC for the multi-playback (not used in this
6893 #define ALC882_DIGOUT_NID 0x06
6894 #define ALC882_DIGIN_NID 0x0a
6895 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6896 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6897 #define ALC1200_DIGOUT_NID 0x10
6900 static struct hda_channel_mode alc882_ch_modes
[1] = {
6905 static hda_nid_t alc882_dac_nids
[4] = {
6906 /* front, rear, clfe, rear_surr */
6907 0x02, 0x03, 0x04, 0x05
6909 #define alc883_dac_nids alc882_dac_nids
6912 #define alc882_adc_nids alc880_adc_nids
6913 #define alc882_adc_nids_alt alc880_adc_nids_alt
6914 #define alc883_adc_nids alc882_adc_nids_alt
6915 static hda_nid_t alc883_adc_nids_alt
[1] = { 0x08 };
6916 static hda_nid_t alc883_adc_nids_rev
[2] = { 0x09, 0x08 };
6917 #define alc889_adc_nids alc880_adc_nids
6919 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
6920 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
6921 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6922 static hda_nid_t alc883_capsrc_nids_rev
[2] = { 0x22, 0x23 };
6923 #define alc889_capsrc_nids alc882_capsrc_nids
6926 /* FIXME: should be a matrix-type input source selection */
6928 static struct hda_input_mux alc882_capture_source
= {
6932 { "Front Mic", 0x1 },
6938 #define alc883_capture_source alc882_capture_source
6940 static struct hda_input_mux alc889_capture_source
= {
6943 { "Front Mic", 0x0 },
6949 static struct hda_input_mux mb5_capture_source
= {
6958 static struct hda_input_mux macmini3_capture_source
= {
6966 static struct hda_input_mux alc883_3stack_6ch_intel
= {
6970 { "Front Mic", 0x0 },
6976 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
6984 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
6994 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
7002 static struct hda_input_mux alc883_lenovo_sky_capture_source
= {
7006 { "Front Mic", 0x1 },
7011 static struct hda_input_mux alc883_asus_eee1601_capture_source
= {
7019 static struct hda_input_mux alc889A_mb31_capture_source
= {
7023 /* Front Mic (0x01) unused */
7025 /* Line 2 (0x03) unused */
7026 /* CD (0x04) unused? */
7030 static struct hda_input_mux alc889A_imac91_capture_source
= {
7034 { "Line", 0x2 }, /* Not sure! */
7041 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
7048 static struct hda_verb alc882_3ST_ch2_init
[] = {
7049 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7050 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7051 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7052 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7059 static struct hda_verb alc882_3ST_ch4_init
[] = {
7060 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7061 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7062 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7063 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7064 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7071 static struct hda_verb alc882_3ST_ch6_init
[] = {
7072 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7073 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7074 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7075 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7076 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7077 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7081 static struct hda_channel_mode alc882_3ST_6ch_modes
[3] = {
7082 { 2, alc882_3ST_ch2_init
},
7083 { 4, alc882_3ST_ch4_init
},
7084 { 6, alc882_3ST_ch6_init
},
7087 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7092 static struct hda_verb alc883_3ST_ch2_clevo_init
[] = {
7093 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7094 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7095 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7096 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7097 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7104 static struct hda_verb alc883_3ST_ch4_clevo_init
[] = {
7105 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7106 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7107 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7108 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7109 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7110 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7117 static struct hda_verb alc883_3ST_ch6_clevo_init
[] = {
7118 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7119 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7120 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7121 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7122 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7123 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7124 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7128 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes
[3] = {
7129 { 2, alc883_3ST_ch2_clevo_init
},
7130 { 4, alc883_3ST_ch4_clevo_init
},
7131 { 6, alc883_3ST_ch6_clevo_init
},
7138 static struct hda_verb alc882_sixstack_ch6_init
[] = {
7139 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7140 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7141 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7142 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7149 static struct hda_verb alc882_sixstack_ch8_init
[] = {
7150 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7151 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7152 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7153 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7157 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
7158 { 6, alc882_sixstack_ch6_init
},
7159 { 8, alc882_sixstack_ch8_init
},
7163 /* Macbook Air 2,1 */
7165 static struct hda_channel_mode alc885_mba21_ch_modes
[1] = {
7170 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7176 static struct hda_verb alc885_mbp_ch2_init
[] = {
7177 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7178 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7179 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7186 static struct hda_verb alc885_mbp_ch4_init
[] = {
7187 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7188 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7189 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7190 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7191 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7195 static struct hda_channel_mode alc885_mbp_4ch_modes
[2] = {
7196 { 2, alc885_mbp_ch2_init
},
7197 { 4, alc885_mbp_ch4_init
},
7202 * Speakers/Woofer/HP = Front
7205 static struct hda_verb alc885_mb5_ch2_init
[] = {
7206 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7207 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7213 * Speakers/HP = Front
7217 static struct hda_verb alc885_mb5_ch6_init
[] = {
7218 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7219 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7220 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7224 static struct hda_channel_mode alc885_mb5_6ch_modes
[2] = {
7225 { 2, alc885_mb5_ch2_init
},
7226 { 6, alc885_mb5_ch6_init
},
7229 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7234 static struct hda_verb alc883_4ST_ch2_init
[] = {
7235 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7236 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7237 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7238 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7239 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7240 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7247 static struct hda_verb alc883_4ST_ch4_init
[] = {
7248 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7249 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7250 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7251 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7252 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7253 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7254 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7261 static struct hda_verb alc883_4ST_ch6_init
[] = {
7262 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7263 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7264 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7265 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7266 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7267 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7268 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7269 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7276 static struct hda_verb alc883_4ST_ch8_init
[] = {
7277 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7278 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7279 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7280 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7281 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7282 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7283 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7284 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7285 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7289 static struct hda_channel_mode alc883_4ST_8ch_modes
[4] = {
7290 { 2, alc883_4ST_ch2_init
},
7291 { 4, alc883_4ST_ch4_init
},
7292 { 6, alc883_4ST_ch6_init
},
7293 { 8, alc883_4ST_ch8_init
},
7300 static struct hda_verb alc883_3ST_ch2_intel_init
[] = {
7301 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7302 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7303 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7304 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7311 static struct hda_verb alc883_3ST_ch4_intel_init
[] = {
7312 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7313 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7314 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7315 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7316 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7323 static struct hda_verb alc883_3ST_ch6_intel_init
[] = {
7324 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7325 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7326 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7327 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7328 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7329 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7333 static struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
7334 { 2, alc883_3ST_ch2_intel_init
},
7335 { 4, alc883_3ST_ch4_intel_init
},
7336 { 6, alc883_3ST_ch6_intel_init
},
7342 static struct hda_verb alc889_ch2_intel_init
[] = {
7343 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7344 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7345 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7346 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7347 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7348 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7355 static struct hda_verb alc889_ch6_intel_init
[] = {
7356 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7357 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7358 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7359 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7360 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7361 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7368 static struct hda_verb alc889_ch8_intel_init
[] = {
7369 { 0x14, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7370 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7371 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7372 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7373 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7374 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7375 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7379 static struct hda_channel_mode alc889_8ch_intel_modes
[3] = {
7380 { 2, alc889_ch2_intel_init
},
7381 { 6, alc889_ch6_intel_init
},
7382 { 8, alc889_ch8_intel_init
},
7388 static struct hda_verb alc883_sixstack_ch6_init
[] = {
7389 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7390 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7391 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7392 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7399 static struct hda_verb alc883_sixstack_ch8_init
[] = {
7400 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7401 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7402 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7403 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7407 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
7408 { 6, alc883_sixstack_ch6_init
},
7409 { 8, alc883_sixstack_ch8_init
},
7413 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7414 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7416 static struct snd_kcontrol_new alc882_base_mixer
[] = {
7417 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7418 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7419 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7420 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7421 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7422 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7423 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7424 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7425 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
7426 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
7427 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7428 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7429 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7430 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7431 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7433 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7435 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7436 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7437 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7441 /* Macbook Air 2,1 same control for HP and internal Speaker */
7443 static struct snd_kcontrol_new alc885_mba21_mixer
[] = {
7444 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7445 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT
),
7450 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
7451 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7452 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7453 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
7454 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT
),
7455 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
7456 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7457 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7458 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
7459 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
7460 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
7461 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
7465 static struct snd_kcontrol_new alc885_mb5_mixer
[] = {
7466 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7467 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7468 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
7469 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
7470 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
7471 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
7472 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
7473 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
7474 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
7475 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
7476 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7477 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7478 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT
),
7479 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT
),
7483 static struct snd_kcontrol_new alc885_macmini3_mixer
[] = {
7484 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7485 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7486 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
7487 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
7488 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
7489 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
7490 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
7491 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT
),
7492 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT
),
7493 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT
),
7494 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT
),
7498 static struct snd_kcontrol_new alc885_imac91_mixer
[] = {
7499 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
7500 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT
),
7505 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
7506 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7507 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7508 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7509 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7510 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7511 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7512 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7513 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7514 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7518 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
7519 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7520 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7521 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7522 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7523 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7524 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7525 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7526 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7527 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7528 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7529 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7530 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7531 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7535 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7536 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7538 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
7539 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7540 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7541 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7542 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
7543 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7544 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7545 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7546 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7547 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
7548 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
7549 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7550 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7551 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7555 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
7556 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7557 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7558 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7559 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7560 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7561 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7562 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7564 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7569 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
7571 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7572 .name
= "Channel Mode",
7573 .info
= alc_ch_mode_info
,
7574 .get
= alc_ch_mode_get
,
7575 .put
= alc_ch_mode_put
,
7580 static struct hda_verb alc882_base_init_verbs
[] = {
7581 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7589 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7591 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7592 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7594 /* Front Pin: output 0 (0x0c) */
7595 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7596 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7597 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7598 /* Rear Pin: output 1 (0x0d) */
7599 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7600 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7601 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7602 /* CLFE Pin: output 2 (0x0e) */
7603 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7604 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7605 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
7606 /* Side Pin: output 3 (0x0f) */
7607 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7608 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7609 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
7610 /* Mic (rear) pin: input vref at 80% */
7611 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7612 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7613 /* Front Mic pin: input vref at 80% */
7614 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7615 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7616 /* Line In pin: input */
7617 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7618 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7619 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7620 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7621 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7622 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7623 /* CD pin widget for input */
7624 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7626 /* FIXME: use matrix-type input source selection */
7627 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7629 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7631 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7632 /* ADC2: mute amp left and right */
7633 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7634 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7635 /* ADC3: mute amp left and right */
7636 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7637 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7642 static struct hda_verb alc882_adc1_init_verbs
[] = {
7643 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7648 /* ADC1: mute amp left and right */
7649 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7650 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
7654 static struct hda_verb alc882_eapd_verbs
[] = {
7655 /* change to EAPD mode */
7656 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7657 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
7661 static struct hda_verb alc889_eapd_verbs
[] = {
7662 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
7663 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
7667 static struct hda_verb alc_hp15_unsol_verbs
[] = {
7668 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
7669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7673 static struct hda_verb alc885_init_verbs
[] = {
7674 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7678 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7679 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7681 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7682 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7684 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7685 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7687 /* Front HP Pin: output 0 (0x0c) */
7688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7690 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7691 /* Front Pin: output 0 (0x0c) */
7692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7693 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7694 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7695 /* Rear Pin: output 1 (0x0d) */
7696 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7697 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7698 {0x19, AC_VERB_SET_CONNECT_SEL
, 0x01},
7699 /* CLFE Pin: output 2 (0x0e) */
7700 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7701 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7702 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
7703 /* Side Pin: output 3 (0x0f) */
7704 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7705 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7706 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
7707 /* Mic (rear) pin: input vref at 80% */
7708 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7709 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7710 /* Front Mic pin: input vref at 80% */
7711 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7712 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7713 /* Line In pin: input */
7714 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7715 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7717 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7719 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7721 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7723 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7724 /* ADC2: mute amp left and right */
7725 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7726 /* ADC3: mute amp left and right */
7727 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7732 static struct hda_verb alc885_init_input_verbs
[] = {
7733 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7734 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7735 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
7740 /* Unmute Selector 24h and set the default input to front mic */
7741 static struct hda_verb alc889_init_input_verbs
[] = {
7742 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
7743 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7748 #define alc883_init_verbs alc882_base_init_verbs
7751 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
7752 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7753 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7754 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
7755 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7756 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7757 /* FIXME: this looks suspicious...
7758 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7759 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7764 static struct hda_verb alc882_macpro_init_verbs
[] = {
7765 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7766 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7767 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7768 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7769 /* Front Pin: output 0 (0x0c) */
7770 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7771 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7772 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7773 /* Front Mic pin: input vref at 80% */
7774 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7775 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7776 /* Speaker: output */
7777 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7778 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7779 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
7780 /* Headphone output (output 0 - 0x0c) */
7781 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7782 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7783 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
7785 /* FIXME: use matrix-type input source selection */
7786 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7787 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7788 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7789 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7790 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7791 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7793 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7794 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7795 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7796 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7798 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7799 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7800 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7802 /* ADC1: mute amp left and right */
7803 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7804 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
7805 /* ADC2: mute amp left and right */
7806 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7807 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7808 /* ADC3: mute amp left and right */
7809 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7810 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7816 static struct hda_verb alc885_mb5_init_verbs
[] = {
7818 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7819 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7820 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7821 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7824 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7825 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7826 /* Surround mixer */
7827 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7828 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7829 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7831 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7832 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7833 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7835 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7836 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7837 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7838 /* Front Pin (0x0c) */
7839 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
7840 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7841 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
7842 /* LFE Pin (0x0e) */
7843 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
7844 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7845 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
7847 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7848 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7849 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
7850 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7851 /* Front Mic pin: input vref at 80% */
7852 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7853 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7855 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7856 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0x1)},
7859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x7)},
7860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0x4)},
7865 static struct hda_verb alc885_macmini3_init_verbs
[] = {
7867 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7868 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7869 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7870 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7872 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7873 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7875 /* Surround mixer */
7876 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7881 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7882 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7884 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7885 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7886 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7887 /* Front Pin (0x0c) */
7888 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
7889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7890 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
7891 /* LFE Pin (0x0e) */
7892 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
7893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7894 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
7896 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7897 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7898 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
7899 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7902 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7906 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7907 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7912 static struct hda_verb alc885_mba21_init_verbs
[] = {
7913 /*Internal and HP Speaker Mixer*/
7914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7915 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7916 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7917 /*Internal Speaker Pin (0x0c)*/
7918 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
7919 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7920 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
7921 /* HP Pin: output 0 (0x0e) */
7922 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
7923 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7924 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7925 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
7926 /* Line in (is hp when jack connected)*/
7927 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
7928 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7934 /* Macbook Pro rev3 */
7935 static struct hda_verb alc885_mbp3_init_verbs
[] = {
7936 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7938 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7939 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7941 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7942 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7943 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7945 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7946 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7947 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7948 /* Front Pin: output 0 (0x0c) */
7949 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7950 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7951 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7952 /* HP Pin: output 0 (0x0e) */
7953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
7954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7955 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x02},
7956 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7957 /* Mic (rear) pin: input vref at 80% */
7958 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7959 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7960 /* Front Mic pin: input vref at 80% */
7961 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7962 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7963 /* Line In pin: use output 1 when in LineOut mode */
7964 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7965 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7966 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
7968 /* FIXME: use matrix-type input source selection */
7969 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7970 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7972 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7973 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7974 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7976 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7977 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7978 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7979 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7983 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7984 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7985 /* ADC1: mute amp left and right */
7986 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7987 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
7988 /* ADC2: mute amp left and right */
7989 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7990 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7991 /* ADC3: mute amp left and right */
7992 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7993 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7999 static struct hda_verb alc885_imac91_init_verbs
[] = {
8000 /* Internal Speaker Pin (0x0c) */
8001 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8002 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8003 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8004 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, (PIN_OUT
| AC_PINCTL_VREF_50
) },
8005 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8006 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8008 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8009 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8010 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8011 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, (ALC880_HP_EVENT
| AC_USRSP_EN
)},
8013 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, AC_PINCTL_VREF_50
},
8014 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8015 /* Front Mic pin: input vref at 80% */
8016 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8017 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8021 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8022 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8026 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8031 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8035 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8036 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8041 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8042 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8043 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8044 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8045 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8046 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8047 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8048 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8049 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8053 /* iMac 24 mixer. */
8054 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
8055 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8056 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
8060 /* iMac 24 init verbs. */
8061 static struct hda_verb alc885_imac24_init_verbs
[] = {
8062 /* Internal speakers: output 0 (0x0c) */
8063 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8064 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8065 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
8066 /* Internal speakers: output 0 (0x0c) */
8067 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8068 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8069 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8070 /* Headphone: output 0 (0x0c) */
8071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8072 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8073 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8074 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8075 /* Front Mic: input vref at 80% */
8076 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8077 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8081 /* Toggle speaker-output according to the hp-jack state */
8082 static void alc885_imac24_setup(struct hda_codec
*codec
)
8084 struct alc_spec
*spec
= codec
->spec
;
8086 spec
->autocfg
.hp_pins
[0] = 0x14;
8087 spec
->autocfg
.speaker_pins
[0] = 0x18;
8088 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8091 #define alc885_mb5_setup alc885_imac24_setup
8092 #define alc885_macmini3_setup alc885_imac24_setup
8094 /* Macbook Air 2,1 */
8095 static void alc885_mba21_setup(struct hda_codec
*codec
)
8097 struct alc_spec
*spec
= codec
->spec
;
8099 spec
->autocfg
.hp_pins
[0] = 0x14;
8100 spec
->autocfg
.speaker_pins
[0] = 0x18;
8105 static void alc885_mbp3_setup(struct hda_codec
*codec
)
8107 struct alc_spec
*spec
= codec
->spec
;
8109 spec
->autocfg
.hp_pins
[0] = 0x15;
8110 spec
->autocfg
.speaker_pins
[0] = 0x14;
8113 static void alc885_imac91_setup(struct hda_codec
*codec
)
8115 struct alc_spec
*spec
= codec
->spec
;
8117 spec
->autocfg
.hp_pins
[0] = 0x14;
8118 spec
->autocfg
.speaker_pins
[0] = 0x18;
8119 spec
->autocfg
.speaker_pins
[1] = 0x1a;
8122 static struct hda_verb alc882_targa_verbs
[] = {
8123 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8124 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8126 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8127 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8129 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8130 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8131 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8133 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8137 /* toggle speaker-output according to the hp-jack state */
8138 static void alc882_targa_automute(struct hda_codec
*codec
)
8140 struct alc_spec
*spec
= codec
->spec
;
8141 alc_automute_amp(codec
);
8142 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
8143 spec
->jack_present
? 1 : 3);
8146 static void alc882_targa_setup(struct hda_codec
*codec
)
8148 struct alc_spec
*spec
= codec
->spec
;
8150 spec
->autocfg
.hp_pins
[0] = 0x14;
8151 spec
->autocfg
.speaker_pins
[0] = 0x1b;
8154 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8156 if ((res
>> 26) == ALC880_HP_EVENT
)
8157 alc882_targa_automute(codec
);
8160 static struct hda_verb alc882_asus_a7j_verbs
[] = {
8161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8165 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8166 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8168 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8169 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8170 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8172 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8173 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8174 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8178 static struct hda_verb alc882_asus_a7m_verbs
[] = {
8179 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8183 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8184 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8186 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8187 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8188 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
8190 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
8191 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
8192 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
8196 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
8198 unsigned int gpiostate
, gpiomask
, gpiodir
;
8200 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8201 AC_VERB_GET_GPIO_DATA
, 0);
8204 gpiostate
|= (1 << pin
);
8206 gpiostate
&= ~(1 << pin
);
8208 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8209 AC_VERB_GET_GPIO_MASK
, 0);
8210 gpiomask
|= (1 << pin
);
8212 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
8213 AC_VERB_GET_GPIO_DIRECTION
, 0);
8214 gpiodir
|= (1 << pin
);
8217 snd_hda_codec_write(codec
, codec
->afg
, 0,
8218 AC_VERB_SET_GPIO_MASK
, gpiomask
);
8219 snd_hda_codec_write(codec
, codec
->afg
, 0,
8220 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
8224 snd_hda_codec_write(codec
, codec
->afg
, 0,
8225 AC_VERB_SET_GPIO_DATA
, gpiostate
);
8228 /* set up GPIO at initialization */
8229 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
8231 alc882_gpio_mute(codec
, 0, 0);
8232 alc882_gpio_mute(codec
, 1, 0);
8235 /* set up GPIO and update auto-muting at initialization */
8236 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
8238 alc885_macpro_init_hook(codec
);
8239 alc_automute_amp(codec
);
8243 * generic initialization of ADC, input mixers and output mixers
8245 static struct hda_verb alc883_auto_init_verbs
[] = {
8247 * Unmute ADC0-2 and set the default input to mic-in
8249 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8250 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8251 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8252 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8255 * Set up output mixers (0x0c - 0x0f)
8257 /* set vol=0 to output mixers */
8258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8259 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8261 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8262 /* set up input amps for analog loopback */
8263 /* Amp Indices: DAC = 0, mixer = 1 */
8264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8265 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8266 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8267 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8268 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8269 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8270 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8271 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8272 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8273 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8275 /* FIXME: use matrix-type input source selection */
8276 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8278 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8280 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8284 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8285 static struct hda_verb alc889A_mb31_ch2_init
[] = {
8286 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
8287 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8288 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
8289 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
8293 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8294 static struct hda_verb alc889A_mb31_ch4_init
[] = {
8295 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
8296 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8297 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
8298 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
8302 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8303 static struct hda_verb alc889A_mb31_ch5_init
[] = {
8304 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as rear */
8305 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
8306 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
8307 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
8311 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8312 static struct hda_verb alc889A_mb31_ch6_init
[] = {
8313 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as front */
8314 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Subwoofer off */
8315 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
8316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
8320 static struct hda_channel_mode alc889A_mb31_6ch_modes
[4] = {
8321 { 2, alc889A_mb31_ch2_init
},
8322 { 4, alc889A_mb31_ch4_init
},
8323 { 5, alc889A_mb31_ch5_init
},
8324 { 6, alc889A_mb31_ch6_init
},
8327 static struct hda_verb alc883_medion_eapd_verbs
[] = {
8328 /* eanable EAPD on medion laptop */
8329 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8330 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
8334 #define alc883_base_mixer alc882_base_mixer
8336 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
8337 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8338 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8339 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8340 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8341 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8342 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8343 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8344 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8345 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8346 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8347 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8348 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8349 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8353 static struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
8354 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8355 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8356 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8357 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8358 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8359 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8361 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8362 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8363 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8367 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
8368 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8369 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8371 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8372 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8373 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8374 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8375 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8376 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8377 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8381 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
8382 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8383 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8385 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8386 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8387 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8388 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8390 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8391 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8392 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8393 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8394 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8398 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
8399 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8400 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8401 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8402 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8403 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8404 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8405 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8406 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8407 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8408 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8409 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8410 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8411 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8412 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8413 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8414 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8415 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8416 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8417 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8421 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
8422 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8423 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8424 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8425 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8426 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8428 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8429 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8430 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8432 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8433 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8434 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8435 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8436 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8437 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
8438 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8439 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8440 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT
),
8441 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8445 static struct snd_kcontrol_new alc885_8ch_intel_mixer
[] = {
8446 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8447 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8448 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8449 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8450 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8452 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8453 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8454 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8455 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8456 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT
),
8457 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8458 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8459 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8460 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
8461 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT
),
8462 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
8463 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8464 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT
),
8465 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8469 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
8470 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8471 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8472 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8473 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8474 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8475 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8476 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8477 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8478 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8479 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8480 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8482 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8484 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8486 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8487 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8488 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8492 static struct snd_kcontrol_new alc883_targa_mixer
[] = {
8493 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8494 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8495 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8496 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8497 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8498 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8499 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8500 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8501 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8502 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8503 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8504 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8505 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8506 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8507 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8508 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8509 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8513 static struct snd_kcontrol_new alc883_targa_2ch_mixer
[] = {
8514 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8515 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8516 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8517 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8518 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8519 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8521 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8522 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8523 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8524 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8525 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8529 static struct snd_kcontrol_new alc883_targa_8ch_mixer
[] = {
8530 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8531 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
8532 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8533 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8534 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8538 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
8539 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8540 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8541 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8542 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8543 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8544 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8545 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8546 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8550 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
8551 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8552 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
8553 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8554 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8555 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8556 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8557 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8558 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8559 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8563 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
8564 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8565 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8566 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8567 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8568 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8569 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8570 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8571 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8572 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8576 static struct snd_kcontrol_new alc883_medion_wim2160_mixer
[] = {
8577 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8578 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8579 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8580 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT
),
8581 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT
),
8582 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT
),
8586 static struct hda_verb alc883_medion_wim2160_verbs
[] = {
8587 /* Unmute front mixer */
8588 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8591 /* Set speaker pin to front mixer */
8592 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8594 /* Init headphone pin */
8595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8596 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8597 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8598 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8603 /* toggle speaker-output according to the hp-jack state */
8604 static void alc883_medion_wim2160_setup(struct hda_codec
*codec
)
8606 struct alc_spec
*spec
= codec
->spec
;
8608 spec
->autocfg
.hp_pins
[0] = 0x1a;
8609 spec
->autocfg
.speaker_pins
[0] = 0x15;
8612 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
8613 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8614 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8615 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8616 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8617 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8618 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8619 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8620 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8624 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer
[] = {
8625 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8626 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8627 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8628 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8629 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8630 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8632 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8633 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8637 static struct snd_kcontrol_new alc888_lenovo_sky_mixer
[] = {
8638 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8639 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8640 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
8641 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
8642 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8643 0x0d, 1, 0x0, HDA_OUTPUT
),
8644 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
8645 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
8646 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
8647 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8648 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
8649 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8650 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8651 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8652 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8653 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8654 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8655 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8656 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8657 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8658 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8662 static struct snd_kcontrol_new alc889A_mb31_mixer
[] = {
8664 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8665 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8666 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8667 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
8668 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8670 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT
),
8671 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT
),
8672 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT
),
8673 /* Output switches */
8674 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT
),
8675 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT
),
8676 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT
),
8678 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
8679 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
8681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
8682 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
8683 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8684 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8688 static struct snd_kcontrol_new alc883_vaiott_mixer
[] = {
8689 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8690 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8692 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8693 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
8694 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8698 static struct hda_bind_ctls alc883_bind_cap_vol
= {
8699 .ops
= &snd_hda_bind_vol
,
8701 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
8702 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
8707 static struct hda_bind_ctls alc883_bind_cap_switch
= {
8708 .ops
= &snd_hda_bind_sw
,
8710 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
8711 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
8716 static struct snd_kcontrol_new alc883_asus_eee1601_mixer
[] = {
8717 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8718 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8719 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8720 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8721 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8723 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8724 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8728 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer
[] = {
8729 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol
),
8730 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch
),
8732 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8733 /* .name = "Capture Source", */
8734 .name
= "Input Source",
8736 .info
= alc_mux_enum_info
,
8737 .get
= alc_mux_enum_get
,
8738 .put
= alc_mux_enum_put
,
8743 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
8745 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8746 .name
= "Channel Mode",
8747 .info
= alc_ch_mode_info
,
8748 .get
= alc_ch_mode_get
,
8749 .put
= alc_ch_mode_put
,
8754 /* toggle speaker-output according to the hp-jack state */
8755 static void alc883_mitac_setup(struct hda_codec
*codec
)
8757 struct alc_spec
*spec
= codec
->spec
;
8759 spec
->autocfg
.hp_pins
[0] = 0x15;
8760 spec
->autocfg
.speaker_pins
[0] = 0x14;
8761 spec
->autocfg
.speaker_pins
[1] = 0x17;
8764 /* auto-toggle front mic */
8766 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8768 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8770 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8774 static struct hda_verb alc883_mitac_verbs
[] = {
8776 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8777 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8779 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
8780 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8782 /* enable unsolicited event */
8783 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8784 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8789 static struct hda_verb alc883_clevo_m540r_verbs
[] = {
8791 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8792 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8794 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8796 /* enable unsolicited event */
8798 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8799 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8805 static struct hda_verb alc883_clevo_m720_verbs
[] = {
8807 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8808 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8810 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
8811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8813 /* enable unsolicited event */
8814 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8815 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
8820 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
8822 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8825 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8828 /* enable unsolicited event */
8829 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8834 static struct hda_verb alc883_targa_verbs
[] = {
8835 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8836 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8838 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8839 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8841 /* Connect Line-Out side jack (SPDIF) to Side */
8842 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8843 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8844 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8845 /* Connect Mic jack to CLFE */
8846 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8847 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8848 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
8849 /* Connect Line-in jack to Surround */
8850 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8851 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8852 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
8853 /* Connect HP out jack to Front */
8854 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8855 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8856 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8858 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8863 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
8864 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8865 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
8866 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
8870 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
8871 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8872 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8873 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8874 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8878 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
8879 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8880 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8881 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8882 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
8883 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8887 static struct hda_verb alc883_haier_w66_verbs
[] = {
8888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8891 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8893 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8894 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8895 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8896 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8900 static struct hda_verb alc888_lenovo_sky_verbs
[] = {
8901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8903 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8905 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8906 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8907 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8908 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8912 static struct hda_verb alc888_6st_dell_verbs
[] = {
8913 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8917 static struct hda_verb alc883_vaiott_verbs
[] = {
8919 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8920 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8922 /* enable unsolicited event */
8923 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8928 static void alc888_3st_hp_setup(struct hda_codec
*codec
)
8930 struct alc_spec
*spec
= codec
->spec
;
8932 spec
->autocfg
.hp_pins
[0] = 0x1b;
8933 spec
->autocfg
.speaker_pins
[0] = 0x14;
8934 spec
->autocfg
.speaker_pins
[1] = 0x16;
8935 spec
->autocfg
.speaker_pins
[2] = 0x18;
8938 static struct hda_verb alc888_3st_hp_verbs
[] = {
8939 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
8940 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
8941 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
8942 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8949 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
8950 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8951 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8952 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8953 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8960 static struct hda_verb alc888_3st_hp_4ch_init
[] = {
8961 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8962 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8963 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8964 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8965 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8972 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
8973 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8974 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8975 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8976 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8977 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8978 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8982 static struct hda_channel_mode alc888_3st_hp_modes
[3] = {
8983 { 2, alc888_3st_hp_2ch_init
},
8984 { 4, alc888_3st_hp_4ch_init
},
8985 { 6, alc888_3st_hp_6ch_init
},
8988 /* toggle front-jack and RCA according to the hp-jack state */
8989 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
8991 unsigned int present
= snd_hda_jack_detect(codec
, 0x1b);
8993 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8994 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8995 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8996 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8999 /* toggle RCA according to the front-jack state */
9000 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
9002 unsigned int present
= snd_hda_jack_detect(codec
, 0x14);
9004 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9005 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9008 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
9011 if ((res
>> 26) == ALC880_HP_EVENT
)
9012 alc888_lenovo_ms7195_front_automute(codec
);
9013 if ((res
>> 26) == ALC880_FRONT_EVENT
)
9014 alc888_lenovo_ms7195_rca_automute(codec
);
9017 static struct hda_verb alc883_medion_md2_verbs
[] = {
9018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9021 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9023 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9027 /* toggle speaker-output according to the hp-jack state */
9028 static void alc883_medion_md2_setup(struct hda_codec
*codec
)
9030 struct alc_spec
*spec
= codec
->spec
;
9032 spec
->autocfg
.hp_pins
[0] = 0x14;
9033 spec
->autocfg
.speaker_pins
[0] = 0x15;
9036 /* toggle speaker-output according to the hp-jack state */
9037 #define alc883_targa_init_hook alc882_targa_init_hook
9038 #define alc883_targa_unsol_event alc882_targa_unsol_event
9040 static void alc883_clevo_m720_mic_automute(struct hda_codec
*codec
)
9042 unsigned int present
;
9044 present
= snd_hda_jack_detect(codec
, 0x18);
9045 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
9046 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9049 static void alc883_clevo_m720_setup(struct hda_codec
*codec
)
9051 struct alc_spec
*spec
= codec
->spec
;
9053 spec
->autocfg
.hp_pins
[0] = 0x15;
9054 spec
->autocfg
.speaker_pins
[0] = 0x14;
9057 static void alc883_clevo_m720_init_hook(struct hda_codec
*codec
)
9059 alc_automute_amp(codec
);
9060 alc883_clevo_m720_mic_automute(codec
);
9063 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
9066 switch (res
>> 26) {
9067 case ALC880_MIC_EVENT
:
9068 alc883_clevo_m720_mic_automute(codec
);
9071 alc_automute_amp_unsol_event(codec
, res
);
9076 /* toggle speaker-output according to the hp-jack state */
9077 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec
*codec
)
9079 struct alc_spec
*spec
= codec
->spec
;
9081 spec
->autocfg
.hp_pins
[0] = 0x14;
9082 spec
->autocfg
.speaker_pins
[0] = 0x15;
9085 static void alc883_haier_w66_setup(struct hda_codec
*codec
)
9087 struct alc_spec
*spec
= codec
->spec
;
9089 spec
->autocfg
.hp_pins
[0] = 0x1b;
9090 spec
->autocfg
.speaker_pins
[0] = 0x14;
9093 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
9095 int bits
= snd_hda_jack_detect(codec
, 0x14) ? HDA_AMP_MUTE
: 0;
9097 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9098 HDA_AMP_MUTE
, bits
);
9101 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
9103 int bits
= snd_hda_jack_detect(codec
, 0x1b) ? HDA_AMP_MUTE
: 0;
9105 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9106 HDA_AMP_MUTE
, bits
);
9107 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9108 HDA_AMP_MUTE
, bits
);
9111 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
9114 if ((res
>> 26) == ALC880_HP_EVENT
)
9115 alc883_lenovo_101e_all_automute(codec
);
9116 if ((res
>> 26) == ALC880_FRONT_EVENT
)
9117 alc883_lenovo_101e_ispeaker_automute(codec
);
9120 /* toggle speaker-output according to the hp-jack state */
9121 static void alc883_acer_aspire_setup(struct hda_codec
*codec
)
9123 struct alc_spec
*spec
= codec
->spec
;
9125 spec
->autocfg
.hp_pins
[0] = 0x14;
9126 spec
->autocfg
.speaker_pins
[0] = 0x15;
9127 spec
->autocfg
.speaker_pins
[1] = 0x16;
9130 static struct hda_verb alc883_acer_eapd_verbs
[] = {
9131 /* HP Pin: output 0 (0x0c) */
9132 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9133 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9134 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9135 /* Front Pin: output 0 (0x0c) */
9136 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9137 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9138 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9139 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
9140 /* eanable EAPD on medion laptop */
9141 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9142 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9143 /* enable unsolicited event */
9144 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9148 static struct hda_verb alc888_acer_aspire_7730G_verbs
[] = {
9149 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9150 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
9151 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9155 static void alc888_6st_dell_setup(struct hda_codec
*codec
)
9157 struct alc_spec
*spec
= codec
->spec
;
9159 spec
->autocfg
.hp_pins
[0] = 0x1b;
9160 spec
->autocfg
.speaker_pins
[0] = 0x14;
9161 spec
->autocfg
.speaker_pins
[1] = 0x15;
9162 spec
->autocfg
.speaker_pins
[2] = 0x16;
9163 spec
->autocfg
.speaker_pins
[3] = 0x17;
9166 static void alc888_lenovo_sky_setup(struct hda_codec
*codec
)
9168 struct alc_spec
*spec
= codec
->spec
;
9170 spec
->autocfg
.hp_pins
[0] = 0x1b;
9171 spec
->autocfg
.speaker_pins
[0] = 0x14;
9172 spec
->autocfg
.speaker_pins
[1] = 0x15;
9173 spec
->autocfg
.speaker_pins
[2] = 0x16;
9174 spec
->autocfg
.speaker_pins
[3] = 0x17;
9175 spec
->autocfg
.speaker_pins
[4] = 0x1a;
9178 static void alc883_vaiott_setup(struct hda_codec
*codec
)
9180 struct alc_spec
*spec
= codec
->spec
;
9182 spec
->autocfg
.hp_pins
[0] = 0x15;
9183 spec
->autocfg
.speaker_pins
[0] = 0x14;
9184 spec
->autocfg
.speaker_pins
[1] = 0x17;
9187 static struct hda_verb alc888_asus_m90v_verbs
[] = {
9188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9189 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9191 /* enable unsolicited event */
9192 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9193 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
9197 static void alc883_mode2_setup(struct hda_codec
*codec
)
9199 struct alc_spec
*spec
= codec
->spec
;
9201 spec
->autocfg
.hp_pins
[0] = 0x1b;
9202 spec
->autocfg
.speaker_pins
[0] = 0x14;
9203 spec
->autocfg
.speaker_pins
[1] = 0x15;
9204 spec
->autocfg
.speaker_pins
[2] = 0x16;
9205 spec
->ext_mic
.pin
= 0x18;
9206 spec
->int_mic
.pin
= 0x19;
9207 spec
->ext_mic
.mux_idx
= 0;
9208 spec
->int_mic
.mux_idx
= 1;
9212 static struct hda_verb alc888_asus_eee1601_verbs
[] = {
9213 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9214 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9216 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9217 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9218 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
9219 {0x20, AC_VERB_SET_PROC_COEF
, 0x0838},
9220 /* enable unsolicited event */
9221 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9225 static void alc883_eee1601_inithook(struct hda_codec
*codec
)
9227 struct alc_spec
*spec
= codec
->spec
;
9229 spec
->autocfg
.hp_pins
[0] = 0x14;
9230 spec
->autocfg
.speaker_pins
[0] = 0x1b;
9231 alc_automute_pin(codec
);
9234 static struct hda_verb alc889A_mb31_verbs
[] = {
9235 /* Init rear pin (used as headphone output) */
9236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4}, /* Apple Headphones */
9237 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Connect to front */
9238 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9239 /* Init line pin (used as output in 4ch and 6ch mode) */
9240 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Connect to CLFE */
9241 /* Init line 2 pin (used as headphone out by default) */
9242 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Use as input */
9243 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Mute output */
9247 /* Mute speakers according to the headphone jack state */
9248 static void alc889A_mb31_automute(struct hda_codec
*codec
)
9250 unsigned int present
;
9252 /* Mute only in 2ch or 4ch mode */
9253 if (snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_CONNECT_SEL
, 0)
9255 present
= snd_hda_jack_detect(codec
, 0x15);
9256 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9257 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9258 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9259 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9263 static void alc889A_mb31_unsol_event(struct hda_codec
*codec
, unsigned int res
)
9265 if ((res
>> 26) == ALC880_HP_EVENT
)
9266 alc889A_mb31_automute(codec
);
9270 #ifdef CONFIG_SND_HDA_POWER_SAVE
9271 #define alc882_loopbacks alc880_loopbacks
9274 /* pcm configuration: identical with ALC880 */
9275 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9276 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9277 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9278 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9280 static hda_nid_t alc883_slave_dig_outs
[] = {
9281 ALC1200_DIGOUT_NID
, 0,
9284 static hda_nid_t alc1200_slave_dig_outs
[] = {
9285 ALC883_DIGOUT_NID
, 0,
9289 * configuration and preset
9291 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
9292 [ALC882_3ST_DIG
] = "3stack-dig",
9293 [ALC882_6ST_DIG
] = "6stack-dig",
9294 [ALC882_ARIMA
] = "arima",
9295 [ALC882_W2JC
] = "w2jc",
9296 [ALC882_TARGA
] = "targa",
9297 [ALC882_ASUS_A7J
] = "asus-a7j",
9298 [ALC882_ASUS_A7M
] = "asus-a7m",
9299 [ALC885_MACPRO
] = "macpro",
9300 [ALC885_MB5
] = "mb5",
9301 [ALC885_MACMINI3
] = "macmini3",
9302 [ALC885_MBA21
] = "mba21",
9303 [ALC885_MBP3
] = "mbp3",
9304 [ALC885_IMAC24
] = "imac24",
9305 [ALC885_IMAC91
] = "imac91",
9306 [ALC883_3ST_2ch_DIG
] = "3stack-2ch-dig",
9307 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
9308 [ALC883_3ST_6ch
] = "3stack-6ch",
9309 [ALC883_6ST_DIG
] = "alc883-6stack-dig",
9310 [ALC883_TARGA_DIG
] = "targa-dig",
9311 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
9312 [ALC883_TARGA_8ch_DIG
] = "targa-8ch-dig",
9313 [ALC883_ACER
] = "acer",
9314 [ALC883_ACER_ASPIRE
] = "acer-aspire",
9315 [ALC888_ACER_ASPIRE_4930G
] = "acer-aspire-4930g",
9316 [ALC888_ACER_ASPIRE_6530G
] = "acer-aspire-6530g",
9317 [ALC888_ACER_ASPIRE_8930G
] = "acer-aspire-8930g",
9318 [ALC888_ACER_ASPIRE_7730G
] = "acer-aspire-7730g",
9319 [ALC883_MEDION
] = "medion",
9320 [ALC883_MEDION_MD2
] = "medion-md2",
9321 [ALC883_MEDION_WIM2160
] = "medion-wim2160",
9322 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
9323 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
9324 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
9325 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
9326 [ALC888_LENOVO_SKY
] = "lenovo-sky",
9327 [ALC883_HAIER_W66
] = "haier-w66",
9328 [ALC888_3ST_HP
] = "3stack-hp",
9329 [ALC888_6ST_DELL
] = "6stack-dell",
9330 [ALC883_MITAC
] = "mitac",
9331 [ALC883_CLEVO_M540R
] = "clevo-m540r",
9332 [ALC883_CLEVO_M720
] = "clevo-m720",
9333 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
9334 [ALC888_FUJITSU_XA3530
] = "fujitsu-xa3530",
9335 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
9336 [ALC889A_INTEL
] = "intel-alc889a",
9337 [ALC889_INTEL
] = "intel-x58",
9338 [ALC1200_ASUS_P5Q
] = "asus-p5q",
9339 [ALC889A_MB31
] = "mb31",
9340 [ALC883_SONY_VAIO_TT
] = "sony-vaio-tt",
9341 [ALC882_AUTO
] = "auto",
9344 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
9345 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
9347 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
9348 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE
),
9349 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE
),
9350 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
9351 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
9352 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
9353 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9354 ALC888_ACER_ASPIRE_4930G
),
9355 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9356 ALC888_ACER_ASPIRE_4930G
),
9357 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9358 ALC888_ACER_ASPIRE_8930G
),
9359 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9360 ALC888_ACER_ASPIRE_8930G
),
9361 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO
),
9362 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO
),
9363 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9364 ALC888_ACER_ASPIRE_6530G
),
9365 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9366 ALC888_ACER_ASPIRE_6530G
),
9367 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9368 ALC888_ACER_ASPIRE_7730G
),
9369 /* default Acer -- disabled as it causes more problems.
9370 * model=auto should work fine now
9372 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9374 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
9376 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
9377 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
9378 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
9379 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
9380 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP
),
9381 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP
),
9383 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
9384 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
9385 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
9386 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V
),
9387 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
9388 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
9389 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
9390 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
9391 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG
),
9392 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q
),
9393 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601
),
9395 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT
),
9396 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
9397 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
9398 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC
),
9399 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
9400 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
9401 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL
),
9402 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
9403 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
9405 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
9406 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
9407 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
9408 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
9409 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO
),
9410 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
9411 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
9412 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
9413 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
9414 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
9415 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
9416 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
9417 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
9418 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
9419 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG
),
9420 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
9421 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
9422 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
9423 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG
),
9424 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG
),
9425 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
9426 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
9427 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
9428 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG
),
9429 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
9430 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
9431 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
9432 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG
),
9433 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG
),
9434 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
9435 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG
),
9437 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
9438 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG
),
9439 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
9440 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
9441 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R
),
9442 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD
),
9443 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
9444 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9445 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
9446 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9447 ALC883_FUJITSU_PI2515
),
9448 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9449 ALC888_FUJITSU_XA3530
),
9450 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
9451 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9452 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9453 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9454 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY
),
9455 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
9456 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG
),
9457 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
9458 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
9460 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
9461 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
9462 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC
),
9463 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL
),
9464 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL
),
9465 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL
),
9466 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG
),
9471 /* codec SSID table for Intel Mac */
9472 static struct snd_pci_quirk alc882_ssid_cfg_tbl
[] = {
9473 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3
),
9474 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3
),
9475 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3
),
9476 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO
),
9477 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24
),
9478 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24
),
9479 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3
),
9480 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31
),
9481 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M
),
9482 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3
),
9483 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21
),
9484 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31
),
9485 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3
),
9486 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24
),
9487 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91
),
9488 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5
),
9489 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9490 * so apparently no perfect solution yet
9492 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5
),
9493 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5
),
9494 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3
),
9498 static struct alc_config_preset alc882_presets
[] = {
9499 [ALC882_3ST_DIG
] = {
9500 .mixers
= { alc882_base_mixer
},
9501 .init_verbs
= { alc882_base_init_verbs
,
9502 alc882_adc1_init_verbs
},
9503 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9504 .dac_nids
= alc882_dac_nids
,
9505 .dig_out_nid
= ALC882_DIGOUT_NID
,
9506 .dig_in_nid
= ALC882_DIGIN_NID
,
9507 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
9508 .channel_mode
= alc882_ch_modes
,
9510 .input_mux
= &alc882_capture_source
,
9512 [ALC882_6ST_DIG
] = {
9513 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
9514 .init_verbs
= { alc882_base_init_verbs
,
9515 alc882_adc1_init_verbs
},
9516 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9517 .dac_nids
= alc882_dac_nids
,
9518 .dig_out_nid
= ALC882_DIGOUT_NID
,
9519 .dig_in_nid
= ALC882_DIGIN_NID
,
9520 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
9521 .channel_mode
= alc882_sixstack_modes
,
9522 .input_mux
= &alc882_capture_source
,
9525 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
9526 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
9527 alc882_eapd_verbs
},
9528 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9529 .dac_nids
= alc882_dac_nids
,
9530 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
9531 .channel_mode
= alc882_sixstack_modes
,
9532 .input_mux
= &alc882_capture_source
,
9535 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
9536 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
9537 alc882_eapd_verbs
, alc880_gpio1_init_verbs
},
9538 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9539 .dac_nids
= alc882_dac_nids
,
9540 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
9541 .channel_mode
= alc880_threestack_modes
,
9543 .input_mux
= &alc882_capture_source
,
9544 .dig_out_nid
= ALC882_DIGOUT_NID
,
9547 .mixers
= { alc885_mba21_mixer
},
9548 .init_verbs
= { alc885_mba21_init_verbs
, alc880_gpio1_init_verbs
},
9550 .dac_nids
= alc882_dac_nids
,
9551 .channel_mode
= alc885_mba21_ch_modes
,
9552 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
9553 .input_mux
= &alc882_capture_source
,
9554 .unsol_event
= alc_automute_amp_unsol_event
,
9555 .setup
= alc885_mba21_setup
,
9556 .init_hook
= alc_automute_amp
,
9559 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
9560 .init_verbs
= { alc885_mbp3_init_verbs
,
9561 alc880_gpio1_init_verbs
},
9563 .dac_nids
= alc882_dac_nids
,
9565 .channel_mode
= alc885_mbp_4ch_modes
,
9566 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_4ch_modes
),
9567 .input_mux
= &alc882_capture_source
,
9568 .dig_out_nid
= ALC882_DIGOUT_NID
,
9569 .dig_in_nid
= ALC882_DIGIN_NID
,
9570 .unsol_event
= alc_automute_amp_unsol_event
,
9571 .setup
= alc885_mbp3_setup
,
9572 .init_hook
= alc_automute_amp
,
9575 .mixers
= { alc885_mb5_mixer
, alc882_chmode_mixer
},
9576 .init_verbs
= { alc885_mb5_init_verbs
,
9577 alc880_gpio1_init_verbs
},
9578 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9579 .dac_nids
= alc882_dac_nids
,
9580 .channel_mode
= alc885_mb5_6ch_modes
,
9581 .num_channel_mode
= ARRAY_SIZE(alc885_mb5_6ch_modes
),
9582 .input_mux
= &mb5_capture_source
,
9583 .dig_out_nid
= ALC882_DIGOUT_NID
,
9584 .dig_in_nid
= ALC882_DIGIN_NID
,
9585 .unsol_event
= alc_automute_amp_unsol_event
,
9586 .setup
= alc885_mb5_setup
,
9587 .init_hook
= alc_automute_amp
,
9589 [ALC885_MACMINI3
] = {
9590 .mixers
= { alc885_macmini3_mixer
, alc882_chmode_mixer
},
9591 .init_verbs
= { alc885_macmini3_init_verbs
,
9592 alc880_gpio1_init_verbs
},
9593 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9594 .dac_nids
= alc882_dac_nids
,
9595 .channel_mode
= alc885_macmini3_6ch_modes
,
9596 .num_channel_mode
= ARRAY_SIZE(alc885_macmini3_6ch_modes
),
9597 .input_mux
= &macmini3_capture_source
,
9598 .dig_out_nid
= ALC882_DIGOUT_NID
,
9599 .dig_in_nid
= ALC882_DIGIN_NID
,
9600 .unsol_event
= alc_automute_amp_unsol_event
,
9601 .setup
= alc885_macmini3_setup
,
9602 .init_hook
= alc_automute_amp
,
9605 .mixers
= { alc882_macpro_mixer
},
9606 .init_verbs
= { alc882_macpro_init_verbs
},
9607 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9608 .dac_nids
= alc882_dac_nids
,
9609 .dig_out_nid
= ALC882_DIGOUT_NID
,
9610 .dig_in_nid
= ALC882_DIGIN_NID
,
9611 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
9612 .channel_mode
= alc882_ch_modes
,
9613 .input_mux
= &alc882_capture_source
,
9614 .init_hook
= alc885_macpro_init_hook
,
9617 .mixers
= { alc885_imac24_mixer
},
9618 .init_verbs
= { alc885_imac24_init_verbs
},
9619 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9620 .dac_nids
= alc882_dac_nids
,
9621 .dig_out_nid
= ALC882_DIGOUT_NID
,
9622 .dig_in_nid
= ALC882_DIGIN_NID
,
9623 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
9624 .channel_mode
= alc882_ch_modes
,
9625 .input_mux
= &alc882_capture_source
,
9626 .unsol_event
= alc_automute_amp_unsol_event
,
9627 .setup
= alc885_imac24_setup
,
9628 .init_hook
= alc885_imac24_init_hook
,
9631 .mixers
= {alc885_imac91_mixer
},
9632 .init_verbs
= { alc885_imac91_init_verbs
,
9633 alc880_gpio1_init_verbs
},
9634 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9635 .dac_nids
= alc882_dac_nids
,
9636 .channel_mode
= alc885_mba21_ch_modes
,
9637 .num_channel_mode
= ARRAY_SIZE(alc885_mba21_ch_modes
),
9638 .input_mux
= &alc889A_imac91_capture_source
,
9639 .dig_out_nid
= ALC882_DIGOUT_NID
,
9640 .dig_in_nid
= ALC882_DIGIN_NID
,
9641 .unsol_event
= alc_automute_amp_unsol_event
,
9642 .setup
= alc885_imac91_setup
,
9643 .init_hook
= alc_automute_amp
,
9646 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
},
9647 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
9648 alc880_gpio3_init_verbs
, alc882_targa_verbs
},
9649 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9650 .dac_nids
= alc882_dac_nids
,
9651 .dig_out_nid
= ALC882_DIGOUT_NID
,
9652 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
9653 .adc_nids
= alc882_adc_nids
,
9654 .capsrc_nids
= alc882_capsrc_nids
,
9655 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
9656 .channel_mode
= alc882_3ST_6ch_modes
,
9658 .input_mux
= &alc882_capture_source
,
9659 .unsol_event
= alc882_targa_unsol_event
,
9660 .setup
= alc882_targa_setup
,
9661 .init_hook
= alc882_targa_automute
,
9663 [ALC882_ASUS_A7J
] = {
9664 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
},
9665 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
9666 alc882_asus_a7j_verbs
},
9667 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9668 .dac_nids
= alc882_dac_nids
,
9669 .dig_out_nid
= ALC882_DIGOUT_NID
,
9670 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
9671 .adc_nids
= alc882_adc_nids
,
9672 .capsrc_nids
= alc882_capsrc_nids
,
9673 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
9674 .channel_mode
= alc882_3ST_6ch_modes
,
9676 .input_mux
= &alc882_capture_source
,
9678 [ALC882_ASUS_A7M
] = {
9679 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
9680 .init_verbs
= { alc882_base_init_verbs
, alc882_adc1_init_verbs
,
9681 alc882_eapd_verbs
, alc880_gpio1_init_verbs
,
9682 alc882_asus_a7m_verbs
},
9683 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
9684 .dac_nids
= alc882_dac_nids
,
9685 .dig_out_nid
= ALC882_DIGOUT_NID
,
9686 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
9687 .channel_mode
= alc880_threestack_modes
,
9689 .input_mux
= &alc882_capture_source
,
9691 [ALC883_3ST_2ch_DIG
] = {
9692 .mixers
= { alc883_3ST_2ch_mixer
},
9693 .init_verbs
= { alc883_init_verbs
},
9694 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9695 .dac_nids
= alc883_dac_nids
,
9696 .dig_out_nid
= ALC883_DIGOUT_NID
,
9697 .dig_in_nid
= ALC883_DIGIN_NID
,
9698 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9699 .channel_mode
= alc883_3ST_2ch_modes
,
9700 .input_mux
= &alc883_capture_source
,
9702 [ALC883_3ST_6ch_DIG
] = {
9703 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9704 .init_verbs
= { alc883_init_verbs
},
9705 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9706 .dac_nids
= alc883_dac_nids
,
9707 .dig_out_nid
= ALC883_DIGOUT_NID
,
9708 .dig_in_nid
= ALC883_DIGIN_NID
,
9709 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9710 .channel_mode
= alc883_3ST_6ch_modes
,
9712 .input_mux
= &alc883_capture_source
,
9714 [ALC883_3ST_6ch
] = {
9715 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9716 .init_verbs
= { alc883_init_verbs
},
9717 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9718 .dac_nids
= alc883_dac_nids
,
9719 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9720 .channel_mode
= alc883_3ST_6ch_modes
,
9722 .input_mux
= &alc883_capture_source
,
9724 [ALC883_3ST_6ch_INTEL
] = {
9725 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
9726 .init_verbs
= { alc883_init_verbs
},
9727 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9728 .dac_nids
= alc883_dac_nids
,
9729 .dig_out_nid
= ALC883_DIGOUT_NID
,
9730 .dig_in_nid
= ALC883_DIGIN_NID
,
9731 .slave_dig_outs
= alc883_slave_dig_outs
,
9732 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
9733 .channel_mode
= alc883_3ST_6ch_intel_modes
,
9735 .input_mux
= &alc883_3stack_6ch_intel
,
9738 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
9739 .init_verbs
= { alc885_init_verbs
, alc885_init_input_verbs
,
9740 alc_hp15_unsol_verbs
},
9741 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9742 .dac_nids
= alc883_dac_nids
,
9743 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
9744 .adc_nids
= alc889_adc_nids
,
9745 .dig_out_nid
= ALC883_DIGOUT_NID
,
9746 .dig_in_nid
= ALC883_DIGIN_NID
,
9747 .slave_dig_outs
= alc883_slave_dig_outs
,
9748 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
9749 .channel_mode
= alc889_8ch_intel_modes
,
9750 .capsrc_nids
= alc889_capsrc_nids
,
9751 .input_mux
= &alc889_capture_source
,
9752 .setup
= alc889_automute_setup
,
9753 .init_hook
= alc_automute_amp
,
9754 .unsol_event
= alc_automute_amp_unsol_event
,
9758 .mixers
= { alc885_8ch_intel_mixer
, alc883_chmode_mixer
},
9759 .init_verbs
= { alc885_init_verbs
, alc889_init_input_verbs
,
9760 alc889_eapd_verbs
, alc_hp15_unsol_verbs
},
9761 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9762 .dac_nids
= alc883_dac_nids
,
9763 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
9764 .adc_nids
= alc889_adc_nids
,
9765 .dig_out_nid
= ALC883_DIGOUT_NID
,
9766 .dig_in_nid
= ALC883_DIGIN_NID
,
9767 .slave_dig_outs
= alc883_slave_dig_outs
,
9768 .num_channel_mode
= ARRAY_SIZE(alc889_8ch_intel_modes
),
9769 .channel_mode
= alc889_8ch_intel_modes
,
9770 .capsrc_nids
= alc889_capsrc_nids
,
9771 .input_mux
= &alc889_capture_source
,
9772 .setup
= alc889_automute_setup
,
9773 .init_hook
= alc889_intel_init_hook
,
9774 .unsol_event
= alc_automute_amp_unsol_event
,
9777 [ALC883_6ST_DIG
] = {
9778 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
9779 .init_verbs
= { alc883_init_verbs
},
9780 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9781 .dac_nids
= alc883_dac_nids
,
9782 .dig_out_nid
= ALC883_DIGOUT_NID
,
9783 .dig_in_nid
= ALC883_DIGIN_NID
,
9784 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9785 .channel_mode
= alc883_sixstack_modes
,
9786 .input_mux
= &alc883_capture_source
,
9788 [ALC883_TARGA_DIG
] = {
9789 .mixers
= { alc883_targa_mixer
, alc883_chmode_mixer
},
9790 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
9791 alc883_targa_verbs
},
9792 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9793 .dac_nids
= alc883_dac_nids
,
9794 .dig_out_nid
= ALC883_DIGOUT_NID
,
9795 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9796 .channel_mode
= alc883_3ST_6ch_modes
,
9798 .input_mux
= &alc883_capture_source
,
9799 .unsol_event
= alc883_targa_unsol_event
,
9800 .setup
= alc882_targa_setup
,
9801 .init_hook
= alc882_targa_automute
,
9803 [ALC883_TARGA_2ch_DIG
] = {
9804 .mixers
= { alc883_targa_2ch_mixer
},
9805 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
9806 alc883_targa_verbs
},
9807 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9808 .dac_nids
= alc883_dac_nids
,
9809 .adc_nids
= alc883_adc_nids_alt
,
9810 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
9811 .capsrc_nids
= alc883_capsrc_nids
,
9812 .dig_out_nid
= ALC883_DIGOUT_NID
,
9813 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9814 .channel_mode
= alc883_3ST_2ch_modes
,
9815 .input_mux
= &alc883_capture_source
,
9816 .unsol_event
= alc883_targa_unsol_event
,
9817 .setup
= alc882_targa_setup
,
9818 .init_hook
= alc882_targa_automute
,
9820 [ALC883_TARGA_8ch_DIG
] = {
9821 .mixers
= { alc883_targa_mixer
, alc883_targa_8ch_mixer
,
9822 alc883_chmode_mixer
},
9823 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
9824 alc883_targa_verbs
},
9825 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9826 .dac_nids
= alc883_dac_nids
,
9827 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9828 .adc_nids
= alc883_adc_nids_rev
,
9829 .capsrc_nids
= alc883_capsrc_nids_rev
,
9830 .dig_out_nid
= ALC883_DIGOUT_NID
,
9831 .dig_in_nid
= ALC883_DIGIN_NID
,
9832 .num_channel_mode
= ARRAY_SIZE(alc883_4ST_8ch_modes
),
9833 .channel_mode
= alc883_4ST_8ch_modes
,
9835 .input_mux
= &alc883_capture_source
,
9836 .unsol_event
= alc883_targa_unsol_event
,
9837 .setup
= alc882_targa_setup
,
9838 .init_hook
= alc882_targa_automute
,
9841 .mixers
= { alc883_base_mixer
},
9842 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9843 * and the headphone jack. Turn this on and rely on the
9844 * standard mute methods whenever the user wants to turn
9845 * these outputs off.
9847 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
9848 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9849 .dac_nids
= alc883_dac_nids
,
9850 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9851 .channel_mode
= alc883_3ST_2ch_modes
,
9852 .input_mux
= &alc883_capture_source
,
9854 [ALC883_ACER_ASPIRE
] = {
9855 .mixers
= { alc883_acer_aspire_mixer
},
9856 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
9857 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9858 .dac_nids
= alc883_dac_nids
,
9859 .dig_out_nid
= ALC883_DIGOUT_NID
,
9860 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9861 .channel_mode
= alc883_3ST_2ch_modes
,
9862 .input_mux
= &alc883_capture_source
,
9863 .unsol_event
= alc_automute_amp_unsol_event
,
9864 .setup
= alc883_acer_aspire_setup
,
9865 .init_hook
= alc_automute_amp
,
9867 [ALC888_ACER_ASPIRE_4930G
] = {
9868 .mixers
= { alc888_base_mixer
,
9869 alc883_chmode_mixer
},
9870 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
9871 alc888_acer_aspire_4930g_verbs
},
9872 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9873 .dac_nids
= alc883_dac_nids
,
9874 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9875 .adc_nids
= alc883_adc_nids_rev
,
9876 .capsrc_nids
= alc883_capsrc_nids_rev
,
9877 .dig_out_nid
= ALC883_DIGOUT_NID
,
9878 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9879 .channel_mode
= alc883_3ST_6ch_modes
,
9881 .const_channel_count
= 6,
9883 ARRAY_SIZE(alc888_2_capture_sources
),
9884 .input_mux
= alc888_2_capture_sources
,
9885 .unsol_event
= alc_automute_amp_unsol_event
,
9886 .setup
= alc888_acer_aspire_4930g_setup
,
9887 .init_hook
= alc_automute_amp
,
9889 [ALC888_ACER_ASPIRE_6530G
] = {
9890 .mixers
= { alc888_acer_aspire_6530_mixer
},
9891 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
9892 alc888_acer_aspire_6530g_verbs
},
9893 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9894 .dac_nids
= alc883_dac_nids
,
9895 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9896 .adc_nids
= alc883_adc_nids_rev
,
9897 .capsrc_nids
= alc883_capsrc_nids_rev
,
9898 .dig_out_nid
= ALC883_DIGOUT_NID
,
9899 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9900 .channel_mode
= alc883_3ST_2ch_modes
,
9902 ARRAY_SIZE(alc888_2_capture_sources
),
9903 .input_mux
= alc888_acer_aspire_6530_sources
,
9904 .unsol_event
= alc_automute_amp_unsol_event
,
9905 .setup
= alc888_acer_aspire_6530g_setup
,
9906 .init_hook
= alc_automute_amp
,
9908 [ALC888_ACER_ASPIRE_8930G
] = {
9909 .mixers
= { alc889_acer_aspire_8930g_mixer
,
9910 alc883_chmode_mixer
},
9911 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
9912 alc889_acer_aspire_8930g_verbs
,
9914 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9915 .dac_nids
= alc883_dac_nids
,
9916 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
9917 .adc_nids
= alc889_adc_nids
,
9918 .capsrc_nids
= alc889_capsrc_nids
,
9919 .dig_out_nid
= ALC883_DIGOUT_NID
,
9920 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9921 .channel_mode
= alc883_3ST_6ch_modes
,
9923 .const_channel_count
= 6,
9925 ARRAY_SIZE(alc889_capture_sources
),
9926 .input_mux
= alc889_capture_sources
,
9927 .unsol_event
= alc_automute_amp_unsol_event
,
9928 .setup
= alc889_acer_aspire_8930g_setup
,
9929 .init_hook
= alc_automute_amp
,
9930 #ifdef CONFIG_SND_HDA_POWER_SAVE
9931 .power_hook
= alc_power_eapd
,
9934 [ALC888_ACER_ASPIRE_7730G
] = {
9935 .mixers
= { alc883_3ST_6ch_mixer
,
9936 alc883_chmode_mixer
},
9937 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
9938 alc888_acer_aspire_7730G_verbs
},
9939 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9940 .dac_nids
= alc883_dac_nids
,
9941 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9942 .adc_nids
= alc883_adc_nids_rev
,
9943 .capsrc_nids
= alc883_capsrc_nids_rev
,
9944 .dig_out_nid
= ALC883_DIGOUT_NID
,
9945 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9946 .channel_mode
= alc883_3ST_6ch_modes
,
9948 .const_channel_count
= 6,
9949 .input_mux
= &alc883_capture_source
,
9950 .unsol_event
= alc_automute_amp_unsol_event
,
9951 .setup
= alc888_acer_aspire_6530g_setup
,
9952 .init_hook
= alc_automute_amp
,
9955 .mixers
= { alc883_fivestack_mixer
,
9956 alc883_chmode_mixer
},
9957 .init_verbs
= { alc883_init_verbs
,
9958 alc883_medion_eapd_verbs
},
9959 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9960 .dac_nids
= alc883_dac_nids
,
9961 .adc_nids
= alc883_adc_nids_alt
,
9962 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
9963 .capsrc_nids
= alc883_capsrc_nids
,
9964 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9965 .channel_mode
= alc883_sixstack_modes
,
9966 .input_mux
= &alc883_capture_source
,
9968 [ALC883_MEDION_MD2
] = {
9969 .mixers
= { alc883_medion_md2_mixer
},
9970 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
9971 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9972 .dac_nids
= alc883_dac_nids
,
9973 .dig_out_nid
= ALC883_DIGOUT_NID
,
9974 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9975 .channel_mode
= alc883_3ST_2ch_modes
,
9976 .input_mux
= &alc883_capture_source
,
9977 .unsol_event
= alc_automute_amp_unsol_event
,
9978 .setup
= alc883_medion_md2_setup
,
9979 .init_hook
= alc_automute_amp
,
9981 [ALC883_MEDION_WIM2160
] = {
9982 .mixers
= { alc883_medion_wim2160_mixer
},
9983 .init_verbs
= { alc883_init_verbs
, alc883_medion_wim2160_verbs
},
9984 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9985 .dac_nids
= alc883_dac_nids
,
9986 .dig_out_nid
= ALC883_DIGOUT_NID
,
9987 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
9988 .adc_nids
= alc883_adc_nids
,
9989 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9990 .channel_mode
= alc883_3ST_2ch_modes
,
9991 .input_mux
= &alc883_capture_source
,
9992 .unsol_event
= alc_automute_amp_unsol_event
,
9993 .setup
= alc883_medion_wim2160_setup
,
9994 .init_hook
= alc_automute_amp
,
9996 [ALC883_LAPTOP_EAPD
] = {
9997 .mixers
= { alc883_base_mixer
},
9998 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
9999 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10000 .dac_nids
= alc883_dac_nids
,
10001 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10002 .channel_mode
= alc883_3ST_2ch_modes
,
10003 .input_mux
= &alc883_capture_source
,
10005 [ALC883_CLEVO_M540R
] = {
10006 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10007 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m540r_verbs
},
10008 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10009 .dac_nids
= alc883_dac_nids
,
10010 .dig_out_nid
= ALC883_DIGOUT_NID
,
10011 .dig_in_nid
= ALC883_DIGIN_NID
,
10012 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_clevo_modes
),
10013 .channel_mode
= alc883_3ST_6ch_clevo_modes
,
10015 .input_mux
= &alc883_capture_source
,
10016 /* This machine has the hardware HP auto-muting, thus
10017 * we need no software mute via unsol event
10020 [ALC883_CLEVO_M720
] = {
10021 .mixers
= { alc883_clevo_m720_mixer
},
10022 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
10023 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10024 .dac_nids
= alc883_dac_nids
,
10025 .dig_out_nid
= ALC883_DIGOUT_NID
,
10026 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10027 .channel_mode
= alc883_3ST_2ch_modes
,
10028 .input_mux
= &alc883_capture_source
,
10029 .unsol_event
= alc883_clevo_m720_unsol_event
,
10030 .setup
= alc883_clevo_m720_setup
,
10031 .init_hook
= alc883_clevo_m720_init_hook
,
10033 [ALC883_LENOVO_101E_2ch
] = {
10034 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
10035 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
10036 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10037 .dac_nids
= alc883_dac_nids
,
10038 .adc_nids
= alc883_adc_nids_alt
,
10039 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
10040 .capsrc_nids
= alc883_capsrc_nids
,
10041 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10042 .channel_mode
= alc883_3ST_2ch_modes
,
10043 .input_mux
= &alc883_lenovo_101e_capture_source
,
10044 .unsol_event
= alc883_lenovo_101e_unsol_event
,
10045 .init_hook
= alc883_lenovo_101e_all_automute
,
10047 [ALC883_LENOVO_NB0763
] = {
10048 .mixers
= { alc883_lenovo_nb0763_mixer
},
10049 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
10050 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10051 .dac_nids
= alc883_dac_nids
,
10052 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10053 .channel_mode
= alc883_3ST_2ch_modes
,
10055 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
10056 .unsol_event
= alc_automute_amp_unsol_event
,
10057 .setup
= alc883_medion_md2_setup
,
10058 .init_hook
= alc_automute_amp
,
10060 [ALC888_LENOVO_MS7195_DIG
] = {
10061 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10062 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
10063 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10064 .dac_nids
= alc883_dac_nids
,
10065 .dig_out_nid
= ALC883_DIGOUT_NID
,
10066 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10067 .channel_mode
= alc883_3ST_6ch_modes
,
10069 .input_mux
= &alc883_capture_source
,
10070 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
10071 .init_hook
= alc888_lenovo_ms7195_front_automute
,
10073 [ALC883_HAIER_W66
] = {
10074 .mixers
= { alc883_targa_2ch_mixer
},
10075 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
10076 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10077 .dac_nids
= alc883_dac_nids
,
10078 .dig_out_nid
= ALC883_DIGOUT_NID
,
10079 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10080 .channel_mode
= alc883_3ST_2ch_modes
,
10081 .input_mux
= &alc883_capture_source
,
10082 .unsol_event
= alc_automute_amp_unsol_event
,
10083 .setup
= alc883_haier_w66_setup
,
10084 .init_hook
= alc_automute_amp
,
10086 [ALC888_3ST_HP
] = {
10087 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10088 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
10089 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10090 .dac_nids
= alc883_dac_nids
,
10091 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
10092 .channel_mode
= alc888_3st_hp_modes
,
10094 .input_mux
= &alc883_capture_source
,
10095 .unsol_event
= alc_automute_amp_unsol_event
,
10096 .setup
= alc888_3st_hp_setup
,
10097 .init_hook
= alc_automute_amp
,
10099 [ALC888_6ST_DELL
] = {
10100 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10101 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
10102 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10103 .dac_nids
= alc883_dac_nids
,
10104 .dig_out_nid
= ALC883_DIGOUT_NID
,
10105 .dig_in_nid
= ALC883_DIGIN_NID
,
10106 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10107 .channel_mode
= alc883_sixstack_modes
,
10108 .input_mux
= &alc883_capture_source
,
10109 .unsol_event
= alc_automute_amp_unsol_event
,
10110 .setup
= alc888_6st_dell_setup
,
10111 .init_hook
= alc_automute_amp
,
10114 .mixers
= { alc883_mitac_mixer
},
10115 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
10116 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10117 .dac_nids
= alc883_dac_nids
,
10118 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10119 .channel_mode
= alc883_3ST_2ch_modes
,
10120 .input_mux
= &alc883_capture_source
,
10121 .unsol_event
= alc_automute_amp_unsol_event
,
10122 .setup
= alc883_mitac_setup
,
10123 .init_hook
= alc_automute_amp
,
10125 [ALC883_FUJITSU_PI2515
] = {
10126 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
10127 .init_verbs
= { alc883_init_verbs
,
10128 alc883_2ch_fujitsu_pi2515_verbs
},
10129 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10130 .dac_nids
= alc883_dac_nids
,
10131 .dig_out_nid
= ALC883_DIGOUT_NID
,
10132 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10133 .channel_mode
= alc883_3ST_2ch_modes
,
10134 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10135 .unsol_event
= alc_automute_amp_unsol_event
,
10136 .setup
= alc883_2ch_fujitsu_pi2515_setup
,
10137 .init_hook
= alc_automute_amp
,
10139 [ALC888_FUJITSU_XA3530
] = {
10140 .mixers
= { alc888_base_mixer
, alc883_chmode_mixer
},
10141 .init_verbs
= { alc883_init_verbs
,
10142 alc888_fujitsu_xa3530_verbs
},
10143 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10144 .dac_nids
= alc883_dac_nids
,
10145 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
10146 .adc_nids
= alc883_adc_nids_rev
,
10147 .capsrc_nids
= alc883_capsrc_nids_rev
,
10148 .dig_out_nid
= ALC883_DIGOUT_NID
,
10149 .num_channel_mode
= ARRAY_SIZE(alc888_4ST_8ch_intel_modes
),
10150 .channel_mode
= alc888_4ST_8ch_intel_modes
,
10152 ARRAY_SIZE(alc888_2_capture_sources
),
10153 .input_mux
= alc888_2_capture_sources
,
10154 .unsol_event
= alc_automute_amp_unsol_event
,
10155 .setup
= alc888_fujitsu_xa3530_setup
,
10156 .init_hook
= alc_automute_amp
,
10158 [ALC888_LENOVO_SKY
] = {
10159 .mixers
= { alc888_lenovo_sky_mixer
, alc883_chmode_mixer
},
10160 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_sky_verbs
},
10161 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10162 .dac_nids
= alc883_dac_nids
,
10163 .dig_out_nid
= ALC883_DIGOUT_NID
,
10164 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10165 .channel_mode
= alc883_sixstack_modes
,
10167 .input_mux
= &alc883_lenovo_sky_capture_source
,
10168 .unsol_event
= alc_automute_amp_unsol_event
,
10169 .setup
= alc888_lenovo_sky_setup
,
10170 .init_hook
= alc_automute_amp
,
10172 [ALC888_ASUS_M90V
] = {
10173 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
10174 .init_verbs
= { alc883_init_verbs
, alc888_asus_m90v_verbs
},
10175 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10176 .dac_nids
= alc883_dac_nids
,
10177 .dig_out_nid
= ALC883_DIGOUT_NID
,
10178 .dig_in_nid
= ALC883_DIGIN_NID
,
10179 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
10180 .channel_mode
= alc883_3ST_6ch_modes
,
10182 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
10183 .unsol_event
= alc_sku_unsol_event
,
10184 .setup
= alc883_mode2_setup
,
10185 .init_hook
= alc_inithook
,
10187 [ALC888_ASUS_EEE1601
] = {
10188 .mixers
= { alc883_asus_eee1601_mixer
},
10189 .cap_mixer
= alc883_asus_eee1601_cap_mixer
,
10190 .init_verbs
= { alc883_init_verbs
, alc888_asus_eee1601_verbs
},
10191 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10192 .dac_nids
= alc883_dac_nids
,
10193 .dig_out_nid
= ALC883_DIGOUT_NID
,
10194 .dig_in_nid
= ALC883_DIGIN_NID
,
10195 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10196 .channel_mode
= alc883_3ST_2ch_modes
,
10198 .input_mux
= &alc883_asus_eee1601_capture_source
,
10199 .unsol_event
= alc_sku_unsol_event
,
10200 .init_hook
= alc883_eee1601_inithook
,
10202 [ALC1200_ASUS_P5Q
] = {
10203 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
10204 .init_verbs
= { alc883_init_verbs
},
10205 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10206 .dac_nids
= alc883_dac_nids
,
10207 .dig_out_nid
= ALC1200_DIGOUT_NID
,
10208 .dig_in_nid
= ALC883_DIGIN_NID
,
10209 .slave_dig_outs
= alc1200_slave_dig_outs
,
10210 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
10211 .channel_mode
= alc883_sixstack_modes
,
10212 .input_mux
= &alc883_capture_source
,
10215 .mixers
= { alc889A_mb31_mixer
, alc883_chmode_mixer
},
10216 .init_verbs
= { alc883_init_verbs
, alc889A_mb31_verbs
,
10217 alc880_gpio1_init_verbs
},
10218 .adc_nids
= alc883_adc_nids
,
10219 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
10220 .capsrc_nids
= alc883_capsrc_nids
,
10221 .dac_nids
= alc883_dac_nids
,
10222 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10223 .channel_mode
= alc889A_mb31_6ch_modes
,
10224 .num_channel_mode
= ARRAY_SIZE(alc889A_mb31_6ch_modes
),
10225 .input_mux
= &alc889A_mb31_capture_source
,
10226 .dig_out_nid
= ALC883_DIGOUT_NID
,
10227 .unsol_event
= alc889A_mb31_unsol_event
,
10228 .init_hook
= alc889A_mb31_automute
,
10230 [ALC883_SONY_VAIO_TT
] = {
10231 .mixers
= { alc883_vaiott_mixer
},
10232 .init_verbs
= { alc883_init_verbs
, alc883_vaiott_verbs
},
10233 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
10234 .dac_nids
= alc883_dac_nids
,
10235 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10236 .channel_mode
= alc883_3ST_2ch_modes
,
10237 .input_mux
= &alc883_capture_source
,
10238 .unsol_event
= alc_automute_amp_unsol_event
,
10239 .setup
= alc883_vaiott_setup
,
10240 .init_hook
= alc_automute_amp
,
10249 PINFIX_ABIT_AW9D_MAX
10252 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
10253 { 0x15, 0x01080104 }, /* side */
10254 { 0x16, 0x01011012 }, /* rear */
10255 { 0x17, 0x01016011 }, /* clfe */
10259 static const struct alc_fixup alc882_fixups
[] = {
10260 [PINFIX_ABIT_AW9D_MAX
] = {
10261 .pins
= alc882_abit_aw9d_pinfix
10265 static struct snd_pci_quirk alc882_fixup_tbl
[] = {
10266 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
10271 * BIOS auto configuration
10273 static int alc882_auto_create_input_ctls(struct hda_codec
*codec
,
10274 const struct auto_pin_cfg
*cfg
)
10276 return alc_auto_create_input_ctls(codec
, cfg
, 0x0b, 0x23, 0x22);
10279 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
10280 hda_nid_t nid
, int pin_type
,
10285 /* set as output */
10286 alc_set_pin_output(codec
, nid
, pin_type
);
10290 else if (dac
>= 0x02 && dac
<= 0x05)
10294 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
10297 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
10299 struct alc_spec
*spec
= codec
->spec
;
10302 for (i
= 0; i
<= HDA_SIDE
; i
++) {
10303 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
10304 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
10306 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
10307 spec
->multiout
.dac_nids
[i
]);
10311 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
10313 struct alc_spec
*spec
= codec
->spec
;
10314 hda_nid_t pin
, dac
;
10316 pin
= spec
->autocfg
.hp_pins
[0];
10318 dac
= spec
->multiout
.hp_nid
;
10320 dac
= spec
->multiout
.dac_nids
[0]; /* to front */
10321 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, dac
);
10323 pin
= spec
->autocfg
.speaker_pins
[0];
10325 dac
= spec
->multiout
.extra_out_nid
[0];
10327 dac
= spec
->multiout
.dac_nids
[0]; /* to front */
10328 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, dac
);
10332 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
10334 struct alc_spec
*spec
= codec
->spec
;
10337 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
10338 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
10341 alc_set_input_pin(codec
, nid
, i
);
10342 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
10343 snd_hda_codec_write(codec
, nid
, 0,
10344 AC_VERB_SET_AMP_GAIN_MUTE
,
10349 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
10351 struct alc_spec
*spec
= codec
->spec
;
10354 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
10355 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
10356 hda_nid_t nid
= spec
->capsrc_nids
[c
];
10357 unsigned int mux_idx
;
10358 const struct hda_input_mux
*imux
;
10359 int conns
, mute
, idx
, item
;
10361 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
10362 ARRAY_SIZE(conn_list
));
10365 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
10366 imux
= &spec
->input_mux
[mux_idx
];
10367 if (!imux
->num_items
&& mux_idx
> 0)
10368 imux
= &spec
->input_mux
[0];
10369 for (idx
= 0; idx
< conns
; idx
++) {
10370 /* if the current connection is the selected one,
10371 * unmute it as default - otherwise mute it
10373 mute
= AMP_IN_MUTE(idx
);
10374 for (item
= 0; item
< imux
->num_items
; item
++) {
10375 if (imux
->items
[item
].index
== idx
) {
10376 if (spec
->cur_mux
[c
] == item
)
10377 mute
= AMP_IN_UNMUTE(idx
);
10381 /* check if we have a selector or mixer
10382 * we could check for the widget type instead, but
10383 * just check for Amp-In presence (in case of mixer
10384 * without amp-in there is something wrong, this
10385 * function shouldn't be used or capsrc nid is wrong)
10387 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)
10388 snd_hda_codec_write(codec
, nid
, 0,
10389 AC_VERB_SET_AMP_GAIN_MUTE
,
10391 else if (mute
!= AMP_IN_MUTE(idx
))
10392 snd_hda_codec_write(codec
, nid
, 0,
10393 AC_VERB_SET_CONNECT_SEL
,
10399 /* add mic boosts if needed */
10400 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
10402 struct alc_spec
*spec
= codec
->spec
;
10406 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
10407 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
10408 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10410 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
10414 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
10415 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
10416 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10418 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
10425 /* almost identical with ALC880 parser... */
10426 static int alc882_parse_auto_config(struct hda_codec
*codec
)
10428 struct alc_spec
*spec
= codec
->spec
;
10429 static hda_nid_t alc882_ignore
[] = { 0x1d, 0 };
10432 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10436 if (!spec
->autocfg
.line_outs
)
10437 return 0; /* can't find valid BIOS pin config */
10439 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
10442 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10445 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
10449 err
= alc880_auto_create_extra_out(spec
,
10450 spec
->autocfg
.speaker_pins
[0],
10454 err
= alc882_auto_create_input_ctls(codec
, &spec
->autocfg
);
10458 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
10460 /* check multiple SPDIF-out (for recent codecs) */
10461 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
10463 err
= snd_hda_get_connections(codec
,
10464 spec
->autocfg
.dig_out_pins
[i
],
10469 spec
->multiout
.dig_out_nid
= dig_nid
;
10471 spec
->multiout
.slave_dig_outs
= spec
->slave_dig_outs
;
10472 if (i
>= ARRAY_SIZE(spec
->slave_dig_outs
) - 1)
10474 spec
->slave_dig_outs
[i
- 1] = dig_nid
;
10477 if (spec
->autocfg
.dig_in_pin
)
10478 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
10480 if (spec
->kctls
.list
)
10481 add_mixer(spec
, spec
->kctls
.list
);
10483 add_verb(spec
, alc883_auto_init_verbs
);
10484 /* if ADC 0x07 is available, initialize it, too */
10485 if (get_wcaps_type(get_wcaps(codec
, 0x07)) == AC_WID_AUD_IN
)
10486 add_verb(spec
, alc882_adc1_init_verbs
);
10488 spec
->num_mux_defs
= 1;
10489 spec
->input_mux
= &spec
->private_imux
[0];
10491 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
10493 err
= alc_auto_add_mic_boost(codec
);
10497 return 1; /* config found */
10500 /* additional initialization for auto-configuration model */
10501 static void alc882_auto_init(struct hda_codec
*codec
)
10503 struct alc_spec
*spec
= codec
->spec
;
10504 alc882_auto_init_multi_out(codec
);
10505 alc882_auto_init_hp_out(codec
);
10506 alc882_auto_init_analog_input(codec
);
10507 alc882_auto_init_input_src(codec
);
10508 if (spec
->unsol_event
)
10509 alc_inithook(codec
);
10512 static int patch_alc882(struct hda_codec
*codec
)
10514 struct alc_spec
*spec
;
10515 int err
, board_config
;
10517 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10521 codec
->spec
= spec
;
10523 alc_auto_parse_customize_define(codec
);
10525 switch (codec
->vendor_id
) {
10530 /* ALC883 and variants */
10531 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
10535 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
10539 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
)
10540 board_config
= snd_hda_check_board_codec_sid_config(codec
,
10541 ALC882_MODEL_LAST
, alc882_models
, alc882_ssid_cfg_tbl
);
10543 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
10544 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
10546 board_config
= ALC882_AUTO
;
10549 if (board_config
== ALC882_AUTO
)
10550 alc_pick_fixup(codec
, alc882_fixup_tbl
, alc882_fixups
, 1);
10552 if (board_config
== ALC882_AUTO
) {
10553 /* automatic parse from the BIOS config */
10554 err
= alc882_parse_auto_config(codec
);
10560 "hda_codec: Cannot set up configuration "
10561 "from BIOS. Using base mode...\n");
10562 board_config
= ALC882_3ST_DIG
;
10566 err
= snd_hda_attach_beep_device(codec
, 0x1);
10572 if (board_config
!= ALC882_AUTO
)
10573 setup_preset(codec
, &alc882_presets
[board_config
]);
10575 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
10576 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
10577 /* FIXME: setup DAC5 */
10578 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10579 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
10581 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
10582 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
10584 if (!spec
->adc_nids
&& spec
->input_mux
) {
10586 spec
->num_adc_nids
= 0;
10587 for (i
= 0; i
< ARRAY_SIZE(alc882_adc_nids
); i
++) {
10588 const struct hda_input_mux
*imux
= spec
->input_mux
;
10590 hda_nid_t items
[16];
10591 hda_nid_t nid
= alc882_adc_nids
[i
];
10592 unsigned int wcap
= get_wcaps(codec
, nid
);
10594 wcap
= get_wcaps_type(wcap
);
10595 if (wcap
!= AC_WID_AUD_IN
)
10597 spec
->private_adc_nids
[spec
->num_adc_nids
] = nid
;
10598 err
= snd_hda_get_connections(codec
, nid
, &cap
, 1);
10601 err
= snd_hda_get_connections(codec
, cap
, items
,
10602 ARRAY_SIZE(items
));
10605 for (j
= 0; j
< imux
->num_items
; j
++)
10606 if (imux
->items
[j
].index
>= err
)
10608 if (j
< imux
->num_items
)
10610 spec
->private_capsrc_nids
[spec
->num_adc_nids
] = cap
;
10611 spec
->num_adc_nids
++;
10613 spec
->adc_nids
= spec
->private_adc_nids
;
10614 spec
->capsrc_nids
= spec
->private_capsrc_nids
;
10617 set_capture_mixer(codec
);
10619 if (spec
->cdefine
.enable_pcbeep
)
10620 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
10622 if (board_config
== ALC882_AUTO
)
10623 alc_pick_fixup(codec
, alc882_fixup_tbl
, alc882_fixups
, 0);
10625 spec
->vmaster_nid
= 0x0c;
10627 codec
->patch_ops
= alc_patch_ops
;
10628 if (board_config
== ALC882_AUTO
)
10629 spec
->init_hook
= alc882_auto_init
;
10630 #ifdef CONFIG_SND_HDA_POWER_SAVE
10631 if (!spec
->loopback
.amplist
)
10632 spec
->loopback
.amplist
= alc882_loopbacks
;
10643 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10644 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10646 #define alc262_dac_nids alc260_dac_nids
10647 #define alc262_adc_nids alc882_adc_nids
10648 #define alc262_adc_nids_alt alc882_adc_nids_alt
10649 #define alc262_capsrc_nids alc882_capsrc_nids
10650 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10652 #define alc262_modes alc260_modes
10653 #define alc262_capture_source alc882_capture_source
10655 static hda_nid_t alc262_dmic_adc_nids
[1] = {
10660 static hda_nid_t alc262_dmic_capsrc_nids
[1] = { 0x22 };
10662 static struct snd_kcontrol_new alc262_base_mixer
[] = {
10663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10664 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10665 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10666 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10667 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10668 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10671 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10672 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10673 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10674 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10675 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
10676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10677 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
10678 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
10682 /* update HP, line and mono-out pins according to the master switch */
10683 static void alc262_hp_master_update(struct hda_codec
*codec
)
10685 struct alc_spec
*spec
= codec
->spec
;
10686 int val
= spec
->master_sw
;
10688 /* HP & line-out */
10689 snd_hda_codec_write_cache(codec
, 0x1b, 0,
10690 AC_VERB_SET_PIN_WIDGET_CONTROL
,
10692 snd_hda_codec_write_cache(codec
, 0x15, 0,
10693 AC_VERB_SET_PIN_WIDGET_CONTROL
,
10695 /* mono (speaker) depending on the HP jack sense */
10696 val
= val
&& !spec
->jack_present
;
10697 snd_hda_codec_write_cache(codec
, 0x16, 0,
10698 AC_VERB_SET_PIN_WIDGET_CONTROL
,
10699 val
? PIN_OUT
: 0);
10702 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
10704 struct alc_spec
*spec
= codec
->spec
;
10706 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x1b);
10707 alc262_hp_master_update(codec
);
10710 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
10712 if ((res
>> 26) != ALC880_HP_EVENT
)
10714 alc262_hp_bpc_automute(codec
);
10717 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
10719 struct alc_spec
*spec
= codec
->spec
;
10721 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
10722 alc262_hp_master_update(codec
);
10725 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
10728 if ((res
>> 26) != ALC880_HP_EVENT
)
10730 alc262_hp_wildwest_automute(codec
);
10733 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10735 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
10736 struct snd_ctl_elem_value
*ucontrol
)
10738 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10739 struct alc_spec
*spec
= codec
->spec
;
10740 int val
= !!*ucontrol
->value
.integer
.value
;
10742 if (val
== spec
->master_sw
)
10744 spec
->master_sw
= val
;
10745 alc262_hp_master_update(codec
);
10749 #define ALC262_HP_MASTER_SWITCH \
10751 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10752 .name = "Master Playback Switch", \
10753 .info = snd_ctl_boolean_mono_info, \
10754 .get = alc262_hp_master_sw_get, \
10755 .put = alc262_hp_master_sw_put, \
10758 .iface = NID_MAPPING, \
10759 .name = "Master Playback Switch", \
10760 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10764 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
10765 ALC262_HP_MASTER_SWITCH
,
10766 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10767 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10769 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10771 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10775 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10776 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10777 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10778 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10779 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10780 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10781 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10782 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10783 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
10784 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
10788 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
10789 ALC262_HP_MASTER_SWITCH
,
10790 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10791 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10792 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
10793 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10794 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10796 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10798 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10799 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10800 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
10801 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10802 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10803 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10804 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10808 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
10809 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10810 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10811 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
10815 /* mute/unmute internal speaker according to the hp jack and mute state */
10816 static void alc262_hp_t5735_setup(struct hda_codec
*codec
)
10818 struct alc_spec
*spec
= codec
->spec
;
10820 spec
->autocfg
.hp_pins
[0] = 0x15;
10821 spec
->autocfg
.speaker_pins
[0] = 0x14;
10824 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
10825 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10826 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10827 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
10828 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10830 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10831 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10835 static struct hda_verb alc262_hp_t5735_verbs
[] = {
10836 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10839 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10843 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
10844 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10845 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10846 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
10847 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
10848 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10849 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10853 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
10854 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10855 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10856 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10857 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10858 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10859 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10860 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
10861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
10862 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
10863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
10867 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
10874 /* bind hp and internal speaker mute (with plug check) as master switch */
10875 static void alc262_hippo_master_update(struct hda_codec
*codec
)
10877 struct alc_spec
*spec
= codec
->spec
;
10878 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
10879 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
10880 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
10884 mute
= spec
->master_sw
? 0 : HDA_AMP_MUTE
;
10885 snd_hda_codec_amp_stereo(codec
, hp_nid
, HDA_OUTPUT
, 0,
10886 HDA_AMP_MUTE
, mute
);
10887 /* mute internal speaker per jack sense */
10888 if (spec
->jack_present
)
10889 mute
= HDA_AMP_MUTE
;
10891 snd_hda_codec_amp_stereo(codec
, line_nid
, HDA_OUTPUT
, 0,
10892 HDA_AMP_MUTE
, mute
);
10893 if (speaker_nid
&& speaker_nid
!= line_nid
)
10894 snd_hda_codec_amp_stereo(codec
, speaker_nid
, HDA_OUTPUT
, 0,
10895 HDA_AMP_MUTE
, mute
);
10898 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10900 static int alc262_hippo_master_sw_put(struct snd_kcontrol
*kcontrol
,
10901 struct snd_ctl_elem_value
*ucontrol
)
10903 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10904 struct alc_spec
*spec
= codec
->spec
;
10905 int val
= !!*ucontrol
->value
.integer
.value
;
10907 if (val
== spec
->master_sw
)
10909 spec
->master_sw
= val
;
10910 alc262_hippo_master_update(codec
);
10914 #define ALC262_HIPPO_MASTER_SWITCH \
10916 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10917 .name = "Master Playback Switch", \
10918 .info = snd_ctl_boolean_mono_info, \
10919 .get = alc262_hippo_master_sw_get, \
10920 .put = alc262_hippo_master_sw_put, \
10923 .iface = NID_MAPPING, \
10924 .name = "Master Playback Switch", \
10925 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10926 (SUBDEV_SPEAKER(0) << 16), \
10929 static struct snd_kcontrol_new alc262_hippo_mixer
[] = {
10930 ALC262_HIPPO_MASTER_SWITCH
,
10931 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10932 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10933 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10934 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10935 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10936 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10937 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10938 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10939 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10940 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10941 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10942 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
10946 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
10947 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10948 ALC262_HIPPO_MASTER_SWITCH
,
10949 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10950 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10951 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10952 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10954 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10955 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10956 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10957 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10958 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10962 /* mute/unmute internal speaker according to the hp jack and mute state */
10963 static void alc262_hippo_automute(struct hda_codec
*codec
)
10965 struct alc_spec
*spec
= codec
->spec
;
10966 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
10968 spec
->jack_present
= snd_hda_jack_detect(codec
, hp_nid
);
10969 alc262_hippo_master_update(codec
);
10972 static void alc262_hippo_unsol_event(struct hda_codec
*codec
, unsigned int res
)
10974 if ((res
>> 26) != ALC880_HP_EVENT
)
10976 alc262_hippo_automute(codec
);
10979 static void alc262_hippo_setup(struct hda_codec
*codec
)
10981 struct alc_spec
*spec
= codec
->spec
;
10983 spec
->autocfg
.hp_pins
[0] = 0x15;
10984 spec
->autocfg
.speaker_pins
[0] = 0x14;
10987 static void alc262_hippo1_setup(struct hda_codec
*codec
)
10989 struct alc_spec
*spec
= codec
->spec
;
10991 spec
->autocfg
.hp_pins
[0] = 0x1b;
10992 spec
->autocfg
.speaker_pins
[0] = 0x14;
10996 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
10997 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10998 ALC262_HIPPO_MASTER_SWITCH
,
10999 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11000 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11001 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11002 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11006 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
11007 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11008 ALC262_HIPPO_MASTER_SWITCH
,
11009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11011 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11012 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11013 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11017 static struct snd_kcontrol_new alc262_tyan_mixer
[] = {
11018 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11019 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
11020 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT
),
11021 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT
),
11022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11023 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11024 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11025 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11026 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11027 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11028 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11029 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
11033 static struct hda_verb alc262_tyan_verbs
[] = {
11034 /* Headphone automute */
11035 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11036 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11037 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11039 /* P11 AUX_IN, white 4-pin connector */
11040 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11041 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
, 0xe1},
11042 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
, 0x93},
11043 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
, 0x19},
11048 /* unsolicited event for HP jack sensing */
11049 static void alc262_tyan_setup(struct hda_codec
*codec
)
11051 struct alc_spec
*spec
= codec
->spec
;
11053 spec
->autocfg
.hp_pins
[0] = 0x1b;
11054 spec
->autocfg
.speaker_pins
[0] = 0x15;
11058 #define alc262_capture_mixer alc882_capture_mixer
11059 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11062 * generic initialization of ADC, input mixers and output mixers
11064 static struct hda_verb alc262_init_verbs
[] = {
11066 * Unmute ADC0-2 and set the default input to mic-in
11068 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11069 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11070 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11071 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11072 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11073 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11075 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11077 * Note: PASD motherboards uses the Line In 2 as the input for
11078 * front panel mic (mic 2)
11080 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11088 * Set up output mixers (0x0c - 0x0e)
11090 /* set vol=0 to output mixers */
11091 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11092 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11093 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11094 /* set up input amps for analog loopback */
11095 /* Amp Indices: DAC = 0, mixer = 1 */
11096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11098 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11099 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11100 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11101 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11103 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11104 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11105 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11106 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11107 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11108 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11110 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11112 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11113 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11114 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11116 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11117 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11119 /* FIXME: use matrix-type input source selection */
11120 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11121 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11122 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11123 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11124 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11125 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11127 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11128 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11129 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11130 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11133 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11135 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11140 static struct hda_verb alc262_eapd_verbs
[] = {
11141 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11142 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11146 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
11147 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11148 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11149 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
11151 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11152 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11156 static struct hda_verb alc262_sony_unsol_verbs
[] = {
11157 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11158 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11159 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
11161 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11162 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11166 static struct snd_kcontrol_new alc262_toshiba_s06_mixer
[] = {
11167 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11168 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11169 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11175 static struct hda_verb alc262_toshiba_s06_verbs
[] = {
11176 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11177 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11179 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11180 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x09},
11181 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11182 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11183 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11187 static void alc262_toshiba_s06_setup(struct hda_codec
*codec
)
11189 struct alc_spec
*spec
= codec
->spec
;
11191 spec
->autocfg
.hp_pins
[0] = 0x15;
11192 spec
->autocfg
.speaker_pins
[0] = 0x14;
11193 spec
->ext_mic
.pin
= 0x18;
11194 spec
->ext_mic
.mux_idx
= 0;
11195 spec
->int_mic
.pin
= 0x12;
11196 spec
->int_mic
.mux_idx
= 9;
11197 spec
->auto_mic
= 1;
11203 * 0x16 = internal speaker
11204 * 0x18 = external mic
11207 static struct snd_kcontrol_new alc262_nec_mixer
[] = {
11208 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
11209 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
11211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11213 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11215 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
11216 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11220 static struct hda_verb alc262_nec_verbs
[] = {
11221 /* Unmute Speaker */
11222 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11225 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11226 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11228 /* External mic to headphone */
11229 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11230 /* External mic to speaker */
11231 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11237 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11238 * 0x1b = port replicator headphone out
11241 #define ALC_HP_EVENT 0x37
11243 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
11244 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11245 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11246 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11247 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11251 static struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
11252 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
11253 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11257 static struct hda_verb alc262_lenovo_3000_init_verbs
[] = {
11258 /* Front Mic pin: input vref at 50% */
11259 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11260 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11264 static struct hda_input_mux alc262_fujitsu_capture_source
= {
11268 { "Int Mic", 0x1 },
11273 static struct hda_input_mux alc262_HP_capture_source
= {
11277 { "Front Mic", 0x1 },
11284 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
11288 { "Front Mic", 0x2 },
11294 /* mute/unmute internal speaker according to the hp jacks and mute state */
11295 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
11297 struct alc_spec
*spec
= codec
->spec
;
11300 if (force
|| !spec
->sense_updated
) {
11301 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x14) ||
11302 snd_hda_jack_detect(codec
, 0x1b);
11303 spec
->sense_updated
= 1;
11305 /* unmute internal speaker only if both HPs are unplugged and
11306 * master switch is on
11308 if (spec
->jack_present
)
11309 mute
= HDA_AMP_MUTE
;
11311 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
11312 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
11313 HDA_AMP_MUTE
, mute
);
11316 /* unsolicited event for HP jack sensing */
11317 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
11320 if ((res
>> 26) != ALC_HP_EVENT
)
11322 alc262_fujitsu_automute(codec
, 1);
11325 static void alc262_fujitsu_init_hook(struct hda_codec
*codec
)
11327 alc262_fujitsu_automute(codec
, 1);
11330 /* bind volumes of both NID 0x0c and 0x0d */
11331 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
11332 .ops
= &snd_hda_bind_vol
,
11334 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
11335 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
11340 /* mute/unmute internal speaker according to the hp jack and mute state */
11341 static void alc262_lenovo_3000_automute(struct hda_codec
*codec
, int force
)
11343 struct alc_spec
*spec
= codec
->spec
;
11346 if (force
|| !spec
->sense_updated
) {
11347 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x1b);
11348 spec
->sense_updated
= 1;
11350 if (spec
->jack_present
) {
11351 /* mute internal speaker */
11352 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11353 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
11354 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
11355 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
11357 /* unmute internal speaker if necessary */
11358 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
11359 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11360 HDA_AMP_MUTE
, mute
);
11361 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
11362 HDA_AMP_MUTE
, mute
);
11366 /* unsolicited event for HP jack sensing */
11367 static void alc262_lenovo_3000_unsol_event(struct hda_codec
*codec
,
11370 if ((res
>> 26) != ALC_HP_EVENT
)
11372 alc262_lenovo_3000_automute(codec
, 1);
11375 static int amp_stereo_mute_update(struct hda_codec
*codec
, hda_nid_t nid
,
11376 int dir
, int idx
, long *valp
)
11380 for (i
= 0; i
< 2; i
++, valp
++)
11381 change
|= snd_hda_codec_amp_update(codec
, nid
, i
, dir
, idx
,
11383 *valp
? 0 : HDA_AMP_MUTE
);
11387 /* bind hp and internal speaker mute (with plug check) */
11388 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
11389 struct snd_ctl_elem_value
*ucontrol
)
11391 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11392 long *valp
= ucontrol
->value
.integer
.value
;
11395 change
= amp_stereo_mute_update(codec
, 0x14, HDA_OUTPUT
, 0, valp
);
11396 change
|= amp_stereo_mute_update(codec
, 0x1b, HDA_OUTPUT
, 0, valp
);
11398 alc262_fujitsu_automute(codec
, 0);
11402 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
11403 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11405 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11406 .name
= "Master Playback Switch",
11407 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
11408 .info
= snd_hda_mixer_amp_switch_info
,
11409 .get
= snd_hda_mixer_amp_switch_get
,
11410 .put
= alc262_fujitsu_master_sw_put
,
11411 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11414 .iface
= NID_MAPPING
,
11415 .name
= "Master Playback Switch",
11416 .private_value
= 0x1b,
11418 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11419 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11420 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11421 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11422 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11423 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
11424 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11425 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11429 /* bind hp and internal speaker mute (with plug check) */
11430 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol
*kcontrol
,
11431 struct snd_ctl_elem_value
*ucontrol
)
11433 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11434 long *valp
= ucontrol
->value
.integer
.value
;
11437 change
= amp_stereo_mute_update(codec
, 0x1b, HDA_OUTPUT
, 0, valp
);
11439 alc262_lenovo_3000_automute(codec
, 0);
11443 static struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
11444 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11446 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11447 .name
= "Master Playback Switch",
11448 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
11449 .info
= snd_hda_mixer_amp_switch_info
,
11450 .get
= snd_hda_mixer_amp_switch_get
,
11451 .put
= alc262_lenovo_3000_master_sw_put
,
11452 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
11454 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11455 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11456 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11457 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11458 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11459 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
11460 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11461 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11465 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer
[] = {
11466 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
11467 ALC262_HIPPO_MASTER_SWITCH
,
11468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11470 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11471 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11472 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11473 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
11477 /* additional init verbs for Benq laptops */
11478 static struct hda_verb alc262_EAPD_verbs
[] = {
11479 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
11480 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
11484 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
11485 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11486 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11488 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
11489 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
11493 /* Samsung Q1 Ultra Vista model setup */
11494 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
11495 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
11496 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
11497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11498 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11499 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
11500 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT
),
11504 static struct hda_verb alc262_ultra_verbs
[] = {
11506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11511 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11513 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11518 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11519 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11521 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11523 /* ADC, choose mic */
11524 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11525 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11526 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11527 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11529 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
11531 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
11532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
11533 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
11537 /* mute/unmute internal speaker according to the hp jack and mute state */
11538 static void alc262_ultra_automute(struct hda_codec
*codec
)
11540 struct alc_spec
*spec
= codec
->spec
;
11544 /* auto-mute only when HP is used as HP */
11545 if (!spec
->cur_mux
[0]) {
11546 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x15);
11547 if (spec
->jack_present
)
11548 mute
= HDA_AMP_MUTE
;
11550 /* mute/unmute internal speaker */
11551 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11552 HDA_AMP_MUTE
, mute
);
11553 /* mute/unmute HP */
11554 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
11555 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
11558 /* unsolicited event for HP jack sensing */
11559 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
11562 if ((res
>> 26) != ALC880_HP_EVENT
)
11564 alc262_ultra_automute(codec
);
11567 static struct hda_input_mux alc262_ultra_capture_source
= {
11571 { "Headphone", 0x7 },
11575 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
11576 struct snd_ctl_elem_value
*ucontrol
)
11578 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11579 struct alc_spec
*spec
= codec
->spec
;
11582 ret
= alc_mux_enum_put(kcontrol
, ucontrol
);
11585 /* reprogram the HP pin as mic or HP according to the input source */
11586 snd_hda_codec_write_cache(codec
, 0x15, 0,
11587 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11588 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
11589 alc262_ultra_automute(codec
); /* mute/unmute HP */
11593 static struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
11594 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
11595 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
11597 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11598 .name
= "Capture Source",
11599 .info
= alc_mux_enum_info
,
11600 .get
= alc_mux_enum_get
,
11601 .put
= alc262_ultra_mux_enum_put
,
11604 .iface
= NID_MAPPING
,
11605 .name
= "Capture Source",
11606 .private_value
= 0x15,
11611 /* We use two mixers depending on the output pin; 0x16 is a mono output
11612 * and thus it's bound with a different mixer.
11613 * This function returns which mixer amp should be used.
11615 static int alc262_check_volbit(hda_nid_t nid
)
11619 else if (nid
== 0x16)
11625 static int alc262_add_out_vol_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
11626 const char *pfx
, int *vbits
)
11631 vbit
= alc262_check_volbit(nid
);
11634 if (*vbits
& vbit
) /* a volume control for this mixer already there */
11638 val
= HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
);
11640 val
= HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
);
11641 return add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
, val
);
11644 static int alc262_add_out_sw_ctl(struct alc_spec
*spec
, hda_nid_t nid
,
11652 val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
11654 val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
11655 return add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
, val
);
11658 /* add playback controls from the parsed DAC table */
11659 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11660 const struct auto_pin_cfg
*cfg
)
11666 spec
->multiout
.num_dacs
= 1; /* only use one dac */
11667 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
11668 spec
->multiout
.dac_nids
[0] = 2;
11670 if (!cfg
->speaker_pins
[0] && !cfg
->hp_pins
[0])
11672 else if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
11676 err
= alc262_add_out_sw_ctl(spec
, cfg
->line_out_pins
[0], pfx
);
11679 err
= alc262_add_out_sw_ctl(spec
, cfg
->speaker_pins
[0], "Speaker");
11682 err
= alc262_add_out_sw_ctl(spec
, cfg
->hp_pins
[0], "Headphone");
11686 vbits
= alc262_check_volbit(cfg
->line_out_pins
[0]) |
11687 alc262_check_volbit(cfg
->speaker_pins
[0]) |
11688 alc262_check_volbit(cfg
->hp_pins
[0]);
11689 if (vbits
== 1 || vbits
== 2)
11690 pfx
= "Master"; /* only one mixer is used */
11691 else if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
11696 err
= alc262_add_out_vol_ctl(spec
, cfg
->line_out_pins
[0], pfx
, &vbits
);
11699 err
= alc262_add_out_vol_ctl(spec
, cfg
->speaker_pins
[0], "Speaker",
11703 err
= alc262_add_out_vol_ctl(spec
, cfg
->hp_pins
[0], "Headphone",
11710 #define alc262_auto_create_input_ctls \
11711 alc882_auto_create_input_ctls
11714 * generic initialization of ADC, input mixers and output mixers
11716 static struct hda_verb alc262_volume_init_verbs
[] = {
11718 * Unmute ADC0-2 and set the default input to mic-in
11720 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11722 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11723 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11724 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11725 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11727 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11729 * Note: PASD motherboards uses the Line In 2 as the input for
11730 * front panel mic (mic 2)
11732 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11736 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11737 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11740 * Set up output mixers (0x0c - 0x0f)
11742 /* set vol=0 to output mixers */
11743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11745 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11747 /* set up input amps for analog loopback */
11748 /* Amp Indices: DAC = 0, mixer = 1 */
11749 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11750 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11751 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11752 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11753 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11754 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11756 /* FIXME: use matrix-type input source selection */
11757 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11758 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11764 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11765 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11777 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
11779 * Unmute ADC0-2 and set the default input to mic-in
11781 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11783 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11785 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11786 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11788 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11790 * Note: PASD motherboards uses the Line In 2 as the input for
11791 * front panel mic (mic 2)
11793 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11794 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11795 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11796 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
11800 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
11803 * Set up output mixers (0x0c - 0x0e)
11805 /* set vol=0 to output mixers */
11806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11808 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11810 /* set up input amps for analog loopback */
11811 /* Amp Indices: DAC = 0, mixer = 1 */
11812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11815 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11816 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11817 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11819 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11820 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11821 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11823 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11824 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11826 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11827 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11829 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11830 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11831 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11832 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11833 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11835 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11836 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11837 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11838 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11839 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11840 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11843 /* FIXME: use matrix-type input source selection */
11844 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11845 /* Input mixer1: only unmute Mic */
11846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
11848 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11850 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11851 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
11852 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
11853 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
11854 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
11856 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11857 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
11858 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11859 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11860 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11861 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
11862 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
11863 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
11864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
11866 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11867 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
11868 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11869 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
11872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
11873 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
11874 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
11876 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11881 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
11883 * Unmute ADC0-2 and set the default input to mic-in
11885 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11886 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11887 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11888 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11889 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11890 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11892 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11894 * Note: PASD motherboards uses the Line In 2 as the input for front
11895 * panel mic (mic 2)
11897 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11898 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11899 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11900 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11901 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11903 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
11904 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
11905 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
11907 * Set up output mixers (0x0c - 0x0e)
11909 /* set vol=0 to output mixers */
11910 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11911 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11912 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11914 /* set up input amps for analog loopback */
11915 /* Amp Indices: DAC = 0, mixer = 1 */
11916 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11917 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11918 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11920 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11921 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11924 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
11925 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
11926 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
11927 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
11928 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
11929 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
11930 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
11932 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11933 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11935 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11936 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11938 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11939 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11940 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11941 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
11942 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11943 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11945 /* FIXME: use matrix-type input source selection */
11946 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11947 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11948 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11949 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
11950 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
11951 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
11952 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
11953 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11954 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
11956 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11957 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11958 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
11959 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
11960 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
11961 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11962 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
11964 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11965 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
11967 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
11968 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
11969 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
11972 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11977 static struct hda_verb alc262_toshiba_rx1_unsol_verbs
[] = {
11979 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Front Speaker */
11980 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11981 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
11983 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* MIC jack */
11984 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
11985 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
11986 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
11988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP jack */
11989 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11990 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11995 #ifdef CONFIG_SND_HDA_POWER_SAVE
11996 #define alc262_loopbacks alc880_loopbacks
11999 /* pcm configuration: identical with ALC880 */
12000 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12001 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12002 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12003 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12006 * BIOS auto configuration
12008 static int alc262_parse_auto_config(struct hda_codec
*codec
)
12010 struct alc_spec
*spec
= codec
->spec
;
12012 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
12014 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12018 if (!spec
->autocfg
.line_outs
) {
12019 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
12020 spec
->multiout
.max_channels
= 2;
12021 spec
->no_analog
= 1;
12024 return 0; /* can't find valid BIOS pin config */
12026 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12029 err
= alc262_auto_create_input_ctls(codec
, &spec
->autocfg
);
12033 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12036 if (spec
->autocfg
.dig_outs
) {
12037 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
12038 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
12040 if (spec
->autocfg
.dig_in_pin
)
12041 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
12043 if (spec
->kctls
.list
)
12044 add_mixer(spec
, spec
->kctls
.list
);
12046 add_verb(spec
, alc262_volume_init_verbs
);
12047 spec
->num_mux_defs
= 1;
12048 spec
->input_mux
= &spec
->private_imux
[0];
12050 err
= alc_auto_add_mic_boost(codec
);
12054 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
12059 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12060 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12061 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12062 #define alc262_auto_init_input_src alc882_auto_init_input_src
12065 /* init callback for auto-configuration model -- overriding the default init */
12066 static void alc262_auto_init(struct hda_codec
*codec
)
12068 struct alc_spec
*spec
= codec
->spec
;
12069 alc262_auto_init_multi_out(codec
);
12070 alc262_auto_init_hp_out(codec
);
12071 alc262_auto_init_analog_input(codec
);
12072 alc262_auto_init_input_src(codec
);
12073 if (spec
->unsol_event
)
12074 alc_inithook(codec
);
12078 * configuration and preset
12080 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
12081 [ALC262_BASIC
] = "basic",
12082 [ALC262_HIPPO
] = "hippo",
12083 [ALC262_HIPPO_1
] = "hippo_1",
12084 [ALC262_FUJITSU
] = "fujitsu",
12085 [ALC262_HP_BPC
] = "hp-bpc",
12086 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
12087 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
12088 [ALC262_HP_RP5700
] = "hp-rp5700",
12089 [ALC262_BENQ_ED8
] = "benq",
12090 [ALC262_BENQ_T31
] = "benq-t31",
12091 [ALC262_SONY_ASSAMD
] = "sony-assamd",
12092 [ALC262_TOSHIBA_S06
] = "toshiba-s06",
12093 [ALC262_TOSHIBA_RX1
] = "toshiba-rx1",
12094 [ALC262_ULTRA
] = "ultra",
12095 [ALC262_LENOVO_3000
] = "lenovo-3000",
12096 [ALC262_NEC
] = "nec",
12097 [ALC262_TYAN
] = "tyan",
12098 [ALC262_AUTO
] = "auto",
12101 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
12102 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
12103 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
12104 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12106 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12108 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12110 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12111 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12112 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12113 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12114 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12115 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12116 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
12117 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
12118 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
12119 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
12120 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
12121 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12122 ALC262_HP_TC_T5735
),
12123 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
12124 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12125 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
12126 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
12127 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO
), /* dig-only */
12128 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06
),
12129 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO
),
12130 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO
),
12131 #if 0 /* disable the quirk since model=auto works better in recent versions */
12132 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12133 ALC262_SONY_ASSAMD
),
12135 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12136 ALC262_TOSHIBA_RX1
),
12137 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06
),
12138 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
12139 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
12140 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN
),
12141 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12143 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO
),
12144 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
12145 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
12146 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
12147 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
12151 static struct alc_config_preset alc262_presets
[] = {
12153 .mixers
= { alc262_base_mixer
},
12154 .init_verbs
= { alc262_init_verbs
},
12155 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12156 .dac_nids
= alc262_dac_nids
,
12158 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12159 .channel_mode
= alc262_modes
,
12160 .input_mux
= &alc262_capture_source
,
12163 .mixers
= { alc262_hippo_mixer
},
12164 .init_verbs
= { alc262_init_verbs
, alc_hp15_unsol_verbs
},
12165 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12166 .dac_nids
= alc262_dac_nids
,
12168 .dig_out_nid
= ALC262_DIGOUT_NID
,
12169 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12170 .channel_mode
= alc262_modes
,
12171 .input_mux
= &alc262_capture_source
,
12172 .unsol_event
= alc262_hippo_unsol_event
,
12173 .setup
= alc262_hippo_setup
,
12174 .init_hook
= alc262_hippo_automute
,
12176 [ALC262_HIPPO_1
] = {
12177 .mixers
= { alc262_hippo1_mixer
},
12178 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
12179 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12180 .dac_nids
= alc262_dac_nids
,
12182 .dig_out_nid
= ALC262_DIGOUT_NID
,
12183 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12184 .channel_mode
= alc262_modes
,
12185 .input_mux
= &alc262_capture_source
,
12186 .unsol_event
= alc262_hippo_unsol_event
,
12187 .setup
= alc262_hippo1_setup
,
12188 .init_hook
= alc262_hippo_automute
,
12190 [ALC262_FUJITSU
] = {
12191 .mixers
= { alc262_fujitsu_mixer
},
12192 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12193 alc262_fujitsu_unsol_verbs
},
12194 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12195 .dac_nids
= alc262_dac_nids
,
12197 .dig_out_nid
= ALC262_DIGOUT_NID
,
12198 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12199 .channel_mode
= alc262_modes
,
12200 .input_mux
= &alc262_fujitsu_capture_source
,
12201 .unsol_event
= alc262_fujitsu_unsol_event
,
12202 .init_hook
= alc262_fujitsu_init_hook
,
12204 [ALC262_HP_BPC
] = {
12205 .mixers
= { alc262_HP_BPC_mixer
},
12206 .init_verbs
= { alc262_HP_BPC_init_verbs
},
12207 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12208 .dac_nids
= alc262_dac_nids
,
12210 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12211 .channel_mode
= alc262_modes
,
12212 .input_mux
= &alc262_HP_capture_source
,
12213 .unsol_event
= alc262_hp_bpc_unsol_event
,
12214 .init_hook
= alc262_hp_bpc_automute
,
12216 [ALC262_HP_BPC_D7000_WF
] = {
12217 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
12218 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12219 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12220 .dac_nids
= alc262_dac_nids
,
12222 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12223 .channel_mode
= alc262_modes
,
12224 .input_mux
= &alc262_HP_D7000_capture_source
,
12225 .unsol_event
= alc262_hp_wildwest_unsol_event
,
12226 .init_hook
= alc262_hp_wildwest_automute
,
12228 [ALC262_HP_BPC_D7000_WL
] = {
12229 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
12230 alc262_HP_BPC_WildWest_option_mixer
},
12231 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
12232 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12233 .dac_nids
= alc262_dac_nids
,
12235 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12236 .channel_mode
= alc262_modes
,
12237 .input_mux
= &alc262_HP_D7000_capture_source
,
12238 .unsol_event
= alc262_hp_wildwest_unsol_event
,
12239 .init_hook
= alc262_hp_wildwest_automute
,
12241 [ALC262_HP_TC_T5735
] = {
12242 .mixers
= { alc262_hp_t5735_mixer
},
12243 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
12244 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12245 .dac_nids
= alc262_dac_nids
,
12247 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12248 .channel_mode
= alc262_modes
,
12249 .input_mux
= &alc262_capture_source
,
12250 .unsol_event
= alc_sku_unsol_event
,
12251 .setup
= alc262_hp_t5735_setup
,
12252 .init_hook
= alc_inithook
,
12254 [ALC262_HP_RP5700
] = {
12255 .mixers
= { alc262_hp_rp5700_mixer
},
12256 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
12257 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12258 .dac_nids
= alc262_dac_nids
,
12259 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12260 .channel_mode
= alc262_modes
,
12261 .input_mux
= &alc262_hp_rp5700_capture_source
,
12263 [ALC262_BENQ_ED8
] = {
12264 .mixers
= { alc262_base_mixer
},
12265 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
12266 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12267 .dac_nids
= alc262_dac_nids
,
12269 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12270 .channel_mode
= alc262_modes
,
12271 .input_mux
= &alc262_capture_source
,
12273 [ALC262_SONY_ASSAMD
] = {
12274 .mixers
= { alc262_sony_mixer
},
12275 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
12276 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12277 .dac_nids
= alc262_dac_nids
,
12279 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12280 .channel_mode
= alc262_modes
,
12281 .input_mux
= &alc262_capture_source
,
12282 .unsol_event
= alc262_hippo_unsol_event
,
12283 .setup
= alc262_hippo_setup
,
12284 .init_hook
= alc262_hippo_automute
,
12286 [ALC262_BENQ_T31
] = {
12287 .mixers
= { alc262_benq_t31_mixer
},
12288 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
,
12289 alc_hp15_unsol_verbs
},
12290 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12291 .dac_nids
= alc262_dac_nids
,
12293 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12294 .channel_mode
= alc262_modes
,
12295 .input_mux
= &alc262_capture_source
,
12296 .unsol_event
= alc262_hippo_unsol_event
,
12297 .setup
= alc262_hippo_setup
,
12298 .init_hook
= alc262_hippo_automute
,
12301 .mixers
= { alc262_ultra_mixer
},
12302 .cap_mixer
= alc262_ultra_capture_mixer
,
12303 .init_verbs
= { alc262_ultra_verbs
},
12304 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12305 .dac_nids
= alc262_dac_nids
,
12306 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12307 .channel_mode
= alc262_modes
,
12308 .input_mux
= &alc262_ultra_capture_source
,
12309 .adc_nids
= alc262_adc_nids
, /* ADC0 */
12310 .capsrc_nids
= alc262_capsrc_nids
,
12311 .num_adc_nids
= 1, /* single ADC */
12312 .unsol_event
= alc262_ultra_unsol_event
,
12313 .init_hook
= alc262_ultra_automute
,
12315 [ALC262_LENOVO_3000
] = {
12316 .mixers
= { alc262_lenovo_3000_mixer
},
12317 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
12318 alc262_lenovo_3000_unsol_verbs
,
12319 alc262_lenovo_3000_init_verbs
},
12320 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12321 .dac_nids
= alc262_dac_nids
,
12323 .dig_out_nid
= ALC262_DIGOUT_NID
,
12324 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12325 .channel_mode
= alc262_modes
,
12326 .input_mux
= &alc262_fujitsu_capture_source
,
12327 .unsol_event
= alc262_lenovo_3000_unsol_event
,
12330 .mixers
= { alc262_nec_mixer
},
12331 .init_verbs
= { alc262_nec_verbs
},
12332 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12333 .dac_nids
= alc262_dac_nids
,
12335 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12336 .channel_mode
= alc262_modes
,
12337 .input_mux
= &alc262_capture_source
,
12339 [ALC262_TOSHIBA_S06
] = {
12340 .mixers
= { alc262_toshiba_s06_mixer
},
12341 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_s06_verbs
,
12342 alc262_eapd_verbs
},
12343 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12344 .capsrc_nids
= alc262_dmic_capsrc_nids
,
12345 .dac_nids
= alc262_dac_nids
,
12346 .adc_nids
= alc262_dmic_adc_nids
, /* ADC0 */
12347 .num_adc_nids
= 1, /* single ADC */
12348 .dig_out_nid
= ALC262_DIGOUT_NID
,
12349 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12350 .channel_mode
= alc262_modes
,
12351 .unsol_event
= alc_sku_unsol_event
,
12352 .setup
= alc262_toshiba_s06_setup
,
12353 .init_hook
= alc_inithook
,
12355 [ALC262_TOSHIBA_RX1
] = {
12356 .mixers
= { alc262_toshiba_rx1_mixer
},
12357 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_rx1_unsol_verbs
},
12358 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12359 .dac_nids
= alc262_dac_nids
,
12361 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12362 .channel_mode
= alc262_modes
,
12363 .input_mux
= &alc262_capture_source
,
12364 .unsol_event
= alc262_hippo_unsol_event
,
12365 .setup
= alc262_hippo_setup
,
12366 .init_hook
= alc262_hippo_automute
,
12369 .mixers
= { alc262_tyan_mixer
},
12370 .init_verbs
= { alc262_init_verbs
, alc262_tyan_verbs
},
12371 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
12372 .dac_nids
= alc262_dac_nids
,
12374 .dig_out_nid
= ALC262_DIGOUT_NID
,
12375 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
12376 .channel_mode
= alc262_modes
,
12377 .input_mux
= &alc262_capture_source
,
12378 .unsol_event
= alc_automute_amp_unsol_event
,
12379 .setup
= alc262_tyan_setup
,
12380 .init_hook
= alc_automute_amp
,
12384 static int patch_alc262(struct hda_codec
*codec
)
12386 struct alc_spec
*spec
;
12390 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12394 codec
->spec
= spec
;
12396 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12401 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
12402 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
12403 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
12404 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
12407 alc_auto_parse_customize_define(codec
);
12409 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
12411 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
12415 if (board_config
< 0) {
12416 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
12418 board_config
= ALC262_AUTO
;
12421 if (board_config
== ALC262_AUTO
) {
12422 /* automatic parse from the BIOS config */
12423 err
= alc262_parse_auto_config(codec
);
12429 "hda_codec: Cannot set up configuration "
12430 "from BIOS. Using base mode...\n");
12431 board_config
= ALC262_BASIC
;
12435 if (!spec
->no_analog
) {
12436 err
= snd_hda_attach_beep_device(codec
, 0x1);
12443 if (board_config
!= ALC262_AUTO
)
12444 setup_preset(codec
, &alc262_presets
[board_config
]);
12446 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
12447 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
12449 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
12450 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
12452 if (!spec
->adc_nids
&& spec
->input_mux
) {
12454 /* check whether the digital-mic has to be supported */
12455 for (i
= 0; i
< spec
->input_mux
->num_items
; i
++) {
12456 if (spec
->input_mux
->items
[i
].index
>= 9)
12459 if (i
< spec
->input_mux
->num_items
) {
12460 /* use only ADC0 */
12461 spec
->adc_nids
= alc262_dmic_adc_nids
;
12462 spec
->num_adc_nids
= 1;
12463 spec
->capsrc_nids
= alc262_dmic_capsrc_nids
;
12465 /* all analog inputs */
12466 /* check whether NID 0x07 is valid */
12467 unsigned int wcap
= get_wcaps(codec
, 0x07);
12470 wcap
= get_wcaps_type(wcap
);
12471 if (wcap
!= AC_WID_AUD_IN
) {
12472 spec
->adc_nids
= alc262_adc_nids_alt
;
12473 spec
->num_adc_nids
=
12474 ARRAY_SIZE(alc262_adc_nids_alt
);
12475 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
12477 spec
->adc_nids
= alc262_adc_nids
;
12478 spec
->num_adc_nids
=
12479 ARRAY_SIZE(alc262_adc_nids
);
12480 spec
->capsrc_nids
= alc262_capsrc_nids
;
12484 if (!spec
->cap_mixer
&& !spec
->no_analog
)
12485 set_capture_mixer(codec
);
12486 if (!spec
->no_analog
&& spec
->cdefine
.enable_pcbeep
)
12487 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
12489 spec
->vmaster_nid
= 0x0c;
12491 codec
->patch_ops
= alc_patch_ops
;
12492 if (board_config
== ALC262_AUTO
)
12493 spec
->init_hook
= alc262_auto_init
;
12494 #ifdef CONFIG_SND_HDA_POWER_SAVE
12495 if (!spec
->loopback
.amplist
)
12496 spec
->loopback
.amplist
= alc262_loopbacks
;
12503 * ALC268 channel source setting (2 channel)
12505 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12506 #define alc268_modes alc260_modes
12508 static hda_nid_t alc268_dac_nids
[2] = {
12513 static hda_nid_t alc268_adc_nids
[2] = {
12518 static hda_nid_t alc268_adc_nids_alt
[1] = {
12523 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
12525 static struct snd_kcontrol_new alc268_base_mixer
[] = {
12526 /* output mixer control */
12527 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
12528 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12529 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
12530 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12531 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12532 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12533 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
12537 static struct snd_kcontrol_new alc268_toshiba_mixer
[] = {
12538 /* output mixer control */
12539 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
12540 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
12541 ALC262_HIPPO_MASTER_SWITCH
,
12542 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12543 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12544 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
12548 /* bind Beep switches of both NID 0x0f and 0x10 */
12549 static struct hda_bind_ctls alc268_bind_beep_sw
= {
12550 .ops
= &snd_hda_bind_sw
,
12552 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
12553 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
12558 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
12559 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
12560 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
12564 static struct hda_verb alc268_eapd_verbs
[] = {
12565 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12566 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12570 /* Toshiba specific */
12571 static struct hda_verb alc268_toshiba_verbs
[] = {
12572 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12576 /* Acer specific */
12577 /* bind volumes of both NID 0x02 and 0x03 */
12578 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
12579 .ops
= &snd_hda_bind_vol
,
12581 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
12582 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
12587 /* mute/unmute internal speaker according to the hp jack and mute state */
12588 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
12590 struct alc_spec
*spec
= codec
->spec
;
12593 if (force
|| !spec
->sense_updated
) {
12594 spec
->jack_present
= snd_hda_jack_detect(codec
, 0x14);
12595 spec
->sense_updated
= 1;
12597 if (spec
->jack_present
)
12598 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
12599 else /* unmute internal speaker if necessary */
12600 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
12601 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
12602 HDA_AMP_MUTE
, mute
);
12606 /* bind hp and internal speaker mute (with plug check) */
12607 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
12608 struct snd_ctl_elem_value
*ucontrol
)
12610 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
12611 long *valp
= ucontrol
->value
.integer
.value
;
12614 change
= amp_stereo_mute_update(codec
, 0x14, HDA_OUTPUT
, 0, valp
);
12616 alc268_acer_automute(codec
, 0);
12620 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer
[] = {
12621 /* output mixer control */
12622 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12624 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12625 .name
= "Master Playback Switch",
12626 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
12627 .info
= snd_hda_mixer_amp_switch_info
,
12628 .get
= snd_hda_mixer_amp_switch_get
,
12629 .put
= alc268_acer_master_sw_put
,
12630 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
12632 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT
),
12636 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
12637 /* output mixer control */
12638 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12640 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12641 .name
= "Master Playback Switch",
12642 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
12643 .info
= snd_hda_mixer_amp_switch_info
,
12644 .get
= snd_hda_mixer_amp_switch_get
,
12645 .put
= alc268_acer_master_sw_put
,
12646 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
12648 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12649 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
12650 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
12654 static struct snd_kcontrol_new alc268_acer_dmic_mixer
[] = {
12655 /* output mixer control */
12656 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12658 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12659 .name
= "Master Playback Switch",
12660 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
12661 .info
= snd_hda_mixer_amp_switch_info
,
12662 .get
= snd_hda_mixer_amp_switch_get
,
12663 .put
= alc268_acer_master_sw_put
,
12664 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
12666 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12667 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
12671 static struct hda_verb alc268_acer_aspire_one_verbs
[] = {
12672 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12673 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12674 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12675 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12676 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x06},
12677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, 0xa017},
12681 static struct hda_verb alc268_acer_verbs
[] = {
12682 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
12683 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12685 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12686 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12687 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12688 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12692 /* unsolicited event for HP jack sensing */
12693 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12694 #define alc268_toshiba_setup alc262_hippo_setup
12695 #define alc268_toshiba_automute alc262_hippo_automute
12697 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
12700 if ((res
>> 26) != ALC880_HP_EVENT
)
12702 alc268_acer_automute(codec
, 1);
12705 static void alc268_acer_init_hook(struct hda_codec
*codec
)
12707 alc268_acer_automute(codec
, 1);
12710 /* toggle speaker-output according to the hp-jack state */
12711 static void alc268_aspire_one_speaker_automute(struct hda_codec
*codec
)
12713 unsigned int present
;
12714 unsigned char bits
;
12716 present
= snd_hda_jack_detect(codec
, 0x15);
12717 bits
= present
? HDA_AMP_MUTE
: 0;
12718 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 0,
12719 HDA_AMP_MUTE
, bits
);
12720 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 1,
12721 HDA_AMP_MUTE
, bits
);
12724 static void alc268_acer_lc_unsol_event(struct hda_codec
*codec
,
12727 switch (res
>> 26) {
12728 case ALC880_HP_EVENT
:
12729 alc268_aspire_one_speaker_automute(codec
);
12731 case ALC880_MIC_EVENT
:
12732 alc_mic_automute(codec
);
12737 static void alc268_acer_lc_setup(struct hda_codec
*codec
)
12739 struct alc_spec
*spec
= codec
->spec
;
12740 spec
->ext_mic
.pin
= 0x18;
12741 spec
->ext_mic
.mux_idx
= 0;
12742 spec
->int_mic
.pin
= 0x12;
12743 spec
->int_mic
.mux_idx
= 6;
12744 spec
->auto_mic
= 1;
12747 static void alc268_acer_lc_init_hook(struct hda_codec
*codec
)
12749 alc268_aspire_one_speaker_automute(codec
);
12750 alc_mic_automute(codec
);
12753 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
12754 /* output mixer control */
12755 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12756 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12757 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12759 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12760 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
12764 static struct hda_verb alc268_dell_verbs
[] = {
12765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12766 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12767 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12768 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
12772 /* mute/unmute internal speaker according to the hp jack and mute state */
12773 static void alc268_dell_setup(struct hda_codec
*codec
)
12775 struct alc_spec
*spec
= codec
->spec
;
12777 spec
->autocfg
.hp_pins
[0] = 0x15;
12778 spec
->autocfg
.speaker_pins
[0] = 0x14;
12779 spec
->ext_mic
.pin
= 0x18;
12780 spec
->ext_mic
.mux_idx
= 0;
12781 spec
->int_mic
.pin
= 0x19;
12782 spec
->int_mic
.mux_idx
= 1;
12783 spec
->auto_mic
= 1;
12786 static struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
12787 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
12788 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12789 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
12790 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12791 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12792 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
12793 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
12794 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
12798 static struct hda_verb alc267_quanta_il1_verbs
[] = {
12799 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12800 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
12804 static void alc267_quanta_il1_setup(struct hda_codec
*codec
)
12806 struct alc_spec
*spec
= codec
->spec
;
12807 spec
->autocfg
.hp_pins
[0] = 0x15;
12808 spec
->autocfg
.speaker_pins
[0] = 0x14;
12809 spec
->ext_mic
.pin
= 0x18;
12810 spec
->ext_mic
.mux_idx
= 0;
12811 spec
->int_mic
.pin
= 0x19;
12812 spec
->int_mic
.mux_idx
= 1;
12813 spec
->auto_mic
= 1;
12817 * generic initialization of ADC, input mixers and output mixers
12819 static struct hda_verb alc268_base_init_verbs
[] = {
12820 /* Unmute DAC0-1 and set vol = 0 */
12821 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12822 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12825 * Set up output mixers (0x0c - 0x0e)
12827 /* set vol=0 to output mixers */
12828 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12829 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
12831 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12832 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12834 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
12835 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
12836 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
12837 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12838 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12839 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12840 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12841 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12843 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12844 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12846 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12847 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12849 /* set PCBEEP vol = 0, mute connections */
12850 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12851 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12852 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12854 /* Unmute Selector 23h,24h and set the default input to mic-in */
12856 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
12857 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12858 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
12859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12865 * generic initialization of ADC, input mixers and output mixers
12867 static struct hda_verb alc268_volume_init_verbs
[] = {
12868 /* set output DAC */
12869 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12870 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12872 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12873 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12874 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12875 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12876 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12878 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12879 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12880 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12882 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12883 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12885 /* set PCBEEP vol = 0, mute connections */
12886 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12887 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12888 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12893 static struct snd_kcontrol_new alc268_capture_nosrc_mixer
[] = {
12894 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12895 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
12899 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
12900 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12901 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
12906 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
12907 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12908 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
12909 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
12910 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
12915 static struct hda_input_mux alc268_capture_source
= {
12919 { "Front Mic", 0x1 },
12925 static struct hda_input_mux alc268_acer_capture_source
= {
12929 { "Internal Mic", 0x1 },
12934 static struct hda_input_mux alc268_acer_dmic_capture_source
= {
12938 { "Internal Mic", 0x6 },
12943 #ifdef CONFIG_SND_DEBUG
12944 static struct snd_kcontrol_new alc268_test_mixer
[] = {
12945 /* Volume widgets */
12946 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12947 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12948 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
12949 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
12950 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
12951 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
12952 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
12953 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
12954 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
12955 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
12956 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
12957 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
12958 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
12959 /* The below appears problematic on some hardwares */
12960 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12961 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12962 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
12963 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
12964 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
12966 /* Modes for retasking pin widgets */
12967 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
12968 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
12969 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
12970 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
12972 /* Controls for GPIO pins, assuming they are configured as outputs */
12973 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12974 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12975 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12976 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12978 /* Switches to allow the digital SPDIF output pin to be enabled.
12979 * The ALC268 does not have an SPDIF input.
12981 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12983 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12984 * this output to turn on an external amplifier.
12986 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12987 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12993 /* create input playback/capture controls for the given pin */
12994 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
12995 const char *ctlname
, int idx
)
13006 case 0x21: /* ALC269vb has this pin, too */
13012 if (spec
->multiout
.dac_nids
[0] != dac
&&
13013 spec
->multiout
.dac_nids
[1] != dac
) {
13014 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, ctlname
,
13015 HDA_COMPOSE_AMP_VAL(dac
, 3, idx
,
13019 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
13023 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13024 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
13026 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, ctlname
,
13027 HDA_COMPOSE_AMP_VAL(nid
, 2, idx
, HDA_OUTPUT
));
13033 /* add playback controls from the parsed DAC table */
13034 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13035 const struct auto_pin_cfg
*cfg
)
13040 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
13042 nid
= cfg
->line_out_pins
[0];
13045 if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
13049 err
= alc268_new_analog_output(spec
, nid
, name
, 0);
13054 nid
= cfg
->speaker_pins
[0];
13056 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, "Speaker",
13057 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
13061 err
= alc268_new_analog_output(spec
, nid
, "Speaker", 0);
13065 nid
= cfg
->hp_pins
[0];
13067 err
= alc268_new_analog_output(spec
, nid
, "Headphone", 0);
13072 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
13074 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, "Mono",
13075 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
));
13082 /* create playback/capture controls for input pins */
13083 static int alc268_auto_create_input_ctls(struct hda_codec
*codec
,
13084 const struct auto_pin_cfg
*cfg
)
13086 return alc_auto_create_input_ctls(codec
, cfg
, 0, 0x23, 0x24);
13089 static void alc268_auto_set_output_and_unmute(struct hda_codec
*codec
,
13090 hda_nid_t nid
, int pin_type
)
13094 alc_set_pin_output(codec
, nid
, pin_type
);
13095 if (nid
== 0x14 || nid
== 0x16)
13099 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
13102 static void alc268_auto_init_multi_out(struct hda_codec
*codec
)
13104 struct alc_spec
*spec
= codec
->spec
;
13105 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[0];
13107 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13108 alc268_auto_set_output_and_unmute(codec
, nid
, pin_type
);
13112 static void alc268_auto_init_hp_out(struct hda_codec
*codec
)
13114 struct alc_spec
*spec
= codec
->spec
;
13117 pin
= spec
->autocfg
.hp_pins
[0];
13119 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_HP
);
13120 pin
= spec
->autocfg
.speaker_pins
[0];
13122 alc268_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
);
13125 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
13127 struct alc_spec
*spec
= codec
->spec
;
13128 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
13129 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
13130 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
13131 unsigned int dac_vol1
, dac_vol2
;
13133 if (line_nid
== 0x1d || speaker_nid
== 0x1d) {
13134 snd_hda_codec_write(codec
, speaker_nid
, 0,
13135 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
13136 /* mute mixer inputs from 0x1d */
13137 snd_hda_codec_write(codec
, 0x0f, 0,
13138 AC_VERB_SET_AMP_GAIN_MUTE
,
13140 snd_hda_codec_write(codec
, 0x10, 0,
13141 AC_VERB_SET_AMP_GAIN_MUTE
,
13144 /* unmute mixer inputs from 0x1d */
13145 snd_hda_codec_write(codec
, 0x0f, 0,
13146 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13147 snd_hda_codec_write(codec
, 0x10, 0,
13148 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
13151 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
13152 if (line_nid
== 0x14)
13153 dac_vol2
= AMP_OUT_ZERO
;
13154 else if (line_nid
== 0x15)
13155 dac_vol1
= AMP_OUT_ZERO
;
13156 if (hp_nid
== 0x14)
13157 dac_vol2
= AMP_OUT_ZERO
;
13158 else if (hp_nid
== 0x15)
13159 dac_vol1
= AMP_OUT_ZERO
;
13160 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
13161 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
13162 spec
->autocfg
.line_out_pins
[2] != 0x16)
13163 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
13165 snd_hda_codec_write(codec
, 0x02, 0,
13166 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
13167 snd_hda_codec_write(codec
, 0x03, 0,
13168 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
13171 /* pcm configuration: identical with ALC880 */
13172 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13173 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13174 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13175 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13178 * BIOS auto configuration
13180 static int alc268_parse_auto_config(struct hda_codec
*codec
)
13182 struct alc_spec
*spec
= codec
->spec
;
13184 static hda_nid_t alc268_ignore
[] = { 0 };
13186 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13190 if (!spec
->autocfg
.line_outs
) {
13191 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
13192 spec
->multiout
.max_channels
= 2;
13193 spec
->no_analog
= 1;
13196 return 0; /* can't find valid BIOS pin config */
13198 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13201 err
= alc268_auto_create_input_ctls(codec
, &spec
->autocfg
);
13205 spec
->multiout
.max_channels
= 2;
13208 /* digital only support output */
13209 if (spec
->autocfg
.dig_outs
) {
13210 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
13211 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
13213 if (spec
->kctls
.list
)
13214 add_mixer(spec
, spec
->kctls
.list
);
13216 if (!spec
->no_analog
&& spec
->autocfg
.speaker_pins
[0] != 0x1d)
13217 add_mixer(spec
, alc268_beep_mixer
);
13219 add_verb(spec
, alc268_volume_init_verbs
);
13220 spec
->num_mux_defs
= 2;
13221 spec
->input_mux
= &spec
->private_imux
[0];
13223 err
= alc_auto_add_mic_boost(codec
);
13227 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
13232 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13234 /* init callback for auto-configuration model -- overriding the default init */
13235 static void alc268_auto_init(struct hda_codec
*codec
)
13237 struct alc_spec
*spec
= codec
->spec
;
13238 alc268_auto_init_multi_out(codec
);
13239 alc268_auto_init_hp_out(codec
);
13240 alc268_auto_init_mono_speaker_out(codec
);
13241 alc268_auto_init_analog_input(codec
);
13242 if (spec
->unsol_event
)
13243 alc_inithook(codec
);
13247 * configuration and preset
13249 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
13250 [ALC267_QUANTA_IL1
] = "quanta-il1",
13251 [ALC268_3ST
] = "3stack",
13252 [ALC268_TOSHIBA
] = "toshiba",
13253 [ALC268_ACER
] = "acer",
13254 [ALC268_ACER_DMIC
] = "acer-dmic",
13255 [ALC268_ACER_ASPIRE_ONE
] = "acer-aspire",
13256 [ALC268_DELL
] = "dell",
13257 [ALC268_ZEPTO
] = "zepto",
13258 #ifdef CONFIG_SND_DEBUG
13259 [ALC268_TEST
] = "test",
13261 [ALC268_AUTO
] = "auto",
13264 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
13265 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
13266 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
13267 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
13268 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
13269 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
13270 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13271 ALC268_ACER_ASPIRE_ONE
),
13272 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
13273 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13274 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL
),
13275 /* almost compatible with toshiba but with optional digital outs;
13276 * auto-probing seems working fine
13278 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13280 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
13281 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
13282 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
13283 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
13284 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
13285 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL
),
13289 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13290 static struct snd_pci_quirk alc268_ssid_cfg_tbl
[] = {
13291 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO
),
13292 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO
),
13293 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13298 static struct alc_config_preset alc268_presets
[] = {
13299 [ALC267_QUANTA_IL1
] = {
13300 .mixers
= { alc267_quanta_il1_mixer
, alc268_beep_mixer
,
13301 alc268_capture_nosrc_mixer
},
13302 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13303 alc267_quanta_il1_verbs
},
13304 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13305 .dac_nids
= alc268_dac_nids
,
13306 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13307 .adc_nids
= alc268_adc_nids_alt
,
13309 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13310 .channel_mode
= alc268_modes
,
13311 .unsol_event
= alc_sku_unsol_event
,
13312 .setup
= alc267_quanta_il1_setup
,
13313 .init_hook
= alc_inithook
,
13316 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
13317 alc268_beep_mixer
},
13318 .init_verbs
= { alc268_base_init_verbs
},
13319 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13320 .dac_nids
= alc268_dac_nids
,
13321 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13322 .adc_nids
= alc268_adc_nids_alt
,
13323 .capsrc_nids
= alc268_capsrc_nids
,
13325 .dig_out_nid
= ALC268_DIGOUT_NID
,
13326 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13327 .channel_mode
= alc268_modes
,
13328 .input_mux
= &alc268_capture_source
,
13330 [ALC268_TOSHIBA
] = {
13331 .mixers
= { alc268_toshiba_mixer
, alc268_capture_alt_mixer
,
13332 alc268_beep_mixer
},
13333 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13334 alc268_toshiba_verbs
},
13335 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13336 .dac_nids
= alc268_dac_nids
,
13337 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13338 .adc_nids
= alc268_adc_nids_alt
,
13339 .capsrc_nids
= alc268_capsrc_nids
,
13341 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13342 .channel_mode
= alc268_modes
,
13343 .input_mux
= &alc268_capture_source
,
13344 .unsol_event
= alc268_toshiba_unsol_event
,
13345 .setup
= alc268_toshiba_setup
,
13346 .init_hook
= alc268_toshiba_automute
,
13349 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
13350 alc268_beep_mixer
},
13351 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13352 alc268_acer_verbs
},
13353 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13354 .dac_nids
= alc268_dac_nids
,
13355 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13356 .adc_nids
= alc268_adc_nids_alt
,
13357 .capsrc_nids
= alc268_capsrc_nids
,
13359 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13360 .channel_mode
= alc268_modes
,
13361 .input_mux
= &alc268_acer_capture_source
,
13362 .unsol_event
= alc268_acer_unsol_event
,
13363 .init_hook
= alc268_acer_init_hook
,
13365 [ALC268_ACER_DMIC
] = {
13366 .mixers
= { alc268_acer_dmic_mixer
, alc268_capture_alt_mixer
,
13367 alc268_beep_mixer
},
13368 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13369 alc268_acer_verbs
},
13370 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13371 .dac_nids
= alc268_dac_nids
,
13372 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13373 .adc_nids
= alc268_adc_nids_alt
,
13374 .capsrc_nids
= alc268_capsrc_nids
,
13376 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13377 .channel_mode
= alc268_modes
,
13378 .input_mux
= &alc268_acer_dmic_capture_source
,
13379 .unsol_event
= alc268_acer_unsol_event
,
13380 .init_hook
= alc268_acer_init_hook
,
13382 [ALC268_ACER_ASPIRE_ONE
] = {
13383 .mixers
= { alc268_acer_aspire_one_mixer
,
13385 alc268_capture_nosrc_mixer
},
13386 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13387 alc268_acer_aspire_one_verbs
},
13388 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13389 .dac_nids
= alc268_dac_nids
,
13390 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13391 .adc_nids
= alc268_adc_nids_alt
,
13392 .capsrc_nids
= alc268_capsrc_nids
,
13394 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13395 .channel_mode
= alc268_modes
,
13396 .unsol_event
= alc268_acer_lc_unsol_event
,
13397 .setup
= alc268_acer_lc_setup
,
13398 .init_hook
= alc268_acer_lc_init_hook
,
13401 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
,
13402 alc268_capture_nosrc_mixer
},
13403 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13404 alc268_dell_verbs
},
13405 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13406 .dac_nids
= alc268_dac_nids
,
13407 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13408 .adc_nids
= alc268_adc_nids_alt
,
13409 .capsrc_nids
= alc268_capsrc_nids
,
13411 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13412 .channel_mode
= alc268_modes
,
13413 .unsol_event
= alc_sku_unsol_event
,
13414 .setup
= alc268_dell_setup
,
13415 .init_hook
= alc_inithook
,
13418 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
13419 alc268_beep_mixer
},
13420 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13421 alc268_toshiba_verbs
},
13422 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13423 .dac_nids
= alc268_dac_nids
,
13424 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13425 .adc_nids
= alc268_adc_nids_alt
,
13426 .capsrc_nids
= alc268_capsrc_nids
,
13428 .dig_out_nid
= ALC268_DIGOUT_NID
,
13429 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13430 .channel_mode
= alc268_modes
,
13431 .input_mux
= &alc268_capture_source
,
13432 .setup
= alc268_toshiba_setup
,
13433 .init_hook
= alc268_toshiba_automute
,
13435 #ifdef CONFIG_SND_DEBUG
13437 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
13438 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
13439 alc268_volume_init_verbs
},
13440 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
13441 .dac_nids
= alc268_dac_nids
,
13442 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
13443 .adc_nids
= alc268_adc_nids_alt
,
13444 .capsrc_nids
= alc268_capsrc_nids
,
13446 .dig_out_nid
= ALC268_DIGOUT_NID
,
13447 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
13448 .channel_mode
= alc268_modes
,
13449 .input_mux
= &alc268_capture_source
,
13454 static int patch_alc268(struct hda_codec
*codec
)
13456 struct alc_spec
*spec
;
13458 int i
, has_beep
, err
;
13460 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13464 codec
->spec
= spec
;
13466 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
13470 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
)
13471 board_config
= snd_hda_check_board_codec_sid_config(codec
,
13472 ALC268_MODEL_LAST
, alc268_models
, alc268_ssid_cfg_tbl
);
13474 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
13475 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
13477 board_config
= ALC268_AUTO
;
13480 if (board_config
== ALC268_AUTO
) {
13481 /* automatic parse from the BIOS config */
13482 err
= alc268_parse_auto_config(codec
);
13488 "hda_codec: Cannot set up configuration "
13489 "from BIOS. Using base mode...\n");
13490 board_config
= ALC268_3ST
;
13494 if (board_config
!= ALC268_AUTO
)
13495 setup_preset(codec
, &alc268_presets
[board_config
]);
13497 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
13498 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
13499 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
13501 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
13504 for (i
= 0; i
< spec
->num_mixers
; i
++) {
13505 if (spec
->mixers
[i
] == alc268_beep_mixer
) {
13512 err
= snd_hda_attach_beep_device(codec
, 0x1);
13517 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
13518 /* override the amp caps for beep generator */
13519 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
13520 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
13521 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
13522 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
13523 (0 << AC_AMPCAP_MUTE_SHIFT
));
13526 if (!spec
->no_analog
&& !spec
->adc_nids
&& spec
->input_mux
) {
13527 /* check whether NID 0x07 is valid */
13528 unsigned int wcap
= get_wcaps(codec
, 0x07);
13531 spec
->capsrc_nids
= alc268_capsrc_nids
;
13533 wcap
= get_wcaps_type(wcap
);
13534 if (spec
->auto_mic
||
13535 wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
13536 spec
->adc_nids
= alc268_adc_nids_alt
;
13537 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
13538 if (spec
->auto_mic
)
13539 fixup_automic_adc(codec
);
13540 if (spec
->auto_mic
|| spec
->input_mux
->num_items
== 1)
13541 add_mixer(spec
, alc268_capture_nosrc_mixer
);
13543 add_mixer(spec
, alc268_capture_alt_mixer
);
13545 spec
->adc_nids
= alc268_adc_nids
;
13546 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
13547 add_mixer(spec
, alc268_capture_mixer
);
13549 /* set default input source */
13550 for (i
= 0; i
< spec
->num_adc_nids
; i
++)
13551 snd_hda_codec_write_cache(codec
, alc268_capsrc_nids
[i
],
13552 0, AC_VERB_SET_CONNECT_SEL
,
13553 i
< spec
->num_mux_defs
?
13554 spec
->input_mux
[i
].items
[0].index
:
13555 spec
->input_mux
->items
[0].index
);
13558 spec
->vmaster_nid
= 0x02;
13560 codec
->patch_ops
= alc_patch_ops
;
13561 if (board_config
== ALC268_AUTO
)
13562 spec
->init_hook
= alc268_auto_init
;
13568 * ALC269 channel source setting (2 channel)
13570 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13572 #define alc269_dac_nids alc260_dac_nids
13574 static hda_nid_t alc269_adc_nids
[1] = {
13579 static hda_nid_t alc269_capsrc_nids
[1] = {
13583 static hda_nid_t alc269vb_adc_nids
[1] = {
13588 static hda_nid_t alc269vb_capsrc_nids
[1] = {
13592 static hda_nid_t alc269_adc_candidates
[] = {
13596 #define alc269_modes alc260_modes
13597 #define alc269_capture_source alc880_lg_lw_capture_source
13599 static struct snd_kcontrol_new alc269_base_mixer
[] = {
13600 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13601 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13602 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13603 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13604 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13605 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13606 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13607 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
13608 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
13609 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
13610 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13611 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
13615 static struct snd_kcontrol_new alc269_quanta_fl1_mixer
[] = {
13616 /* output mixer control */
13617 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13619 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13620 .name
= "Master Playback Switch",
13621 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
13622 .info
= snd_hda_mixer_amp_switch_info
,
13623 .get
= snd_hda_mixer_amp_switch_get
,
13624 .put
= alc268_acer_master_sw_put
,
13625 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
13627 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13629 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13630 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
13631 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
13632 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
13636 static struct snd_kcontrol_new alc269_lifebook_mixer
[] = {
13637 /* output mixer control */
13638 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
13640 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13641 .name
= "Master Playback Switch",
13642 .subdevice
= HDA_SUBDEV_AMP_FLAG
,
13643 .info
= snd_hda_mixer_amp_switch_info
,
13644 .get
= snd_hda_mixer_amp_switch_get
,
13645 .put
= alc268_acer_master_sw_put
,
13646 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
13648 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13649 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13650 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13651 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
13652 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
13653 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
13654 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT
),
13655 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT
),
13656 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT
),
13660 static struct snd_kcontrol_new alc269_laptop_mixer
[] = {
13661 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13662 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13664 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13668 static struct snd_kcontrol_new alc269vb_laptop_mixer
[] = {
13669 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13670 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13671 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13672 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13676 /* capture mixer elements */
13677 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer
[] = {
13678 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
13679 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
13680 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13681 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT
),
13685 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer
[] = {
13686 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
13687 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
13688 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13692 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer
[] = {
13693 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
13694 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
13695 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13696 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT
),
13700 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer
[] = {
13701 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
13702 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
13703 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13708 #define alc269_fujitsu_mixer alc269_laptop_mixer
13710 static struct hda_verb alc269_quanta_fl1_verbs
[] = {
13711 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13712 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13713 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13714 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13715 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13716 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13720 static struct hda_verb alc269_lifebook_verbs
[] = {
13721 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13722 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
13723 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13725 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13726 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13727 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13728 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
13729 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13730 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13734 /* toggle speaker-output according to the hp-jack state */
13735 static void alc269_quanta_fl1_speaker_automute(struct hda_codec
*codec
)
13737 unsigned int present
;
13738 unsigned char bits
;
13740 present
= snd_hda_jack_detect(codec
, 0x15);
13741 bits
= present
? HDA_AMP_MUTE
: 0;
13742 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
13743 HDA_AMP_MUTE
, bits
);
13744 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
13745 HDA_AMP_MUTE
, bits
);
13747 snd_hda_codec_write(codec
, 0x20, 0,
13748 AC_VERB_SET_COEF_INDEX
, 0x0c);
13749 snd_hda_codec_write(codec
, 0x20, 0,
13750 AC_VERB_SET_PROC_COEF
, 0x680);
13752 snd_hda_codec_write(codec
, 0x20, 0,
13753 AC_VERB_SET_COEF_INDEX
, 0x0c);
13754 snd_hda_codec_write(codec
, 0x20, 0,
13755 AC_VERB_SET_PROC_COEF
, 0x480);
13758 /* toggle speaker-output according to the hp-jacks state */
13759 static void alc269_lifebook_speaker_automute(struct hda_codec
*codec
)
13761 unsigned int present
;
13762 unsigned char bits
;
13764 /* Check laptop headphone socket */
13765 present
= snd_hda_jack_detect(codec
, 0x15);
13767 /* Check port replicator headphone socket */
13768 present
|= snd_hda_jack_detect(codec
, 0x1a);
13770 bits
= present
? HDA_AMP_MUTE
: 0;
13771 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
13772 HDA_AMP_MUTE
, bits
);
13773 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
13774 HDA_AMP_MUTE
, bits
);
13776 snd_hda_codec_write(codec
, 0x20, 0,
13777 AC_VERB_SET_COEF_INDEX
, 0x0c);
13778 snd_hda_codec_write(codec
, 0x20, 0,
13779 AC_VERB_SET_PROC_COEF
, 0x680);
13781 snd_hda_codec_write(codec
, 0x20, 0,
13782 AC_VERB_SET_COEF_INDEX
, 0x0c);
13783 snd_hda_codec_write(codec
, 0x20, 0,
13784 AC_VERB_SET_PROC_COEF
, 0x480);
13787 static void alc269_lifebook_mic_autoswitch(struct hda_codec
*codec
)
13789 unsigned int present_laptop
;
13790 unsigned int present_dock
;
13792 present_laptop
= snd_hda_jack_detect(codec
, 0x18);
13793 present_dock
= snd_hda_jack_detect(codec
, 0x1b);
13795 /* Laptop mic port overrides dock mic port, design decision */
13797 snd_hda_codec_write(codec
, 0x23, 0,
13798 AC_VERB_SET_CONNECT_SEL
, 0x3);
13799 if (present_laptop
)
13800 snd_hda_codec_write(codec
, 0x23, 0,
13801 AC_VERB_SET_CONNECT_SEL
, 0x0);
13802 if (!present_dock
&& !present_laptop
)
13803 snd_hda_codec_write(codec
, 0x23, 0,
13804 AC_VERB_SET_CONNECT_SEL
, 0x1);
13807 static void alc269_quanta_fl1_unsol_event(struct hda_codec
*codec
,
13810 switch (res
>> 26) {
13811 case ALC880_HP_EVENT
:
13812 alc269_quanta_fl1_speaker_automute(codec
);
13814 case ALC880_MIC_EVENT
:
13815 alc_mic_automute(codec
);
13820 static void alc269_lifebook_unsol_event(struct hda_codec
*codec
,
13823 if ((res
>> 26) == ALC880_HP_EVENT
)
13824 alc269_lifebook_speaker_automute(codec
);
13825 if ((res
>> 26) == ALC880_MIC_EVENT
)
13826 alc269_lifebook_mic_autoswitch(codec
);
13829 static void alc269_quanta_fl1_setup(struct hda_codec
*codec
)
13831 struct alc_spec
*spec
= codec
->spec
;
13832 spec
->autocfg
.hp_pins
[0] = 0x15;
13833 spec
->autocfg
.speaker_pins
[0] = 0x14;
13834 spec
->ext_mic
.pin
= 0x18;
13835 spec
->ext_mic
.mux_idx
= 0;
13836 spec
->int_mic
.pin
= 0x19;
13837 spec
->int_mic
.mux_idx
= 1;
13838 spec
->auto_mic
= 1;
13841 static void alc269_quanta_fl1_init_hook(struct hda_codec
*codec
)
13843 alc269_quanta_fl1_speaker_automute(codec
);
13844 alc_mic_automute(codec
);
13847 static void alc269_lifebook_init_hook(struct hda_codec
*codec
)
13849 alc269_lifebook_speaker_automute(codec
);
13850 alc269_lifebook_mic_autoswitch(codec
);
13853 static struct hda_verb alc269_laptop_dmic_init_verbs
[] = {
13854 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13855 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
13856 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
13857 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
13858 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13859 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13860 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13864 static struct hda_verb alc269_laptop_amic_init_verbs
[] = {
13865 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13866 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
13867 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
13868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
13869 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13870 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13874 static struct hda_verb alc269vb_laptop_dmic_init_verbs
[] = {
13875 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
13876 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x06},
13877 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
13878 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
13879 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13880 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13881 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13885 static struct hda_verb alc269vb_laptop_amic_init_verbs
[] = {
13886 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01},
13887 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x01},
13888 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
13889 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
13890 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13891 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13892 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13896 /* toggle speaker-output according to the hp-jack state */
13897 static void alc269_speaker_automute(struct hda_codec
*codec
)
13899 struct alc_spec
*spec
= codec
->spec
;
13900 unsigned int nid
= spec
->autocfg
.hp_pins
[0];
13901 unsigned int present
;
13902 unsigned char bits
;
13904 present
= snd_hda_jack_detect(codec
, nid
);
13905 bits
= present
? HDA_AMP_MUTE
: 0;
13906 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
13907 HDA_AMP_MUTE
, bits
);
13908 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
13909 HDA_AMP_MUTE
, bits
);
13912 /* unsolicited event for HP jack sensing */
13913 static void alc269_laptop_unsol_event(struct hda_codec
*codec
,
13916 switch (res
>> 26) {
13917 case ALC880_HP_EVENT
:
13918 alc269_speaker_automute(codec
);
13920 case ALC880_MIC_EVENT
:
13921 alc_mic_automute(codec
);
13926 static void alc269_laptop_amic_setup(struct hda_codec
*codec
)
13928 struct alc_spec
*spec
= codec
->spec
;
13929 spec
->autocfg
.hp_pins
[0] = 0x15;
13930 spec
->autocfg
.speaker_pins
[0] = 0x14;
13931 spec
->ext_mic
.pin
= 0x18;
13932 spec
->ext_mic
.mux_idx
= 0;
13933 spec
->int_mic
.pin
= 0x19;
13934 spec
->int_mic
.mux_idx
= 1;
13935 spec
->auto_mic
= 1;
13938 static void alc269_laptop_dmic_setup(struct hda_codec
*codec
)
13940 struct alc_spec
*spec
= codec
->spec
;
13941 spec
->autocfg
.hp_pins
[0] = 0x15;
13942 spec
->autocfg
.speaker_pins
[0] = 0x14;
13943 spec
->ext_mic
.pin
= 0x18;
13944 spec
->ext_mic
.mux_idx
= 0;
13945 spec
->int_mic
.pin
= 0x12;
13946 spec
->int_mic
.mux_idx
= 5;
13947 spec
->auto_mic
= 1;
13950 static void alc269vb_laptop_amic_setup(struct hda_codec
*codec
)
13952 struct alc_spec
*spec
= codec
->spec
;
13953 spec
->autocfg
.hp_pins
[0] = 0x21;
13954 spec
->autocfg
.speaker_pins
[0] = 0x14;
13955 spec
->ext_mic
.pin
= 0x18;
13956 spec
->ext_mic
.mux_idx
= 0;
13957 spec
->int_mic
.pin
= 0x19;
13958 spec
->int_mic
.mux_idx
= 1;
13959 spec
->auto_mic
= 1;
13962 static void alc269vb_laptop_dmic_setup(struct hda_codec
*codec
)
13964 struct alc_spec
*spec
= codec
->spec
;
13965 spec
->autocfg
.hp_pins
[0] = 0x21;
13966 spec
->autocfg
.speaker_pins
[0] = 0x14;
13967 spec
->ext_mic
.pin
= 0x18;
13968 spec
->ext_mic
.mux_idx
= 0;
13969 spec
->int_mic
.pin
= 0x12;
13970 spec
->int_mic
.mux_idx
= 6;
13971 spec
->auto_mic
= 1;
13974 static void alc269_laptop_inithook(struct hda_codec
*codec
)
13976 alc269_speaker_automute(codec
);
13977 alc_mic_automute(codec
);
13981 * generic initialization of ADC, input mixers and output mixers
13983 static struct hda_verb alc269_init_verbs
[] = {
13985 * Unmute ADC0 and set the default input to mic-in
13987 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13990 * Set up output mixers (0x02 - 0x03)
13992 /* set vol=0 to output mixers */
13993 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13994 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13996 /* set up input amps for analog loopback */
13997 /* Amp Indices: DAC = 0, mixer = 1 */
13998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14000 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14001 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14002 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14003 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14006 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14007 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14008 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14009 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14010 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14011 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14013 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14014 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14016 /* FIXME: use Mux-type input source selection */
14017 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14018 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14019 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
14022 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14026 static struct hda_verb alc269vb_init_verbs
[] = {
14028 * Unmute ADC0 and set the default input to mic-in
14030 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14033 * Set up output mixers (0x02 - 0x03)
14035 /* set vol=0 to output mixers */
14036 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14037 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14039 /* set up input amps for analog loopback */
14040 /* Amp Indices: DAC = 0, mixer = 1 */
14041 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14042 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14044 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14045 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14046 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14049 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14050 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14051 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14052 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14053 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14054 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14056 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14057 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14059 /* FIXME: use Mux-type input source selection */
14060 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14061 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14062 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x00},
14065 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14069 #define alc269_auto_create_multi_out_ctls \
14070 alc268_auto_create_multi_out_ctls
14071 #define alc269_auto_create_input_ctls \
14072 alc268_auto_create_input_ctls
14074 #ifdef CONFIG_SND_HDA_POWER_SAVE
14075 #define alc269_loopbacks alc880_loopbacks
14078 /* pcm configuration: identical with ALC880 */
14079 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14080 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14081 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14082 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14084 static struct hda_pcm_stream alc269_44k_pcm_analog_playback
= {
14088 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14089 /* NID is set in alc_build_pcms */
14091 .open
= alc880_playback_pcm_open
,
14092 .prepare
= alc880_playback_pcm_prepare
,
14093 .cleanup
= alc880_playback_pcm_cleanup
14097 static struct hda_pcm_stream alc269_44k_pcm_analog_capture
= {
14101 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
14102 /* NID is set in alc_build_pcms */
14105 #ifdef CONFIG_SND_HDA_POWER_SAVE
14106 static int alc269_mic2_for_mute_led(struct hda_codec
*codec
)
14108 switch (codec
->subsystem_id
) {
14115 static int alc269_mic2_mute_check_ps(struct hda_codec
*codec
, hda_nid_t nid
)
14117 /* update mute-LED according to the speaker mute state */
14118 if (nid
== 0x01 || nid
== 0x14) {
14120 if (snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0) &
14125 /* mic2 vref pin is used for mute LED control */
14126 snd_hda_codec_update_cache(codec
, 0x19, 0,
14127 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14130 return alc_check_power_status(codec
, nid
);
14132 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14135 * BIOS auto configuration
14137 static int alc269_parse_auto_config(struct hda_codec
*codec
)
14139 struct alc_spec
*spec
= codec
->spec
;
14141 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
14143 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14148 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14151 err
= alc269_auto_create_input_ctls(codec
, &spec
->autocfg
);
14155 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14157 if (spec
->autocfg
.dig_outs
)
14158 spec
->multiout
.dig_out_nid
= ALC269_DIGOUT_NID
;
14160 if (spec
->kctls
.list
)
14161 add_mixer(spec
, spec
->kctls
.list
);
14163 if ((alc_read_coef_idx(codec
, 0) & 0x00f0) == 0x0010) {
14164 add_verb(spec
, alc269vb_init_verbs
);
14165 alc_ssid_check(codec
, 0, 0x1b, 0x14, 0x21);
14167 add_verb(spec
, alc269_init_verbs
);
14168 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
14171 spec
->num_mux_defs
= 1;
14172 spec
->input_mux
= &spec
->private_imux
[0];
14173 fillup_priv_adc_nids(codec
, alc269_adc_candidates
,
14174 sizeof(alc269_adc_candidates
));
14176 /* set default input source */
14177 snd_hda_codec_write_cache(codec
, spec
->capsrc_nids
[0],
14178 0, AC_VERB_SET_CONNECT_SEL
,
14179 spec
->input_mux
->items
[0].index
);
14181 err
= alc_auto_add_mic_boost(codec
);
14185 if (!spec
->cap_mixer
&& !spec
->no_analog
)
14186 set_capture_mixer(codec
);
14191 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14192 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14193 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14196 /* init callback for auto-configuration model -- overriding the default init */
14197 static void alc269_auto_init(struct hda_codec
*codec
)
14199 struct alc_spec
*spec
= codec
->spec
;
14200 alc269_auto_init_multi_out(codec
);
14201 alc269_auto_init_hp_out(codec
);
14202 alc269_auto_init_analog_input(codec
);
14203 if (spec
->unsol_event
)
14204 alc_inithook(codec
);
14208 ALC269_FIXUP_SONY_VAIO
,
14211 static const struct hda_verb alc269_sony_vaio_fixup_verbs
[] = {
14212 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREFGRD
},
14216 static const struct alc_fixup alc269_fixups
[] = {
14217 [ALC269_FIXUP_SONY_VAIO
] = {
14218 .verbs
= alc269_sony_vaio_fixup_verbs
14222 static struct snd_pci_quirk alc269_fixup_tbl
[] = {
14223 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO
),
14229 * configuration and preset
14231 static const char *alc269_models
[ALC269_MODEL_LAST
] = {
14232 [ALC269_BASIC
] = "basic",
14233 [ALC269_QUANTA_FL1
] = "quanta",
14234 [ALC269_AMIC
] = "laptop-amic",
14235 [ALC269_DMIC
] = "laptop-dmic",
14236 [ALC269_FUJITSU
] = "fujitsu",
14237 [ALC269_LIFEBOOK
] = "lifebook",
14238 [ALC269_AUTO
] = "auto",
14241 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
14242 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1
),
14243 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14245 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC
),
14246 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC
),
14247 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC
),
14248 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC
),
14249 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC
),
14250 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC
),
14251 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC
),
14252 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC
),
14253 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC
),
14254 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC
),
14255 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC
),
14256 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC
),
14257 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC
),
14258 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC
),
14259 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC
),
14260 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC
),
14261 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC
),
14262 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC
),
14263 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC
),
14264 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC
),
14265 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC
),
14266 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC
),
14267 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC
),
14268 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC
),
14269 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC
),
14270 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC
),
14271 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC
),
14272 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC
),
14273 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC
),
14274 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC
),
14275 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC
),
14276 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC
),
14277 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC
),
14278 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC
),
14279 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC
),
14280 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC
),
14281 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14283 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14285 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC
),
14286 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC
),
14287 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO
),
14288 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK
),
14289 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC
),
14290 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU
),
14291 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC
),
14292 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC
),
14293 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC
),
14294 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC
),
14298 static struct alc_config_preset alc269_presets
[] = {
14300 .mixers
= { alc269_base_mixer
},
14301 .init_verbs
= { alc269_init_verbs
},
14302 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14303 .dac_nids
= alc269_dac_nids
,
14305 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14306 .channel_mode
= alc269_modes
,
14307 .input_mux
= &alc269_capture_source
,
14309 [ALC269_QUANTA_FL1
] = {
14310 .mixers
= { alc269_quanta_fl1_mixer
},
14311 .init_verbs
= { alc269_init_verbs
, alc269_quanta_fl1_verbs
},
14312 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14313 .dac_nids
= alc269_dac_nids
,
14315 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14316 .channel_mode
= alc269_modes
,
14317 .input_mux
= &alc269_capture_source
,
14318 .unsol_event
= alc269_quanta_fl1_unsol_event
,
14319 .setup
= alc269_quanta_fl1_setup
,
14320 .init_hook
= alc269_quanta_fl1_init_hook
,
14323 .mixers
= { alc269_laptop_mixer
},
14324 .cap_mixer
= alc269_laptop_analog_capture_mixer
,
14325 .init_verbs
= { alc269_init_verbs
,
14326 alc269_laptop_amic_init_verbs
},
14327 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14328 .dac_nids
= alc269_dac_nids
,
14330 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14331 .channel_mode
= alc269_modes
,
14332 .unsol_event
= alc269_laptop_unsol_event
,
14333 .setup
= alc269_laptop_amic_setup
,
14334 .init_hook
= alc269_laptop_inithook
,
14337 .mixers
= { alc269_laptop_mixer
},
14338 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
14339 .init_verbs
= { alc269_init_verbs
,
14340 alc269_laptop_dmic_init_verbs
},
14341 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14342 .dac_nids
= alc269_dac_nids
,
14344 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14345 .channel_mode
= alc269_modes
,
14346 .unsol_event
= alc269_laptop_unsol_event
,
14347 .setup
= alc269_laptop_dmic_setup
,
14348 .init_hook
= alc269_laptop_inithook
,
14350 [ALC269VB_AMIC
] = {
14351 .mixers
= { alc269vb_laptop_mixer
},
14352 .cap_mixer
= alc269vb_laptop_analog_capture_mixer
,
14353 .init_verbs
= { alc269vb_init_verbs
,
14354 alc269vb_laptop_amic_init_verbs
},
14355 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14356 .dac_nids
= alc269_dac_nids
,
14358 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14359 .channel_mode
= alc269_modes
,
14360 .unsol_event
= alc269_laptop_unsol_event
,
14361 .setup
= alc269vb_laptop_amic_setup
,
14362 .init_hook
= alc269_laptop_inithook
,
14364 [ALC269VB_DMIC
] = {
14365 .mixers
= { alc269vb_laptop_mixer
},
14366 .cap_mixer
= alc269vb_laptop_digital_capture_mixer
,
14367 .init_verbs
= { alc269vb_init_verbs
,
14368 alc269vb_laptop_dmic_init_verbs
},
14369 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14370 .dac_nids
= alc269_dac_nids
,
14372 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14373 .channel_mode
= alc269_modes
,
14374 .unsol_event
= alc269_laptop_unsol_event
,
14375 .setup
= alc269vb_laptop_dmic_setup
,
14376 .init_hook
= alc269_laptop_inithook
,
14378 [ALC269_FUJITSU
] = {
14379 .mixers
= { alc269_fujitsu_mixer
},
14380 .cap_mixer
= alc269_laptop_digital_capture_mixer
,
14381 .init_verbs
= { alc269_init_verbs
,
14382 alc269_laptop_dmic_init_verbs
},
14383 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14384 .dac_nids
= alc269_dac_nids
,
14386 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14387 .channel_mode
= alc269_modes
,
14388 .unsol_event
= alc269_laptop_unsol_event
,
14389 .setup
= alc269_laptop_dmic_setup
,
14390 .init_hook
= alc269_laptop_inithook
,
14392 [ALC269_LIFEBOOK
] = {
14393 .mixers
= { alc269_lifebook_mixer
},
14394 .init_verbs
= { alc269_init_verbs
, alc269_lifebook_verbs
},
14395 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
14396 .dac_nids
= alc269_dac_nids
,
14398 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
14399 .channel_mode
= alc269_modes
,
14400 .input_mux
= &alc269_capture_source
,
14401 .unsol_event
= alc269_lifebook_unsol_event
,
14402 .init_hook
= alc269_lifebook_init_hook
,
14406 static int patch_alc269(struct hda_codec
*codec
)
14408 struct alc_spec
*spec
;
14411 int is_alc269vb
= 0;
14413 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14417 codec
->spec
= spec
;
14419 alc_auto_parse_customize_define(codec
);
14421 if ((alc_read_coef_idx(codec
, 0) & 0x00f0) == 0x0010){
14422 if (codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
14423 spec
->cdefine
.platform_type
== 1)
14424 alc_codec_rename(codec
, "ALC271X");
14426 alc_codec_rename(codec
, "ALC259");
14429 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
14431 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
14435 if (board_config
< 0) {
14436 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
14438 board_config
= ALC269_AUTO
;
14441 if (board_config
== ALC269_AUTO
)
14442 alc_pick_fixup(codec
, alc269_fixup_tbl
, alc269_fixups
, 1);
14444 if (board_config
== ALC269_AUTO
) {
14445 /* automatic parse from the BIOS config */
14446 err
= alc269_parse_auto_config(codec
);
14452 "hda_codec: Cannot set up configuration "
14453 "from BIOS. Using base mode...\n");
14454 board_config
= ALC269_BASIC
;
14458 err
= snd_hda_attach_beep_device(codec
, 0x1);
14464 if (board_config
!= ALC269_AUTO
)
14465 setup_preset(codec
, &alc269_presets
[board_config
]);
14467 if (board_config
== ALC269_QUANTA_FL1
) {
14468 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14469 * fix the sample rate of analog I/O to 44.1kHz
14471 spec
->stream_analog_playback
= &alc269_44k_pcm_analog_playback
;
14472 spec
->stream_analog_capture
= &alc269_44k_pcm_analog_capture
;
14474 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
14475 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
14477 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
14478 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
14480 if (!spec
->adc_nids
) { /* wasn't filled automatically? use default */
14481 if (!is_alc269vb
) {
14482 spec
->adc_nids
= alc269_adc_nids
;
14483 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
14484 spec
->capsrc_nids
= alc269_capsrc_nids
;
14486 spec
->adc_nids
= alc269vb_adc_nids
;
14487 spec
->num_adc_nids
= ARRAY_SIZE(alc269vb_adc_nids
);
14488 spec
->capsrc_nids
= alc269vb_capsrc_nids
;
14492 if (!spec
->cap_mixer
)
14493 set_capture_mixer(codec
);
14494 if (spec
->cdefine
.enable_pcbeep
)
14495 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
14497 if (board_config
== ALC269_AUTO
)
14498 alc_pick_fixup(codec
, alc269_fixup_tbl
, alc269_fixups
, 0);
14500 spec
->vmaster_nid
= 0x02;
14502 codec
->patch_ops
= alc_patch_ops
;
14503 if (board_config
== ALC269_AUTO
)
14504 spec
->init_hook
= alc269_auto_init
;
14505 #ifdef CONFIG_SND_HDA_POWER_SAVE
14506 if (!spec
->loopback
.amplist
)
14507 spec
->loopback
.amplist
= alc269_loopbacks
;
14508 if (alc269_mic2_for_mute_led(codec
))
14509 codec
->patch_ops
.check_power_status
= alc269_mic2_mute_check_ps
;
14516 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14520 * set the path ways for 2 channel output
14521 * need to set the codec line out and mic 1 pin widgets to inputs
14523 static struct hda_verb alc861_threestack_ch2_init
[] = {
14524 /* set pin widget 1Ah (line in) for input */
14525 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14526 /* set pin widget 18h (mic1/2) for input, for mic also enable
14529 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14531 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
14533 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
14534 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
14540 * need to set the codec line out and mic 1 pin widgets to outputs
14542 static struct hda_verb alc861_threestack_ch6_init
[] = {
14543 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14544 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14545 /* set pin widget 18h (mic1) for output (CLFE)*/
14546 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14548 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14549 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14551 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
14553 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
14554 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
14559 static struct hda_channel_mode alc861_threestack_modes
[2] = {
14560 { 2, alc861_threestack_ch2_init
},
14561 { 6, alc861_threestack_ch6_init
},
14563 /* Set mic1 as input and unmute the mixer */
14564 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
14565 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14566 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
14569 /* Set mic1 as output and mute mixer */
14570 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
14571 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14572 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
14576 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
14577 { 2, alc861_uniwill_m31_ch2_init
},
14578 { 4, alc861_uniwill_m31_ch4_init
},
14581 /* Set mic1 and line-in as input and unmute the mixer */
14582 static struct hda_verb alc861_asus_ch2_init
[] = {
14583 /* set pin widget 1Ah (line in) for input */
14584 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14585 /* set pin widget 18h (mic1/2) for input, for mic also enable
14588 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14590 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
14592 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
14593 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
14597 /* Set mic1 nad line-in as output and mute mixer */
14598 static struct hda_verb alc861_asus_ch6_init
[] = {
14599 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14600 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14601 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14602 /* set pin widget 18h (mic1) for output (CLFE)*/
14603 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14604 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14605 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14606 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14608 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
14610 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
14611 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
14616 static struct hda_channel_mode alc861_asus_modes
[2] = {
14617 { 2, alc861_asus_ch2_init
},
14618 { 6, alc861_asus_ch6_init
},
14623 static struct snd_kcontrol_new alc861_base_mixer
[] = {
14624 /* output mixer control */
14625 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
14626 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
14627 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
14628 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
14629 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
14631 /*Input mixer control */
14632 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14633 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14634 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
14635 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
14636 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
14637 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
14638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
14639 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
14640 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
14641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
14646 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
14647 /* output mixer control */
14648 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
14649 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
14650 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
14651 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
14652 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14654 /* Input mixer control */
14655 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14656 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14657 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
14658 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
14659 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
14660 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
14661 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
14662 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
14663 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
14664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
14667 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14668 .name
= "Channel Mode",
14669 .info
= alc_ch_mode_info
,
14670 .get
= alc_ch_mode_get
,
14671 .put
= alc_ch_mode_put
,
14672 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
14677 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
14678 /* output mixer control */
14679 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
14680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
14681 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
14686 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
14687 /* output mixer control */
14688 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
14689 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
14690 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
14691 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
14692 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14694 /* Input mixer control */
14695 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14696 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14697 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
14698 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
14699 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
14700 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
14701 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
14702 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
14703 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
14704 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
14707 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14708 .name
= "Channel Mode",
14709 .info
= alc_ch_mode_info
,
14710 .get
= alc_ch_mode_get
,
14711 .put
= alc_ch_mode_put
,
14712 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
14717 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
14718 /* output mixer control */
14719 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
14720 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
14721 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
14722 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
14723 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
14725 /* Input mixer control */
14726 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
14727 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14728 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
14729 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
14730 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
14731 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
14732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
14733 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
14734 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
14735 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
14738 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14739 .name
= "Channel Mode",
14740 .info
= alc_ch_mode_info
,
14741 .get
= alc_ch_mode_get
,
14742 .put
= alc_ch_mode_put
,
14743 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
14748 /* additional mixer */
14749 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
14750 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
14751 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
14756 * generic initialization of ADC, input mixers and output mixers
14758 static struct hda_verb alc861_base_init_verbs
[] = {
14760 * Unmute ADC0 and set the default input to mic-in
14762 /* port-A for surround (rear panel) */
14763 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14764 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14765 /* port-B for mic-in (rear panel) with vref */
14766 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14767 /* port-C for line-in (rear panel) */
14768 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14769 /* port-D for Front */
14770 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14771 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14772 /* port-E for HP out (front panel) */
14773 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
14774 /* route front PCM to HP */
14775 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14776 /* port-F for mic-in (front panel) with vref */
14777 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14778 /* port-G for CLFE (rear panel) */
14779 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14780 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14781 /* port-H for side (rear panel) */
14782 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14783 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14785 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14786 /* route front mic to ADC1*/
14787 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
14788 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14790 /* Unmute DAC0~3 & spdif out*/
14791 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14792 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14793 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14794 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14795 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14797 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14798 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14799 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14800 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14801 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14803 /* Unmute Stereo Mixer 15 */
14804 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14806 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14807 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
14809 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14810 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14811 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14812 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14813 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14814 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14815 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14816 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14817 /* hp used DAC 3 (Front) */
14818 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
14819 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14824 static struct hda_verb alc861_threestack_init_verbs
[] = {
14826 * Unmute ADC0 and set the default input to mic-in
14828 /* port-A for surround (rear panel) */
14829 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14830 /* port-B for mic-in (rear panel) with vref */
14831 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14832 /* port-C for line-in (rear panel) */
14833 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14834 /* port-D for Front */
14835 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14836 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14837 /* port-E for HP out (front panel) */
14838 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
14839 /* route front PCM to HP */
14840 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14841 /* port-F for mic-in (front panel) with vref */
14842 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14843 /* port-G for CLFE (rear panel) */
14844 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14845 /* port-H for side (rear panel) */
14846 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14848 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14849 /* route front mic to ADC1*/
14850 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
14851 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14852 /* Unmute DAC0~3 & spdif out*/
14853 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14854 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14855 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14856 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14859 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14860 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14861 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14862 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14863 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14865 /* Unmute Stereo Mixer 15 */
14866 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14867 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14868 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
14871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14872 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14873 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14874 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14876 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14877 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14878 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14879 /* hp used DAC 3 (Front) */
14880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
14881 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14885 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
14887 * Unmute ADC0 and set the default input to mic-in
14889 /* port-A for surround (rear panel) */
14890 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14891 /* port-B for mic-in (rear panel) with vref */
14892 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14893 /* port-C for line-in (rear panel) */
14894 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14895 /* port-D for Front */
14896 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14897 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14898 /* port-E for HP out (front panel) */
14899 /* this has to be set to VREF80 */
14900 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14901 /* route front PCM to HP */
14902 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14903 /* port-F for mic-in (front panel) with vref */
14904 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14905 /* port-G for CLFE (rear panel) */
14906 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14907 /* port-H for side (rear panel) */
14908 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14910 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14911 /* route front mic to ADC1*/
14912 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
14913 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14914 /* Unmute DAC0~3 & spdif out*/
14915 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14916 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14917 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14918 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14921 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14922 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14923 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14924 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14925 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14927 /* Unmute Stereo Mixer 15 */
14928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
14933 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14934 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14935 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14936 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14937 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14938 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14939 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14940 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14941 /* hp used DAC 3 (Front) */
14942 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
14943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14947 static struct hda_verb alc861_asus_init_verbs
[] = {
14949 * Unmute ADC0 and set the default input to mic-in
14951 /* port-A for surround (rear panel)
14952 * according to codec#0 this is the HP jack
14954 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
14955 /* route front PCM to HP */
14956 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
14957 /* port-B for mic-in (rear panel) with vref */
14958 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14959 /* port-C for line-in (rear panel) */
14960 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14961 /* port-D for Front */
14962 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14963 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14964 /* port-E for HP out (front panel) */
14965 /* this has to be set to VREF80 */
14966 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14967 /* route front PCM to HP */
14968 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14969 /* port-F for mic-in (front panel) with vref */
14970 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14971 /* port-G for CLFE (rear panel) */
14972 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14973 /* port-H for side (rear panel) */
14974 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14976 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14977 /* route front mic to ADC1*/
14978 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
14979 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14980 /* Unmute DAC0~3 & spdif out*/
14981 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14982 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14983 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14984 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14985 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14986 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14987 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14988 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14989 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14990 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14992 /* Unmute Stereo Mixer 15 */
14993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
14998 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14999 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15000 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15001 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15002 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15003 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15004 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15005 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15006 /* hp used DAC 3 (Front) */
15007 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
15008 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15012 /* additional init verbs for ASUS laptops */
15013 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
15014 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
15015 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
15020 * generic initialization of ADC, input mixers and output mixers
15022 static struct hda_verb alc861_auto_init_verbs
[] = {
15024 * Unmute ADC0 and set the default input to mic-in
15026 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15027 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15029 /* Unmute DAC0~3 & spdif out*/
15030 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15031 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15032 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15033 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15034 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15036 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15037 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15038 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15039 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15040 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15042 /* Unmute Stereo Mixer 15 */
15043 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15044 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15045 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15046 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
15048 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15049 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15050 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15051 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15052 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15053 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15054 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15055 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15057 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15058 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15059 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15060 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15061 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15063 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15064 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15066 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
15071 static struct hda_verb alc861_toshiba_init_verbs
[] = {
15072 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15077 /* toggle speaker-output according to the hp-jack state */
15078 static void alc861_toshiba_automute(struct hda_codec
*codec
)
15080 unsigned int present
= snd_hda_jack_detect(codec
, 0x0f);
15082 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
15083 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
15084 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
15085 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
15088 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
15091 if ((res
>> 26) == ALC880_HP_EVENT
)
15092 alc861_toshiba_automute(codec
);
15095 /* pcm configuration: identical with ALC880 */
15096 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15097 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15098 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15099 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15102 #define ALC861_DIGOUT_NID 0x07
15104 static struct hda_channel_mode alc861_8ch_modes
[1] = {
15108 static hda_nid_t alc861_dac_nids
[4] = {
15109 /* front, surround, clfe, side */
15110 0x03, 0x06, 0x05, 0x04
15113 static hda_nid_t alc660_dac_nids
[3] = {
15114 /* front, clfe, surround */
15118 static hda_nid_t alc861_adc_nids
[1] = {
15123 static struct hda_input_mux alc861_capture_source
= {
15127 { "Front Mic", 0x3 },
15134 static hda_nid_t
alc861_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
15136 struct alc_spec
*spec
= codec
->spec
;
15137 hda_nid_t mix
, srcs
[5];
15140 if (snd_hda_get_connections(codec
, pin
, &mix
, 1) != 1)
15142 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
15145 for (i
= 0; i
< num
; i
++) {
15147 type
= get_wcaps_type(get_wcaps(codec
, srcs
[i
]));
15148 if (type
!= AC_WID_AUD_OUT
)
15150 for (j
= 0; j
< spec
->multiout
.num_dacs
; j
++)
15151 if (spec
->multiout
.dac_nids
[j
] == srcs
[i
])
15153 if (j
>= spec
->multiout
.num_dacs
)
15159 /* fill in the dac_nids table from the parsed pin configuration */
15160 static int alc861_auto_fill_dac_nids(struct hda_codec
*codec
,
15161 const struct auto_pin_cfg
*cfg
)
15163 struct alc_spec
*spec
= codec
->spec
;
15165 hda_nid_t nid
, dac
;
15167 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
15168 for (i
= 0; i
< cfg
->line_outs
; i
++) {
15169 nid
= cfg
->line_out_pins
[i
];
15170 dac
= alc861_look_for_dac(codec
, nid
);
15173 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
15178 static int alc861_create_out_sw(struct hda_codec
*codec
, const char *pfx
,
15179 hda_nid_t nid
, unsigned int chs
)
15181 return add_pb_sw_ctrl(codec
->spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
15182 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
15185 /* add playback controls from the parsed DAC table */
15186 static int alc861_auto_create_multi_out_ctls(struct hda_codec
*codec
,
15187 const struct auto_pin_cfg
*cfg
)
15189 struct alc_spec
*spec
= codec
->spec
;
15190 static const char *chname
[4] = {
15191 "Front", "Surround", NULL
/*CLFE*/, "Side"
15196 if (cfg
->line_outs
== 1) {
15197 const char *pfx
= NULL
;
15200 else if (cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
15203 nid
= spec
->multiout
.dac_nids
[0];
15204 return alc861_create_out_sw(codec
, pfx
, nid
, 3);
15208 for (i
= 0; i
< cfg
->line_outs
; i
++) {
15209 nid
= spec
->multiout
.dac_nids
[i
];
15214 err
= alc861_create_out_sw(codec
, "Center", nid
, 1);
15217 err
= alc861_create_out_sw(codec
, "LFE", nid
, 2);
15221 err
= alc861_create_out_sw(codec
, chname
[i
], nid
, 3);
15229 static int alc861_auto_create_hp_ctls(struct hda_codec
*codec
, hda_nid_t pin
)
15231 struct alc_spec
*spec
= codec
->spec
;
15238 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
15239 nid
= alc861_look_for_dac(codec
, pin
);
15241 err
= alc861_create_out_sw(codec
, "Headphone", nid
, 3);
15244 spec
->multiout
.hp_nid
= nid
;
15250 /* create playback/capture controls for input pins */
15251 static int alc861_auto_create_input_ctls(struct hda_codec
*codec
,
15252 const struct auto_pin_cfg
*cfg
)
15254 return alc_auto_create_input_ctls(codec
, cfg
, 0x15, 0x08, 0);
15257 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
15259 int pin_type
, hda_nid_t dac
)
15261 hda_nid_t mix
, srcs
[5];
15264 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
15266 snd_hda_codec_write(codec
, dac
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15268 if (snd_hda_get_connections(codec
, nid
, &mix
, 1) != 1)
15270 num
= snd_hda_get_connections(codec
, mix
, srcs
, ARRAY_SIZE(srcs
));
15273 for (i
= 0; i
< num
; i
++) {
15275 if (srcs
[i
] == dac
|| srcs
[i
] == 0x15)
15276 mute
= AMP_IN_UNMUTE(i
);
15278 mute
= AMP_IN_MUTE(i
);
15279 snd_hda_codec_write(codec
, mix
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15284 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
15286 struct alc_spec
*spec
= codec
->spec
;
15289 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
15290 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
15291 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
15293 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
15294 spec
->multiout
.dac_nids
[i
]);
15298 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
15300 struct alc_spec
*spec
= codec
->spec
;
15302 if (spec
->autocfg
.hp_outs
)
15303 alc861_auto_set_output_and_unmute(codec
,
15304 spec
->autocfg
.hp_pins
[0],
15306 spec
->multiout
.hp_nid
);
15307 if (spec
->autocfg
.speaker_outs
)
15308 alc861_auto_set_output_and_unmute(codec
,
15309 spec
->autocfg
.speaker_pins
[0],
15311 spec
->multiout
.dac_nids
[0]);
15314 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
15316 struct alc_spec
*spec
= codec
->spec
;
15319 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
15320 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
15321 if (nid
>= 0x0c && nid
<= 0x11)
15322 alc_set_input_pin(codec
, nid
, i
);
15326 /* parse the BIOS configuration and set up the alc_spec */
15327 /* return 1 if successful, 0 if the proper config is not found,
15328 * or a negative error code
15330 static int alc861_parse_auto_config(struct hda_codec
*codec
)
15332 struct alc_spec
*spec
= codec
->spec
;
15334 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
15336 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
15340 if (!spec
->autocfg
.line_outs
)
15341 return 0; /* can't find valid BIOS pin config */
15343 err
= alc861_auto_fill_dac_nids(codec
, &spec
->autocfg
);
15346 err
= alc861_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
15349 err
= alc861_auto_create_hp_ctls(codec
, spec
->autocfg
.hp_pins
[0]);
15352 err
= alc861_auto_create_input_ctls(codec
, &spec
->autocfg
);
15356 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
15358 if (spec
->autocfg
.dig_outs
)
15359 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
15361 if (spec
->kctls
.list
)
15362 add_mixer(spec
, spec
->kctls
.list
);
15364 add_verb(spec
, alc861_auto_init_verbs
);
15366 spec
->num_mux_defs
= 1;
15367 spec
->input_mux
= &spec
->private_imux
[0];
15369 spec
->adc_nids
= alc861_adc_nids
;
15370 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
15371 set_capture_mixer(codec
);
15373 alc_ssid_check(codec
, 0x0e, 0x0f, 0x0b, 0);
15378 /* additional initialization for auto-configuration model */
15379 static void alc861_auto_init(struct hda_codec
*codec
)
15381 struct alc_spec
*spec
= codec
->spec
;
15382 alc861_auto_init_multi_out(codec
);
15383 alc861_auto_init_hp_out(codec
);
15384 alc861_auto_init_analog_input(codec
);
15385 if (spec
->unsol_event
)
15386 alc_inithook(codec
);
15389 #ifdef CONFIG_SND_HDA_POWER_SAVE
15390 static struct hda_amp_list alc861_loopbacks
[] = {
15391 { 0x15, HDA_INPUT
, 0 },
15392 { 0x15, HDA_INPUT
, 1 },
15393 { 0x15, HDA_INPUT
, 2 },
15394 { 0x15, HDA_INPUT
, 3 },
15401 * configuration and preset
15403 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
15404 [ALC861_3ST
] = "3stack",
15405 [ALC660_3ST
] = "3stack-660",
15406 [ALC861_3ST_DIG
] = "3stack-dig",
15407 [ALC861_6ST_DIG
] = "6stack-dig",
15408 [ALC861_UNIWILL_M31
] = "uniwill-m31",
15409 [ALC861_TOSHIBA
] = "toshiba",
15410 [ALC861_ASUS
] = "asus",
15411 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
15412 [ALC861_AUTO
] = "auto",
15415 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
15416 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
15417 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
15418 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
15419 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
15420 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
15421 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
15422 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
15423 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15424 * Any other models that need this preset?
15426 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15427 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
15428 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
15429 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
15430 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
15431 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
15432 /* FIXME: the below seems conflict */
15433 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15434 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
15435 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
15439 static struct alc_config_preset alc861_presets
[] = {
15441 .mixers
= { alc861_3ST_mixer
},
15442 .init_verbs
= { alc861_threestack_init_verbs
},
15443 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15444 .dac_nids
= alc861_dac_nids
,
15445 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
15446 .channel_mode
= alc861_threestack_modes
,
15448 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15449 .adc_nids
= alc861_adc_nids
,
15450 .input_mux
= &alc861_capture_source
,
15452 [ALC861_3ST_DIG
] = {
15453 .mixers
= { alc861_base_mixer
},
15454 .init_verbs
= { alc861_threestack_init_verbs
},
15455 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15456 .dac_nids
= alc861_dac_nids
,
15457 .dig_out_nid
= ALC861_DIGOUT_NID
,
15458 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
15459 .channel_mode
= alc861_threestack_modes
,
15461 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15462 .adc_nids
= alc861_adc_nids
,
15463 .input_mux
= &alc861_capture_source
,
15465 [ALC861_6ST_DIG
] = {
15466 .mixers
= { alc861_base_mixer
},
15467 .init_verbs
= { alc861_base_init_verbs
},
15468 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15469 .dac_nids
= alc861_dac_nids
,
15470 .dig_out_nid
= ALC861_DIGOUT_NID
,
15471 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
15472 .channel_mode
= alc861_8ch_modes
,
15473 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15474 .adc_nids
= alc861_adc_nids
,
15475 .input_mux
= &alc861_capture_source
,
15478 .mixers
= { alc861_3ST_mixer
},
15479 .init_verbs
= { alc861_threestack_init_verbs
},
15480 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
15481 .dac_nids
= alc660_dac_nids
,
15482 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
15483 .channel_mode
= alc861_threestack_modes
,
15485 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15486 .adc_nids
= alc861_adc_nids
,
15487 .input_mux
= &alc861_capture_source
,
15489 [ALC861_UNIWILL_M31
] = {
15490 .mixers
= { alc861_uniwill_m31_mixer
},
15491 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
15492 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15493 .dac_nids
= alc861_dac_nids
,
15494 .dig_out_nid
= ALC861_DIGOUT_NID
,
15495 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
15496 .channel_mode
= alc861_uniwill_m31_modes
,
15498 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15499 .adc_nids
= alc861_adc_nids
,
15500 .input_mux
= &alc861_capture_source
,
15502 [ALC861_TOSHIBA
] = {
15503 .mixers
= { alc861_toshiba_mixer
},
15504 .init_verbs
= { alc861_base_init_verbs
,
15505 alc861_toshiba_init_verbs
},
15506 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15507 .dac_nids
= alc861_dac_nids
,
15508 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
15509 .channel_mode
= alc883_3ST_2ch_modes
,
15510 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15511 .adc_nids
= alc861_adc_nids
,
15512 .input_mux
= &alc861_capture_source
,
15513 .unsol_event
= alc861_toshiba_unsol_event
,
15514 .init_hook
= alc861_toshiba_automute
,
15517 .mixers
= { alc861_asus_mixer
},
15518 .init_verbs
= { alc861_asus_init_verbs
},
15519 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15520 .dac_nids
= alc861_dac_nids
,
15521 .dig_out_nid
= ALC861_DIGOUT_NID
,
15522 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
15523 .channel_mode
= alc861_asus_modes
,
15526 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15527 .adc_nids
= alc861_adc_nids
,
15528 .input_mux
= &alc861_capture_source
,
15530 [ALC861_ASUS_LAPTOP
] = {
15531 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
15532 .init_verbs
= { alc861_asus_init_verbs
,
15533 alc861_asus_laptop_init_verbs
},
15534 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
15535 .dac_nids
= alc861_dac_nids
,
15536 .dig_out_nid
= ALC861_DIGOUT_NID
,
15537 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
15538 .channel_mode
= alc883_3ST_2ch_modes
,
15540 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
15541 .adc_nids
= alc861_adc_nids
,
15542 .input_mux
= &alc861_capture_source
,
15546 /* Pin config fixes */
15548 PINFIX_FSC_AMILO_PI1505
,
15551 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix
[] = {
15552 { 0x0b, 0x0221101f }, /* HP */
15553 { 0x0f, 0x90170310 }, /* speaker */
15557 static const struct alc_fixup alc861_fixups
[] = {
15558 [PINFIX_FSC_AMILO_PI1505
] = {
15559 .pins
= alc861_fsc_amilo_pi1505_pinfix
15563 static struct snd_pci_quirk alc861_fixup_tbl
[] = {
15564 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505
),
15568 static int patch_alc861(struct hda_codec
*codec
)
15570 struct alc_spec
*spec
;
15574 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
15578 codec
->spec
= spec
;
15580 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
15584 if (board_config
< 0) {
15585 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
15587 board_config
= ALC861_AUTO
;
15590 if (board_config
== ALC861_AUTO
)
15591 alc_pick_fixup(codec
, alc861_fixup_tbl
, alc861_fixups
, 1);
15593 if (board_config
== ALC861_AUTO
) {
15594 /* automatic parse from the BIOS config */
15595 err
= alc861_parse_auto_config(codec
);
15601 "hda_codec: Cannot set up configuration "
15602 "from BIOS. Using base mode...\n");
15603 board_config
= ALC861_3ST_DIG
;
15607 err
= snd_hda_attach_beep_device(codec
, 0x23);
15613 if (board_config
!= ALC861_AUTO
)
15614 setup_preset(codec
, &alc861_presets
[board_config
]);
15616 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
15617 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
15619 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
15620 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
15622 if (!spec
->cap_mixer
)
15623 set_capture_mixer(codec
);
15624 set_beep_amp(spec
, 0x23, 0, HDA_OUTPUT
);
15626 spec
->vmaster_nid
= 0x03;
15628 if (board_config
== ALC861_AUTO
)
15629 alc_pick_fixup(codec
, alc861_fixup_tbl
, alc861_fixups
, 0);
15631 codec
->patch_ops
= alc_patch_ops
;
15632 if (board_config
== ALC861_AUTO
) {
15633 spec
->init_hook
= alc861_auto_init
;
15634 #ifdef CONFIG_SND_HDA_POWER_SAVE
15635 spec
->power_hook
= alc_power_eapd
;
15638 #ifdef CONFIG_SND_HDA_POWER_SAVE
15639 if (!spec
->loopback
.amplist
)
15640 spec
->loopback
.amplist
= alc861_loopbacks
;
15647 * ALC861-VD support
15651 * In addition, an independent DAC
15653 #define ALC861VD_DIGOUT_NID 0x06
15655 static hda_nid_t alc861vd_dac_nids
[4] = {
15656 /* front, surr, clfe, side surr */
15657 0x02, 0x03, 0x04, 0x05
15660 /* dac_nids for ALC660vd are in a different order - according to
15661 * Realtek's driver.
15662 * This should probably result in a different mixer for 6stack models
15663 * of ALC660vd codecs, but for now there is only 3stack mixer
15664 * - and it is the same as in 861vd.
15665 * adc_nids in ALC660vd are (is) the same as in 861vd
15667 static hda_nid_t alc660vd_dac_nids
[3] = {
15668 /* front, rear, clfe, rear_surr */
15672 static hda_nid_t alc861vd_adc_nids
[1] = {
15677 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
15680 /* FIXME: should be a matrix-type input source selection */
15681 static struct hda_input_mux alc861vd_capture_source
= {
15685 { "Front Mic", 0x1 },
15691 static struct hda_input_mux alc861vd_dallas_capture_source
= {
15694 { "Ext Mic", 0x0 },
15695 { "Int Mic", 0x1 },
15699 static struct hda_input_mux alc861vd_hp_capture_source
= {
15702 { "Front Mic", 0x0 },
15703 { "ATAPI Mic", 0x1 },
15710 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
15717 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
15718 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15719 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15720 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15721 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15728 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
15729 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15730 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15731 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15732 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15736 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
15737 { 6, alc861vd_6stack_ch6_init
},
15738 { 8, alc861vd_6stack_ch8_init
},
15741 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
15743 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15744 .name
= "Channel Mode",
15745 .info
= alc_ch_mode_info
,
15746 .get
= alc_ch_mode_get
,
15747 .put
= alc_ch_mode_put
,
15752 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15753 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15755 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
15756 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15757 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
15759 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15760 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
15762 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15764 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15766 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
15767 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
15769 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
15770 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
15772 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
15775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15778 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
15779 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15780 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15782 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15783 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15785 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
15786 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
15791 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
15792 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15793 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
15795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15797 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
15798 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15799 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15801 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
15802 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15803 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15805 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15806 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15808 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
15809 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
15814 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
15815 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15816 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15817 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
15819 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15821 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
15822 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15823 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15825 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
15826 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15827 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15829 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
15830 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
15835 /* Pin assignment: Speaker=0x14, HP = 0x15,
15836 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15838 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
15839 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15840 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
15841 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15842 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
15843 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
15844 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15845 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15846 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
15847 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15848 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15852 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15853 * Front Mic=0x18, ATAPI Mic = 0x19,
15855 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
15856 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15857 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
15858 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15859 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
15860 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15861 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15862 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15863 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15869 * generic initialization of ADC, input mixers and output mixers
15871 static struct hda_verb alc861vd_volume_init_verbs
[] = {
15873 * Unmute ADC0 and set the default input to mic-in
15875 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
15876 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15878 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15879 * the analog-loopback mixer widget
15881 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15883 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15884 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15885 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15886 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
15888 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15889 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15890 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15891 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
15892 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
15895 * Set up output mixers (0x02 - 0x05)
15897 /* set vol=0 to output mixers */
15898 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15899 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15900 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15901 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15903 /* set up input amps for analog loopback */
15904 /* Amp Indices: DAC = 0, mixer = 1 */
15905 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15906 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15907 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15908 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15909 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15910 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15911 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15912 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15918 * 3-stack pin configuration:
15919 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15921 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
15923 * Set pin mode and muting
15925 /* set front pin widgets 0x14 for output */
15926 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15927 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15928 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
15930 /* Mic (rear) pin: input vref at 80% */
15931 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
15932 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15933 /* Front Mic pin: input vref at 80% */
15934 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
15935 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15936 /* Line In pin: input */
15937 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15938 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15939 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15940 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15941 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15942 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
15943 /* CD pin widget for input */
15944 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15950 * 6-stack pin configuration:
15952 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
15954 * Set pin mode and muting
15956 /* set front pin widgets 0x14 for output */
15957 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15958 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15959 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
15961 /* Rear Pin: output 1 (0x0d) */
15962 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15963 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15964 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
15965 /* CLFE Pin: output 2 (0x0e) */
15966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15967 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15968 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
15969 /* Side Pin: output 3 (0x0f) */
15970 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15971 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15972 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
15974 /* Mic (rear) pin: input vref at 80% */
15975 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
15976 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15977 /* Front Mic pin: input vref at 80% */
15978 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
15979 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15980 /* Line In pin: input */
15981 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15982 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15983 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15984 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15985 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15986 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
15987 /* CD pin widget for input */
15988 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15993 static struct hda_verb alc861vd_eapd_verbs
[] = {
15994 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
15998 static struct hda_verb alc660vd_eapd_verbs
[] = {
15999 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16000 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16004 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
16005 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16006 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16007 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
16008 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16009 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16013 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
16015 unsigned int present
;
16016 unsigned char bits
;
16018 present
= snd_hda_jack_detect(codec
, 0x18);
16019 bits
= present
? HDA_AMP_MUTE
: 0;
16021 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
16022 HDA_AMP_MUTE
, bits
);
16025 static void alc861vd_lenovo_setup(struct hda_codec
*codec
)
16027 struct alc_spec
*spec
= codec
->spec
;
16028 spec
->autocfg
.hp_pins
[0] = 0x1b;
16029 spec
->autocfg
.speaker_pins
[0] = 0x14;
16032 static void alc861vd_lenovo_init_hook(struct hda_codec
*codec
)
16034 alc_automute_amp(codec
);
16035 alc861vd_lenovo_mic_automute(codec
);
16038 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
16041 switch (res
>> 26) {
16042 case ALC880_MIC_EVENT
:
16043 alc861vd_lenovo_mic_automute(codec
);
16046 alc_automute_amp_unsol_event(codec
, res
);
16051 static struct hda_verb alc861vd_dallas_verbs
[] = {
16052 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16053 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16054 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16055 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16059 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16060 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16061 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16062 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16063 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16064 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16066 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16067 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16068 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16071 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16072 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16073 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16075 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16076 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16077 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
16078 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16079 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16080 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16081 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16082 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16089 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16090 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16091 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16096 /* toggle speaker-output according to the hp-jack state */
16097 static void alc861vd_dallas_setup(struct hda_codec
*codec
)
16099 struct alc_spec
*spec
= codec
->spec
;
16101 spec
->autocfg
.hp_pins
[0] = 0x15;
16102 spec
->autocfg
.speaker_pins
[0] = 0x14;
16105 #ifdef CONFIG_SND_HDA_POWER_SAVE
16106 #define alc861vd_loopbacks alc880_loopbacks
16109 /* pcm configuration: identical with ALC880 */
16110 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16111 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16112 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16113 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16116 * configuration and preset
16118 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
16119 [ALC660VD_3ST
] = "3stack-660",
16120 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
16121 [ALC660VD_ASUS_V1S
] = "asus-v1s",
16122 [ALC861VD_3ST
] = "3stack",
16123 [ALC861VD_3ST_DIG
] = "3stack-digout",
16124 [ALC861VD_6ST_DIG
] = "6stack-digout",
16125 [ALC861VD_LENOVO
] = "lenovo",
16126 [ALC861VD_DALLAS
] = "dallas",
16127 [ALC861VD_HP
] = "hp",
16128 [ALC861VD_AUTO
] = "auto",
16131 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
16132 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
16133 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
16134 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
16135 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16136 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S
),
16137 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
16138 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
16139 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
16140 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16141 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO
),
16142 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
16143 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
16144 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
16145 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO
),
16146 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
16150 static struct alc_config_preset alc861vd_presets
[] = {
16152 .mixers
= { alc861vd_3st_mixer
},
16153 .init_verbs
= { alc861vd_volume_init_verbs
,
16154 alc861vd_3stack_init_verbs
},
16155 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16156 .dac_nids
= alc660vd_dac_nids
,
16157 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16158 .channel_mode
= alc861vd_3stack_2ch_modes
,
16159 .input_mux
= &alc861vd_capture_source
,
16161 [ALC660VD_3ST_DIG
] = {
16162 .mixers
= { alc861vd_3st_mixer
},
16163 .init_verbs
= { alc861vd_volume_init_verbs
,
16164 alc861vd_3stack_init_verbs
},
16165 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16166 .dac_nids
= alc660vd_dac_nids
,
16167 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16168 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16169 .channel_mode
= alc861vd_3stack_2ch_modes
,
16170 .input_mux
= &alc861vd_capture_source
,
16173 .mixers
= { alc861vd_3st_mixer
},
16174 .init_verbs
= { alc861vd_volume_init_verbs
,
16175 alc861vd_3stack_init_verbs
},
16176 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16177 .dac_nids
= alc861vd_dac_nids
,
16178 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16179 .channel_mode
= alc861vd_3stack_2ch_modes
,
16180 .input_mux
= &alc861vd_capture_source
,
16182 [ALC861VD_3ST_DIG
] = {
16183 .mixers
= { alc861vd_3st_mixer
},
16184 .init_verbs
= { alc861vd_volume_init_verbs
,
16185 alc861vd_3stack_init_verbs
},
16186 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16187 .dac_nids
= alc861vd_dac_nids
,
16188 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16189 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16190 .channel_mode
= alc861vd_3stack_2ch_modes
,
16191 .input_mux
= &alc861vd_capture_source
,
16193 [ALC861VD_6ST_DIG
] = {
16194 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
16195 .init_verbs
= { alc861vd_volume_init_verbs
,
16196 alc861vd_6stack_init_verbs
},
16197 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16198 .dac_nids
= alc861vd_dac_nids
,
16199 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16200 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
16201 .channel_mode
= alc861vd_6stack_modes
,
16202 .input_mux
= &alc861vd_capture_source
,
16204 [ALC861VD_LENOVO
] = {
16205 .mixers
= { alc861vd_lenovo_mixer
},
16206 .init_verbs
= { alc861vd_volume_init_verbs
,
16207 alc861vd_3stack_init_verbs
,
16208 alc861vd_eapd_verbs
,
16209 alc861vd_lenovo_unsol_verbs
},
16210 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16211 .dac_nids
= alc660vd_dac_nids
,
16212 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16213 .channel_mode
= alc861vd_3stack_2ch_modes
,
16214 .input_mux
= &alc861vd_capture_source
,
16215 .unsol_event
= alc861vd_lenovo_unsol_event
,
16216 .setup
= alc861vd_lenovo_setup
,
16217 .init_hook
= alc861vd_lenovo_init_hook
,
16219 [ALC861VD_DALLAS
] = {
16220 .mixers
= { alc861vd_dallas_mixer
},
16221 .init_verbs
= { alc861vd_dallas_verbs
},
16222 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16223 .dac_nids
= alc861vd_dac_nids
,
16224 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16225 .channel_mode
= alc861vd_3stack_2ch_modes
,
16226 .input_mux
= &alc861vd_dallas_capture_source
,
16227 .unsol_event
= alc_automute_amp_unsol_event
,
16228 .setup
= alc861vd_dallas_setup
,
16229 .init_hook
= alc_automute_amp
,
16232 .mixers
= { alc861vd_hp_mixer
},
16233 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
16234 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
16235 .dac_nids
= alc861vd_dac_nids
,
16236 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16237 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16238 .channel_mode
= alc861vd_3stack_2ch_modes
,
16239 .input_mux
= &alc861vd_hp_capture_source
,
16240 .unsol_event
= alc_automute_amp_unsol_event
,
16241 .setup
= alc861vd_dallas_setup
,
16242 .init_hook
= alc_automute_amp
,
16244 [ALC660VD_ASUS_V1S
] = {
16245 .mixers
= { alc861vd_lenovo_mixer
},
16246 .init_verbs
= { alc861vd_volume_init_verbs
,
16247 alc861vd_3stack_init_verbs
,
16248 alc861vd_eapd_verbs
,
16249 alc861vd_lenovo_unsol_verbs
},
16250 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
16251 .dac_nids
= alc660vd_dac_nids
,
16252 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
16253 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
16254 .channel_mode
= alc861vd_3stack_2ch_modes
,
16255 .input_mux
= &alc861vd_capture_source
,
16256 .unsol_event
= alc861vd_lenovo_unsol_event
,
16257 .setup
= alc861vd_lenovo_setup
,
16258 .init_hook
= alc861vd_lenovo_init_hook
,
16263 * BIOS auto configuration
16265 static int alc861vd_auto_create_input_ctls(struct hda_codec
*codec
,
16266 const struct auto_pin_cfg
*cfg
)
16268 return alc_auto_create_input_ctls(codec
, cfg
, 0x15, 0x09, 0);
16272 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
16273 hda_nid_t nid
, int pin_type
, int dac_idx
)
16275 alc_set_pin_output(codec
, nid
, pin_type
);
16278 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
16280 struct alc_spec
*spec
= codec
->spec
;
16283 for (i
= 0; i
<= HDA_SIDE
; i
++) {
16284 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
16285 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
16287 alc861vd_auto_set_output_and_unmute(codec
, nid
,
16293 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
16295 struct alc_spec
*spec
= codec
->spec
;
16298 pin
= spec
->autocfg
.hp_pins
[0];
16299 if (pin
) /* connect to front and use dac 0 */
16300 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
16301 pin
= spec
->autocfg
.speaker_pins
[0];
16303 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
16306 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16308 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
16310 struct alc_spec
*spec
= codec
->spec
;
16313 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
16314 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
16315 if (alc_is_input_pin(codec
, nid
)) {
16316 alc_set_input_pin(codec
, nid
, i
);
16317 if (nid
!= ALC861VD_PIN_CD_NID
&&
16318 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
16319 snd_hda_codec_write(codec
, nid
, 0,
16320 AC_VERB_SET_AMP_GAIN_MUTE
,
16326 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16328 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16329 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16331 /* add playback controls from the parsed DAC table */
16332 /* Based on ALC880 version. But ALC861VD has separate,
16333 * different NIDs for mute/unmute switch and volume control */
16334 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
16335 const struct auto_pin_cfg
*cfg
)
16337 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
16338 hda_nid_t nid_v
, nid_s
;
16341 for (i
= 0; i
< cfg
->line_outs
; i
++) {
16342 if (!spec
->multiout
.dac_nids
[i
])
16344 nid_v
= alc861vd_idx_to_mixer_vol(
16346 spec
->multiout
.dac_nids
[i
]));
16347 nid_s
= alc861vd_idx_to_mixer_switch(
16349 spec
->multiout
.dac_nids
[i
]));
16353 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
16355 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
16359 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
,
16361 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
16365 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
16367 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
16371 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
,
16373 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
16379 if (cfg
->line_outs
== 1 &&
16380 cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
) {
16387 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
16388 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
16392 if (cfg
->line_outs
== 1 &&
16393 cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
16395 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
16396 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
16405 /* add playback controls for speaker and HP outputs */
16406 /* Based on ALC880 version. But ALC861VD has separate,
16407 * different NIDs for mute/unmute switch and volume control */
16408 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
16409 hda_nid_t pin
, const char *pfx
)
16411 hda_nid_t nid_v
, nid_s
;
16417 if (alc880_is_fixed_pin(pin
)) {
16418 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
16419 /* specify the DAC as the extra output */
16420 if (!spec
->multiout
.hp_nid
)
16421 spec
->multiout
.hp_nid
= nid_v
;
16423 spec
->multiout
.extra_out_nid
[0] = nid_v
;
16424 /* control HP volume/switch on the output mixer amp */
16425 nid_v
= alc861vd_idx_to_mixer_vol(
16426 alc880_fixed_pin_idx(pin
));
16427 nid_s
= alc861vd_idx_to_mixer_switch(
16428 alc880_fixed_pin_idx(pin
));
16430 err
= add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
16431 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
16434 err
= add_pb_sw_ctrl(spec
, ALC_CTL_BIND_MUTE
, pfx
,
16435 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
16438 } else if (alc880_is_multi_pin(pin
)) {
16439 /* set manual connection */
16440 /* we have only a switch on HP-out PIN */
16441 err
= add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
16442 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
16449 /* parse the BIOS configuration and set up the alc_spec
16450 * return 1 if successful, 0 if the proper config is not found,
16451 * or a negative error code
16452 * Based on ALC880 version - had to change it to override
16453 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16454 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
16456 struct alc_spec
*spec
= codec
->spec
;
16458 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
16460 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
16464 if (!spec
->autocfg
.line_outs
)
16465 return 0; /* can't find valid BIOS pin config */
16467 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
16470 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
16473 err
= alc861vd_auto_create_extra_out(spec
,
16474 spec
->autocfg
.speaker_pins
[0],
16478 err
= alc861vd_auto_create_extra_out(spec
,
16479 spec
->autocfg
.hp_pins
[0],
16483 err
= alc861vd_auto_create_input_ctls(codec
, &spec
->autocfg
);
16487 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
16489 if (spec
->autocfg
.dig_outs
)
16490 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
16492 if (spec
->kctls
.list
)
16493 add_mixer(spec
, spec
->kctls
.list
);
16495 add_verb(spec
, alc861vd_volume_init_verbs
);
16497 spec
->num_mux_defs
= 1;
16498 spec
->input_mux
= &spec
->private_imux
[0];
16500 err
= alc_auto_add_mic_boost(codec
);
16504 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
16509 /* additional initialization for auto-configuration model */
16510 static void alc861vd_auto_init(struct hda_codec
*codec
)
16512 struct alc_spec
*spec
= codec
->spec
;
16513 alc861vd_auto_init_multi_out(codec
);
16514 alc861vd_auto_init_hp_out(codec
);
16515 alc861vd_auto_init_analog_input(codec
);
16516 alc861vd_auto_init_input_src(codec
);
16517 if (spec
->unsol_event
)
16518 alc_inithook(codec
);
16522 ALC660VD_FIX_ASUS_GPIO1
16526 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs
[] = {
16527 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
16528 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
16529 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
16533 static const struct alc_fixup alc861vd_fixups
[] = {
16534 [ALC660VD_FIX_ASUS_GPIO1
] = {
16535 .verbs
= alc660vd_fix_asus_gpio1_verbs
,
16539 static struct snd_pci_quirk alc861vd_fixup_tbl
[] = {
16540 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1
),
16544 static int patch_alc861vd(struct hda_codec
*codec
)
16546 struct alc_spec
*spec
;
16547 int err
, board_config
;
16549 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
16553 codec
->spec
= spec
;
16555 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
16559 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
16560 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
16562 board_config
= ALC861VD_AUTO
;
16565 if (board_config
== ALC861VD_AUTO
)
16566 alc_pick_fixup(codec
, alc861vd_fixup_tbl
, alc861vd_fixups
, 1);
16568 if (board_config
== ALC861VD_AUTO
) {
16569 /* automatic parse from the BIOS config */
16570 err
= alc861vd_parse_auto_config(codec
);
16576 "hda_codec: Cannot set up configuration "
16577 "from BIOS. Using base mode...\n");
16578 board_config
= ALC861VD_3ST
;
16582 err
= snd_hda_attach_beep_device(codec
, 0x23);
16588 if (board_config
!= ALC861VD_AUTO
)
16589 setup_preset(codec
, &alc861vd_presets
[board_config
]);
16591 if (codec
->vendor_id
== 0x10ec0660) {
16592 /* always turn on EAPD */
16593 add_verb(spec
, alc660vd_eapd_verbs
);
16596 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
16597 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
16599 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
16600 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
16602 if (!spec
->adc_nids
) {
16603 spec
->adc_nids
= alc861vd_adc_nids
;
16604 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
16606 if (!spec
->capsrc_nids
)
16607 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
16609 set_capture_mixer(codec
);
16610 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
16612 spec
->vmaster_nid
= 0x02;
16614 if (board_config
== ALC861VD_AUTO
)
16615 alc_pick_fixup(codec
, alc861vd_fixup_tbl
, alc861vd_fixups
, 0);
16617 codec
->patch_ops
= alc_patch_ops
;
16619 if (board_config
== ALC861VD_AUTO
)
16620 spec
->init_hook
= alc861vd_auto_init
;
16621 #ifdef CONFIG_SND_HDA_POWER_SAVE
16622 if (!spec
->loopback
.amplist
)
16623 spec
->loopback
.amplist
= alc861vd_loopbacks
;
16632 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16633 * configuration. Each pin widget can choose any input DACs and a mixer.
16634 * Each ADC is connected from a mixer of all inputs. This makes possible
16635 * 6-channel independent captures.
16637 * In addition, an independent DAC for the multi-playback (not used in this
16640 #define ALC662_DIGOUT_NID 0x06
16641 #define ALC662_DIGIN_NID 0x0a
16643 static hda_nid_t alc662_dac_nids
[4] = {
16644 /* front, rear, clfe, rear_surr */
16648 static hda_nid_t alc272_dac_nids
[2] = {
16652 static hda_nid_t alc662_adc_nids
[2] = {
16657 static hda_nid_t alc272_adc_nids
[1] = {
16662 static hda_nid_t alc662_capsrc_nids
[2] = { 0x22, 0x23 };
16663 static hda_nid_t alc272_capsrc_nids
[1] = { 0x23 };
16667 /* FIXME: should be a matrix-type input source selection */
16668 static struct hda_input_mux alc662_capture_source
= {
16672 { "Front Mic", 0x1 },
16678 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
16686 static struct hda_input_mux alc663_capture_source
= {
16690 { "Front Mic", 0x1 },
16695 #if 0 /* set to 1 for testing other input sources below */
16696 static struct hda_input_mux alc272_nc10_capture_source
= {
16699 { "Autoselect Mic", 0x0 },
16700 { "Internal Mic", 0x1 },
16701 { "In-0x02", 0x2 },
16702 { "In-0x03", 0x3 },
16703 { "In-0x04", 0x4 },
16704 { "In-0x05", 0x5 },
16705 { "In-0x06", 0x6 },
16706 { "In-0x07", 0x7 },
16707 { "In-0x08", 0x8 },
16708 { "In-0x09", 0x9 },
16709 { "In-0x0a", 0x0a },
16710 { "In-0x0b", 0x0b },
16711 { "In-0x0c", 0x0c },
16712 { "In-0x0d", 0x0d },
16713 { "In-0x0e", 0x0e },
16714 { "In-0x0f", 0x0f },
16722 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
16729 static struct hda_verb alc662_3ST_ch2_init
[] = {
16730 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16731 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16732 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16733 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16740 static struct hda_verb alc662_3ST_ch6_init
[] = {
16741 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16742 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16743 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
16744 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16745 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16746 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
16750 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
16751 { 2, alc662_3ST_ch2_init
},
16752 { 6, alc662_3ST_ch6_init
},
16758 static struct hda_verb alc662_sixstack_ch6_init
[] = {
16759 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
16760 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
16761 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16768 static struct hda_verb alc662_sixstack_ch8_init
[] = {
16769 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16770 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16771 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16775 static struct hda_channel_mode alc662_5stack_modes
[2] = {
16776 { 2, alc662_sixstack_ch6_init
},
16777 { 6, alc662_sixstack_ch8_init
},
16780 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16781 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16784 static struct snd_kcontrol_new alc662_base_mixer
[] = {
16785 /* output mixer control */
16786 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
16787 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
16788 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
16789 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
16790 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
16791 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
16792 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
16793 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
16794 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16796 /*Input mixer control */
16797 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
16798 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
16799 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
16800 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
16801 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
16802 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
16803 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
16804 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
16808 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
16809 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16810 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
16811 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16812 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16813 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16814 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16815 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16816 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16817 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16818 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16819 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16823 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
16824 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16825 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
16826 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16827 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
16828 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
16829 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
16830 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
16831 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
16832 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16833 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
16834 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
16835 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16836 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16839 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16840 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16844 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
16845 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16846 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
16847 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16848 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
16849 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16850 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16851 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16853 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16857 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
16858 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16859 ALC262_HIPPO_MASTER_SWITCH
,
16861 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
16862 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16863 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16865 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
16866 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16867 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16871 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
16872 ALC262_HIPPO_MASTER_SWITCH
,
16873 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16874 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16875 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
16876 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
16877 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
16878 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16879 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16880 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16885 static struct hda_bind_ctls alc663_asus_bind_master_vol
= {
16886 .ops
= &snd_hda_bind_vol
,
16888 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
16889 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
16894 static struct hda_bind_ctls alc663_asus_one_bind_switch
= {
16895 .ops
= &snd_hda_bind_sw
,
16897 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
16898 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
16903 static struct snd_kcontrol_new alc663_m51va_mixer
[] = {
16904 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
16905 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch
),
16906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16911 static struct hda_bind_ctls alc663_asus_tree_bind_switch
= {
16912 .ops
= &snd_hda_bind_sw
,
16914 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
16915 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
16916 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
16921 static struct snd_kcontrol_new alc663_two_hp_m1_mixer
[] = {
16922 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
16923 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch
),
16924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16926 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16927 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16932 static struct hda_bind_ctls alc663_asus_four_bind_switch
= {
16933 .ops
= &snd_hda_bind_sw
,
16935 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
16936 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
16937 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
16942 static struct snd_kcontrol_new alc663_two_hp_m2_mixer
[] = {
16943 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
16944 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch
),
16945 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16946 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16947 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16948 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16952 static struct snd_kcontrol_new alc662_1bjd_mixer
[] = {
16953 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16954 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
16955 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
16956 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16957 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16958 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16959 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16963 static struct hda_bind_ctls alc663_asus_two_bind_master_vol
= {
16964 .ops
= &snd_hda_bind_vol
,
16966 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
16967 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT
),
16972 static struct hda_bind_ctls alc663_asus_two_bind_switch
= {
16973 .ops
= &snd_hda_bind_sw
,
16975 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
16976 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT
),
16981 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer
[] = {
16982 HDA_BIND_VOL("Master Playback Volume",
16983 &alc663_asus_two_bind_master_vol
),
16984 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
16985 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16986 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
16987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16992 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer
[] = {
16993 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
16994 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
16995 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16996 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
16997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17002 static struct snd_kcontrol_new alc663_g71v_mixer
[] = {
17003 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17004 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17005 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17006 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17011 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17012 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17016 static struct snd_kcontrol_new alc663_g50v_mixer
[] = {
17017 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17018 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17019 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17022 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17023 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17024 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17025 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
17026 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
17030 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch
= {
17031 .ops
= &snd_hda_bind_sw
,
17033 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17034 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
17035 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17036 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
17037 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
17042 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch
= {
17043 .ops
= &snd_hda_bind_sw
,
17045 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
17046 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT
),
17051 static struct snd_kcontrol_new alc663_mode7_mixer
[] = {
17052 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17053 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17054 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17055 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
17056 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17057 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17058 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17060 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17064 static struct snd_kcontrol_new alc663_mode8_mixer
[] = {
17065 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch
),
17066 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol
),
17067 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch
),
17068 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
17069 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17070 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17071 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17076 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
17078 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
17079 .name
= "Channel Mode",
17080 .info
= alc_ch_mode_info
,
17081 .get
= alc_ch_mode_get
,
17082 .put
= alc_ch_mode_put
,
17087 static struct hda_verb alc662_init_verbs
[] = {
17088 /* ADC: mute amp left and right */
17089 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17090 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
17092 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17093 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17094 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17095 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17096 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17097 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17099 /* Front Pin: output 0 (0x0c) */
17100 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17101 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17103 /* Rear Pin: output 1 (0x0d) */
17104 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17105 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17107 /* CLFE Pin: output 2 (0x0e) */
17108 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17109 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17111 /* Mic (rear) pin: input vref at 80% */
17112 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17113 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17114 /* Front Mic pin: input vref at 80% */
17115 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
17116 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17117 /* Line In pin: input */
17118 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17119 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17120 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17121 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17122 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17123 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
17124 /* CD pin widget for input */
17125 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17127 /* FIXME: use matrix-type input source selection */
17128 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17131 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17133 /* always trun on EAPD */
17134 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17135 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
17140 static struct hda_verb alc663_init_verbs
[] = {
17141 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17142 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17143 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17144 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17145 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17146 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17150 static struct hda_verb alc272_init_verbs
[] = {
17151 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17152 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
17153 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17154 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17155 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17156 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17157 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
17158 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17162 static struct hda_verb alc662_sue_init_verbs
[] = {
17163 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
17164 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
17168 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
17169 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17170 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17174 /* Set Unsolicited Event*/
17175 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
17176 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17177 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17181 static struct hda_verb alc663_m51va_init_verbs
[] = {
17182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17183 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17184 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17185 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17186 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17187 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17189 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17190 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17194 static struct hda_verb alc663_21jd_amic_init_verbs
[] = {
17195 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17196 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17197 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17200 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17201 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17205 static struct hda_verb alc662_1bjd_amic_init_verbs
[] = {
17206 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17207 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17208 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17209 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
17210 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17211 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17212 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17213 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17217 static struct hda_verb alc663_15jd_amic_init_verbs
[] = {
17218 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17219 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17220 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17221 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17222 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17223 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17224 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17228 static struct hda_verb alc663_two_hp_amic_m1_init_verbs
[] = {
17229 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17230 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17231 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17232 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
17233 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17234 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17235 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
17236 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17237 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17238 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17239 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17240 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17244 static struct hda_verb alc663_two_hp_amic_m2_init_verbs
[] = {
17245 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17246 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17247 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17248 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17249 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17250 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17251 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
17254 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17255 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17256 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17260 static struct hda_verb alc663_g71v_init_verbs
[] = {
17261 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17262 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17263 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17265 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17266 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17267 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
17269 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
17270 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
17271 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
17275 static struct hda_verb alc663_g50v_init_verbs
[] = {
17276 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17277 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17278 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
17280 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17281 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17285 static struct hda_verb alc662_ecs_init_verbs
[] = {
17286 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
17287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17288 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17289 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17293 static struct hda_verb alc272_dell_zm1_init_verbs
[] = {
17294 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17295 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17297 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17298 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17299 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17300 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17303 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17304 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17308 static struct hda_verb alc272_dell_init_verbs
[] = {
17309 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17310 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17311 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17312 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17313 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17314 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17315 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17318 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17319 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17323 static struct hda_verb alc663_mode7_init_verbs
[] = {
17324 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17325 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17326 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17327 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17328 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17329 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17330 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
17331 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17332 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17333 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17336 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17337 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17338 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17342 static struct hda_verb alc663_mode8_init_verbs
[] = {
17343 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17345 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17346 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
17347 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17348 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
17349 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17350 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
17351 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
17352 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
17353 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
17354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
17355 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
17356 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17357 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
17358 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
17362 static struct snd_kcontrol_new alc662_auto_capture_mixer
[] = {
17363 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
17364 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
17368 static struct snd_kcontrol_new alc272_auto_capture_mixer
[] = {
17369 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
17370 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
17374 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
17376 unsigned int present
;
17377 unsigned char bits
;
17379 present
= snd_hda_jack_detect(codec
, 0x14);
17380 bits
= present
? HDA_AMP_MUTE
: 0;
17382 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
17383 HDA_AMP_MUTE
, bits
);
17386 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
17388 unsigned int present
;
17389 unsigned char bits
;
17391 present
= snd_hda_jack_detect(codec
, 0x1b);
17392 bits
= present
? HDA_AMP_MUTE
: 0;
17394 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
17395 HDA_AMP_MUTE
, bits
);
17396 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
17397 HDA_AMP_MUTE
, bits
);
17400 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
17403 if ((res
>> 26) == ALC880_HP_EVENT
)
17404 alc662_lenovo_101e_all_automute(codec
);
17405 if ((res
>> 26) == ALC880_FRONT_EVENT
)
17406 alc662_lenovo_101e_ispeaker_automute(codec
);
17409 /* unsolicited event for HP jack sensing */
17410 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
17413 if ((res
>> 26) == ALC880_MIC_EVENT
)
17414 alc_mic_automute(codec
);
17416 alc262_hippo_unsol_event(codec
, res
);
17419 static void alc662_eeepc_setup(struct hda_codec
*codec
)
17421 struct alc_spec
*spec
= codec
->spec
;
17423 alc262_hippo1_setup(codec
);
17424 spec
->ext_mic
.pin
= 0x18;
17425 spec
->ext_mic
.mux_idx
= 0;
17426 spec
->int_mic
.pin
= 0x19;
17427 spec
->int_mic
.mux_idx
= 1;
17428 spec
->auto_mic
= 1;
17431 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
17433 alc262_hippo_automute(codec
);
17434 alc_mic_automute(codec
);
17437 static void alc662_eeepc_ep20_setup(struct hda_codec
*codec
)
17439 struct alc_spec
*spec
= codec
->spec
;
17441 spec
->autocfg
.hp_pins
[0] = 0x14;
17442 spec
->autocfg
.speaker_pins
[0] = 0x1b;
17445 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17447 static void alc663_m51va_speaker_automute(struct hda_codec
*codec
)
17449 unsigned int present
;
17450 unsigned char bits
;
17452 present
= snd_hda_jack_detect(codec
, 0x21);
17453 bits
= present
? HDA_AMP_MUTE
: 0;
17454 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
17455 HDA_AMP_MUTE
, bits
);
17456 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
17457 HDA_AMP_MUTE
, bits
);
17460 static void alc663_21jd_two_speaker_automute(struct hda_codec
*codec
)
17462 unsigned int present
;
17463 unsigned char bits
;
17465 present
= snd_hda_jack_detect(codec
, 0x21);
17466 bits
= present
? HDA_AMP_MUTE
: 0;
17467 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
17468 HDA_AMP_MUTE
, bits
);
17469 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
17470 HDA_AMP_MUTE
, bits
);
17471 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
17472 HDA_AMP_MUTE
, bits
);
17473 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
17474 HDA_AMP_MUTE
, bits
);
17477 static void alc663_15jd_two_speaker_automute(struct hda_codec
*codec
)
17479 unsigned int present
;
17480 unsigned char bits
;
17482 present
= snd_hda_jack_detect(codec
, 0x15);
17483 bits
= present
? HDA_AMP_MUTE
: 0;
17484 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
17485 HDA_AMP_MUTE
, bits
);
17486 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
17487 HDA_AMP_MUTE
, bits
);
17488 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
17489 HDA_AMP_MUTE
, bits
);
17490 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
17491 HDA_AMP_MUTE
, bits
);
17494 static void alc662_f5z_speaker_automute(struct hda_codec
*codec
)
17496 unsigned int present
;
17497 unsigned char bits
;
17499 present
= snd_hda_jack_detect(codec
, 0x1b);
17500 bits
= present
? 0 : PIN_OUT
;
17501 snd_hda_codec_write(codec
, 0x14, 0,
17502 AC_VERB_SET_PIN_WIDGET_CONTROL
, bits
);
17505 static void alc663_two_hp_m1_speaker_automute(struct hda_codec
*codec
)
17507 unsigned int present1
, present2
;
17509 present1
= snd_hda_jack_detect(codec
, 0x21);
17510 present2
= snd_hda_jack_detect(codec
, 0x15);
17512 if (present1
|| present2
) {
17513 snd_hda_codec_write_cache(codec
, 0x14, 0,
17514 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
17516 snd_hda_codec_write_cache(codec
, 0x14, 0,
17517 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
17521 static void alc663_two_hp_m2_speaker_automute(struct hda_codec
*codec
)
17523 unsigned int present1
, present2
;
17525 present1
= snd_hda_jack_detect(codec
, 0x1b);
17526 present2
= snd_hda_jack_detect(codec
, 0x15);
17528 if (present1
|| present2
) {
17529 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
17530 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
17531 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
17532 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
17534 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
17536 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
17541 static void alc663_two_hp_m7_speaker_automute(struct hda_codec
*codec
)
17543 unsigned int present1
, present2
;
17545 present1
= snd_hda_codec_read(codec
, 0x1b, 0,
17546 AC_VERB_GET_PIN_SENSE
, 0)
17547 & AC_PINSENSE_PRESENCE
;
17548 present2
= snd_hda_codec_read(codec
, 0x21, 0,
17549 AC_VERB_GET_PIN_SENSE
, 0)
17550 & AC_PINSENSE_PRESENCE
;
17552 if (present1
|| present2
) {
17553 snd_hda_codec_write_cache(codec
, 0x14, 0,
17554 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
17555 snd_hda_codec_write_cache(codec
, 0x17, 0,
17556 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
17558 snd_hda_codec_write_cache(codec
, 0x14, 0,
17559 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
17560 snd_hda_codec_write_cache(codec
, 0x17, 0,
17561 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
17565 static void alc663_two_hp_m8_speaker_automute(struct hda_codec
*codec
)
17567 unsigned int present1
, present2
;
17569 present1
= snd_hda_codec_read(codec
, 0x21, 0,
17570 AC_VERB_GET_PIN_SENSE
, 0)
17571 & AC_PINSENSE_PRESENCE
;
17572 present2
= snd_hda_codec_read(codec
, 0x15, 0,
17573 AC_VERB_GET_PIN_SENSE
, 0)
17574 & AC_PINSENSE_PRESENCE
;
17576 if (present1
|| present2
) {
17577 snd_hda_codec_write_cache(codec
, 0x14, 0,
17578 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
17579 snd_hda_codec_write_cache(codec
, 0x17, 0,
17580 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
17582 snd_hda_codec_write_cache(codec
, 0x14, 0,
17583 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
17584 snd_hda_codec_write_cache(codec
, 0x17, 0,
17585 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
17589 static void alc663_m51va_unsol_event(struct hda_codec
*codec
,
17592 switch (res
>> 26) {
17593 case ALC880_HP_EVENT
:
17594 alc663_m51va_speaker_automute(codec
);
17596 case ALC880_MIC_EVENT
:
17597 alc_mic_automute(codec
);
17602 static void alc663_m51va_setup(struct hda_codec
*codec
)
17604 struct alc_spec
*spec
= codec
->spec
;
17605 spec
->ext_mic
.pin
= 0x18;
17606 spec
->ext_mic
.mux_idx
= 0;
17607 spec
->int_mic
.pin
= 0x12;
17608 spec
->int_mic
.mux_idx
= 9;
17609 spec
->auto_mic
= 1;
17612 static void alc663_m51va_inithook(struct hda_codec
*codec
)
17614 alc663_m51va_speaker_automute(codec
);
17615 alc_mic_automute(codec
);
17618 /* ***************** Mode1 ******************************/
17619 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17621 static void alc663_mode1_setup(struct hda_codec
*codec
)
17623 struct alc_spec
*spec
= codec
->spec
;
17624 spec
->ext_mic
.pin
= 0x18;
17625 spec
->ext_mic
.mux_idx
= 0;
17626 spec
->int_mic
.pin
= 0x19;
17627 spec
->int_mic
.mux_idx
= 1;
17628 spec
->auto_mic
= 1;
17631 #define alc663_mode1_inithook alc663_m51va_inithook
17633 /* ***************** Mode2 ******************************/
17634 static void alc662_mode2_unsol_event(struct hda_codec
*codec
,
17637 switch (res
>> 26) {
17638 case ALC880_HP_EVENT
:
17639 alc662_f5z_speaker_automute(codec
);
17641 case ALC880_MIC_EVENT
:
17642 alc_mic_automute(codec
);
17647 #define alc662_mode2_setup alc663_mode1_setup
17649 static void alc662_mode2_inithook(struct hda_codec
*codec
)
17651 alc662_f5z_speaker_automute(codec
);
17652 alc_mic_automute(codec
);
17654 /* ***************** Mode3 ******************************/
17655 static void alc663_mode3_unsol_event(struct hda_codec
*codec
,
17658 switch (res
>> 26) {
17659 case ALC880_HP_EVENT
:
17660 alc663_two_hp_m1_speaker_automute(codec
);
17662 case ALC880_MIC_EVENT
:
17663 alc_mic_automute(codec
);
17668 #define alc663_mode3_setup alc663_mode1_setup
17670 static void alc663_mode3_inithook(struct hda_codec
*codec
)
17672 alc663_two_hp_m1_speaker_automute(codec
);
17673 alc_mic_automute(codec
);
17675 /* ***************** Mode4 ******************************/
17676 static void alc663_mode4_unsol_event(struct hda_codec
*codec
,
17679 switch (res
>> 26) {
17680 case ALC880_HP_EVENT
:
17681 alc663_21jd_two_speaker_automute(codec
);
17683 case ALC880_MIC_EVENT
:
17684 alc_mic_automute(codec
);
17689 #define alc663_mode4_setup alc663_mode1_setup
17691 static void alc663_mode4_inithook(struct hda_codec
*codec
)
17693 alc663_21jd_two_speaker_automute(codec
);
17694 alc_mic_automute(codec
);
17696 /* ***************** Mode5 ******************************/
17697 static void alc663_mode5_unsol_event(struct hda_codec
*codec
,
17700 switch (res
>> 26) {
17701 case ALC880_HP_EVENT
:
17702 alc663_15jd_two_speaker_automute(codec
);
17704 case ALC880_MIC_EVENT
:
17705 alc_mic_automute(codec
);
17710 #define alc663_mode5_setup alc663_mode1_setup
17712 static void alc663_mode5_inithook(struct hda_codec
*codec
)
17714 alc663_15jd_two_speaker_automute(codec
);
17715 alc_mic_automute(codec
);
17717 /* ***************** Mode6 ******************************/
17718 static void alc663_mode6_unsol_event(struct hda_codec
*codec
,
17721 switch (res
>> 26) {
17722 case ALC880_HP_EVENT
:
17723 alc663_two_hp_m2_speaker_automute(codec
);
17725 case ALC880_MIC_EVENT
:
17726 alc_mic_automute(codec
);
17731 #define alc663_mode6_setup alc663_mode1_setup
17733 static void alc663_mode6_inithook(struct hda_codec
*codec
)
17735 alc663_two_hp_m2_speaker_automute(codec
);
17736 alc_mic_automute(codec
);
17739 /* ***************** Mode7 ******************************/
17740 static void alc663_mode7_unsol_event(struct hda_codec
*codec
,
17743 switch (res
>> 26) {
17744 case ALC880_HP_EVENT
:
17745 alc663_two_hp_m7_speaker_automute(codec
);
17747 case ALC880_MIC_EVENT
:
17748 alc_mic_automute(codec
);
17753 #define alc663_mode7_setup alc663_mode1_setup
17755 static void alc663_mode7_inithook(struct hda_codec
*codec
)
17757 alc663_two_hp_m7_speaker_automute(codec
);
17758 alc_mic_automute(codec
);
17761 /* ***************** Mode8 ******************************/
17762 static void alc663_mode8_unsol_event(struct hda_codec
*codec
,
17765 switch (res
>> 26) {
17766 case ALC880_HP_EVENT
:
17767 alc663_two_hp_m8_speaker_automute(codec
);
17769 case ALC880_MIC_EVENT
:
17770 alc_mic_automute(codec
);
17775 #define alc663_mode8_setup alc663_m51va_setup
17777 static void alc663_mode8_inithook(struct hda_codec
*codec
)
17779 alc663_two_hp_m8_speaker_automute(codec
);
17780 alc_mic_automute(codec
);
17783 static void alc663_g71v_hp_automute(struct hda_codec
*codec
)
17785 unsigned int present
;
17786 unsigned char bits
;
17788 present
= snd_hda_jack_detect(codec
, 0x21);
17789 bits
= present
? HDA_AMP_MUTE
: 0;
17790 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
17791 HDA_AMP_MUTE
, bits
);
17792 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
17793 HDA_AMP_MUTE
, bits
);
17796 static void alc663_g71v_front_automute(struct hda_codec
*codec
)
17798 unsigned int present
;
17799 unsigned char bits
;
17801 present
= snd_hda_jack_detect(codec
, 0x15);
17802 bits
= present
? HDA_AMP_MUTE
: 0;
17803 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
17804 HDA_AMP_MUTE
, bits
);
17807 static void alc663_g71v_unsol_event(struct hda_codec
*codec
,
17810 switch (res
>> 26) {
17811 case ALC880_HP_EVENT
:
17812 alc663_g71v_hp_automute(codec
);
17814 case ALC880_FRONT_EVENT
:
17815 alc663_g71v_front_automute(codec
);
17817 case ALC880_MIC_EVENT
:
17818 alc_mic_automute(codec
);
17823 #define alc663_g71v_setup alc663_m51va_setup
17825 static void alc663_g71v_inithook(struct hda_codec
*codec
)
17827 alc663_g71v_front_automute(codec
);
17828 alc663_g71v_hp_automute(codec
);
17829 alc_mic_automute(codec
);
17832 static void alc663_g50v_unsol_event(struct hda_codec
*codec
,
17835 switch (res
>> 26) {
17836 case ALC880_HP_EVENT
:
17837 alc663_m51va_speaker_automute(codec
);
17839 case ALC880_MIC_EVENT
:
17840 alc_mic_automute(codec
);
17845 #define alc663_g50v_setup alc663_m51va_setup
17847 static void alc663_g50v_inithook(struct hda_codec
*codec
)
17849 alc663_m51va_speaker_automute(codec
);
17850 alc_mic_automute(codec
);
17853 static struct snd_kcontrol_new alc662_ecs_mixer
[] = {
17854 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17855 ALC262_HIPPO_MASTER_SWITCH
,
17857 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT
),
17858 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17859 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17861 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
17862 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17863 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17867 static struct snd_kcontrol_new alc272_nc10_mixer
[] = {
17868 /* Master Playback automatically created from Speaker and Headphone */
17869 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
17870 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
17871 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
17872 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
17874 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
17875 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
17876 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
17878 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
17879 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
17880 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
17884 #ifdef CONFIG_SND_HDA_POWER_SAVE
17885 #define alc662_loopbacks alc880_loopbacks
17889 /* pcm configuration: identical with ALC880 */
17890 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17891 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17892 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17893 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17896 * configuration and preset
17898 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
17899 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
17900 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
17901 [ALC662_3ST_6ch
] = "3stack-6ch",
17902 [ALC662_5ST_DIG
] = "6stack-dig",
17903 [ALC662_LENOVO_101E
] = "lenovo-101e",
17904 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
17905 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
17906 [ALC662_ECS
] = "ecs",
17907 [ALC663_ASUS_M51VA
] = "m51va",
17908 [ALC663_ASUS_G71V
] = "g71v",
17909 [ALC663_ASUS_H13
] = "h13",
17910 [ALC663_ASUS_G50V
] = "g50v",
17911 [ALC663_ASUS_MODE1
] = "asus-mode1",
17912 [ALC662_ASUS_MODE2
] = "asus-mode2",
17913 [ALC663_ASUS_MODE3
] = "asus-mode3",
17914 [ALC663_ASUS_MODE4
] = "asus-mode4",
17915 [ALC663_ASUS_MODE5
] = "asus-mode5",
17916 [ALC663_ASUS_MODE6
] = "asus-mode6",
17917 [ALC663_ASUS_MODE7
] = "asus-mode7",
17918 [ALC663_ASUS_MODE8
] = "asus-mode8",
17919 [ALC272_DELL
] = "dell",
17920 [ALC272_DELL_ZM1
] = "dell-zm1",
17921 [ALC272_SAMSUNG_NC10
] = "samsung-nc10",
17922 [ALC662_AUTO
] = "auto",
17925 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
17926 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS
),
17927 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL
),
17928 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1
),
17929 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1
),
17930 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3
),
17931 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1
),
17932 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3
),
17933 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1
),
17934 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2
),
17935 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1
),
17936 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1
),
17937 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1
),
17938 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2
),
17939 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7
),
17940 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7
),
17941 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8
),
17942 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3
),
17943 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1
),
17944 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2
),
17945 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2
),
17946 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1
),
17947 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2
),
17948 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6
),
17949 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6
),
17950 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2
),
17951 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1
),
17952 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3
),
17953 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA
),
17954 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2
),
17955 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2
),
17956 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5
),
17957 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6
),
17958 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2
),
17959 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1
),
17960 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2
),
17961 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2
),
17962 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
17963 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17964 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3
),
17965 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3
),
17966 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1
),
17967 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1
),
17968 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1
),
17969 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1
),
17970 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1
),
17971 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2
),
17972 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2
),
17973 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1
),
17974 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1
),
17975 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3
),
17976 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1
),
17977 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1
),
17978 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V
),
17979 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17980 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1
),
17981 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2
),
17982 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA
),
17983 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1
),
17984 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4
),
17985 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
17986 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
17987 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
17988 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS
),
17989 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17990 ALC662_3ST_6ch_DIG
),
17991 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO
),
17992 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10
),
17993 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17994 ALC662_3ST_6ch_DIG
),
17995 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13
),
17996 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG
),
17997 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA
),
17998 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
17999 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18000 ALC662_3ST_6ch_DIG
),
18001 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18006 static struct alc_config_preset alc662_presets
[] = {
18007 [ALC662_3ST_2ch_DIG
] = {
18008 .mixers
= { alc662_3ST_2ch_mixer
},
18009 .init_verbs
= { alc662_init_verbs
},
18010 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18011 .dac_nids
= alc662_dac_nids
,
18012 .dig_out_nid
= ALC662_DIGOUT_NID
,
18013 .dig_in_nid
= ALC662_DIGIN_NID
,
18014 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18015 .channel_mode
= alc662_3ST_2ch_modes
,
18016 .input_mux
= &alc662_capture_source
,
18018 [ALC662_3ST_6ch_DIG
] = {
18019 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18020 .init_verbs
= { alc662_init_verbs
},
18021 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18022 .dac_nids
= alc662_dac_nids
,
18023 .dig_out_nid
= ALC662_DIGOUT_NID
,
18024 .dig_in_nid
= ALC662_DIGIN_NID
,
18025 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18026 .channel_mode
= alc662_3ST_6ch_modes
,
18028 .input_mux
= &alc662_capture_source
,
18030 [ALC662_3ST_6ch
] = {
18031 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
18032 .init_verbs
= { alc662_init_verbs
},
18033 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18034 .dac_nids
= alc662_dac_nids
,
18035 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18036 .channel_mode
= alc662_3ST_6ch_modes
,
18038 .input_mux
= &alc662_capture_source
,
18040 [ALC662_5ST_DIG
] = {
18041 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
},
18042 .init_verbs
= { alc662_init_verbs
},
18043 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18044 .dac_nids
= alc662_dac_nids
,
18045 .dig_out_nid
= ALC662_DIGOUT_NID
,
18046 .dig_in_nid
= ALC662_DIGIN_NID
,
18047 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
18048 .channel_mode
= alc662_5stack_modes
,
18049 .input_mux
= &alc662_capture_source
,
18051 [ALC662_LENOVO_101E
] = {
18052 .mixers
= { alc662_lenovo_101e_mixer
},
18053 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
18054 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18055 .dac_nids
= alc662_dac_nids
,
18056 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18057 .channel_mode
= alc662_3ST_2ch_modes
,
18058 .input_mux
= &alc662_lenovo_101e_capture_source
,
18059 .unsol_event
= alc662_lenovo_101e_unsol_event
,
18060 .init_hook
= alc662_lenovo_101e_all_automute
,
18062 [ALC662_ASUS_EEEPC_P701
] = {
18063 .mixers
= { alc662_eeepc_p701_mixer
},
18064 .init_verbs
= { alc662_init_verbs
,
18065 alc662_eeepc_sue_init_verbs
},
18066 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18067 .dac_nids
= alc662_dac_nids
,
18068 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18069 .channel_mode
= alc662_3ST_2ch_modes
,
18070 .unsol_event
= alc662_eeepc_unsol_event
,
18071 .setup
= alc662_eeepc_setup
,
18072 .init_hook
= alc662_eeepc_inithook
,
18074 [ALC662_ASUS_EEEPC_EP20
] = {
18075 .mixers
= { alc662_eeepc_ep20_mixer
,
18076 alc662_chmode_mixer
},
18077 .init_verbs
= { alc662_init_verbs
,
18078 alc662_eeepc_ep20_sue_init_verbs
},
18079 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18080 .dac_nids
= alc662_dac_nids
,
18081 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18082 .channel_mode
= alc662_3ST_6ch_modes
,
18083 .input_mux
= &alc662_lenovo_101e_capture_source
,
18084 .unsol_event
= alc662_eeepc_unsol_event
,
18085 .setup
= alc662_eeepc_ep20_setup
,
18086 .init_hook
= alc662_eeepc_ep20_inithook
,
18089 .mixers
= { alc662_ecs_mixer
},
18090 .init_verbs
= { alc662_init_verbs
,
18091 alc662_ecs_init_verbs
},
18092 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18093 .dac_nids
= alc662_dac_nids
,
18094 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18095 .channel_mode
= alc662_3ST_2ch_modes
,
18096 .unsol_event
= alc662_eeepc_unsol_event
,
18097 .setup
= alc662_eeepc_setup
,
18098 .init_hook
= alc662_eeepc_inithook
,
18100 [ALC663_ASUS_M51VA
] = {
18101 .mixers
= { alc663_m51va_mixer
},
18102 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
18103 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18104 .dac_nids
= alc662_dac_nids
,
18105 .dig_out_nid
= ALC662_DIGOUT_NID
,
18106 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18107 .channel_mode
= alc662_3ST_2ch_modes
,
18108 .unsol_event
= alc663_m51va_unsol_event
,
18109 .setup
= alc663_m51va_setup
,
18110 .init_hook
= alc663_m51va_inithook
,
18112 [ALC663_ASUS_G71V
] = {
18113 .mixers
= { alc663_g71v_mixer
},
18114 .init_verbs
= { alc662_init_verbs
, alc663_g71v_init_verbs
},
18115 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18116 .dac_nids
= alc662_dac_nids
,
18117 .dig_out_nid
= ALC662_DIGOUT_NID
,
18118 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18119 .channel_mode
= alc662_3ST_2ch_modes
,
18120 .unsol_event
= alc663_g71v_unsol_event
,
18121 .setup
= alc663_g71v_setup
,
18122 .init_hook
= alc663_g71v_inithook
,
18124 [ALC663_ASUS_H13
] = {
18125 .mixers
= { alc663_m51va_mixer
},
18126 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
18127 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18128 .dac_nids
= alc662_dac_nids
,
18129 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18130 .channel_mode
= alc662_3ST_2ch_modes
,
18131 .unsol_event
= alc663_m51va_unsol_event
,
18132 .init_hook
= alc663_m51va_inithook
,
18134 [ALC663_ASUS_G50V
] = {
18135 .mixers
= { alc663_g50v_mixer
},
18136 .init_verbs
= { alc662_init_verbs
, alc663_g50v_init_verbs
},
18137 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18138 .dac_nids
= alc662_dac_nids
,
18139 .dig_out_nid
= ALC662_DIGOUT_NID
,
18140 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
18141 .channel_mode
= alc662_3ST_6ch_modes
,
18142 .input_mux
= &alc663_capture_source
,
18143 .unsol_event
= alc663_g50v_unsol_event
,
18144 .setup
= alc663_g50v_setup
,
18145 .init_hook
= alc663_g50v_inithook
,
18147 [ALC663_ASUS_MODE1
] = {
18148 .mixers
= { alc663_m51va_mixer
},
18149 .cap_mixer
= alc662_auto_capture_mixer
,
18150 .init_verbs
= { alc662_init_verbs
,
18151 alc663_21jd_amic_init_verbs
},
18152 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18154 .dac_nids
= alc662_dac_nids
,
18155 .dig_out_nid
= ALC662_DIGOUT_NID
,
18156 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18157 .channel_mode
= alc662_3ST_2ch_modes
,
18158 .unsol_event
= alc663_mode1_unsol_event
,
18159 .setup
= alc663_mode1_setup
,
18160 .init_hook
= alc663_mode1_inithook
,
18162 [ALC662_ASUS_MODE2
] = {
18163 .mixers
= { alc662_1bjd_mixer
},
18164 .cap_mixer
= alc662_auto_capture_mixer
,
18165 .init_verbs
= { alc662_init_verbs
,
18166 alc662_1bjd_amic_init_verbs
},
18167 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18168 .dac_nids
= alc662_dac_nids
,
18169 .dig_out_nid
= ALC662_DIGOUT_NID
,
18170 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18171 .channel_mode
= alc662_3ST_2ch_modes
,
18172 .unsol_event
= alc662_mode2_unsol_event
,
18173 .setup
= alc662_mode2_setup
,
18174 .init_hook
= alc662_mode2_inithook
,
18176 [ALC663_ASUS_MODE3
] = {
18177 .mixers
= { alc663_two_hp_m1_mixer
},
18178 .cap_mixer
= alc662_auto_capture_mixer
,
18179 .init_verbs
= { alc662_init_verbs
,
18180 alc663_two_hp_amic_m1_init_verbs
},
18181 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18183 .dac_nids
= alc662_dac_nids
,
18184 .dig_out_nid
= ALC662_DIGOUT_NID
,
18185 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18186 .channel_mode
= alc662_3ST_2ch_modes
,
18187 .unsol_event
= alc663_mode3_unsol_event
,
18188 .setup
= alc663_mode3_setup
,
18189 .init_hook
= alc663_mode3_inithook
,
18191 [ALC663_ASUS_MODE4
] = {
18192 .mixers
= { alc663_asus_21jd_clfe_mixer
},
18193 .cap_mixer
= alc662_auto_capture_mixer
,
18194 .init_verbs
= { alc662_init_verbs
,
18195 alc663_21jd_amic_init_verbs
},
18196 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18198 .dac_nids
= alc662_dac_nids
,
18199 .dig_out_nid
= ALC662_DIGOUT_NID
,
18200 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18201 .channel_mode
= alc662_3ST_2ch_modes
,
18202 .unsol_event
= alc663_mode4_unsol_event
,
18203 .setup
= alc663_mode4_setup
,
18204 .init_hook
= alc663_mode4_inithook
,
18206 [ALC663_ASUS_MODE5
] = {
18207 .mixers
= { alc663_asus_15jd_clfe_mixer
},
18208 .cap_mixer
= alc662_auto_capture_mixer
,
18209 .init_verbs
= { alc662_init_verbs
,
18210 alc663_15jd_amic_init_verbs
},
18211 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18213 .dac_nids
= alc662_dac_nids
,
18214 .dig_out_nid
= ALC662_DIGOUT_NID
,
18215 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18216 .channel_mode
= alc662_3ST_2ch_modes
,
18217 .unsol_event
= alc663_mode5_unsol_event
,
18218 .setup
= alc663_mode5_setup
,
18219 .init_hook
= alc663_mode5_inithook
,
18221 [ALC663_ASUS_MODE6
] = {
18222 .mixers
= { alc663_two_hp_m2_mixer
},
18223 .cap_mixer
= alc662_auto_capture_mixer
,
18224 .init_verbs
= { alc662_init_verbs
,
18225 alc663_two_hp_amic_m2_init_verbs
},
18226 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18228 .dac_nids
= alc662_dac_nids
,
18229 .dig_out_nid
= ALC662_DIGOUT_NID
,
18230 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18231 .channel_mode
= alc662_3ST_2ch_modes
,
18232 .unsol_event
= alc663_mode6_unsol_event
,
18233 .setup
= alc663_mode6_setup
,
18234 .init_hook
= alc663_mode6_inithook
,
18236 [ALC663_ASUS_MODE7
] = {
18237 .mixers
= { alc663_mode7_mixer
},
18238 .cap_mixer
= alc662_auto_capture_mixer
,
18239 .init_verbs
= { alc662_init_verbs
,
18240 alc663_mode7_init_verbs
},
18241 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18243 .dac_nids
= alc662_dac_nids
,
18244 .dig_out_nid
= ALC662_DIGOUT_NID
,
18245 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18246 .channel_mode
= alc662_3ST_2ch_modes
,
18247 .unsol_event
= alc663_mode7_unsol_event
,
18248 .setup
= alc663_mode7_setup
,
18249 .init_hook
= alc663_mode7_inithook
,
18251 [ALC663_ASUS_MODE8
] = {
18252 .mixers
= { alc663_mode8_mixer
},
18253 .cap_mixer
= alc662_auto_capture_mixer
,
18254 .init_verbs
= { alc662_init_verbs
,
18255 alc663_mode8_init_verbs
},
18256 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
18258 .dac_nids
= alc662_dac_nids
,
18259 .dig_out_nid
= ALC662_DIGOUT_NID
,
18260 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18261 .channel_mode
= alc662_3ST_2ch_modes
,
18262 .unsol_event
= alc663_mode8_unsol_event
,
18263 .setup
= alc663_mode8_setup
,
18264 .init_hook
= alc663_mode8_inithook
,
18267 .mixers
= { alc663_m51va_mixer
},
18268 .cap_mixer
= alc272_auto_capture_mixer
,
18269 .init_verbs
= { alc662_init_verbs
, alc272_dell_init_verbs
},
18270 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18271 .dac_nids
= alc662_dac_nids
,
18272 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18273 .adc_nids
= alc272_adc_nids
,
18274 .num_adc_nids
= ARRAY_SIZE(alc272_adc_nids
),
18275 .capsrc_nids
= alc272_capsrc_nids
,
18276 .channel_mode
= alc662_3ST_2ch_modes
,
18277 .unsol_event
= alc663_m51va_unsol_event
,
18278 .setup
= alc663_m51va_setup
,
18279 .init_hook
= alc663_m51va_inithook
,
18281 [ALC272_DELL_ZM1
] = {
18282 .mixers
= { alc663_m51va_mixer
},
18283 .cap_mixer
= alc662_auto_capture_mixer
,
18284 .init_verbs
= { alc662_init_verbs
, alc272_dell_zm1_init_verbs
},
18285 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18286 .dac_nids
= alc662_dac_nids
,
18287 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18288 .adc_nids
= alc662_adc_nids
,
18290 .capsrc_nids
= alc662_capsrc_nids
,
18291 .channel_mode
= alc662_3ST_2ch_modes
,
18292 .unsol_event
= alc663_m51va_unsol_event
,
18293 .setup
= alc663_m51va_setup
,
18294 .init_hook
= alc663_m51va_inithook
,
18296 [ALC272_SAMSUNG_NC10
] = {
18297 .mixers
= { alc272_nc10_mixer
},
18298 .init_verbs
= { alc662_init_verbs
,
18299 alc663_21jd_amic_init_verbs
},
18300 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
18301 .dac_nids
= alc272_dac_nids
,
18302 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
18303 .channel_mode
= alc662_3ST_2ch_modes
,
18304 /*.input_mux = &alc272_nc10_capture_source,*/
18305 .unsol_event
= alc663_mode4_unsol_event
,
18306 .setup
= alc663_mode4_setup
,
18307 .init_hook
= alc663_mode4_inithook
,
18313 * BIOS auto configuration
18316 /* convert from MIX nid to DAC */
18317 static inline hda_nid_t
alc662_mix_to_dac(hda_nid_t nid
)
18321 else if (nid
>= 0x0c && nid
<= 0x0e)
18322 return nid
- 0x0c + 0x02;
18327 /* get MIX nid connected to the given pin targeted to DAC */
18328 static hda_nid_t
alc662_dac_to_mix(struct hda_codec
*codec
, hda_nid_t pin
,
18334 num
= snd_hda_get_connections(codec
, pin
, mix
, ARRAY_SIZE(mix
));
18335 for (i
= 0; i
< num
; i
++) {
18336 if (alc662_mix_to_dac(mix
[i
]) == dac
)
18342 /* look for an empty DAC slot */
18343 static hda_nid_t
alc662_look_for_dac(struct hda_codec
*codec
, hda_nid_t pin
)
18345 struct alc_spec
*spec
= codec
->spec
;
18349 num
= snd_hda_get_connections(codec
, pin
, srcs
, ARRAY_SIZE(srcs
));
18352 for (i
= 0; i
< num
; i
++) {
18353 hda_nid_t nid
= alc662_mix_to_dac(srcs
[i
]);
18356 for (j
= 0; j
< spec
->multiout
.num_dacs
; j
++)
18357 if (spec
->multiout
.dac_nids
[j
] == nid
)
18359 if (j
>= spec
->multiout
.num_dacs
)
18365 /* fill in the dac_nids table from the parsed pin configuration */
18366 static int alc662_auto_fill_dac_nids(struct hda_codec
*codec
,
18367 const struct auto_pin_cfg
*cfg
)
18369 struct alc_spec
*spec
= codec
->spec
;
18373 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
18374 for (i
= 0; i
< cfg
->line_outs
; i
++) {
18375 dac
= alc662_look_for_dac(codec
, cfg
->line_out_pins
[i
]);
18378 spec
->multiout
.dac_nids
[spec
->multiout
.num_dacs
++] = dac
;
18383 static inline int alc662_add_vol_ctl(struct alc_spec
*spec
, const char *pfx
,
18384 hda_nid_t nid
, unsigned int chs
)
18386 return add_pb_vol_ctrl(spec
, ALC_CTL_WIDGET_VOL
, pfx
,
18387 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_OUTPUT
));
18390 static inline int alc662_add_sw_ctl(struct alc_spec
*spec
, const char *pfx
,
18391 hda_nid_t nid
, unsigned int chs
)
18393 return add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
18394 HDA_COMPOSE_AMP_VAL(nid
, chs
, 0, HDA_INPUT
));
18397 #define alc662_add_stereo_vol(spec, pfx, nid) \
18398 alc662_add_vol_ctl(spec, pfx, nid, 3)
18399 #define alc662_add_stereo_sw(spec, pfx, nid) \
18400 alc662_add_sw_ctl(spec, pfx, nid, 3)
18402 /* add playback controls from the parsed DAC table */
18403 static int alc662_auto_create_multi_out_ctls(struct hda_codec
*codec
,
18404 const struct auto_pin_cfg
*cfg
)
18406 struct alc_spec
*spec
= codec
->spec
;
18407 static const char *chname
[4] = {
18408 "Front", "Surround", NULL
/*CLFE*/, "Side"
18410 hda_nid_t nid
, mix
;
18413 for (i
= 0; i
< cfg
->line_outs
; i
++) {
18414 nid
= spec
->multiout
.dac_nids
[i
];
18417 mix
= alc662_dac_to_mix(codec
, cfg
->line_out_pins
[i
], nid
);
18422 err
= alc662_add_vol_ctl(spec
, "Center", nid
, 1);
18425 err
= alc662_add_vol_ctl(spec
, "LFE", nid
, 2);
18428 err
= alc662_add_sw_ctl(spec
, "Center", mix
, 1);
18431 err
= alc662_add_sw_ctl(spec
, "LFE", mix
, 2);
18436 if (cfg
->line_outs
== 1 &&
18437 cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
) {
18444 err
= alc662_add_vol_ctl(spec
, pfx
, nid
, 3);
18447 if (cfg
->line_outs
== 1 &&
18448 cfg
->line_out_type
== AUTO_PIN_SPEAKER_OUT
)
18450 err
= alc662_add_sw_ctl(spec
, pfx
, mix
, 3);
18458 /* add playback controls for speaker and HP outputs */
18459 /* return DAC nid if any new DAC is assigned */
18460 static int alc662_auto_create_extra_out(struct hda_codec
*codec
, hda_nid_t pin
,
18463 struct alc_spec
*spec
= codec
->spec
;
18464 hda_nid_t nid
, mix
;
18469 nid
= alc662_look_for_dac(codec
, pin
);
18471 /* the corresponding DAC is already occupied */
18472 if (!(get_wcaps(codec
, pin
) & AC_WCAP_OUT_AMP
))
18473 return 0; /* no way */
18474 /* create a switch only */
18475 return add_pb_sw_ctrl(spec
, ALC_CTL_WIDGET_MUTE
, pfx
,
18476 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
18479 mix
= alc662_dac_to_mix(codec
, pin
, nid
);
18482 err
= alc662_add_vol_ctl(spec
, pfx
, nid
, 3);
18485 err
= alc662_add_sw_ctl(spec
, pfx
, mix
, 3);
18491 /* create playback/capture controls for input pins */
18492 #define alc662_auto_create_input_ctls \
18493 alc882_auto_create_input_ctls
18495 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
18496 hda_nid_t nid
, int pin_type
,
18502 alc_set_pin_output(codec
, nid
, pin_type
);
18503 /* need the manual connection? */
18504 num
= snd_hda_get_connections(codec
, nid
, srcs
, ARRAY_SIZE(srcs
));
18507 for (i
= 0; i
< num
; i
++) {
18508 if (alc662_mix_to_dac(srcs
[i
]) != dac
)
18510 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, i
);
18515 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
18517 struct alc_spec
*spec
= codec
->spec
;
18518 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
18521 for (i
= 0; i
<= HDA_SIDE
; i
++) {
18522 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
18524 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
18525 spec
->multiout
.dac_nids
[i
]);
18529 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
18531 struct alc_spec
*spec
= codec
->spec
;
18534 pin
= spec
->autocfg
.hp_pins
[0];
18536 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
18537 spec
->multiout
.hp_nid
);
18538 pin
= spec
->autocfg
.speaker_pins
[0];
18540 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
,
18541 spec
->multiout
.extra_out_nid
[0]);
18544 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18546 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
18548 struct alc_spec
*spec
= codec
->spec
;
18551 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
18552 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
18553 if (alc_is_input_pin(codec
, nid
)) {
18554 alc_set_input_pin(codec
, nid
, i
);
18555 if (nid
!= ALC662_PIN_CD_NID
&&
18556 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
18557 snd_hda_codec_write(codec
, nid
, 0,
18558 AC_VERB_SET_AMP_GAIN_MUTE
,
18564 #define alc662_auto_init_input_src alc882_auto_init_input_src
18566 static int alc662_parse_auto_config(struct hda_codec
*codec
)
18568 struct alc_spec
*spec
= codec
->spec
;
18570 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
18572 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
18576 if (!spec
->autocfg
.line_outs
)
18577 return 0; /* can't find valid BIOS pin config */
18579 err
= alc662_auto_fill_dac_nids(codec
, &spec
->autocfg
);
18582 err
= alc662_auto_create_multi_out_ctls(codec
, &spec
->autocfg
);
18585 err
= alc662_auto_create_extra_out(codec
,
18586 spec
->autocfg
.speaker_pins
[0],
18591 spec
->multiout
.extra_out_nid
[0] = err
;
18592 err
= alc662_auto_create_extra_out(codec
, spec
->autocfg
.hp_pins
[0],
18597 spec
->multiout
.hp_nid
= err
;
18598 err
= alc662_auto_create_input_ctls(codec
, &spec
->autocfg
);
18602 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
18604 if (spec
->autocfg
.dig_outs
)
18605 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
18607 if (spec
->kctls
.list
)
18608 add_mixer(spec
, spec
->kctls
.list
);
18610 spec
->num_mux_defs
= 1;
18611 spec
->input_mux
= &spec
->private_imux
[0];
18613 add_verb(spec
, alc662_init_verbs
);
18614 if (codec
->vendor_id
== 0x10ec0272 || codec
->vendor_id
== 0x10ec0663 ||
18615 codec
->vendor_id
== 0x10ec0665)
18616 add_verb(spec
, alc663_init_verbs
);
18618 if (codec
->vendor_id
== 0x10ec0272)
18619 add_verb(spec
, alc272_init_verbs
);
18621 err
= alc_auto_add_mic_boost(codec
);
18625 if (codec
->vendor_id
== 0x10ec0272 || codec
->vendor_id
== 0x10ec0663 ||
18626 codec
->vendor_id
== 0x10ec0665 || codec
->vendor_id
== 0x10ec0670)
18627 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0x21);
18629 alc_ssid_check(codec
, 0x15, 0x1b, 0x14, 0);
18634 /* additional initialization for auto-configuration model */
18635 static void alc662_auto_init(struct hda_codec
*codec
)
18637 struct alc_spec
*spec
= codec
->spec
;
18638 alc662_auto_init_multi_out(codec
);
18639 alc662_auto_init_hp_out(codec
);
18640 alc662_auto_init_analog_input(codec
);
18641 alc662_auto_init_input_src(codec
);
18642 if (spec
->unsol_event
)
18643 alc_inithook(codec
);
18646 static int patch_alc662(struct hda_codec
*codec
)
18648 struct alc_spec
*spec
;
18649 int err
, board_config
;
18651 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
18655 codec
->spec
= spec
;
18657 alc_auto_parse_customize_define(codec
);
18659 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
18661 if (alc_read_coef_idx(codec
, 0) == 0x8020)
18662 alc_codec_rename(codec
, "ALC661");
18663 else if ((alc_read_coef_idx(codec
, 0) & (1 << 14)) &&
18664 codec
->bus
->pci
->subsystem_vendor
== 0x1025 &&
18665 spec
->cdefine
.platform_type
== 1)
18666 alc_codec_rename(codec
, "ALC272X");
18668 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
18671 if (board_config
< 0) {
18672 printk(KERN_INFO
"hda_codec: %s: BIOS auto-probing.\n",
18674 board_config
= ALC662_AUTO
;
18677 if (board_config
== ALC662_AUTO
) {
18678 /* automatic parse from the BIOS config */
18679 err
= alc662_parse_auto_config(codec
);
18685 "hda_codec: Cannot set up configuration "
18686 "from BIOS. Using base mode...\n");
18687 board_config
= ALC662_3ST_2ch_DIG
;
18691 err
= snd_hda_attach_beep_device(codec
, 0x1);
18697 if (board_config
!= ALC662_AUTO
)
18698 setup_preset(codec
, &alc662_presets
[board_config
]);
18700 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
18701 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
18703 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
18704 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
18706 if (!spec
->adc_nids
) {
18707 spec
->adc_nids
= alc662_adc_nids
;
18708 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
18710 if (!spec
->capsrc_nids
)
18711 spec
->capsrc_nids
= alc662_capsrc_nids
;
18713 if (!spec
->cap_mixer
)
18714 set_capture_mixer(codec
);
18716 if (spec
->cdefine
.enable_pcbeep
) {
18717 switch (codec
->vendor_id
) {
18719 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
18724 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
18727 set_beep_amp(spec
, 0x0b, 0x03, HDA_INPUT
);
18731 spec
->vmaster_nid
= 0x02;
18733 codec
->patch_ops
= alc_patch_ops
;
18734 if (board_config
== ALC662_AUTO
)
18735 spec
->init_hook
= alc662_auto_init
;
18736 #ifdef CONFIG_SND_HDA_POWER_SAVE
18737 if (!spec
->loopback
.amplist
)
18738 spec
->loopback
.amplist
= alc662_loopbacks
;
18744 static int patch_alc888(struct hda_codec
*codec
)
18746 if ((alc_read_coef_idx(codec
, 0) & 0x00f0)==0x0030){
18747 kfree(codec
->chip_name
);
18748 codec
->chip_name
= kstrdup("ALC888-VD", GFP_KERNEL
);
18749 if (!codec
->chip_name
) {
18753 return patch_alc662(codec
);
18755 return patch_alc882(codec
);
18761 static struct hda_codec_preset snd_hda_preset_realtek
[] = {
18762 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
18763 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
18764 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
18765 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
18766 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
18767 { .id
= 0x10ec0270, .name
= "ALC270", .patch
= patch_alc269
},
18768 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
18769 { .id
= 0x10ec0275, .name
= "ALC275", .patch
= patch_alc269
},
18770 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
18771 .patch
= patch_alc861
},
18772 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
18773 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
18774 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
18775 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
18776 .patch
= patch_alc882
},
18777 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
18778 .patch
= patch_alc662
},
18779 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
18780 { .id
= 0x10ec0665, .name
= "ALC665", .patch
= patch_alc662
},
18781 { .id
= 0x10ec0670, .name
= "ALC670", .patch
= patch_alc662
},
18782 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
18783 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
18784 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc882
},
18785 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
18786 .patch
= patch_alc882
},
18787 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
18788 .patch
= patch_alc882
},
18789 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
18790 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc882
},
18791 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
18792 .patch
= patch_alc882
},
18793 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc888
},
18794 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc882
},
18795 { .id
= 0x10ec0892, .name
= "ALC892", .patch
= patch_alc662
},
18796 {} /* terminator */
18799 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18801 MODULE_LICENSE("GPL");
18802 MODULE_DESCRIPTION("Realtek HD-audio codec");
18804 static struct hda_codec_preset_list realtek_list
= {
18805 .preset
= snd_hda_preset_realtek
,
18806 .owner
= THIS_MODULE
,
18809 static int __init
patch_realtek_init(void)
18811 return snd_hda_add_codec_preset(&realtek_list
);
18814 static void __exit
patch_realtek_exit(void)
18816 snd_hda_delete_codec_preset(&realtek_list
);
18819 module_init(patch_realtek_init
)
18820 module_exit(patch_realtek_exit
)