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 */
134 ALC269_ASUS_EEEPC_P703
,
135 ALC269_ASUS_EEEPC_P901
,
139 ALC269_MODEL_LAST
/* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701
,
179 ALC662_ASUS_EEEPC_EP20
,
222 ALC883_TARGA_2ch_DIG
,
223 ALC883_TARGA_8ch_DIG
,
226 ALC888_ACER_ASPIRE_4930G
,
227 ALC888_ACER_ASPIRE_6530G
,
228 ALC888_ACER_ASPIRE_8930G
,
232 ALC883_LENOVO_101E_2ch
,
233 ALC883_LENOVO_NB0763
,
234 ALC888_LENOVO_MS7195_DIG
,
241 ALC883_FUJITSU_PI2515
,
242 ALC888_FUJITSU_XA3530
,
243 ALC883_3ST_6ch_INTEL
,
253 /* styles of capture selection */
255 CAPT_MUX
= 0, /* only mux based */
256 CAPT_MIX
, /* only mixer based */
257 CAPT_1MUX_MIX
, /* first mux and other mixers */
261 #define GPIO_MASK 0x03
263 /* extra amp-initialization sequence types */
273 /* codec parameterization */
274 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
275 unsigned int num_mixers
;
276 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
277 unsigned int beep_amp
; /* beep amp value, set via set_beep_amp() */
279 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
283 unsigned int num_init_verbs
;
285 char stream_name_analog
[16]; /* analog PCM stream */
286 struct hda_pcm_stream
*stream_analog_playback
;
287 struct hda_pcm_stream
*stream_analog_capture
;
288 struct hda_pcm_stream
*stream_analog_alt_playback
;
289 struct hda_pcm_stream
*stream_analog_alt_capture
;
291 char stream_name_digital
[16]; /* digital PCM stream */
292 struct hda_pcm_stream
*stream_digital_playback
;
293 struct hda_pcm_stream
*stream_digital_capture
;
296 struct hda_multi_out multiout
; /* playback set-up
297 * max_channels, dacs must be set
298 * dig_out_nid and hp_nid are optional
300 hda_nid_t alt_dac_nid
;
301 hda_nid_t slave_dig_outs
[3]; /* optional - for auto-parsing */
305 unsigned int num_adc_nids
;
307 hda_nid_t
*capsrc_nids
;
308 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
309 int capture_style
; /* capture style (CAPT_*) */
312 unsigned int num_mux_defs
;
313 const struct hda_input_mux
*input_mux
;
314 unsigned int cur_mux
[3];
317 const struct hda_channel_mode
*channel_mode
;
318 int num_channel_mode
;
320 int const_channel_count
;
321 int ext_channel_count
;
323 /* PCM information */
324 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
326 /* dynamic controls, init_verbs and input_mux */
327 struct auto_pin_cfg autocfg
;
328 struct snd_array kctls
;
329 struct hda_input_mux private_imux
[3];
330 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
333 void (*init_hook
)(struct hda_codec
*codec
);
334 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
336 /* for pin sensing */
337 unsigned int sense_updated
: 1;
338 unsigned int jack_present
: 1;
339 unsigned int master_sw
: 1;
342 unsigned int no_analog
:1; /* digital I/O only */
345 /* for virtual master */
346 hda_nid_t vmaster_nid
;
347 #ifdef CONFIG_SND_HDA_POWER_SAVE
348 struct hda_loopback_check loopback
;
353 unsigned int pll_coef_idx
, pll_coef_bit
;
357 * configuration template - to be copied to the spec instance
359 struct alc_config_preset
{
360 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
363 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
364 const struct hda_verb
*init_verbs
[5];
365 unsigned int num_dacs
;
367 hda_nid_t dig_out_nid
; /* optional */
368 hda_nid_t hp_nid
; /* optional */
369 hda_nid_t
*slave_dig_outs
;
370 unsigned int num_adc_nids
;
372 hda_nid_t
*capsrc_nids
;
373 hda_nid_t dig_in_nid
;
374 unsigned int num_channel_mode
;
375 const struct hda_channel_mode
*channel_mode
;
377 int const_channel_count
;
378 unsigned int num_mux_defs
;
379 const struct hda_input_mux
*input_mux
;
380 void (*unsol_event
)(struct hda_codec
*, unsigned int);
381 void (*init_hook
)(struct hda_codec
*);
382 #ifdef CONFIG_SND_HDA_POWER_SAVE
383 struct hda_amp_list
*loopbacks
;
391 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
392 struct snd_ctl_elem_info
*uinfo
)
394 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
395 struct alc_spec
*spec
= codec
->spec
;
396 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
397 if (mux_idx
>= spec
->num_mux_defs
)
399 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
402 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
403 struct snd_ctl_elem_value
*ucontrol
)
405 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
406 struct alc_spec
*spec
= codec
->spec
;
407 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
409 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
413 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
414 struct snd_ctl_elem_value
*ucontrol
)
416 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
417 struct alc_spec
*spec
= codec
->spec
;
418 const struct hda_input_mux
*imux
;
419 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
420 unsigned int mux_idx
;
421 hda_nid_t nid
= spec
->capsrc_nids
?
422 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
424 mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
425 imux
= &spec
->input_mux
[mux_idx
];
427 if (spec
->capture_style
&&
428 !(spec
->capture_style
== CAPT_1MUX_MIX
&& !adc_idx
)) {
429 /* Matrix-mixer style (e.g. ALC882) */
430 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
433 idx
= ucontrol
->value
.enumerated
.item
[0];
434 if (idx
>= imux
->num_items
)
435 idx
= imux
->num_items
- 1;
438 for (i
= 0; i
< imux
->num_items
; i
++) {
439 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
440 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
441 imux
->items
[i
].index
,
447 /* MUX style (e.g. ALC880) */
448 return snd_hda_input_mux_put(codec
, imux
, ucontrol
, nid
,
449 &spec
->cur_mux
[adc_idx
]);
454 * channel mode setting
456 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
457 struct snd_ctl_elem_info
*uinfo
)
459 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
460 struct alc_spec
*spec
= codec
->spec
;
461 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
462 spec
->num_channel_mode
);
465 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
466 struct snd_ctl_elem_value
*ucontrol
)
468 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
469 struct alc_spec
*spec
= codec
->spec
;
470 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
471 spec
->num_channel_mode
,
472 spec
->ext_channel_count
);
475 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
476 struct snd_ctl_elem_value
*ucontrol
)
478 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
479 struct alc_spec
*spec
= codec
->spec
;
480 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
481 spec
->num_channel_mode
,
482 &spec
->ext_channel_count
);
483 if (err
>= 0 && !spec
->const_channel_count
) {
484 spec
->multiout
.max_channels
= spec
->ext_channel_count
;
485 if (spec
->need_dac_fix
)
486 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
492 * Control the mode of pin widget settings via the mixer. "pc" is used
493 * instead of "%" to avoid consequences of accidently treating the % as
494 * being part of a format specifier. Maximum allowed length of a value is
495 * 63 characters plus NULL terminator.
497 * Note: some retasking pin complexes seem to ignore requests for input
498 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
499 * are requested. Therefore order this list so that this behaviour will not
500 * cause problems when mixer clients move through the enum sequentially.
501 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
504 static char *alc_pin_mode_names
[] = {
505 "Mic 50pc bias", "Mic 80pc bias",
506 "Line in", "Line out", "Headphone out",
508 static unsigned char alc_pin_mode_values
[] = {
509 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
511 /* The control can present all 5 options, or it can limit the options based
512 * in the pin being assumed to be exclusively an input or an output pin. In
513 * addition, "input" pins may or may not process the mic bias option
514 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
515 * accept requests for bias as of chip versions up to March 2006) and/or
516 * wiring in the computer.
518 #define ALC_PIN_DIR_IN 0x00
519 #define ALC_PIN_DIR_OUT 0x01
520 #define ALC_PIN_DIR_INOUT 0x02
521 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
522 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
524 /* Info about the pin modes supported by the different pin direction modes.
525 * For each direction the minimum and maximum values are given.
527 static signed char alc_pin_mode_dir_info
[5][2] = {
528 { 0, 2 }, /* ALC_PIN_DIR_IN */
529 { 3, 4 }, /* ALC_PIN_DIR_OUT */
530 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
531 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
532 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
534 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
535 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
536 #define alc_pin_mode_n_items(_dir) \
537 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
539 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
540 struct snd_ctl_elem_info
*uinfo
)
542 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
543 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
545 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
547 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
549 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
550 item_num
= alc_pin_mode_min(dir
);
551 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
555 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
556 struct snd_ctl_elem_value
*ucontrol
)
559 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
560 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
561 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
562 long *valp
= ucontrol
->value
.integer
.value
;
563 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
564 AC_VERB_GET_PIN_WIDGET_CONTROL
,
567 /* Find enumerated value for current pinctl setting */
568 i
= alc_pin_mode_min(dir
);
569 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
571 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
575 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
576 struct snd_ctl_elem_value
*ucontrol
)
579 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
580 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
581 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
582 long val
= *ucontrol
->value
.integer
.value
;
583 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
584 AC_VERB_GET_PIN_WIDGET_CONTROL
,
587 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
588 val
= alc_pin_mode_min(dir
);
590 change
= pinctl
!= alc_pin_mode_values
[val
];
592 /* Set pin mode to that requested */
593 snd_hda_codec_write_cache(codec
, nid
, 0,
594 AC_VERB_SET_PIN_WIDGET_CONTROL
,
595 alc_pin_mode_values
[val
]);
597 /* Also enable the retasking pin's input/output as required
598 * for the requested pin mode. Enum values of 2 or less are
601 * Dynamically switching the input/output buffers probably
602 * reduces noise slightly (particularly on input) so we'll
603 * do it. However, having both input and output buffers
604 * enabled simultaneously doesn't seem to be problematic if
605 * this turns out to be necessary in the future.
608 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
609 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
610 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
613 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
614 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
615 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
622 #define ALC_PIN_MODE(xname, nid, dir) \
623 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
624 .info = alc_pin_mode_info, \
625 .get = alc_pin_mode_get, \
626 .put = alc_pin_mode_put, \
627 .private_value = nid | (dir<<16) }
629 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
630 * together using a mask with more than one bit set. This control is
631 * currently used only by the ALC260 test model. At this stage they are not
632 * needed for any "production" models.
634 #ifdef CONFIG_SND_DEBUG
635 #define alc_gpio_data_info snd_ctl_boolean_mono_info
637 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
638 struct snd_ctl_elem_value
*ucontrol
)
640 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
641 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
642 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
643 long *valp
= ucontrol
->value
.integer
.value
;
644 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
645 AC_VERB_GET_GPIO_DATA
, 0x00);
647 *valp
= (val
& mask
) != 0;
650 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
651 struct snd_ctl_elem_value
*ucontrol
)
654 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
655 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
656 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
657 long val
= *ucontrol
->value
.integer
.value
;
658 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
659 AC_VERB_GET_GPIO_DATA
,
662 /* Set/unset the masked GPIO bit(s) as needed */
663 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
668 snd_hda_codec_write_cache(codec
, nid
, 0,
669 AC_VERB_SET_GPIO_DATA
, gpio_data
);
673 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
674 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
675 .info = alc_gpio_data_info, \
676 .get = alc_gpio_data_get, \
677 .put = alc_gpio_data_put, \
678 .private_value = nid | (mask<<16) }
679 #endif /* CONFIG_SND_DEBUG */
681 /* A switch control to allow the enabling of the digital IO pins on the
682 * ALC260. This is incredibly simplistic; the intention of this control is
683 * to provide something in the test model allowing digital outputs to be
684 * identified if present. If models are found which can utilise these
685 * outputs a more complete mixer control can be devised for those models if
688 #ifdef CONFIG_SND_DEBUG
689 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
691 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
692 struct snd_ctl_elem_value
*ucontrol
)
694 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
695 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
696 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
697 long *valp
= ucontrol
->value
.integer
.value
;
698 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
699 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
701 *valp
= (val
& mask
) != 0;
704 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
705 struct snd_ctl_elem_value
*ucontrol
)
708 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
709 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
710 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
711 long val
= *ucontrol
->value
.integer
.value
;
712 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
713 AC_VERB_GET_DIGI_CONVERT_1
,
716 /* Set/unset the masked control bit(s) as needed */
717 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
722 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
727 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
728 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
729 .info = alc_spdif_ctrl_info, \
730 .get = alc_spdif_ctrl_get, \
731 .put = alc_spdif_ctrl_put, \
732 .private_value = nid | (mask<<16) }
733 #endif /* CONFIG_SND_DEBUG */
735 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
736 * Again, this is only used in the ALC26x test models to help identify when
737 * the EAPD line must be asserted for features to work.
739 #ifdef CONFIG_SND_DEBUG
740 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
742 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
743 struct snd_ctl_elem_value
*ucontrol
)
745 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
746 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
747 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
748 long *valp
= ucontrol
->value
.integer
.value
;
749 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
750 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
752 *valp
= (val
& mask
) != 0;
756 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
757 struct snd_ctl_elem_value
*ucontrol
)
760 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
761 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
762 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
763 long val
= *ucontrol
->value
.integer
.value
;
764 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
765 AC_VERB_GET_EAPD_BTLENABLE
,
768 /* Set/unset the masked control bit(s) as needed */
769 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
774 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
780 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
781 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
782 .info = alc_eapd_ctrl_info, \
783 .get = alc_eapd_ctrl_get, \
784 .put = alc_eapd_ctrl_put, \
785 .private_value = nid | (mask<<16) }
786 #endif /* CONFIG_SND_DEBUG */
789 * set up the input pin config (depending on the given auto-pin type)
791 static void alc_set_input_pin(struct hda_codec
*codec
, hda_nid_t nid
,
794 unsigned int val
= PIN_IN
;
796 if (auto_pin_type
<= AUTO_PIN_FRONT_MIC
) {
798 pincap
= snd_hda_query_pin_caps(codec
, nid
);
799 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
800 if (pincap
& AC_PINCAP_VREF_80
)
802 else if (pincap
& AC_PINCAP_VREF_50
)
804 else if (pincap
& AC_PINCAP_VREF_100
)
806 else if (pincap
& AC_PINCAP_VREF_GRD
)
809 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, val
);
814 static void add_mixer(struct alc_spec
*spec
, struct snd_kcontrol_new
*mix
)
816 if (snd_BUG_ON(spec
->num_mixers
>= ARRAY_SIZE(spec
->mixers
)))
818 spec
->mixers
[spec
->num_mixers
++] = mix
;
821 static void add_verb(struct alc_spec
*spec
, const struct hda_verb
*verb
)
823 if (snd_BUG_ON(spec
->num_init_verbs
>= ARRAY_SIZE(spec
->init_verbs
)))
825 spec
->init_verbs
[spec
->num_init_verbs
++] = verb
;
828 #ifdef CONFIG_PROC_FS
832 static void print_realtek_coef(struct snd_info_buffer
*buffer
,
833 struct hda_codec
*codec
, hda_nid_t nid
)
839 coeff
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_PROC_COEF
, 0);
840 snd_iprintf(buffer
, " Processing Coefficient: 0x%02x\n", coeff
);
841 coeff
= snd_hda_codec_read(codec
, nid
, 0,
842 AC_VERB_GET_COEF_INDEX
, 0);
843 snd_iprintf(buffer
, " Coefficient Index: 0x%02x\n", coeff
);
846 #define print_realtek_coef NULL
850 * set up from the preset table
852 static void setup_preset(struct alc_spec
*spec
,
853 const struct alc_config_preset
*preset
)
857 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
858 add_mixer(spec
, preset
->mixers
[i
]);
859 spec
->cap_mixer
= preset
->cap_mixer
;
860 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
862 add_verb(spec
, preset
->init_verbs
[i
]);
864 spec
->channel_mode
= preset
->channel_mode
;
865 spec
->num_channel_mode
= preset
->num_channel_mode
;
866 spec
->need_dac_fix
= preset
->need_dac_fix
;
867 spec
->const_channel_count
= preset
->const_channel_count
;
869 if (preset
->const_channel_count
)
870 spec
->multiout
.max_channels
= preset
->const_channel_count
;
872 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
873 spec
->ext_channel_count
= spec
->channel_mode
[0].channels
;
875 spec
->multiout
.num_dacs
= preset
->num_dacs
;
876 spec
->multiout
.dac_nids
= preset
->dac_nids
;
877 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
878 spec
->multiout
.slave_dig_outs
= preset
->slave_dig_outs
;
879 spec
->multiout
.hp_nid
= preset
->hp_nid
;
881 spec
->num_mux_defs
= preset
->num_mux_defs
;
882 if (!spec
->num_mux_defs
)
883 spec
->num_mux_defs
= 1;
884 spec
->input_mux
= preset
->input_mux
;
886 spec
->num_adc_nids
= preset
->num_adc_nids
;
887 spec
->adc_nids
= preset
->adc_nids
;
888 spec
->capsrc_nids
= preset
->capsrc_nids
;
889 spec
->dig_in_nid
= preset
->dig_in_nid
;
891 spec
->unsol_event
= preset
->unsol_event
;
892 spec
->init_hook
= preset
->init_hook
;
893 #ifdef CONFIG_SND_HDA_POWER_SAVE
894 spec
->loopback
.amplist
= preset
->loopbacks
;
898 /* Enable GPIO mask and set output */
899 static struct hda_verb alc_gpio1_init_verbs
[] = {
900 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
901 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
902 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
906 static struct hda_verb alc_gpio2_init_verbs
[] = {
907 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
908 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
909 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
913 static struct hda_verb alc_gpio3_init_verbs
[] = {
914 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
915 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
916 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
921 * Fix hardware PLL issue
922 * On some codecs, the analog PLL gating control must be off while
923 * the default value is 1.
925 static void alc_fix_pll(struct hda_codec
*codec
)
927 struct alc_spec
*spec
= codec
->spec
;
932 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
934 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
935 AC_VERB_GET_PROC_COEF
, 0);
936 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
938 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
939 val
& ~(1 << spec
->pll_coef_bit
));
942 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
943 unsigned int coef_idx
, unsigned int coef_bit
)
945 struct alc_spec
*spec
= codec
->spec
;
947 spec
->pll_coef_idx
= coef_idx
;
948 spec
->pll_coef_bit
= coef_bit
;
952 static void alc_automute_pin(struct hda_codec
*codec
)
954 struct alc_spec
*spec
= codec
->spec
;
955 unsigned int present
;
956 unsigned int nid
= spec
->autocfg
.hp_pins
[0];
959 /* need to execute and sync at first */
960 snd_hda_codec_read(codec
, nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
961 present
= snd_hda_codec_read(codec
, nid
, 0,
962 AC_VERB_GET_PIN_SENSE
, 0);
963 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
964 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
965 nid
= spec
->autocfg
.speaker_pins
[i
];
968 snd_hda_codec_write(codec
, nid
, 0,
969 AC_VERB_SET_PIN_WIDGET_CONTROL
,
970 spec
->jack_present
? 0 : PIN_OUT
);
974 #if 0 /* it's broken in some cases -- temporarily disabled */
975 static void alc_mic_automute(struct hda_codec
*codec
)
977 struct alc_spec
*spec
= codec
->spec
;
978 unsigned int present
;
979 unsigned int mic_nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
980 unsigned int fmic_nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
981 unsigned int mix_nid
= spec
->capsrc_nids
[0];
982 unsigned int capsrc_idx_mic
, capsrc_idx_fmic
;
984 capsrc_idx_mic
= mic_nid
- 0x18;
985 capsrc_idx_fmic
= fmic_nid
- 0x18;
986 present
= snd_hda_codec_read(codec
, mic_nid
, 0,
987 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
988 snd_hda_codec_write(codec
, mix_nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
989 0x7000 | (capsrc_idx_mic
<< 8) | (present
? 0 : 0x80));
990 snd_hda_codec_write(codec
, mix_nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
991 0x7000 | (capsrc_idx_fmic
<< 8) | (present
? 0x80 : 0));
992 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, capsrc_idx_fmic
,
993 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
996 #define alc_mic_automute(codec) do {} while(0) /* NOP */
997 #endif /* disabled */
999 /* unsolicited event for HP jack sensing */
1000 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1002 if (codec
->vendor_id
== 0x10ec0880)
1007 case ALC880_HP_EVENT
:
1008 alc_automute_pin(codec
);
1010 case ALC880_MIC_EVENT
:
1011 alc_mic_automute(codec
);
1016 static void alc_inithook(struct hda_codec
*codec
)
1018 alc_automute_pin(codec
);
1019 alc_mic_automute(codec
);
1022 /* additional initialization for ALC888 variants */
1023 static void alc888_coef_init(struct hda_codec
*codec
)
1027 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
1028 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1029 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1030 if ((tmp
& 0xf0) == 0x20)
1032 snd_hda_codec_read(codec
, 0x20, 0,
1033 AC_VERB_SET_PROC_COEF
, 0x830);
1036 snd_hda_codec_read(codec
, 0x20, 0,
1037 AC_VERB_SET_PROC_COEF
, 0x3030);
1040 static void alc_auto_init_amp(struct hda_codec
*codec
, int type
)
1045 case ALC_INIT_GPIO1
:
1046 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
1048 case ALC_INIT_GPIO2
:
1049 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
1051 case ALC_INIT_GPIO3
:
1052 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
1054 case ALC_INIT_DEFAULT
:
1055 switch (codec
->vendor_id
) {
1057 snd_hda_codec_write(codec
, 0x0f, 0,
1058 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1059 snd_hda_codec_write(codec
, 0x10, 0,
1060 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1072 snd_hda_codec_write(codec
, 0x14, 0,
1073 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1074 snd_hda_codec_write(codec
, 0x15, 0,
1075 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1078 switch (codec
->vendor_id
) {
1080 snd_hda_codec_write(codec
, 0x1a, 0,
1081 AC_VERB_SET_COEF_INDEX
, 7);
1082 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
1083 AC_VERB_GET_PROC_COEF
, 0);
1084 snd_hda_codec_write(codec
, 0x1a, 0,
1085 AC_VERB_SET_COEF_INDEX
, 7);
1086 snd_hda_codec_write(codec
, 0x1a, 0,
1087 AC_VERB_SET_PROC_COEF
,
1097 snd_hda_codec_write(codec
, 0x20, 0,
1098 AC_VERB_SET_COEF_INDEX
, 7);
1099 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1100 AC_VERB_GET_PROC_COEF
, 0);
1101 snd_hda_codec_write(codec
, 0x20, 0,
1102 AC_VERB_SET_COEF_INDEX
, 7);
1103 snd_hda_codec_write(codec
, 0x20, 0,
1104 AC_VERB_SET_PROC_COEF
,
1108 alc888_coef_init(codec
);
1112 snd_hda_codec_write(codec
, 0x20, 0,
1113 AC_VERB_SET_COEF_INDEX
, 7);
1114 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1115 AC_VERB_GET_PROC_COEF
, 0);
1116 snd_hda_codec_write(codec
, 0x20, 0,
1117 AC_VERB_SET_COEF_INDEX
, 7);
1118 snd_hda_codec_write(codec
, 0x20, 0,
1119 AC_VERB_SET_PROC_COEF
,
1127 static void alc_init_auto_hp(struct hda_codec
*codec
)
1129 struct alc_spec
*spec
= codec
->spec
;
1131 if (!spec
->autocfg
.hp_pins
[0])
1134 if (!spec
->autocfg
.speaker_pins
[0]) {
1135 if (spec
->autocfg
.line_out_pins
[0] &&
1136 spec
->autocfg
.line_out_type
== AUTO_PIN_SPEAKER_OUT
)
1137 spec
->autocfg
.speaker_pins
[0] =
1138 spec
->autocfg
.line_out_pins
[0];
1143 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1144 spec
->autocfg
.hp_pins
[0]);
1145 snd_hda_codec_write_cache(codec
, spec
->autocfg
.hp_pins
[0], 0,
1146 AC_VERB_SET_UNSOLICITED_ENABLE
,
1147 AC_USRSP_EN
| ALC880_HP_EVENT
);
1148 spec
->unsol_event
= alc_sku_unsol_event
;
1151 /* check subsystem ID and set up device-specific initialization;
1152 * return 1 if initialized, 0 if invalid SSID
1154 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1155 * 31 ~ 16 : Manufacture ID
1157 * 7 ~ 0 : Assembly ID
1158 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1160 static int alc_subsystem_id(struct hda_codec
*codec
,
1161 hda_nid_t porta
, hda_nid_t porte
,
1164 unsigned int ass
, tmp
, i
;
1166 struct alc_spec
*spec
= codec
->spec
;
1168 ass
= codec
->subsystem_id
& 0xffff;
1169 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
1172 /* invalid SSID, check the special NID pin defcfg instead */
1174 * 31~30 : port connectivity
1177 * 19~16 : Check sum (15:1)
1182 if (codec
->vendor_id
== 0x10ec0260)
1184 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1185 snd_printd("realtek: No valid SSID, "
1186 "checking pincfg 0x%08x for NID 0x%x\n",
1188 if (!(ass
& 1) && !(ass
& 0x100000))
1190 if ((ass
>> 30) != 1) /* no physical connection */
1195 for (i
= 1; i
< 16; i
++) {
1199 if (((ass
>> 16) & 0xf) != tmp
)
1202 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1203 ass
& 0xffff, codec
->vendor_id
);
1207 * 2 : 0 --> Desktop, 1 --> Laptop
1208 * 3~5 : External Amplifier control
1211 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
1214 spec
->init_amp
= ALC_INIT_GPIO1
;
1217 spec
->init_amp
= ALC_INIT_GPIO2
;
1220 spec
->init_amp
= ALC_INIT_GPIO3
;
1223 spec
->init_amp
= ALC_INIT_DEFAULT
;
1227 /* is laptop or Desktop and enable the function "Mute internal speaker
1228 * when the external headphone out jack is plugged"
1230 if (!(ass
& 0x8000))
1233 * 10~8 : Jack location
1234 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1236 * 15 : 1 --> enable the function "Mute internal speaker
1237 * when the external headphone out jack is plugged"
1239 if (!spec
->autocfg
.hp_pins
[0]) {
1240 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
1242 spec
->autocfg
.hp_pins
[0] = porta
;
1244 spec
->autocfg
.hp_pins
[0] = porte
;
1246 spec
->autocfg
.hp_pins
[0] = portd
;
1251 alc_init_auto_hp(codec
);
1255 static void alc_ssid_check(struct hda_codec
*codec
,
1256 hda_nid_t porta
, hda_nid_t porte
, hda_nid_t portd
)
1258 if (!alc_subsystem_id(codec
, porta
, porte
, portd
)) {
1259 struct alc_spec
*spec
= codec
->spec
;
1260 snd_printd("realtek: "
1261 "Enable default setup for auto mode as fallback\n");
1262 spec
->init_amp
= ALC_INIT_DEFAULT
;
1263 alc_init_auto_hp(codec
);
1268 * Fix-up pin default configurations
1276 static void alc_fix_pincfg(struct hda_codec
*codec
,
1277 const struct snd_pci_quirk
*quirk
,
1278 const struct alc_pincfg
**pinfix
)
1280 const struct alc_pincfg
*cfg
;
1282 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
1286 cfg
= pinfix
[quirk
->value
];
1287 for (; cfg
->nid
; cfg
++)
1288 snd_hda_codec_set_pincfg(codec
, cfg
->nid
, cfg
->val
);
1298 static struct hda_verb alc888_4ST_ch2_intel_init
[] = {
1299 /* Mic-in jack as mic in */
1300 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1301 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1302 /* Line-in jack as Line in */
1303 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1304 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1305 /* Line-Out as Front */
1306 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1313 static struct hda_verb alc888_4ST_ch4_intel_init
[] = {
1314 /* Mic-in jack as mic in */
1315 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1316 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1317 /* Line-in jack as Surround */
1318 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1319 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1320 /* Line-Out as Front */
1321 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1328 static struct hda_verb alc888_4ST_ch6_intel_init
[] = {
1329 /* Mic-in jack as CLFE */
1330 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1331 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1332 /* Line-in jack as Surround */
1333 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1334 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1335 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1336 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1343 static struct hda_verb alc888_4ST_ch8_intel_init
[] = {
1344 /* Mic-in jack as CLFE */
1345 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1346 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1347 /* Line-in jack as Surround */
1348 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1349 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1350 /* Line-Out as Side */
1351 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1355 static struct hda_channel_mode alc888_4ST_8ch_intel_modes
[4] = {
1356 { 2, alc888_4ST_ch2_intel_init
},
1357 { 4, alc888_4ST_ch4_intel_init
},
1358 { 6, alc888_4ST_ch6_intel_init
},
1359 { 8, alc888_4ST_ch8_intel_init
},
1363 * ALC888 Fujitsu Siemens Amillo xa3530
1366 static struct hda_verb alc888_fujitsu_xa3530_verbs
[] = {
1367 /* Front Mic: set to PIN_IN (empty by default) */
1368 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1369 /* Connect Internal HP to Front */
1370 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1371 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1372 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1373 /* Connect Bass HP to Front */
1374 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1375 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1376 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1377 /* Connect Line-Out side jack (SPDIF) to Side */
1378 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1379 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1380 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1381 /* Connect Mic jack to CLFE */
1382 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1383 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1384 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
1385 /* Connect Line-in jack to Surround */
1386 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1387 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1388 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
1389 /* Connect HP out jack to Front */
1390 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1391 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1392 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1393 /* Enable unsolicited event for HP jack and Line-out jack */
1394 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1395 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1399 static void alc_automute_amp(struct hda_codec
*codec
)
1401 struct alc_spec
*spec
= codec
->spec
;
1402 unsigned int val
, mute
;
1406 spec
->jack_present
= 0;
1407 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.hp_pins
); i
++) {
1408 nid
= spec
->autocfg
.hp_pins
[i
];
1411 val
= snd_hda_codec_read(codec
, nid
, 0,
1412 AC_VERB_GET_PIN_SENSE
, 0);
1413 if (val
& AC_PINSENSE_PRESENCE
) {
1414 spec
->jack_present
= 1;
1419 mute
= spec
->jack_present
? HDA_AMP_MUTE
: 0;
1420 /* Toggle internal speakers muting */
1421 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
1422 nid
= spec
->autocfg
.speaker_pins
[i
];
1425 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
1426 HDA_AMP_MUTE
, mute
);
1430 static void alc_automute_amp_unsol_event(struct hda_codec
*codec
,
1433 if (codec
->vendor_id
== 0x10ec0880)
1437 if (res
== ALC880_HP_EVENT
)
1438 alc_automute_amp(codec
);
1441 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec
*codec
)
1443 struct alc_spec
*spec
= codec
->spec
;
1445 spec
->autocfg
.hp_pins
[0] = 0x17; /* line-out */
1446 spec
->autocfg
.hp_pins
[1] = 0x1b; /* hp */
1447 spec
->autocfg
.speaker_pins
[0] = 0x14; /* speaker */
1448 spec
->autocfg
.speaker_pins
[1] = 0x15; /* bass */
1449 alc_automute_amp(codec
);
1453 * ALC888 Acer Aspire 4930G model
1456 static struct hda_verb alc888_acer_aspire_4930g_verbs
[] = {
1457 /* Front Mic: set to PIN_IN (empty by default) */
1458 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1459 /* Unselect Front Mic by default in input mixer 3 */
1460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
1461 /* Enable unsolicited event for HP jack */
1462 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1463 /* Connect Internal HP to front */
1464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1465 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1466 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1467 /* Connect HP out to front */
1468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1470 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1475 * ALC888 Acer Aspire 6530G model
1478 static struct hda_verb alc888_acer_aspire_6530g_verbs
[] = {
1479 /* Bias voltage on for external mic port */
1480 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
1481 /* Enable unsolicited event for HP jack */
1482 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1483 /* Enable speaker output */
1484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1485 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1486 /* Enable headphone output */
1487 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
1488 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1489 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1494 * ALC889 Acer Aspire 8930G model
1497 static struct hda_verb alc889_acer_aspire_8930g_verbs
[] = {
1498 /* Front Mic: set to PIN_IN (empty by default) */
1499 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1500 /* Unselect Front Mic by default in input mixer 3 */
1501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
1502 /* Enable unsolicited event for HP jack */
1503 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1504 /* Connect Internal Front to Front */
1505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1507 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1508 /* Connect Internal Rear to Rear */
1509 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1510 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1511 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
1512 /* Connect Internal CLFE to CLFE */
1513 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1514 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1515 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
1516 /* Connect HP out to Front */
1517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
1518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1519 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1520 /* Enable all DACs */
1521 /* DAC DISABLE/MUTE 1? */
1522 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1523 {0x20, AC_VERB_SET_COEF_INDEX
, 0x03},
1524 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
1525 /* DAC DISABLE/MUTE 2? */
1526 /* some bit here disables the other DACs. Init=0x4900 */
1527 {0x20, AC_VERB_SET_COEF_INDEX
, 0x08},
1528 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
1529 /* Enable amplifiers */
1530 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
1531 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
1533 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1534 * which makes the stereo useless. However, either the mic or the ALC889
1535 * makes the signal become a difference/sum signal instead of standard
1536 * stereo, which is annoying. So instead we flip this bit which makes the
1537 * codec replicate the sum signal to both channels, turning it into a
1540 /* DMIC_CONTROL? Init value = 0x0001 */
1541 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
1542 {0x20, AC_VERB_SET_PROC_COEF
, 0x0003},
1546 static struct hda_input_mux alc888_2_capture_sources
[2] = {
1547 /* Front mic only available on one ADC */
1554 { "Front Mic", 0xb },
1567 static struct hda_input_mux alc888_acer_aspire_6530_sources
[2] = {
1568 /* Interal mic only available on one ADC */
1586 static struct hda_input_mux alc889_capture_sources
[3] = {
1587 /* Digital mic only available on first "ADC" */
1594 { "Front Mic", 0xb },
1595 { "Input Mix", 0xa },
1604 { "Input Mix", 0xa },
1613 { "Input Mix", 0xa },
1618 static struct snd_kcontrol_new alc888_base_mixer
[] = {
1619 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1620 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1621 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1622 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1623 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1625 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1626 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1627 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1628 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1629 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1630 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1631 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1632 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1633 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1634 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1635 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
1636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1640 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec
*codec
)
1642 struct alc_spec
*spec
= codec
->spec
;
1644 spec
->autocfg
.hp_pins
[0] = 0x15;
1645 spec
->autocfg
.speaker_pins
[0] = 0x14;
1646 alc_automute_amp(codec
);
1649 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec
*codec
)
1651 struct alc_spec
*spec
= codec
->spec
;
1653 spec
->autocfg
.hp_pins
[0] = 0x15;
1654 spec
->autocfg
.speaker_pins
[0] = 0x14;
1655 spec
->autocfg
.speaker_pins
[1] = 0x16;
1656 spec
->autocfg
.speaker_pins
[2] = 0x1b;
1657 alc_automute_amp(codec
);
1661 * ALC880 3-stack model
1663 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1664 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1665 * F-Mic = 0x1b, HP = 0x19
1668 static hda_nid_t alc880_dac_nids
[4] = {
1669 /* front, rear, clfe, rear_surr */
1670 0x02, 0x05, 0x04, 0x03
1673 static hda_nid_t alc880_adc_nids
[3] = {
1678 /* The datasheet says the node 0x07 is connected from inputs,
1679 * but it shows zero connection in the real implementation on some devices.
1680 * Note: this is a 915GAV bug, fixed on 915GLV
1682 static hda_nid_t alc880_adc_nids_alt
[2] = {
1687 #define ALC880_DIGOUT_NID 0x06
1688 #define ALC880_DIGIN_NID 0x0a
1690 static struct hda_input_mux alc880_capture_source
= {
1694 { "Front Mic", 0x3 },
1700 /* channel source setting (2/6 channel selection for 3-stack) */
1702 static struct hda_verb alc880_threestack_ch2_init
[] = {
1703 /* set line-in to input, mute it */
1704 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1705 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1706 /* set mic-in to input vref 80%, mute it */
1707 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1708 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1713 static struct hda_verb alc880_threestack_ch6_init
[] = {
1714 /* set line-in to output, unmute it */
1715 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1716 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1717 /* set mic-in to output, unmute it */
1718 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1719 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1723 static struct hda_channel_mode alc880_threestack_modes
[2] = {
1724 { 2, alc880_threestack_ch2_init
},
1725 { 6, alc880_threestack_ch6_init
},
1728 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
1729 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1730 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1731 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1732 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
1733 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1734 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1735 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1736 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1737 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1738 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1739 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1740 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1742 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1743 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
1744 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
1745 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
1747 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1748 .name
= "Channel Mode",
1749 .info
= alc_ch_mode_info
,
1750 .get
= alc_ch_mode_get
,
1751 .put
= alc_ch_mode_put
,
1756 /* capture mixer elements */
1757 static int alc_cap_vol_info(struct snd_kcontrol
*kcontrol
,
1758 struct snd_ctl_elem_info
*uinfo
)
1760 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1761 struct alc_spec
*spec
= codec
->spec
;
1764 mutex_lock(&codec
->control_mutex
);
1765 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
1767 err
= snd_hda_mixer_amp_volume_info(kcontrol
, uinfo
);
1768 mutex_unlock(&codec
->control_mutex
);
1772 static int alc_cap_vol_tlv(struct snd_kcontrol
*kcontrol
, int op_flag
,
1773 unsigned int size
, unsigned int __user
*tlv
)
1775 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1776 struct alc_spec
*spec
= codec
->spec
;
1779 mutex_lock(&codec
->control_mutex
);
1780 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
1782 err
= snd_hda_mixer_amp_tlv(kcontrol
, op_flag
, size
, tlv
);
1783 mutex_unlock(&codec
->control_mutex
);
1787 typedef int (*getput_call_t
)(struct snd_kcontrol
*kcontrol
,
1788 struct snd_ctl_elem_value
*ucontrol
);
1790 static int alc_cap_getput_caller(struct snd_kcontrol
*kcontrol
,
1791 struct snd_ctl_elem_value
*ucontrol
,
1794 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1795 struct alc_spec
*spec
= codec
->spec
;
1796 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
1799 mutex_lock(&codec
->control_mutex
);
1800 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[adc_idx
],
1802 err
= func(kcontrol
, ucontrol
);
1803 mutex_unlock(&codec
->control_mutex
);
1807 static int alc_cap_vol_get(struct snd_kcontrol
*kcontrol
,
1808 struct snd_ctl_elem_value
*ucontrol
)
1810 return alc_cap_getput_caller(kcontrol
, ucontrol
,
1811 snd_hda_mixer_amp_volume_get
);
1814 static int alc_cap_vol_put(struct snd_kcontrol
*kcontrol
,
1815 struct snd_ctl_elem_value
*ucontrol
)
1817 return alc_cap_getput_caller(kcontrol
, ucontrol
,
1818 snd_hda_mixer_amp_volume_put
);
1821 /* capture mixer elements */
1822 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1824 static int alc_cap_sw_get(struct snd_kcontrol
*kcontrol
,
1825 struct snd_ctl_elem_value
*ucontrol
)
1827 return alc_cap_getput_caller(kcontrol
, ucontrol
,
1828 snd_hda_mixer_amp_switch_get
);
1831 static int alc_cap_sw_put(struct snd_kcontrol
*kcontrol
,
1832 struct snd_ctl_elem_value
*ucontrol
)
1834 return alc_cap_getput_caller(kcontrol
, ucontrol
,
1835 snd_hda_mixer_amp_switch_put
);
1838 #define _DEFINE_CAPMIX(num) \
1840 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1841 .name = "Capture Switch", \
1842 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1844 .info = alc_cap_sw_info, \
1845 .get = alc_cap_sw_get, \
1846 .put = alc_cap_sw_put, \
1849 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1850 .name = "Capture Volume", \
1851 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1852 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1853 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1855 .info = alc_cap_vol_info, \
1856 .get = alc_cap_vol_get, \
1857 .put = alc_cap_vol_put, \
1858 .tlv = { .c = alc_cap_vol_tlv }, \
1861 #define _DEFINE_CAPSRC(num) \
1863 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1864 /* .name = "Capture Source", */ \
1865 .name = "Input Source", \
1867 .info = alc_mux_enum_info, \
1868 .get = alc_mux_enum_get, \
1869 .put = alc_mux_enum_put, \
1872 #define DEFINE_CAPMIX(num) \
1873 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1874 _DEFINE_CAPMIX(num), \
1875 _DEFINE_CAPSRC(num), \
1879 #define DEFINE_CAPMIX_NOSRC(num) \
1880 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1881 _DEFINE_CAPMIX(num), \
1885 /* up to three ADCs */
1889 DEFINE_CAPMIX_NOSRC(1);
1890 DEFINE_CAPMIX_NOSRC(2);
1891 DEFINE_CAPMIX_NOSRC(3);
1894 * ALC880 5-stack model
1896 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1898 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1899 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1902 /* additional mixers to alc880_three_stack_mixer */
1903 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
1904 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1905 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
1909 /* channel source setting (6/8 channel selection for 5-stack) */
1911 static struct hda_verb alc880_fivestack_ch6_init
[] = {
1912 /* set line-in to input, mute it */
1913 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1914 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1919 static struct hda_verb alc880_fivestack_ch8_init
[] = {
1920 /* set line-in to output, unmute it */
1921 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1922 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1926 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
1927 { 6, alc880_fivestack_ch6_init
},
1928 { 8, alc880_fivestack_ch8_init
},
1933 * ALC880 6-stack model
1935 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1936 * Side = 0x05 (0x0f)
1937 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1938 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1941 static hda_nid_t alc880_6st_dac_nids
[4] = {
1942 /* front, rear, clfe, rear_surr */
1943 0x02, 0x03, 0x04, 0x05
1946 static struct hda_input_mux alc880_6stack_capture_source
= {
1950 { "Front Mic", 0x1 },
1956 /* fixed 8-channels */
1957 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
1961 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
1962 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1963 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1964 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1965 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1966 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1967 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1968 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1969 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1970 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1971 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1972 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1973 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1974 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1975 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1976 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1978 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1979 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1981 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1982 .name
= "Channel Mode",
1983 .info
= alc_ch_mode_info
,
1984 .get
= alc_ch_mode_get
,
1985 .put
= alc_ch_mode_put
,
1994 * W810 has rear IO for:
1997 * Center/LFE (DAC 04)
2000 * The system also has a pair of internal speakers, and a headphone jack.
2001 * These are both connected to Line2 on the codec, hence to DAC 02.
2003 * There is a variable resistor to control the speaker or headphone
2004 * volume. This is a hardware-only device without a software API.
2006 * Plugging headphones in will disable the internal speakers. This is
2007 * implemented in hardware, not via the driver using jack sense. In
2008 * a similar fashion, plugging into the rear socket marked "front" will
2009 * disable both the speakers and headphones.
2011 * For input, there's a microphone jack, and an "audio in" jack.
2012 * These may not do anything useful with this driver yet, because I
2013 * haven't setup any initialization verbs for these yet...
2016 static hda_nid_t alc880_w810_dac_nids
[3] = {
2017 /* front, rear/surround, clfe */
2021 /* fixed 6 channels */
2022 static struct hda_channel_mode alc880_w810_modes
[1] = {
2026 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2027 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
2028 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2029 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2030 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2031 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2032 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2033 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2034 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2035 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2036 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2044 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2045 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2049 static hda_nid_t alc880_z71v_dac_nids
[1] = {
2052 #define ALC880_Z71V_HP_DAC 0x03
2054 /* fixed 2 channels */
2055 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
2059 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
2060 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2061 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2062 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2063 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
2064 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2065 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2067 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2073 * ALC880 F1734 model
2075 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2076 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2079 static hda_nid_t alc880_f1734_dac_nids
[1] = {
2082 #define ALC880_F1734_HP_DAC 0x02
2084 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
2085 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2086 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2087 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2088 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2089 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2090 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2092 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2096 static struct hda_input_mux alc880_f1734_capture_source
= {
2108 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2109 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2110 * Mic = 0x18, Line = 0x1a
2113 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2114 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2116 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
2117 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2118 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2119 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2120 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2121 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2122 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2123 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2124 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2132 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2133 .name
= "Channel Mode",
2134 .info
= alc_ch_mode_info
,
2135 .get
= alc_ch_mode_get
,
2136 .put
= alc_ch_mode_put
,
2142 * ALC880 ASUS W1V model
2144 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2145 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2146 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2149 /* additional mixers to alc880_asus_mixer */
2150 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
2151 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
2152 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
2157 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
2158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2159 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
2161 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
2162 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
2163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
2164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
2165 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
2166 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
2171 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
2172 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2173 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2174 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2175 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2176 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2177 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2178 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2179 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2180 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2181 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2182 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2183 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2184 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2185 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2186 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2187 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2189 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2190 .name
= "Channel Mode",
2191 .info
= alc_ch_mode_info
,
2192 .get
= alc_ch_mode_get
,
2193 .put
= alc_ch_mode_put
,
2198 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
2199 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2200 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2201 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2202 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2203 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2204 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2205 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2206 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2207 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2208 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2212 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
2213 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2214 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2215 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2216 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2223 * virtual master controls
2227 * slave controls for virtual master
2229 static const char *alc_slave_vols
[] = {
2230 "Front Playback Volume",
2231 "Surround Playback Volume",
2232 "Center Playback Volume",
2233 "LFE Playback Volume",
2234 "Side Playback Volume",
2235 "Headphone Playback Volume",
2236 "Speaker Playback Volume",
2237 "Mono Playback Volume",
2238 "Line-Out Playback Volume",
2239 "PCM Playback Volume",
2243 static const char *alc_slave_sws
[] = {
2244 "Front Playback Switch",
2245 "Surround Playback Switch",
2246 "Center Playback Switch",
2247 "LFE Playback Switch",
2248 "Side Playback Switch",
2249 "Headphone Playback Switch",
2250 "Speaker Playback Switch",
2251 "Mono Playback Switch",
2252 "IEC958 Playback Switch",
2257 * build control elements
2260 static void alc_free_kctls(struct hda_codec
*codec
);
2262 /* additional beep mixers; the actual parameters are overwritten at build */
2263 static struct snd_kcontrol_new alc_beep_mixer
[] = {
2264 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT
),
2265 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT
),
2269 static int alc_build_controls(struct hda_codec
*codec
)
2271 struct alc_spec
*spec
= codec
->spec
;
2275 for (i
= 0; i
< spec
->num_mixers
; i
++) {
2276 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
2280 if (spec
->cap_mixer
) {
2281 err
= snd_hda_add_new_ctls(codec
, spec
->cap_mixer
);
2285 if (spec
->multiout
.dig_out_nid
) {
2286 err
= snd_hda_create_spdif_out_ctls(codec
,
2287 spec
->multiout
.dig_out_nid
);
2290 if (!spec
->no_analog
) {
2291 err
= snd_hda_create_spdif_share_sw(codec
,
2295 spec
->multiout
.share_spdif
= 1;
2298 if (spec
->dig_in_nid
) {
2299 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
2304 /* create beep controls if needed */
2305 if (spec
->beep_amp
) {
2306 struct snd_kcontrol_new
*knew
;
2307 for (knew
= alc_beep_mixer
; knew
->name
; knew
++) {
2308 struct snd_kcontrol
*kctl
;
2309 kctl
= snd_ctl_new1(knew
, codec
);
2312 kctl
->private_value
= spec
->beep_amp
;
2313 err
= snd_hda_ctl_add(codec
, kctl
);
2319 /* if we have no master control, let's create it */
2320 if (!spec
->no_analog
&&
2321 !snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
2322 unsigned int vmaster_tlv
[4];
2323 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
2324 HDA_OUTPUT
, vmaster_tlv
);
2325 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
2326 vmaster_tlv
, alc_slave_vols
);
2330 if (!spec
->no_analog
&&
2331 !snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
2332 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
2333 NULL
, alc_slave_sws
);
2338 alc_free_kctls(codec
); /* no longer needed */
2344 * initialize the codec volumes, etc
2348 * generic initialization of ADC, input mixers and output mixers
2350 static struct hda_verb alc880_volume_init_verbs
[] = {
2352 * Unmute ADC0-2 and set the default input to mic-in
2354 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2355 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2356 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2357 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2358 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2359 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2361 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2363 * Note: PASD motherboards uses the Line In 2 as the input for front
2366 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
2372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2373 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2376 * Set up output mixers (0x0c - 0x0f)
2378 /* set vol=0 to output mixers */
2379 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2380 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2381 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2382 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2383 /* set up input amps for analog loopback */
2384 /* Amp Indices: DAC = 0, mixer = 1 */
2385 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2386 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2387 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2388 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2389 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2390 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2391 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2392 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2398 * 3-stack pin configuration:
2399 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2401 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
2403 * preset connection lists of input pins
2404 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2406 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2407 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2408 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2411 * Set pin mode and muting
2413 /* set front pin widgets 0x14 for output */
2414 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2415 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2416 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2417 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2418 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2419 /* Mic2 (as headphone out) for HP output */
2420 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2421 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2422 /* Line In pin widget for input */
2423 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2424 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2425 /* Line2 (as front mic) pin widget for input and vref at 80% */
2426 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2427 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2428 /* CD pin widget for input */
2429 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2435 * 5-stack pin configuration:
2436 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2437 * line-in/side = 0x1a, f-mic = 0x1b
2439 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
2441 * preset connection lists of input pins
2442 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2444 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2445 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
2448 * Set pin mode and muting
2450 /* set pin widgets 0x14-0x17 for output */
2451 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2452 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2453 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2454 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2455 /* unmute pins for output (no gain on this amp) */
2456 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2457 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2458 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2459 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2461 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2462 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2463 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2464 /* Mic2 (as headphone out) for HP output */
2465 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2466 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2467 /* Line In pin widget for input */
2468 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2469 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2470 /* Line2 (as front mic) pin widget for input and vref at 80% */
2471 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2472 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2473 /* CD pin widget for input */
2474 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2480 * W810 pin configuration:
2481 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2483 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
2484 /* hphone/speaker input selector: front DAC */
2485 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
2487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2488 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2491 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2492 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2494 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2495 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2501 * Z71V pin configuration:
2502 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2504 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
2505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2507 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2508 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2510 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2511 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2512 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2513 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2519 * 6-stack pin configuration:
2520 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2521 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2523 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
2524 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2528 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2529 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2530 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2531 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2532 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2533 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2535 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2536 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2537 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2538 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2539 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2540 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2541 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2542 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2543 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2549 * Uniwill pin configuration:
2550 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2553 static struct hda_verb alc880_uniwill_init_verbs
[] = {
2554 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2556 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2560 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2561 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2562 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2563 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2565 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2566 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2567 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2569 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2571 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2572 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2573 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2574 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2575 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2576 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2577 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2578 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2579 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2581 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2582 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
2589 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2591 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
2592 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2594 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2595 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2596 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2597 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2598 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2599 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2600 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2601 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2602 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2604 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2607 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2608 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2609 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2610 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2611 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2612 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2614 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2615 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
2620 static struct hda_verb alc880_beep_init_verbs
[] = {
2621 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
2625 /* auto-toggle front mic */
2626 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
2628 unsigned int present
;
2631 present
= snd_hda_codec_read(codec
, 0x18, 0,
2632 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2633 bits
= present
? HDA_AMP_MUTE
: 0;
2634 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
2637 static void alc880_uniwill_init_hook(struct hda_codec
*codec
)
2639 struct alc_spec
*spec
= codec
->spec
;
2641 spec
->autocfg
.hp_pins
[0] = 0x14;
2642 spec
->autocfg
.speaker_pins
[0] = 0x15;
2643 spec
->autocfg
.speaker_pins
[0] = 0x16;
2644 alc_automute_amp(codec
);
2645 alc880_uniwill_mic_automute(codec
);
2648 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
2651 /* Looks like the unsol event is incompatible with the standard
2652 * definition. 4bit tag is placed at 28 bit!
2654 switch (res
>> 28) {
2655 case ALC880_MIC_EVENT
:
2656 alc880_uniwill_mic_automute(codec
);
2659 alc_automute_amp_unsol_event(codec
, res
);
2664 static void alc880_uniwill_p53_init_hook(struct hda_codec
*codec
)
2666 struct alc_spec
*spec
= codec
->spec
;
2668 spec
->autocfg
.hp_pins
[0] = 0x14;
2669 spec
->autocfg
.speaker_pins
[0] = 0x15;
2670 alc_automute_amp(codec
);
2673 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
2675 unsigned int present
;
2677 present
= snd_hda_codec_read(codec
, 0x21, 0,
2678 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
2679 present
&= HDA_AMP_VOLMASK
;
2680 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
2681 HDA_AMP_VOLMASK
, present
);
2682 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
2683 HDA_AMP_VOLMASK
, present
);
2686 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
2689 /* Looks like the unsol event is incompatible with the standard
2690 * definition. 4bit tag is placed at 28 bit!
2692 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
2693 alc880_uniwill_p53_dcvol_automute(codec
);
2695 alc_automute_amp_unsol_event(codec
, res
);
2699 * F1734 pin configuration:
2700 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2702 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
2703 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
2704 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2705 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2706 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2707 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2709 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2710 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2714 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2715 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2716 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
2717 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2718 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2719 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2720 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2721 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2722 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2724 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
2725 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
2731 * ASUS pin configuration:
2732 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2734 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
2735 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2736 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2737 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2738 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2740 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2741 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2743 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2744 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2746 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2747 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2749 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2750 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2751 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2752 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2753 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2756 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2757 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2762 /* Enable GPIO mask and set output */
2763 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2764 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2765 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2767 /* Clevo m520g init */
2768 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
2769 /* headphone output */
2770 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2775 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2776 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2778 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2779 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2780 /* Mic1 (rear panel) */
2781 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2782 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2783 /* Mic2 (front panel) */
2784 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2785 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2787 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2788 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2789 /* change to EAPD mode */
2790 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2791 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2796 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
2797 /* change to EAPD mode */
2798 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2799 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2801 /* Headphone output */
2802 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2804 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2805 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2807 /* Line In pin widget for input */
2808 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2809 /* CD pin widget for input */
2810 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2811 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2812 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2814 /* change to EAPD mode */
2815 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2816 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
2822 * LG m1 express dual
2825 * Rear Line-In/Out (blue): 0x14
2826 * Build-in Mic-In: 0x15
2828 * HP-Out (green): 0x1b
2829 * Mic-In/Out (red): 0x19
2833 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2834 static hda_nid_t alc880_lg_dac_nids
[3] = {
2838 /* seems analog CD is not working */
2839 static struct hda_input_mux alc880_lg_capture_source
= {
2844 { "Internal Mic", 0x6 },
2848 /* 2,4,6 channel modes */
2849 static struct hda_verb alc880_lg_ch2_init
[] = {
2850 /* set line-in and mic-in to input */
2851 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2852 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2856 static struct hda_verb alc880_lg_ch4_init
[] = {
2857 /* set line-in to out and mic-in to input */
2858 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2859 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2863 static struct hda_verb alc880_lg_ch6_init
[] = {
2864 /* set line-in and mic-in to output */
2865 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2866 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2870 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
2871 { 2, alc880_lg_ch2_init
},
2872 { 4, alc880_lg_ch4_init
},
2873 { 6, alc880_lg_ch6_init
},
2876 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
2877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2878 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
2879 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2880 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
2881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
2882 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
2883 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
2884 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
2885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2887 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
2888 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
2889 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
2890 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
2892 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2893 .name
= "Channel Mode",
2894 .info
= alc_ch_mode_info
,
2895 .get
= alc_ch_mode_get
,
2896 .put
= alc_ch_mode_put
,
2901 static struct hda_verb alc880_lg_init_verbs
[] = {
2902 /* set capture source to mic-in */
2903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2904 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2906 /* mute all amp mixer inputs */
2907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
2908 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2909 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2910 /* line-in to input */
2911 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2914 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2915 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2917 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2918 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2919 /* mic-in to input */
2920 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2921 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2922 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2924 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
2925 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2926 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2928 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2932 /* toggle speaker-output according to the hp-jack state */
2933 static void alc880_lg_init_hook(struct hda_codec
*codec
)
2935 struct alc_spec
*spec
= codec
->spec
;
2937 spec
->autocfg
.hp_pins
[0] = 0x1b;
2938 spec
->autocfg
.speaker_pins
[0] = 0x17;
2939 alc_automute_amp(codec
);
2948 * Built-in Mic-In: 0x19
2954 static struct hda_input_mux alc880_lg_lw_capture_source
= {
2958 { "Internal Mic", 0x1 },
2963 #define alc880_lg_lw_modes alc880_threestack_modes
2965 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
2966 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2967 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2968 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2969 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2970 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2971 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2972 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2973 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2974 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2975 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2976 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2978 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
2979 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
2981 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2982 .name
= "Channel Mode",
2983 .info
= alc_ch_mode_info
,
2984 .get
= alc_ch_mode_get
,
2985 .put
= alc_ch_mode_put
,
2990 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
2991 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2992 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2993 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2995 /* set capture source to mic-in */
2996 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2997 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2998 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2999 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3001 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3002 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3004 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3005 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3006 /* mic-in to input */
3007 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3008 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3010 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3011 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3013 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3017 /* toggle speaker-output according to the hp-jack state */
3018 static void alc880_lg_lw_init_hook(struct hda_codec
*codec
)
3020 struct alc_spec
*spec
= codec
->spec
;
3022 spec
->autocfg
.hp_pins
[0] = 0x1b;
3023 spec
->autocfg
.speaker_pins
[0] = 0x14;
3024 alc_automute_amp(codec
);
3027 static struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
3028 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3029 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
3030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3031 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3032 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3033 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3037 static struct hda_input_mux alc880_medion_rim_capture_source
= {
3041 { "Internal Mic", 0x1 },
3045 static struct hda_verb alc880_medion_rim_init_verbs
[] = {
3046 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3051 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3052 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3053 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3054 /* Mic2 (as headphone out) for HP output */
3055 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3056 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3057 /* Internal Speaker */
3058 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3059 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3061 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3062 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3064 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3068 /* toggle speaker-output according to the hp-jack state */
3069 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
3071 struct alc_spec
*spec
= codec
->spec
;
3072 alc_automute_amp(codec
);
3074 if (spec
->jack_present
)
3075 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
3077 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
3080 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
3083 /* Looks like the unsol event is incompatible with the standard
3084 * definition. 4bit tag is placed at 28 bit!
3086 if ((res
>> 28) == ALC880_HP_EVENT
)
3087 alc880_medion_rim_automute(codec
);
3090 static void alc880_medion_rim_init_hook(struct hda_codec
*codec
)
3092 struct alc_spec
*spec
= codec
->spec
;
3094 spec
->autocfg
.hp_pins
[0] = 0x14;
3095 spec
->autocfg
.speaker_pins
[0] = 0x1b;
3096 alc880_medion_rim_automute(codec
);
3099 #ifdef CONFIG_SND_HDA_POWER_SAVE
3100 static struct hda_amp_list alc880_loopbacks
[] = {
3101 { 0x0b, HDA_INPUT
, 0 },
3102 { 0x0b, HDA_INPUT
, 1 },
3103 { 0x0b, HDA_INPUT
, 2 },
3104 { 0x0b, HDA_INPUT
, 3 },
3105 { 0x0b, HDA_INPUT
, 4 },
3109 static struct hda_amp_list alc880_lg_loopbacks
[] = {
3110 { 0x0b, HDA_INPUT
, 1 },
3111 { 0x0b, HDA_INPUT
, 6 },
3112 { 0x0b, HDA_INPUT
, 7 },
3121 static int alc_init(struct hda_codec
*codec
)
3123 struct alc_spec
*spec
= codec
->spec
;
3127 alc_auto_init_amp(codec
, spec
->init_amp
);
3129 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
3130 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
3132 if (spec
->init_hook
)
3133 spec
->init_hook(codec
);
3138 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
3140 struct alc_spec
*spec
= codec
->spec
;
3142 if (spec
->unsol_event
)
3143 spec
->unsol_event(codec
, res
);
3146 #ifdef CONFIG_SND_HDA_POWER_SAVE
3147 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
3149 struct alc_spec
*spec
= codec
->spec
;
3150 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
3155 * Analog playback callbacks
3157 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3158 struct hda_codec
*codec
,
3159 struct snd_pcm_substream
*substream
)
3161 struct alc_spec
*spec
= codec
->spec
;
3162 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
3166 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3167 struct hda_codec
*codec
,
3168 unsigned int stream_tag
,
3169 unsigned int format
,
3170 struct snd_pcm_substream
*substream
)
3172 struct alc_spec
*spec
= codec
->spec
;
3173 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
3174 stream_tag
, format
, substream
);
3177 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3178 struct hda_codec
*codec
,
3179 struct snd_pcm_substream
*substream
)
3181 struct alc_spec
*spec
= codec
->spec
;
3182 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
3188 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3189 struct hda_codec
*codec
,
3190 struct snd_pcm_substream
*substream
)
3192 struct alc_spec
*spec
= codec
->spec
;
3193 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
3196 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3197 struct hda_codec
*codec
,
3198 unsigned int stream_tag
,
3199 unsigned int format
,
3200 struct snd_pcm_substream
*substream
)
3202 struct alc_spec
*spec
= codec
->spec
;
3203 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
3204 stream_tag
, format
, substream
);
3207 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3208 struct hda_codec
*codec
,
3209 struct snd_pcm_substream
*substream
)
3211 struct alc_spec
*spec
= codec
->spec
;
3212 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
3215 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
3216 struct hda_codec
*codec
,
3217 struct snd_pcm_substream
*substream
)
3219 struct alc_spec
*spec
= codec
->spec
;
3220 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
3226 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3227 struct hda_codec
*codec
,
3228 unsigned int stream_tag
,
3229 unsigned int format
,
3230 struct snd_pcm_substream
*substream
)
3232 struct alc_spec
*spec
= codec
->spec
;
3234 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
3235 stream_tag
, 0, format
);
3239 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3240 struct hda_codec
*codec
,
3241 struct snd_pcm_substream
*substream
)
3243 struct alc_spec
*spec
= codec
->spec
;
3245 snd_hda_codec_cleanup_stream(codec
,
3246 spec
->adc_nids
[substream
->number
+ 1]);
3253 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
3257 /* NID is set in alc_build_pcms */
3259 .open
= alc880_playback_pcm_open
,
3260 .prepare
= alc880_playback_pcm_prepare
,
3261 .cleanup
= alc880_playback_pcm_cleanup
3265 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
3269 /* NID is set in alc_build_pcms */
3272 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
3276 /* NID is set in alc_build_pcms */
3279 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
3280 .substreams
= 2, /* can be overridden */
3283 /* NID is set in alc_build_pcms */
3285 .prepare
= alc880_alt_capture_pcm_prepare
,
3286 .cleanup
= alc880_alt_capture_pcm_cleanup
3290 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
3294 /* NID is set in alc_build_pcms */
3296 .open
= alc880_dig_playback_pcm_open
,
3297 .close
= alc880_dig_playback_pcm_close
,
3298 .prepare
= alc880_dig_playback_pcm_prepare
,
3299 .cleanup
= alc880_dig_playback_pcm_cleanup
3303 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
3307 /* NID is set in alc_build_pcms */
3310 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3311 static struct hda_pcm_stream alc_pcm_null_stream
= {
3317 static int alc_build_pcms(struct hda_codec
*codec
)
3319 struct alc_spec
*spec
= codec
->spec
;
3320 struct hda_pcm
*info
= spec
->pcm_rec
;
3323 codec
->num_pcms
= 1;
3324 codec
->pcm_info
= info
;
3326 if (spec
->no_analog
)
3329 snprintf(spec
->stream_name_analog
, sizeof(spec
->stream_name_analog
),
3330 "%s Analog", codec
->chip_name
);
3331 info
->name
= spec
->stream_name_analog
;
3333 if (spec
->stream_analog_playback
) {
3334 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
3336 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
3337 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
3339 if (spec
->stream_analog_capture
) {
3340 if (snd_BUG_ON(!spec
->adc_nids
))
3342 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
3343 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
3346 if (spec
->channel_mode
) {
3347 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
3348 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
3349 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
3350 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
3356 /* SPDIF for stream index #1 */
3357 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
3358 snprintf(spec
->stream_name_digital
,
3359 sizeof(spec
->stream_name_digital
),
3360 "%s Digital", codec
->chip_name
);
3361 codec
->num_pcms
= 2;
3362 codec
->slave_dig_outs
= spec
->multiout
.slave_dig_outs
;
3363 info
= spec
->pcm_rec
+ 1;
3364 info
->name
= spec
->stream_name_digital
;
3365 if (spec
->dig_out_type
)
3366 info
->pcm_type
= spec
->dig_out_type
;
3368 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
3369 if (spec
->multiout
.dig_out_nid
&&
3370 spec
->stream_digital_playback
) {
3371 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
3372 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
3374 if (spec
->dig_in_nid
&&
3375 spec
->stream_digital_capture
) {
3376 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
3377 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
3379 /* FIXME: do we need this for all Realtek codec models? */
3380 codec
->spdif_status_reset
= 1;
3383 if (spec
->no_analog
)
3386 /* If the use of more than one ADC is requested for the current
3387 * model, configure a second analog capture-only PCM.
3389 /* Additional Analaog capture for index #2 */
3390 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
3391 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
3392 codec
->num_pcms
= 3;
3393 info
= spec
->pcm_rec
+ 2;
3394 info
->name
= spec
->stream_name_analog
;
3395 if (spec
->alt_dac_nid
) {
3396 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
3397 *spec
->stream_analog_alt_playback
;
3398 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
3401 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
3402 alc_pcm_null_stream
;
3403 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
3405 if (spec
->num_adc_nids
> 1) {
3406 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
3407 *spec
->stream_analog_alt_capture
;
3408 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
3410 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
3411 spec
->num_adc_nids
- 1;
3413 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
3414 alc_pcm_null_stream
;
3415 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
3422 static void alc_free_kctls(struct hda_codec
*codec
)
3424 struct alc_spec
*spec
= codec
->spec
;
3426 if (spec
->kctls
.list
) {
3427 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
3429 for (i
= 0; i
< spec
->kctls
.used
; i
++)
3430 kfree(kctl
[i
].name
);
3432 snd_array_free(&spec
->kctls
);
3435 static void alc_free(struct hda_codec
*codec
)
3437 struct alc_spec
*spec
= codec
->spec
;
3442 alc_free_kctls(codec
);
3444 snd_hda_detach_beep_device(codec
);
3447 #ifdef SND_HDA_NEEDS_RESUME
3448 static int alc_resume(struct hda_codec
*codec
)
3450 codec
->patch_ops
.init(codec
);
3451 snd_hda_codec_resume_amp(codec
);
3452 snd_hda_codec_resume_cache(codec
);
3459 static struct hda_codec_ops alc_patch_ops
= {
3460 .build_controls
= alc_build_controls
,
3461 .build_pcms
= alc_build_pcms
,
3464 .unsol_event
= alc_unsol_event
,
3465 #ifdef SND_HDA_NEEDS_RESUME
3466 .resume
= alc_resume
,
3468 #ifdef CONFIG_SND_HDA_POWER_SAVE
3469 .check_power_status
= alc_check_power_status
,
3475 * Test configuration for debugging
3477 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3480 #ifdef CONFIG_SND_DEBUG
3481 static hda_nid_t alc880_test_dac_nids
[4] = {
3482 0x02, 0x03, 0x04, 0x05
3485 static struct hda_input_mux alc880_test_capture_source
= {
3494 { "Surround", 0x6 },
3498 static struct hda_channel_mode alc880_test_modes
[4] = {
3505 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
3506 struct snd_ctl_elem_info
*uinfo
)
3508 static char *texts
[] = {
3509 "N/A", "Line Out", "HP Out",
3510 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3512 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
3514 uinfo
->value
.enumerated
.items
= 8;
3515 if (uinfo
->value
.enumerated
.item
>= 8)
3516 uinfo
->value
.enumerated
.item
= 7;
3517 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
3521 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
3522 struct snd_ctl_elem_value
*ucontrol
)
3524 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3525 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3526 unsigned int pin_ctl
, item
= 0;
3528 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
3529 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3530 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
3531 if (pin_ctl
& AC_PINCTL_HP_EN
)
3535 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
3536 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
3537 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
3538 case AC_PINCTL_VREF_50
: item
= 4; break;
3539 case AC_PINCTL_VREF_GRD
: item
= 5; break;
3540 case AC_PINCTL_VREF_80
: item
= 6; break;
3541 case AC_PINCTL_VREF_100
: item
= 7; break;
3544 ucontrol
->value
.enumerated
.item
[0] = item
;
3548 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
3549 struct snd_ctl_elem_value
*ucontrol
)
3551 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3552 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3553 static unsigned int ctls
[] = {
3554 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
3555 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
3556 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
3557 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
3558 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
3559 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
3561 unsigned int old_ctl
, new_ctl
;
3563 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
3564 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3565 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
3566 if (old_ctl
!= new_ctl
) {
3568 snd_hda_codec_write_cache(codec
, nid
, 0,
3569 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3571 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
3573 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
3580 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
3581 struct snd_ctl_elem_info
*uinfo
)
3583 static char *texts
[] = {
3584 "Front", "Surround", "CLFE", "Side"
3586 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
3588 uinfo
->value
.enumerated
.items
= 4;
3589 if (uinfo
->value
.enumerated
.item
>= 4)
3590 uinfo
->value
.enumerated
.item
= 3;
3591 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
3595 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
3596 struct snd_ctl_elem_value
*ucontrol
)
3598 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3599 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3602 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
3603 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
3607 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
3608 struct snd_ctl_elem_value
*ucontrol
)
3610 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3611 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3614 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
3615 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
3616 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
3617 snd_hda_codec_write_cache(codec
, nid
, 0,
3618 AC_VERB_SET_CONNECT_SEL
, sel
);
3624 #define PIN_CTL_TEST(xname,nid) { \
3625 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3627 .info = alc_test_pin_ctl_info, \
3628 .get = alc_test_pin_ctl_get, \
3629 .put = alc_test_pin_ctl_put, \
3630 .private_value = nid \
3633 #define PIN_SRC_TEST(xname,nid) { \
3634 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3636 .info = alc_test_pin_src_info, \
3637 .get = alc_test_pin_src_get, \
3638 .put = alc_test_pin_src_put, \
3639 .private_value = nid \
3642 static struct snd_kcontrol_new alc880_test_mixer
[] = {
3643 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3644 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3645 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
3646 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3647 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3648 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
3649 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
3650 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
3651 PIN_CTL_TEST("Front Pin Mode", 0x14),
3652 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3653 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3654 PIN_CTL_TEST("Side Pin Mode", 0x17),
3655 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3656 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3657 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3658 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3659 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3660 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3661 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3662 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3663 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3664 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3665 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3666 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3667 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
3668 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
3669 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
3670 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
3671 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
3672 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
3674 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3675 .name
= "Channel Mode",
3676 .info
= alc_ch_mode_info
,
3677 .get
= alc_ch_mode_get
,
3678 .put
= alc_ch_mode_put
,
3683 static struct hda_verb alc880_test_init_verbs
[] = {
3684 /* Unmute inputs of 0x0c - 0x0f */
3685 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3687 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3688 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3689 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3690 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3691 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3692 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3693 /* Vol output for 0x0c-0x0f */
3694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3695 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3696 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3697 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3698 /* Set output pins 0x14-0x17 */
3699 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3701 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3702 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3703 /* Unmute output pins 0x14-0x17 */
3704 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3705 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3706 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3707 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3708 /* Set input pins 0x18-0x1c */
3709 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3710 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3711 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3712 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3713 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3714 /* Mute input pins 0x18-0x1b */
3715 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3716 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3717 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3718 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3721 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
3722 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3723 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
3724 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3725 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
3726 /* Analog input/passthru */
3727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3739 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
3740 [ALC880_3ST
] = "3stack",
3741 [ALC880_TCL_S700
] = "tcl",
3742 [ALC880_3ST_DIG
] = "3stack-digout",
3743 [ALC880_CLEVO
] = "clevo",
3744 [ALC880_5ST
] = "5stack",
3745 [ALC880_5ST_DIG
] = "5stack-digout",
3746 [ALC880_W810
] = "w810",
3747 [ALC880_Z71V
] = "z71v",
3748 [ALC880_6ST
] = "6stack",
3749 [ALC880_6ST_DIG
] = "6stack-digout",
3750 [ALC880_ASUS
] = "asus",
3751 [ALC880_ASUS_W1V
] = "asus-w1v",
3752 [ALC880_ASUS_DIG
] = "asus-dig",
3753 [ALC880_ASUS_DIG2
] = "asus-dig2",
3754 [ALC880_UNIWILL_DIG
] = "uniwill",
3755 [ALC880_UNIWILL_P53
] = "uniwill-p53",
3756 [ALC880_FUJITSU
] = "fujitsu",
3757 [ALC880_F1734
] = "F1734",
3759 [ALC880_LG_LW
] = "lg-lw",
3760 [ALC880_MEDION_RIM
] = "medion",
3761 #ifdef CONFIG_SND_DEBUG
3762 [ALC880_TEST
] = "test",
3764 [ALC880_AUTO
] = "auto",
3767 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
3768 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
3769 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
3770 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
3771 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
3772 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
3773 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
3774 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
3775 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
3776 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
3777 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
3778 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
3779 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
3780 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
3781 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
3782 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
3783 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
3784 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
3785 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
3786 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3787 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
3788 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
3789 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
3790 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
3791 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
3792 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
3793 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS
), /* default ASUS */
3794 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
3795 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
3796 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
3797 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
3798 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
3799 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
3800 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
3801 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
3802 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
3803 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
3804 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
3805 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
3806 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
3807 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
3808 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
3809 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
3810 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
3811 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
3812 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
3813 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
3814 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
3815 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
3816 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
3817 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
3818 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
3819 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
3820 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
3821 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
3822 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
3823 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
3824 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
3825 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
3826 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
3827 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
3828 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
3829 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
3830 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
3831 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
3832 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
3833 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
3834 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
3835 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
3837 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST
),
3838 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
3839 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
3844 * ALC880 codec presets
3846 static struct alc_config_preset alc880_presets
[] = {
3848 .mixers
= { alc880_three_stack_mixer
},
3849 .init_verbs
= { alc880_volume_init_verbs
,
3850 alc880_pin_3stack_init_verbs
},
3851 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3852 .dac_nids
= alc880_dac_nids
,
3853 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3854 .channel_mode
= alc880_threestack_modes
,
3856 .input_mux
= &alc880_capture_source
,
3858 [ALC880_3ST_DIG
] = {
3859 .mixers
= { alc880_three_stack_mixer
},
3860 .init_verbs
= { alc880_volume_init_verbs
,
3861 alc880_pin_3stack_init_verbs
},
3862 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3863 .dac_nids
= alc880_dac_nids
,
3864 .dig_out_nid
= ALC880_DIGOUT_NID
,
3865 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3866 .channel_mode
= alc880_threestack_modes
,
3868 .input_mux
= &alc880_capture_source
,
3870 [ALC880_TCL_S700
] = {
3871 .mixers
= { alc880_tcl_s700_mixer
},
3872 .init_verbs
= { alc880_volume_init_verbs
,
3873 alc880_pin_tcl_S700_init_verbs
,
3874 alc880_gpio2_init_verbs
},
3875 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3876 .dac_nids
= alc880_dac_nids
,
3877 .adc_nids
= alc880_adc_nids_alt
, /* FIXME: correct? */
3878 .num_adc_nids
= 1, /* single ADC */
3880 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3881 .channel_mode
= alc880_2_jack_modes
,
3882 .input_mux
= &alc880_capture_source
,
3885 .mixers
= { alc880_three_stack_mixer
,
3886 alc880_five_stack_mixer
},
3887 .init_verbs
= { alc880_volume_init_verbs
,
3888 alc880_pin_5stack_init_verbs
},
3889 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3890 .dac_nids
= alc880_dac_nids
,
3891 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3892 .channel_mode
= alc880_fivestack_modes
,
3893 .input_mux
= &alc880_capture_source
,
3895 [ALC880_5ST_DIG
] = {
3896 .mixers
= { alc880_three_stack_mixer
,
3897 alc880_five_stack_mixer
},
3898 .init_verbs
= { alc880_volume_init_verbs
,
3899 alc880_pin_5stack_init_verbs
},
3900 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3901 .dac_nids
= alc880_dac_nids
,
3902 .dig_out_nid
= ALC880_DIGOUT_NID
,
3903 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3904 .channel_mode
= alc880_fivestack_modes
,
3905 .input_mux
= &alc880_capture_source
,
3908 .mixers
= { alc880_six_stack_mixer
},
3909 .init_verbs
= { alc880_volume_init_verbs
,
3910 alc880_pin_6stack_init_verbs
},
3911 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3912 .dac_nids
= alc880_6st_dac_nids
,
3913 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3914 .channel_mode
= alc880_sixstack_modes
,
3915 .input_mux
= &alc880_6stack_capture_source
,
3917 [ALC880_6ST_DIG
] = {
3918 .mixers
= { alc880_six_stack_mixer
},
3919 .init_verbs
= { alc880_volume_init_verbs
,
3920 alc880_pin_6stack_init_verbs
},
3921 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3922 .dac_nids
= alc880_6st_dac_nids
,
3923 .dig_out_nid
= ALC880_DIGOUT_NID
,
3924 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3925 .channel_mode
= alc880_sixstack_modes
,
3926 .input_mux
= &alc880_6stack_capture_source
,
3929 .mixers
= { alc880_w810_base_mixer
},
3930 .init_verbs
= { alc880_volume_init_verbs
,
3931 alc880_pin_w810_init_verbs
,
3932 alc880_gpio2_init_verbs
},
3933 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
3934 .dac_nids
= alc880_w810_dac_nids
,
3935 .dig_out_nid
= ALC880_DIGOUT_NID
,
3936 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3937 .channel_mode
= alc880_w810_modes
,
3938 .input_mux
= &alc880_capture_source
,
3941 .mixers
= { alc880_z71v_mixer
},
3942 .init_verbs
= { alc880_volume_init_verbs
,
3943 alc880_pin_z71v_init_verbs
},
3944 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
3945 .dac_nids
= alc880_z71v_dac_nids
,
3946 .dig_out_nid
= ALC880_DIGOUT_NID
,
3948 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3949 .channel_mode
= alc880_2_jack_modes
,
3950 .input_mux
= &alc880_capture_source
,
3953 .mixers
= { alc880_f1734_mixer
},
3954 .init_verbs
= { alc880_volume_init_verbs
,
3955 alc880_pin_f1734_init_verbs
},
3956 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
3957 .dac_nids
= alc880_f1734_dac_nids
,
3959 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3960 .channel_mode
= alc880_2_jack_modes
,
3961 .input_mux
= &alc880_f1734_capture_source
,
3962 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3963 .init_hook
= alc880_uniwill_p53_init_hook
,
3966 .mixers
= { alc880_asus_mixer
},
3967 .init_verbs
= { alc880_volume_init_verbs
,
3968 alc880_pin_asus_init_verbs
,
3969 alc880_gpio1_init_verbs
},
3970 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3971 .dac_nids
= alc880_asus_dac_nids
,
3972 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3973 .channel_mode
= alc880_asus_modes
,
3975 .input_mux
= &alc880_capture_source
,
3977 [ALC880_ASUS_DIG
] = {
3978 .mixers
= { alc880_asus_mixer
},
3979 .init_verbs
= { alc880_volume_init_verbs
,
3980 alc880_pin_asus_init_verbs
,
3981 alc880_gpio1_init_verbs
},
3982 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3983 .dac_nids
= alc880_asus_dac_nids
,
3984 .dig_out_nid
= ALC880_DIGOUT_NID
,
3985 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3986 .channel_mode
= alc880_asus_modes
,
3988 .input_mux
= &alc880_capture_source
,
3990 [ALC880_ASUS_DIG2
] = {
3991 .mixers
= { alc880_asus_mixer
},
3992 .init_verbs
= { alc880_volume_init_verbs
,
3993 alc880_pin_asus_init_verbs
,
3994 alc880_gpio2_init_verbs
}, /* use GPIO2 */
3995 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3996 .dac_nids
= alc880_asus_dac_nids
,
3997 .dig_out_nid
= ALC880_DIGOUT_NID
,
3998 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3999 .channel_mode
= alc880_asus_modes
,
4001 .input_mux
= &alc880_capture_source
,
4003 [ALC880_ASUS_W1V
] = {
4004 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
4005 .init_verbs
= { alc880_volume_init_verbs
,
4006 alc880_pin_asus_init_verbs
,
4007 alc880_gpio1_init_verbs
},
4008 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4009 .dac_nids
= alc880_asus_dac_nids
,
4010 .dig_out_nid
= ALC880_DIGOUT_NID
,
4011 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4012 .channel_mode
= alc880_asus_modes
,
4014 .input_mux
= &alc880_capture_source
,
4016 [ALC880_UNIWILL_DIG
] = {
4017 .mixers
= { alc880_asus_mixer
},
4018 .init_verbs
= { alc880_volume_init_verbs
,
4019 alc880_pin_asus_init_verbs
},
4020 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4021 .dac_nids
= alc880_asus_dac_nids
,
4022 .dig_out_nid
= ALC880_DIGOUT_NID
,
4023 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4024 .channel_mode
= alc880_asus_modes
,
4026 .input_mux
= &alc880_capture_source
,
4028 [ALC880_UNIWILL
] = {
4029 .mixers
= { alc880_uniwill_mixer
},
4030 .init_verbs
= { alc880_volume_init_verbs
,
4031 alc880_uniwill_init_verbs
},
4032 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4033 .dac_nids
= alc880_asus_dac_nids
,
4034 .dig_out_nid
= ALC880_DIGOUT_NID
,
4035 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4036 .channel_mode
= alc880_threestack_modes
,
4038 .input_mux
= &alc880_capture_source
,
4039 .unsol_event
= alc880_uniwill_unsol_event
,
4040 .init_hook
= alc880_uniwill_init_hook
,
4042 [ALC880_UNIWILL_P53
] = {
4043 .mixers
= { alc880_uniwill_p53_mixer
},
4044 .init_verbs
= { alc880_volume_init_verbs
,
4045 alc880_uniwill_p53_init_verbs
},
4046 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4047 .dac_nids
= alc880_asus_dac_nids
,
4048 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
4049 .channel_mode
= alc880_threestack_modes
,
4050 .input_mux
= &alc880_capture_source
,
4051 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4052 .init_hook
= alc880_uniwill_p53_init_hook
,
4054 [ALC880_FUJITSU
] = {
4055 .mixers
= { alc880_fujitsu_mixer
},
4056 .init_verbs
= { alc880_volume_init_verbs
,
4057 alc880_uniwill_p53_init_verbs
,
4058 alc880_beep_init_verbs
},
4059 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4060 .dac_nids
= alc880_dac_nids
,
4061 .dig_out_nid
= ALC880_DIGOUT_NID
,
4062 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4063 .channel_mode
= alc880_2_jack_modes
,
4064 .input_mux
= &alc880_capture_source
,
4065 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4066 .init_hook
= alc880_uniwill_p53_init_hook
,
4069 .mixers
= { alc880_three_stack_mixer
},
4070 .init_verbs
= { alc880_volume_init_verbs
,
4071 alc880_pin_clevo_init_verbs
},
4072 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4073 .dac_nids
= alc880_dac_nids
,
4075 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4076 .channel_mode
= alc880_threestack_modes
,
4078 .input_mux
= &alc880_capture_source
,
4081 .mixers
= { alc880_lg_mixer
},
4082 .init_verbs
= { alc880_volume_init_verbs
,
4083 alc880_lg_init_verbs
},
4084 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
4085 .dac_nids
= alc880_lg_dac_nids
,
4086 .dig_out_nid
= ALC880_DIGOUT_NID
,
4087 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
4088 .channel_mode
= alc880_lg_ch_modes
,
4090 .input_mux
= &alc880_lg_capture_source
,
4091 .unsol_event
= alc_automute_amp_unsol_event
,
4092 .init_hook
= alc880_lg_init_hook
,
4093 #ifdef CONFIG_SND_HDA_POWER_SAVE
4094 .loopbacks
= alc880_lg_loopbacks
,
4098 .mixers
= { alc880_lg_lw_mixer
},
4099 .init_verbs
= { alc880_volume_init_verbs
,
4100 alc880_lg_lw_init_verbs
},
4101 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4102 .dac_nids
= alc880_dac_nids
,
4103 .dig_out_nid
= ALC880_DIGOUT_NID
,
4104 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
4105 .channel_mode
= alc880_lg_lw_modes
,
4106 .input_mux
= &alc880_lg_lw_capture_source
,
4107 .unsol_event
= alc_automute_amp_unsol_event
,
4108 .init_hook
= alc880_lg_lw_init_hook
,
4110 [ALC880_MEDION_RIM
] = {
4111 .mixers
= { alc880_medion_rim_mixer
},
4112 .init_verbs
= { alc880_volume_init_verbs
,
4113 alc880_medion_rim_init_verbs
,
4114 alc_gpio2_init_verbs
},
4115 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4116 .dac_nids
= alc880_dac_nids
,
4117 .dig_out_nid
= ALC880_DIGOUT_NID
,
4118 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4119 .channel_mode
= alc880_2_jack_modes
,
4120 .input_mux
= &alc880_medion_rim_capture_source
,
4121 .unsol_event
= alc880_medion_rim_unsol_event
,
4122 .init_hook
= alc880_medion_rim_init_hook
,
4124 #ifdef CONFIG_SND_DEBUG
4126 .mixers
= { alc880_test_mixer
},
4127 .init_verbs
= { alc880_test_init_verbs
},
4128 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
4129 .dac_nids
= alc880_test_dac_nids
,
4130 .dig_out_nid
= ALC880_DIGOUT_NID
,
4131 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
4132 .channel_mode
= alc880_test_modes
,
4133 .input_mux
= &alc880_test_capture_source
,
4139 * Automatic parse of I/O pins from the BIOS configuration
4144 ALC_CTL_WIDGET_MUTE
,
4147 static struct snd_kcontrol_new alc880_control_templates
[] = {
4148 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
4149 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
4150 HDA_BIND_MUTE(NULL
, 0, 0, 0),
4153 /* add dynamic controls */
4154 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
4157 struct snd_kcontrol_new
*knew
;
4159 snd_array_init(&spec
->kctls
, sizeof(*knew
), 32);
4160 knew
= snd_array_new(&spec
->kctls
);
4163 *knew
= alc880_control_templates
[type
];
4164 knew
->name
= kstrdup(name
, GFP_KERNEL
);
4167 knew
->private_value
= val
;
4171 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4172 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4173 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4174 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4175 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4176 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4177 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4178 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4179 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4180 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4181 #define ALC880_PIN_CD_NID 0x1c
4183 /* fill in the dac_nids table from the parsed pin configuration */
4184 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
4185 const struct auto_pin_cfg
*cfg
)
4191 memset(assigned
, 0, sizeof(assigned
));
4192 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
4194 /* check the pins hardwired to audio widget */
4195 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4196 nid
= cfg
->line_out_pins
[i
];
4197 if (alc880_is_fixed_pin(nid
)) {
4198 int idx
= alc880_fixed_pin_idx(nid
);
4199 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
4203 /* left pins can be connect to any audio widget */
4204 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4205 nid
= cfg
->line_out_pins
[i
];
4206 if (alc880_is_fixed_pin(nid
))
4208 /* search for an empty channel */
4209 for (j
= 0; j
< cfg
->line_outs
; j
++) {
4211 spec
->multiout
.dac_nids
[i
] =
4212 alc880_idx_to_dac(j
);
4218 spec
->multiout
.num_dacs
= cfg
->line_outs
;
4222 /* add playback controls from the parsed DAC table */
4223 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
4224 const struct auto_pin_cfg
*cfg
)
4227 static const char *chname
[4] = {
4228 "Front", "Surround", NULL
/*CLFE*/, "Side"
4233 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4234 if (!spec
->multiout
.dac_nids
[i
])
4236 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
4239 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
4240 "Center Playback Volume",
4241 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
4245 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
4246 "LFE Playback Volume",
4247 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
4251 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
4252 "Center Playback Switch",
4253 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
4257 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
4258 "LFE Playback Switch",
4259 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
4264 sprintf(name
, "%s Playback Volume", chname
[i
]);
4265 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
4266 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
4270 sprintf(name
, "%s Playback Switch", chname
[i
]);
4271 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
4272 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
4281 /* add playback controls for speaker and HP outputs */
4282 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
4292 if (alc880_is_fixed_pin(pin
)) {
4293 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
4294 /* specify the DAC as the extra output */
4295 if (!spec
->multiout
.hp_nid
)
4296 spec
->multiout
.hp_nid
= nid
;
4298 spec
->multiout
.extra_out_nid
[0] = nid
;
4299 /* control HP volume/switch on the output mixer amp */
4300 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
4301 sprintf(name
, "%s Playback Volume", pfx
);
4302 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
4303 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
4306 sprintf(name
, "%s Playback Switch", pfx
);
4307 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
4308 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
4311 } else if (alc880_is_multi_pin(pin
)) {
4312 /* set manual connection */
4313 /* we have only a switch on HP-out PIN */
4314 sprintf(name
, "%s Playback Switch", pfx
);
4315 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
4316 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
4323 /* create input playback/capture controls for the given pin */
4324 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
4325 const char *ctlname
,
4326 int idx
, hda_nid_t mix_nid
)
4331 sprintf(name
, "%s Playback Volume", ctlname
);
4332 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
4333 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
4336 sprintf(name
, "%s Playback Switch", ctlname
);
4337 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
4338 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
4344 /* create playback/capture controls for input pins */
4345 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
4346 const struct auto_pin_cfg
*cfg
)
4348 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
4351 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4352 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
4353 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
4354 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4355 auto_pin_cfg_labels
[i
],
4359 imux
->items
[imux
->num_items
].label
=
4360 auto_pin_cfg_labels
[i
];
4361 imux
->items
[imux
->num_items
].index
=
4362 alc880_input_pin_idx(cfg
->input_pins
[i
]);
4369 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
4370 unsigned int pin_type
)
4372 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4375 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4379 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
4380 hda_nid_t nid
, int pin_type
,
4383 alc_set_pin_output(codec
, nid
, pin_type
);
4384 /* need the manual connection? */
4385 if (alc880_is_multi_pin(nid
)) {
4386 struct alc_spec
*spec
= codec
->spec
;
4387 int idx
= alc880_multi_pin_idx(nid
);
4388 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
4389 AC_VERB_SET_CONNECT_SEL
,
4390 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
4394 static int get_pin_type(int line_out_type
)
4396 if (line_out_type
== AUTO_PIN_HP_OUT
)
4402 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
4404 struct alc_spec
*spec
= codec
->spec
;
4407 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
4408 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
4409 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
4410 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
4414 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
4416 struct alc_spec
*spec
= codec
->spec
;
4419 pin
= spec
->autocfg
.speaker_pins
[0];
4420 if (pin
) /* connect to front */
4421 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
4422 pin
= spec
->autocfg
.hp_pins
[0];
4423 if (pin
) /* connect to front */
4424 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
4427 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
4429 struct alc_spec
*spec
= codec
->spec
;
4432 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4433 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4434 if (alc880_is_input_pin(nid
)) {
4435 alc_set_input_pin(codec
, nid
, i
);
4436 if (nid
!= ALC880_PIN_CD_NID
&&
4437 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
4438 snd_hda_codec_write(codec
, nid
, 0,
4439 AC_VERB_SET_AMP_GAIN_MUTE
,
4445 /* parse the BIOS configuration and set up the alc_spec */
4446 /* return 1 if successful, 0 if the proper config is not found,
4447 * or a negative error code
4449 static int alc880_parse_auto_config(struct hda_codec
*codec
)
4451 struct alc_spec
*spec
= codec
->spec
;
4453 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
4455 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
4459 if (!spec
->autocfg
.line_outs
)
4460 return 0; /* can't find valid BIOS pin config */
4462 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
4465 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
4468 err
= alc880_auto_create_extra_out(spec
,
4469 spec
->autocfg
.speaker_pins
[0],
4473 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
4477 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
4481 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
4483 /* check multiple SPDIF-out (for recent codecs) */
4484 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
4486 err
= snd_hda_get_connections(codec
,
4487 spec
->autocfg
.dig_out_pins
[i
],
4492 spec
->multiout
.dig_out_nid
= dig_nid
;
4494 spec
->multiout
.slave_dig_outs
= spec
->slave_dig_outs
;
4495 spec
->slave_dig_outs
[i
- 1] = dig_nid
;
4496 if (i
== ARRAY_SIZE(spec
->slave_dig_outs
) - 1)
4500 if (spec
->autocfg
.dig_in_pin
)
4501 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
4503 if (spec
->kctls
.list
)
4504 add_mixer(spec
, spec
->kctls
.list
);
4506 add_verb(spec
, alc880_volume_init_verbs
);
4508 spec
->num_mux_defs
= 1;
4509 spec
->input_mux
= &spec
->private_imux
[0];
4511 alc_ssid_check(codec
, 0x15, 0x1b, 0x14);
4516 /* additional initialization for auto-configuration model */
4517 static void alc880_auto_init(struct hda_codec
*codec
)
4519 struct alc_spec
*spec
= codec
->spec
;
4520 alc880_auto_init_multi_out(codec
);
4521 alc880_auto_init_extra_out(codec
);
4522 alc880_auto_init_analog_input(codec
);
4523 if (spec
->unsol_event
)
4524 alc_inithook(codec
);
4527 static void set_capture_mixer(struct alc_spec
*spec
)
4529 static struct snd_kcontrol_new
*caps
[2][3] = {
4530 { alc_capture_mixer_nosrc1
,
4531 alc_capture_mixer_nosrc2
,
4532 alc_capture_mixer_nosrc3
},
4533 { alc_capture_mixer1
,
4535 alc_capture_mixer3
},
4537 if (spec
->num_adc_nids
> 0 && spec
->num_adc_nids
<= 3) {
4539 if (spec
->input_mux
&& spec
->input_mux
->num_items
> 1)
4543 spec
->cap_mixer
= caps
[mux
][spec
->num_adc_nids
- 1];
4547 #define set_beep_amp(spec, nid, idx, dir) \
4548 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4551 * OK, here we have finally the patch for ALC880
4554 static int patch_alc880(struct hda_codec
*codec
)
4556 struct alc_spec
*spec
;
4560 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4566 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
4569 if (board_config
< 0) {
4570 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
4571 "trying auto-probe from BIOS...\n", codec
->chip_name
);
4572 board_config
= ALC880_AUTO
;
4575 if (board_config
== ALC880_AUTO
) {
4576 /* automatic parse from the BIOS config */
4577 err
= alc880_parse_auto_config(codec
);
4583 "hda_codec: Cannot set up configuration "
4584 "from BIOS. Using 3-stack mode...\n");
4585 board_config
= ALC880_3ST
;
4589 err
= snd_hda_attach_beep_device(codec
, 0x1);
4595 if (board_config
!= ALC880_AUTO
)
4596 setup_preset(spec
, &alc880_presets
[board_config
]);
4598 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
4599 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
4600 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
4602 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
4603 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
4605 if (!spec
->adc_nids
&& spec
->input_mux
) {
4606 /* check whether NID 0x07 is valid */
4607 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
4609 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
4610 if (wcap
!= AC_WID_AUD_IN
) {
4611 spec
->adc_nids
= alc880_adc_nids_alt
;
4612 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
4614 spec
->adc_nids
= alc880_adc_nids
;
4615 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
4618 set_capture_mixer(spec
);
4619 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
4621 spec
->vmaster_nid
= 0x0c;
4623 codec
->patch_ops
= alc_patch_ops
;
4624 if (board_config
== ALC880_AUTO
)
4625 spec
->init_hook
= alc880_auto_init
;
4626 #ifdef CONFIG_SND_HDA_POWER_SAVE
4627 if (!spec
->loopback
.amplist
)
4628 spec
->loopback
.amplist
= alc880_loopbacks
;
4630 codec
->proc_widget_hook
= print_realtek_coef
;
4640 static hda_nid_t alc260_dac_nids
[1] = {
4645 static hda_nid_t alc260_adc_nids
[1] = {
4650 static hda_nid_t alc260_adc_nids_alt
[1] = {
4655 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4656 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4658 static hda_nid_t alc260_dual_adc_nids
[2] = {
4663 #define ALC260_DIGOUT_NID 0x03
4664 #define ALC260_DIGIN_NID 0x06
4666 static struct hda_input_mux alc260_capture_source
= {
4670 { "Front Mic", 0x1 },
4676 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4677 * headphone jack and the internal CD lines since these are the only pins at
4678 * which audio can appear. For flexibility, also allow the option of
4679 * recording the mixer output on the second ADC (ADC0 doesn't have a
4680 * connection to the mixer output).
4682 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
4686 { "Mic/Line", 0x0 },
4688 { "Headphone", 0x2 },
4694 { "Mic/Line", 0x0 },
4696 { "Headphone", 0x2 },
4703 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4704 * the Fujitsu S702x, but jacks are marked differently.
4706 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
4713 { "Headphone", 0x5 },
4722 { "Headphone", 0x6 },
4728 /* Maxdata Favorit 100XS */
4729 static struct hda_input_mux alc260_favorit100_capture_sources
[2] = {
4733 { "Line/Mic", 0x0 },
4740 { "Line/Mic", 0x0 },
4748 * This is just place-holder, so there's something for alc_build_pcms to look
4749 * at when it calculates the maximum number of channels. ALC260 has no mixer
4750 * element which allows changing the channel mode, so the verb list is
4753 static struct hda_channel_mode alc260_modes
[1] = {
4758 /* Mixer combinations
4760 * basic: base_output + input + pc_beep + capture
4761 * HP: base_output + input + capture_alt
4762 * HP_3013: hp_3013 + input + capture
4763 * fujitsu: fujitsu + capture
4764 * acer: acer + capture
4767 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
4768 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4769 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4770 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4771 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4772 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4773 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4777 static struct snd_kcontrol_new alc260_input_mixer
[] = {
4778 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4779 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4780 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4781 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4783 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4784 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
4785 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
4789 /* update HP, line and mono out pins according to the master switch */
4790 static void alc260_hp_master_update(struct hda_codec
*codec
,
4791 hda_nid_t hp
, hda_nid_t line
,
4794 struct alc_spec
*spec
= codec
->spec
;
4795 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
4796 /* change HP and line-out pins */
4797 snd_hda_codec_write(codec
, hp
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4799 snd_hda_codec_write(codec
, line
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4801 /* mono (speaker) depending on the HP jack sense */
4802 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
4803 snd_hda_codec_write(codec
, mono
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4807 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
4808 struct snd_ctl_elem_value
*ucontrol
)
4810 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4811 struct alc_spec
*spec
= codec
->spec
;
4812 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
4816 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
4817 struct snd_ctl_elem_value
*ucontrol
)
4819 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4820 struct alc_spec
*spec
= codec
->spec
;
4821 int val
= !!*ucontrol
->value
.integer
.value
;
4822 hda_nid_t hp
, line
, mono
;
4824 if (val
== spec
->master_sw
)
4826 spec
->master_sw
= val
;
4827 hp
= (kcontrol
->private_value
>> 16) & 0xff;
4828 line
= (kcontrol
->private_value
>> 8) & 0xff;
4829 mono
= kcontrol
->private_value
& 0xff;
4830 alc260_hp_master_update(codec
, hp
, line
, mono
);
4834 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
4836 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4837 .name
= "Master Playback Switch",
4838 .info
= snd_ctl_boolean_mono_info
,
4839 .get
= alc260_hp_master_sw_get
,
4840 .put
= alc260_hp_master_sw_put
,
4841 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
4843 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4844 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4845 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4846 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4847 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4849 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4853 static struct hda_verb alc260_hp_unsol_verbs
[] = {
4854 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4858 static void alc260_hp_automute(struct hda_codec
*codec
)
4860 struct alc_spec
*spec
= codec
->spec
;
4861 unsigned int present
;
4863 present
= snd_hda_codec_read(codec
, 0x10, 0,
4864 AC_VERB_GET_PIN_SENSE
, 0);
4865 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4866 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
4869 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4871 if ((res
>> 26) == ALC880_HP_EVENT
)
4872 alc260_hp_automute(codec
);
4875 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
4877 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4878 .name
= "Master Playback Switch",
4879 .info
= snd_ctl_boolean_mono_info
,
4880 .get
= alc260_hp_master_sw_get
,
4881 .put
= alc260_hp_master_sw_put
,
4882 .private_value
= (0x15 << 16) | (0x10 << 8) | 0x11
4884 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4885 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4886 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
4887 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
4888 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
4890 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4891 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
4895 static struct hda_bind_ctls alc260_dc7600_bind_master_vol
= {
4896 .ops
= &snd_hda_bind_vol
,
4898 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT
),
4899 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
4900 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT
),
4905 static struct hda_bind_ctls alc260_dc7600_bind_switch
= {
4906 .ops
= &snd_hda_bind_sw
,
4908 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT
),
4909 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
4914 static struct snd_kcontrol_new alc260_hp_dc7600_mixer
[] = {
4915 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol
),
4916 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch
),
4917 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT
),
4918 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4922 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
4923 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4927 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
4929 struct alc_spec
*spec
= codec
->spec
;
4930 unsigned int present
;
4932 present
= snd_hda_codec_read(codec
, 0x15, 0,
4933 AC_VERB_GET_PIN_SENSE
, 0);
4934 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4935 alc260_hp_master_update(codec
, 0x15, 0x10, 0x11);
4938 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
4941 if ((res
>> 26) == ALC880_HP_EVENT
)
4942 alc260_hp_3013_automute(codec
);
4945 static void alc260_hp_3012_automute(struct hda_codec
*codec
)
4947 unsigned int present
, bits
;
4949 present
= snd_hda_codec_read(codec
, 0x10, 0,
4950 AC_VERB_GET_PIN_SENSE
, 0) & AC_PINSENSE_PRESENCE
;
4952 bits
= present
? 0 : PIN_OUT
;
4953 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4955 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4957 snd_hda_codec_write(codec
, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4961 static void alc260_hp_3012_unsol_event(struct hda_codec
*codec
,
4964 if ((res
>> 26) == ALC880_HP_EVENT
)
4965 alc260_hp_3012_automute(codec
);
4968 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4969 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4971 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
4972 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4973 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
4974 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4975 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4976 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4977 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
4978 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
4979 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4980 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4981 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
4985 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4986 * versions of the ALC260 don't act on requests to enable mic bias from NID
4987 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4988 * datasheet doesn't mention this restriction. At this stage it's not clear
4989 * whether this behaviour is intentional or is a hardware bug in chip
4990 * revisions available in early 2006. Therefore for now allow the
4991 * "Headphone Jack Mode" control to span all choices, but if it turns out
4992 * that the lack of mic bias for this NID is intentional we could change the
4993 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4995 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4996 * don't appear to make the mic bias available from the "line" jack, even
4997 * though the NID used for this jack (0x14) can supply it. The theory is
4998 * that perhaps Acer have included blocking capacitors between the ALC260
4999 * and the output jack. If this turns out to be the case for all such
5000 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5001 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5003 * The C20x Tablet series have a mono internal speaker which is controlled
5004 * via the chip's Mono sum widget and pin complex, so include the necessary
5005 * controls for such models. On models without a "mono speaker" the control
5006 * won't do anything.
5008 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
5009 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5010 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
5011 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
5012 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5014 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5016 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5017 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5019 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5020 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5021 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5022 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5023 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
5027 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5029 static struct snd_kcontrol_new alc260_favorit100_mixer
[] = {
5030 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5031 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
5032 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
5033 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5034 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5035 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5039 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5040 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5042 static struct snd_kcontrol_new alc260_will_mixer
[] = {
5043 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5044 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
5045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5046 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5047 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5048 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5049 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5050 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
5051 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5052 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5056 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5057 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5059 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
5060 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5061 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
5062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5063 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5064 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5065 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
5066 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
5067 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5068 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5069 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
5074 * initialization verbs
5076 static struct hda_verb alc260_init_verbs
[] = {
5077 /* Line In pin widget for input */
5078 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5079 /* CD pin widget for input */
5080 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5081 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5082 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5083 /* Mic2 (front panel) pin widget for input and vref at 80% */
5084 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5085 /* LINE-2 is used for line-out in rear */
5086 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5087 /* select line-out */
5088 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
5090 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5092 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5094 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5095 /* mute capture amp left and right */
5096 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5097 /* set connection select to line in (default select for this ADC) */
5098 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
5099 /* mute capture amp left and right */
5100 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5101 /* set connection select to line in (default select for this ADC) */
5102 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
5103 /* set vol=0 Line-Out mixer amp left and right */
5104 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5105 /* unmute pin widget amp left and right (no gain on this amp) */
5106 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5107 /* set vol=0 HP mixer amp left and right */
5108 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5109 /* unmute pin widget amp left and right (no gain on this amp) */
5110 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5111 /* set vol=0 Mono mixer amp left and right */
5112 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5113 /* unmute pin widget amp left and right (no gain on this amp) */
5114 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5115 /* unmute LINE-2 out pin */
5116 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5117 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5120 /* mute analog inputs */
5121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5122 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5123 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5124 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5125 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5126 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5127 /* mute Front out path */
5128 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5129 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5130 /* mute Headphone out path */
5131 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5132 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5133 /* mute Mono out path */
5134 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5135 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5139 #if 0 /* should be identical with alc260_init_verbs? */
5140 static struct hda_verb alc260_hp_init_verbs
[] = {
5141 /* Headphone and output */
5142 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5144 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5145 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5146 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5147 /* Mic2 (front panel) pin widget for input and vref at 80% */
5148 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5149 /* Line In pin widget for input */
5150 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5151 /* Line-2 pin widget for output */
5152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5153 /* CD pin widget for input */
5154 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5155 /* unmute amp left and right */
5156 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
5157 /* set connection select to line in (default select for this ADC) */
5158 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
5159 /* unmute Line-Out mixer amp left and right (volume = 0) */
5160 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5161 /* mute pin widget amp left and right (no gain on this amp) */
5162 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5163 /* unmute HP mixer amp left and right (volume = 0) */
5164 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5165 /* mute pin widget amp left and right (no gain on this amp) */
5166 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5167 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5170 /* mute analog inputs */
5171 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5172 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5173 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5174 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5175 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5176 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5177 /* Unmute Front out path */
5178 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5179 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5180 /* Unmute Headphone out path */
5181 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5182 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5183 /* Unmute Mono out path */
5184 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5185 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5190 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
5191 /* Line out and output */
5192 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5194 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5195 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5196 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5197 /* Mic2 (front panel) pin widget for input and vref at 80% */
5198 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5199 /* Line In pin widget for input */
5200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5201 /* Headphone pin widget for output */
5202 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5203 /* CD pin widget for input */
5204 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5205 /* unmute amp left and right */
5206 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
5207 /* set connection select to line in (default select for this ADC) */
5208 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
5209 /* unmute Line-Out mixer amp left and right (volume = 0) */
5210 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5211 /* mute pin widget amp left and right (no gain on this amp) */
5212 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5213 /* unmute HP mixer amp left and right (volume = 0) */
5214 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5215 /* mute pin widget amp left and right (no gain on this amp) */
5216 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5217 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5220 /* mute analog inputs */
5221 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5222 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5223 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5224 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5225 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5226 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5227 /* Unmute Front out path */
5228 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5229 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5230 /* Unmute Headphone out path */
5231 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5232 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5233 /* Unmute Mono out path */
5234 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5235 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5239 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5240 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5241 * audio = 0x16, internal speaker = 0x10.
5243 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
5244 /* Disable all GPIOs */
5245 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
5246 /* Internal speaker is connected to headphone pin */
5247 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5248 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5250 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5251 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5252 /* Ensure all other unused pins are disabled and muted. */
5253 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5254 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5255 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5256 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5257 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5258 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5259 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5262 /* Disable digital (SPDIF) pins */
5263 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5264 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5266 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5267 * when acting as an output.
5269 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5271 /* Start with output sum widgets muted and their output gains at min */
5272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5273 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5274 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5275 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5276 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5277 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5278 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5279 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5280 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5282 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5283 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5284 /* Unmute Line1 pin widget output buffer since it starts as an output.
5285 * If the pin mode is changed by the user the pin mode control will
5286 * take care of enabling the pin's input/output buffers as needed.
5287 * Therefore there's no need to enable the input buffer at this
5290 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5291 /* Unmute input buffer of pin widget used for Line-in (no equiv
5294 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5296 /* Mute capture amp left and right */
5297 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5298 /* Set ADC connection select to match default mixer setting - line
5301 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5303 /* Do the same for the second ADC: mute capture input amp and
5304 * set ADC connection to line in (on mic1 pin)
5306 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5307 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5309 /* Mute all inputs to mixer widget (even unconnected ones) */
5310 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5311 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5312 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5313 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5314 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5315 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5316 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5322 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5323 * similar laptops (adapted from Fujitsu init verbs).
5325 static struct hda_verb alc260_acer_init_verbs
[] = {
5326 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5327 * the headphone jack. Turn this on and rely on the standard mute
5328 * methods whenever the user wants to turn these outputs off.
5330 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
5331 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
5332 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
5333 /* Internal speaker/Headphone jack is connected to Line-out pin */
5334 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5335 /* Internal microphone/Mic jack is connected to Mic1 pin */
5336 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
5337 /* Line In jack is connected to Line1 pin */
5338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5339 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5340 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5341 /* Ensure all other unused pins are disabled and muted. */
5342 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5343 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5344 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5345 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5347 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5348 /* Disable digital (SPDIF) pins */
5349 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5350 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5352 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5353 * bus when acting as outputs.
5355 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
5356 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5358 /* Start with output sum widgets muted and their output gains at min */
5359 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5360 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5362 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5363 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5364 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5365 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5366 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5367 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5369 /* Unmute Line-out pin widget amp left and right
5370 * (no equiv mixer ctrl)
5372 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5373 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5374 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5375 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5376 * inputs. If the pin mode is changed by the user the pin mode control
5377 * will take care of enabling the pin's input/output buffers as needed.
5378 * Therefore there's no need to enable the input buffer at this
5381 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5382 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5384 /* Mute capture amp left and right */
5385 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5386 /* Set ADC connection select to match default mixer setting - mic
5389 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5391 /* Do similar with the second ADC: mute capture input amp and
5392 * set ADC connection to mic to match ALSA's default state.
5394 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5395 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5397 /* Mute all inputs to mixer widget (even unconnected ones) */
5398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5402 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5403 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5405 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5410 /* Initialisation sequence for Maxdata Favorit 100XS
5411 * (adapted from Acer init verbs).
5413 static struct hda_verb alc260_favorit100_init_verbs
[] = {
5414 /* GPIO 0 enables the output jack.
5415 * Turn this on and rely on the standard mute
5416 * methods whenever the user wants to turn these outputs off.
5418 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
5419 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
5420 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
5421 /* Line/Mic input jack is connected to Mic1 pin */
5422 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
5423 /* Ensure all other unused pins are disabled and muted. */
5424 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5425 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5426 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5427 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5428 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5429 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5430 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5431 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5432 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5433 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5434 /* Disable digital (SPDIF) pins */
5435 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5436 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5438 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5439 * bus when acting as outputs.
5441 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
5442 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5444 /* Start with output sum widgets muted and their output gains at min */
5445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5446 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5447 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5449 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5451 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5452 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5453 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5455 /* Unmute Line-out pin widget amp left and right
5456 * (no equiv mixer ctrl)
5458 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5459 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5460 * inputs. If the pin mode is changed by the user the pin mode control
5461 * will take care of enabling the pin's input/output buffers as needed.
5462 * Therefore there's no need to enable the input buffer at this
5465 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5467 /* Mute capture amp left and right */
5468 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5469 /* Set ADC connection select to match default mixer setting - mic
5472 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5474 /* Do similar with the second ADC: mute capture input amp and
5475 * set ADC connection to mic to match ALSA's default state.
5477 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5478 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5480 /* Mute all inputs to mixer widget (even unconnected ones) */
5481 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5482 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5483 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5484 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5493 static struct hda_verb alc260_will_verbs
[] = {
5494 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5495 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5496 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
5497 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
5498 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
5499 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
5503 static struct hda_verb alc260_replacer_672v_verbs
[] = {
5504 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
5505 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
5506 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
5508 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
5509 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
5510 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
5512 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5516 /* toggle speaker-output according to the hp-jack state */
5517 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
5519 unsigned int present
;
5521 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5522 present
= snd_hda_codec_read(codec
, 0x0f, 0,
5523 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5525 snd_hda_codec_write_cache(codec
, 0x01, 0,
5526 AC_VERB_SET_GPIO_DATA
, 1);
5527 snd_hda_codec_write_cache(codec
, 0x0f, 0,
5528 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5531 snd_hda_codec_write_cache(codec
, 0x01, 0,
5532 AC_VERB_SET_GPIO_DATA
, 0);
5533 snd_hda_codec_write_cache(codec
, 0x0f, 0,
5534 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5539 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
5542 if ((res
>> 26) == ALC880_HP_EVENT
)
5543 alc260_replacer_672v_automute(codec
);
5546 static struct hda_verb alc260_hp_dc7600_verbs
[] = {
5547 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x01},
5548 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5549 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5550 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5551 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5552 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5553 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5554 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5555 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5556 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5560 /* Test configuration for debugging, modelled after the ALC880 test
5563 #ifdef CONFIG_SND_DEBUG
5564 static hda_nid_t alc260_test_dac_nids
[1] = {
5567 static hda_nid_t alc260_test_adc_nids
[2] = {
5570 /* For testing the ALC260, each input MUX needs its own definition since
5571 * the signal assignments are different. This assumes that the first ADC
5574 static struct hda_input_mux alc260_test_capture_sources
[2] = {
5578 { "MIC1 pin", 0x0 },
5579 { "MIC2 pin", 0x1 },
5580 { "LINE1 pin", 0x2 },
5581 { "LINE2 pin", 0x3 },
5583 { "LINE-OUT pin", 0x5 },
5584 { "HP-OUT pin", 0x6 },
5590 { "MIC1 pin", 0x0 },
5591 { "MIC2 pin", 0x1 },
5592 { "LINE1 pin", 0x2 },
5593 { "LINE2 pin", 0x3 },
5596 { "LINE-OUT pin", 0x6 },
5597 { "HP-OUT pin", 0x7 },
5601 static struct snd_kcontrol_new alc260_test_mixer
[] = {
5602 /* Output driver widgets */
5603 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
5604 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
5605 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5606 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
5607 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5608 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
5610 /* Modes for retasking pin widgets
5611 * Note: the ALC260 doesn't seem to act on requests to enable mic
5612 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5613 * mention this restriction. At this stage it's not clear whether
5614 * this behaviour is intentional or is a hardware bug in chip
5615 * revisions available at least up until early 2006. Therefore for
5616 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5617 * choices, but if it turns out that the lack of mic bias for these
5618 * NIDs is intentional we could change their modes from
5619 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5621 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
5622 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
5623 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
5624 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
5625 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
5626 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
5628 /* Loopback mixer controls */
5629 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
5630 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
5631 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
5632 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
5633 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
5634 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
5635 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
5636 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
5637 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5638 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5639 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
5640 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
5641 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
5642 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
5644 /* Controls for GPIO pins, assuming they are configured as outputs */
5645 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5646 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5647 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5648 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5650 /* Switches to allow the digital IO pins to be enabled. The datasheet
5651 * is ambigious as to which NID is which; testing on laptops which
5652 * make this output available should provide clarification.
5654 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5655 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5657 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5658 * this output to turn on an external amplifier.
5660 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5661 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5665 static struct hda_verb alc260_test_init_verbs
[] = {
5666 /* Enable all GPIOs as outputs with an initial value of 0 */
5667 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
5668 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
5669 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
5671 /* Enable retasking pins as output, initially without power amp */
5672 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5673 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5674 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5676 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5677 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5679 /* Disable digital (SPDIF) pins initially, but users can enable
5680 * them via a mixer switch. In the case of SPDIF-out, this initverb
5681 * payload also sets the generation to 0, output to be in "consumer"
5682 * PCM format, copyright asserted, no pre-emphasis and no validity
5685 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5686 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5688 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5689 * OUT1 sum bus when acting as an output.
5691 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
5692 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
5693 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5694 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
5696 /* Start with output sum widgets muted and their output gains at min */
5697 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5703 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5704 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5705 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5707 /* Unmute retasking pin widget output buffers since the default
5708 * state appears to be output. As the pin mode is changed by the
5709 * user the pin mode control will take care of enabling the pin's
5710 * input/output buffers as needed.
5712 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5713 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5715 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5716 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5717 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5718 /* Also unmute the mono-out pin widget */
5719 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5721 /* Mute capture amp left and right */
5722 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5723 /* Set ADC connection select to match default mixer setting (mic1
5726 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5728 /* Do the same for the second ADC: mute capture input amp and
5729 * set ADC connection to mic1 pin
5731 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5732 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5734 /* Mute all inputs to mixer widget (even unconnected ones) */
5735 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5741 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5748 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5749 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5751 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5752 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5755 * for BIOS auto-configuration
5758 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
5759 const char *pfx
, int *vol_bits
)
5762 unsigned long vol_val
, sw_val
;
5766 if (nid
>= 0x0f && nid
< 0x11) {
5767 nid_vol
= nid
- 0x7;
5768 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
5769 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
5770 } else if (nid
== 0x11) {
5771 nid_vol
= nid
- 0x7;
5772 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
5773 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
5774 } else if (nid
>= 0x12 && nid
<= 0x15) {
5776 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
5777 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
5781 if (!(*vol_bits
& (1 << nid_vol
))) {
5782 /* first control for the volume widget */
5783 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
5784 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
);
5787 *vol_bits
|= (1 << nid_vol
);
5789 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
5790 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
);
5796 /* add playback controls from the parsed DAC table */
5797 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
5798 const struct auto_pin_cfg
*cfg
)
5804 spec
->multiout
.num_dacs
= 1;
5805 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
5806 spec
->multiout
.dac_nids
[0] = 0x02;
5808 nid
= cfg
->line_out_pins
[0];
5810 err
= alc260_add_playback_controls(spec
, nid
, "Front", &vols
);
5815 nid
= cfg
->speaker_pins
[0];
5817 err
= alc260_add_playback_controls(spec
, nid
, "Speaker", &vols
);
5822 nid
= cfg
->hp_pins
[0];
5824 err
= alc260_add_playback_controls(spec
, nid
, "Headphone",
5832 /* create playback/capture controls for input pins */
5833 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
5834 const struct auto_pin_cfg
*cfg
)
5836 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
5839 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5840 if (cfg
->input_pins
[i
] >= 0x12) {
5841 idx
= cfg
->input_pins
[i
] - 0x12;
5842 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
5843 auto_pin_cfg_labels
[i
], idx
,
5847 imux
->items
[imux
->num_items
].label
=
5848 auto_pin_cfg_labels
[i
];
5849 imux
->items
[imux
->num_items
].index
= idx
;
5852 if (cfg
->input_pins
[i
] >= 0x0f && cfg
->input_pins
[i
] <= 0x10){
5853 idx
= cfg
->input_pins
[i
] - 0x09;
5854 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
5855 auto_pin_cfg_labels
[i
], idx
,
5859 imux
->items
[imux
->num_items
].label
=
5860 auto_pin_cfg_labels
[i
];
5861 imux
->items
[imux
->num_items
].index
= idx
;
5868 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
5869 hda_nid_t nid
, int pin_type
,
5872 alc_set_pin_output(codec
, nid
, pin_type
);
5873 /* need the manual connection? */
5875 int idx
= nid
- 0x12;
5876 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
5877 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
5881 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
5883 struct alc_spec
*spec
= codec
->spec
;
5886 nid
= spec
->autocfg
.line_out_pins
[0];
5888 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5889 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
5892 nid
= spec
->autocfg
.speaker_pins
[0];
5894 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
5896 nid
= spec
->autocfg
.hp_pins
[0];
5898 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
5901 #define ALC260_PIN_CD_NID 0x16
5902 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
5904 struct alc_spec
*spec
= codec
->spec
;
5907 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5908 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5910 alc_set_input_pin(codec
, nid
, i
);
5911 if (nid
!= ALC260_PIN_CD_NID
&&
5912 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
5913 snd_hda_codec_write(codec
, nid
, 0,
5914 AC_VERB_SET_AMP_GAIN_MUTE
,
5921 * generic initialization of ADC, input mixers and output mixers
5923 static struct hda_verb alc260_volume_init_verbs
[] = {
5925 * Unmute ADC0-1 and set the default input to mic-in
5927 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5928 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5929 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5930 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5932 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5934 * Note: PASD motherboards uses the Line In 2 as the input for
5935 * front panel mic (mic 2)
5937 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5938 /* mute analog inputs */
5939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5946 * Set up output mixers (0x08 - 0x0a)
5948 /* set vol=0 to output mixers */
5949 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5950 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5951 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5952 /* set up input amps for analog loopback */
5953 /* Amp Indices: DAC = 0, mixer = 1 */
5954 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5955 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5956 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5957 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5958 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5959 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5964 static int alc260_parse_auto_config(struct hda_codec
*codec
)
5966 struct alc_spec
*spec
= codec
->spec
;
5968 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
5970 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5974 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5977 if (!spec
->kctls
.list
)
5978 return 0; /* can't find valid BIOS pin config */
5979 err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
5983 spec
->multiout
.max_channels
= 2;
5985 if (spec
->autocfg
.dig_outs
)
5986 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
5987 if (spec
->kctls
.list
)
5988 add_mixer(spec
, spec
->kctls
.list
);
5990 add_verb(spec
, alc260_volume_init_verbs
);
5992 spec
->num_mux_defs
= 1;
5993 spec
->input_mux
= &spec
->private_imux
[0];
5995 alc_ssid_check(codec
, 0x10, 0x15, 0x0f);
6000 /* additional initialization for auto-configuration model */
6001 static void alc260_auto_init(struct hda_codec
*codec
)
6003 struct alc_spec
*spec
= codec
->spec
;
6004 alc260_auto_init_multi_out(codec
);
6005 alc260_auto_init_analog_input(codec
);
6006 if (spec
->unsol_event
)
6007 alc_inithook(codec
);
6010 #ifdef CONFIG_SND_HDA_POWER_SAVE
6011 static struct hda_amp_list alc260_loopbacks
[] = {
6012 { 0x07, HDA_INPUT
, 0 },
6013 { 0x07, HDA_INPUT
, 1 },
6014 { 0x07, HDA_INPUT
, 2 },
6015 { 0x07, HDA_INPUT
, 3 },
6016 { 0x07, HDA_INPUT
, 4 },
6022 * ALC260 configurations
6024 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
6025 [ALC260_BASIC
] = "basic",
6027 [ALC260_HP_3013
] = "hp-3013",
6028 [ALC260_HP_DC7600
] = "hp-dc7600",
6029 [ALC260_FUJITSU_S702X
] = "fujitsu",
6030 [ALC260_ACER
] = "acer",
6031 [ALC260_WILL
] = "will",
6032 [ALC260_REPLACER_672V
] = "replacer",
6033 [ALC260_FAVORIT100
] = "favorit100",
6034 #ifdef CONFIG_SND_DEBUG
6035 [ALC260_TEST
] = "test",
6037 [ALC260_AUTO
] = "auto",
6040 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
6041 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
6042 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
6043 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100
),
6044 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
6045 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013
),
6046 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
6047 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
6048 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600
),
6049 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
6050 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
6051 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
6052 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
6053 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
6054 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
6055 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
6056 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
6057 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
6058 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
6059 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
6063 static struct alc_config_preset alc260_presets
[] = {
6065 .mixers
= { alc260_base_output_mixer
,
6066 alc260_input_mixer
},
6067 .init_verbs
= { alc260_init_verbs
},
6068 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6069 .dac_nids
= alc260_dac_nids
,
6070 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6071 .adc_nids
= alc260_adc_nids
,
6072 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6073 .channel_mode
= alc260_modes
,
6074 .input_mux
= &alc260_capture_source
,
6077 .mixers
= { alc260_hp_output_mixer
,
6078 alc260_input_mixer
},
6079 .init_verbs
= { alc260_init_verbs
,
6080 alc260_hp_unsol_verbs
},
6081 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6082 .dac_nids
= alc260_dac_nids
,
6083 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
6084 .adc_nids
= alc260_adc_nids_alt
,
6085 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6086 .channel_mode
= alc260_modes
,
6087 .input_mux
= &alc260_capture_source
,
6088 .unsol_event
= alc260_hp_unsol_event
,
6089 .init_hook
= alc260_hp_automute
,
6091 [ALC260_HP_DC7600
] = {
6092 .mixers
= { alc260_hp_dc7600_mixer
,
6093 alc260_input_mixer
},
6094 .init_verbs
= { alc260_init_verbs
,
6095 alc260_hp_dc7600_verbs
},
6096 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6097 .dac_nids
= alc260_dac_nids
,
6098 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
6099 .adc_nids
= alc260_adc_nids_alt
,
6100 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6101 .channel_mode
= alc260_modes
,
6102 .input_mux
= &alc260_capture_source
,
6103 .unsol_event
= alc260_hp_3012_unsol_event
,
6104 .init_hook
= alc260_hp_3012_automute
,
6106 [ALC260_HP_3013
] = {
6107 .mixers
= { alc260_hp_3013_mixer
,
6108 alc260_input_mixer
},
6109 .init_verbs
= { alc260_hp_3013_init_verbs
,
6110 alc260_hp_3013_unsol_verbs
},
6111 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6112 .dac_nids
= alc260_dac_nids
,
6113 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
6114 .adc_nids
= alc260_adc_nids_alt
,
6115 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6116 .channel_mode
= alc260_modes
,
6117 .input_mux
= &alc260_capture_source
,
6118 .unsol_event
= alc260_hp_3013_unsol_event
,
6119 .init_hook
= alc260_hp_3013_automute
,
6121 [ALC260_FUJITSU_S702X
] = {
6122 .mixers
= { alc260_fujitsu_mixer
},
6123 .init_verbs
= { alc260_fujitsu_init_verbs
},
6124 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6125 .dac_nids
= alc260_dac_nids
,
6126 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6127 .adc_nids
= alc260_dual_adc_nids
,
6128 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6129 .channel_mode
= alc260_modes
,
6130 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
6131 .input_mux
= alc260_fujitsu_capture_sources
,
6134 .mixers
= { alc260_acer_mixer
},
6135 .init_verbs
= { alc260_acer_init_verbs
},
6136 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6137 .dac_nids
= alc260_dac_nids
,
6138 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6139 .adc_nids
= alc260_dual_adc_nids
,
6140 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6141 .channel_mode
= alc260_modes
,
6142 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
6143 .input_mux
= alc260_acer_capture_sources
,
6145 [ALC260_FAVORIT100
] = {
6146 .mixers
= { alc260_favorit100_mixer
},
6147 .init_verbs
= { alc260_favorit100_init_verbs
},
6148 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6149 .dac_nids
= alc260_dac_nids
,
6150 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6151 .adc_nids
= alc260_dual_adc_nids
,
6152 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6153 .channel_mode
= alc260_modes
,
6154 .num_mux_defs
= ARRAY_SIZE(alc260_favorit100_capture_sources
),
6155 .input_mux
= alc260_favorit100_capture_sources
,
6158 .mixers
= { alc260_will_mixer
},
6159 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
6160 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6161 .dac_nids
= alc260_dac_nids
,
6162 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
6163 .adc_nids
= alc260_adc_nids
,
6164 .dig_out_nid
= ALC260_DIGOUT_NID
,
6165 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6166 .channel_mode
= alc260_modes
,
6167 .input_mux
= &alc260_capture_source
,
6169 [ALC260_REPLACER_672V
] = {
6170 .mixers
= { alc260_replacer_672v_mixer
},
6171 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
6172 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6173 .dac_nids
= alc260_dac_nids
,
6174 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
6175 .adc_nids
= alc260_adc_nids
,
6176 .dig_out_nid
= ALC260_DIGOUT_NID
,
6177 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6178 .channel_mode
= alc260_modes
,
6179 .input_mux
= &alc260_capture_source
,
6180 .unsol_event
= alc260_replacer_672v_unsol_event
,
6181 .init_hook
= alc260_replacer_672v_automute
,
6183 #ifdef CONFIG_SND_DEBUG
6185 .mixers
= { alc260_test_mixer
},
6186 .init_verbs
= { alc260_test_init_verbs
},
6187 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
6188 .dac_nids
= alc260_test_dac_nids
,
6189 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
6190 .adc_nids
= alc260_test_adc_nids
,
6191 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6192 .channel_mode
= alc260_modes
,
6193 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
6194 .input_mux
= alc260_test_capture_sources
,
6199 static int patch_alc260(struct hda_codec
*codec
)
6201 struct alc_spec
*spec
;
6202 int err
, board_config
;
6204 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6210 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
6213 if (board_config
< 0) {
6214 snd_printd(KERN_INFO
"hda_codec: Unknown model for %s, "
6215 "trying auto-probe from BIOS...\n",
6217 board_config
= ALC260_AUTO
;
6220 if (board_config
== ALC260_AUTO
) {
6221 /* automatic parse from the BIOS config */
6222 err
= alc260_parse_auto_config(codec
);
6228 "hda_codec: Cannot set up configuration "
6229 "from BIOS. Using base mode...\n");
6230 board_config
= ALC260_BASIC
;
6234 err
= snd_hda_attach_beep_device(codec
, 0x1);
6240 if (board_config
!= ALC260_AUTO
)
6241 setup_preset(spec
, &alc260_presets
[board_config
]);
6243 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
6244 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
6246 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
6247 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
6249 if (!spec
->adc_nids
&& spec
->input_mux
) {
6250 /* check whether NID 0x04 is valid */
6251 unsigned int wcap
= get_wcaps(codec
, 0x04);
6252 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
6254 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
6255 spec
->adc_nids
= alc260_adc_nids_alt
;
6256 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
6258 spec
->adc_nids
= alc260_adc_nids
;
6259 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
6262 set_capture_mixer(spec
);
6263 set_beep_amp(spec
, 0x07, 0x05, HDA_INPUT
);
6265 spec
->vmaster_nid
= 0x08;
6267 codec
->patch_ops
= alc_patch_ops
;
6268 if (board_config
== ALC260_AUTO
)
6269 spec
->init_hook
= alc260_auto_init
;
6270 #ifdef CONFIG_SND_HDA_POWER_SAVE
6271 if (!spec
->loopback
.amplist
)
6272 spec
->loopback
.amplist
= alc260_loopbacks
;
6274 codec
->proc_widget_hook
= print_realtek_coef
;
6283 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6284 * configuration. Each pin widget can choose any input DACs and a mixer.
6285 * Each ADC is connected from a mixer of all inputs. This makes possible
6286 * 6-channel independent captures.
6288 * In addition, an independent DAC for the multi-playback (not used in this
6291 #define ALC882_DIGOUT_NID 0x06
6292 #define ALC882_DIGIN_NID 0x0a
6294 static struct hda_channel_mode alc882_ch_modes
[1] = {
6298 static hda_nid_t alc882_dac_nids
[4] = {
6299 /* front, rear, clfe, rear_surr */
6300 0x02, 0x03, 0x04, 0x05
6303 /* identical with ALC880 */
6304 #define alc882_adc_nids alc880_adc_nids
6305 #define alc882_adc_nids_alt alc880_adc_nids_alt
6307 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
6308 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
6311 /* FIXME: should be a matrix-type input source selection */
6313 static struct hda_input_mux alc882_capture_source
= {
6317 { "Front Mic", 0x1 },
6323 static struct hda_input_mux mb5_capture_source
= {
6335 static struct hda_verb alc882_3ST_ch2_init
[] = {
6336 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6337 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6338 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6339 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6346 static struct hda_verb alc882_3ST_ch6_init
[] = {
6347 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6348 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6349 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6350 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6351 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6352 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6356 static struct hda_channel_mode alc882_3ST_6ch_modes
[2] = {
6357 { 2, alc882_3ST_ch2_init
},
6358 { 6, alc882_3ST_ch6_init
},
6364 static struct hda_verb alc882_sixstack_ch6_init
[] = {
6365 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6366 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6367 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6368 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6375 static struct hda_verb alc882_sixstack_ch8_init
[] = {
6376 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6377 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6378 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6379 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6383 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
6384 { 6, alc882_sixstack_ch6_init
},
6385 { 8, alc882_sixstack_ch8_init
},
6389 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6395 static struct hda_verb alc885_mbp_ch2_init
[] = {
6396 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6397 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6398 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6405 static struct hda_verb alc885_mbp_ch6_init
[] = {
6406 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6407 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6408 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6409 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6410 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6414 static struct hda_channel_mode alc885_mbp_6ch_modes
[2] = {
6415 { 2, alc885_mbp_ch2_init
},
6416 { 6, alc885_mbp_ch6_init
},
6421 * Speakers/Woofer/HP = Front
6424 static struct hda_verb alc885_mb5_ch2_init
[] = {
6425 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6426 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6432 * Speakers/HP = Front
6436 static struct hda_verb alc885_mb5_ch6_init
[] = {
6437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6438 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6439 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6443 static struct hda_channel_mode alc885_mb5_6ch_modes
[2] = {
6444 { 2, alc885_mb5_ch2_init
},
6445 { 6, alc885_mb5_ch6_init
},
6448 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6449 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6451 static struct snd_kcontrol_new alc882_base_mixer
[] = {
6452 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6453 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6454 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6455 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6456 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6457 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6458 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6459 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6460 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6461 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6462 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6463 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6464 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6465 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6466 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6468 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6470 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6471 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6472 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6476 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
6477 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
6478 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
6479 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT
),
6480 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
6481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6482 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
6484 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
6485 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
6486 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
6490 static struct snd_kcontrol_new alc885_mb5_mixer
[] = {
6491 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
6492 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
6493 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
6494 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
6495 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
6496 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
6497 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
6498 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT
),
6499 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6500 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
6502 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
6503 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT
),
6504 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT
),
6508 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
6509 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6510 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6511 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6512 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6513 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6514 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6515 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6516 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6521 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
6522 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6523 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6524 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6525 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6526 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6527 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6528 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6530 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6531 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6532 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6533 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6534 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6538 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6539 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6541 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
6542 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6543 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6545 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
6546 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6547 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6548 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6549 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6550 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
6551 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
6552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6553 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6554 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6558 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
6559 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6560 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6561 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6562 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6563 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6564 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6565 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6567 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6568 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6572 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
6574 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6575 .name
= "Channel Mode",
6576 .info
= alc_ch_mode_info
,
6577 .get
= alc_ch_mode_get
,
6578 .put
= alc_ch_mode_put
,
6583 static struct hda_verb alc882_init_verbs
[] = {
6584 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6590 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6591 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6594 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6595 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6597 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6598 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6599 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6601 /* Front Pin: output 0 (0x0c) */
6602 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6603 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6604 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6605 /* Rear Pin: output 1 (0x0d) */
6606 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6607 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6608 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6609 /* CLFE Pin: output 2 (0x0e) */
6610 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6611 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6612 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
6613 /* Side Pin: output 3 (0x0f) */
6614 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6615 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6616 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
6617 /* Mic (rear) pin: input vref at 80% */
6618 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6619 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6620 /* Front Mic pin: input vref at 80% */
6621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6622 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6623 /* Line In pin: input */
6624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6626 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6629 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6630 /* CD pin widget for input */
6631 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6633 /* FIXME: use matrix-type input source selection */
6634 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6635 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6636 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6637 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6638 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6639 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6641 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6642 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6643 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6650 /* ADC1: mute amp left and right */
6651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6652 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6653 /* ADC2: mute amp left and right */
6654 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6655 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6656 /* ADC3: mute amp left and right */
6657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6658 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6663 static struct hda_verb alc882_eapd_verbs
[] = {
6664 /* change to EAPD mode */
6665 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6666 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
6671 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
6672 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6673 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6674 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
6675 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
6676 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
6677 /* FIXME: this looks suspicious...
6678 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6679 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6684 static struct hda_verb alc882_macpro_init_verbs
[] = {
6685 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6688 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6689 /* Front Pin: output 0 (0x0c) */
6690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6692 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6693 /* Front Mic pin: input vref at 80% */
6694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6695 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6696 /* Speaker: output */
6697 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6698 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6699 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
6700 /* Headphone output (output 0 - 0x0c) */
6701 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6702 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6703 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
6705 /* FIXME: use matrix-type input source selection */
6706 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6707 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6710 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6711 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6714 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6715 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6716 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6720 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6721 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6722 /* ADC1: mute amp left and right */
6723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6724 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6725 /* ADC2: mute amp left and right */
6726 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6727 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6728 /* ADC3: mute amp left and right */
6729 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6730 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6736 static struct hda_verb alc885_mb5_init_verbs
[] = {
6738 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6739 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6740 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6741 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6746 /* Surround mixer */
6747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6748 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6749 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6751 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6752 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6753 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6755 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6756 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6757 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6758 /* Front Pin (0x0c) */
6759 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
6760 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6761 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
6762 /* LFE Pin (0x0e) */
6763 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
6764 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6765 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
6767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6769 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
6770 /* Front Mic pin: input vref at 80% */
6771 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6772 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6779 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6780 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6784 /* Macbook Pro rev3 */
6785 static struct hda_verb alc885_mbp3_init_verbs
[] = {
6786 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6788 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6789 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6791 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6792 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6793 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6794 /* Front Pin: output 0 (0x0c) */
6795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6796 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6797 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6798 /* HP Pin: output 0 (0x0d) */
6799 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
6800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6801 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6802 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6803 /* Mic (rear) pin: input vref at 80% */
6804 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6805 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6806 /* Front Mic pin: input vref at 80% */
6807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6809 /* Line In pin: use output 1 when in LineOut mode */
6810 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6811 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6812 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
6814 /* FIXME: use matrix-type input source selection */
6815 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6816 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6817 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6818 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6819 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6820 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6822 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6823 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6824 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6825 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6827 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6830 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6831 /* ADC1: mute amp left and right */
6832 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6833 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6834 /* ADC2: mute amp left and right */
6835 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6836 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6837 /* ADC3: mute amp left and right */
6838 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6839 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6844 /* iMac 24 mixer. */
6845 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
6846 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
6847 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
6851 /* iMac 24 init verbs. */
6852 static struct hda_verb alc885_imac24_init_verbs
[] = {
6853 /* Internal speakers: output 0 (0x0c) */
6854 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6855 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6856 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
6857 /* Internal speakers: output 0 (0x0c) */
6858 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6859 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6860 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
6861 /* Headphone: output 0 (0x0c) */
6862 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6863 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6864 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6865 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6866 /* Front Mic: input vref at 80% */
6867 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6868 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6872 /* Toggle speaker-output according to the hp-jack state */
6873 static void alc885_imac24_automute_init_hook(struct hda_codec
*codec
)
6875 struct alc_spec
*spec
= codec
->spec
;
6877 spec
->autocfg
.hp_pins
[0] = 0x14;
6878 spec
->autocfg
.speaker_pins
[0] = 0x18;
6879 spec
->autocfg
.speaker_pins
[1] = 0x1a;
6880 alc_automute_amp(codec
);
6883 static void alc885_mbp3_init_hook(struct hda_codec
*codec
)
6885 struct alc_spec
*spec
= codec
->spec
;
6887 spec
->autocfg
.hp_pins
[0] = 0x15;
6888 spec
->autocfg
.speaker_pins
[0] = 0x14;
6889 alc_automute_amp(codec
);
6893 static struct hda_verb alc882_targa_verbs
[] = {
6894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6895 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6897 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6898 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6900 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6901 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6902 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6904 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6905 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
6906 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
6907 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
6911 /* toggle speaker-output according to the hp-jack state */
6912 static void alc882_targa_automute(struct hda_codec
*codec
)
6914 struct alc_spec
*spec
= codec
->spec
;
6915 alc_automute_amp(codec
);
6916 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
6917 spec
->jack_present
? 1 : 3);
6920 static void alc882_targa_init_hook(struct hda_codec
*codec
)
6922 struct alc_spec
*spec
= codec
->spec
;
6924 spec
->autocfg
.hp_pins
[0] = 0x14;
6925 spec
->autocfg
.speaker_pins
[0] = 0x1b;
6926 alc882_targa_automute(codec
);
6929 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
6931 if ((res
>> 26) == ALC880_HP_EVENT
)
6932 alc882_targa_automute(codec
);
6935 static struct hda_verb alc882_asus_a7j_verbs
[] = {
6936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6939 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6940 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6941 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6943 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6944 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6945 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6947 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6948 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6949 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6953 static struct hda_verb alc882_asus_a7m_verbs
[] = {
6954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6958 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6959 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6961 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6962 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6963 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6965 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6966 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6967 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6971 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
6973 unsigned int gpiostate
, gpiomask
, gpiodir
;
6975 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6976 AC_VERB_GET_GPIO_DATA
, 0);
6979 gpiostate
|= (1 << pin
);
6981 gpiostate
&= ~(1 << pin
);
6983 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6984 AC_VERB_GET_GPIO_MASK
, 0);
6985 gpiomask
|= (1 << pin
);
6987 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6988 AC_VERB_GET_GPIO_DIRECTION
, 0);
6989 gpiodir
|= (1 << pin
);
6992 snd_hda_codec_write(codec
, codec
->afg
, 0,
6993 AC_VERB_SET_GPIO_MASK
, gpiomask
);
6994 snd_hda_codec_write(codec
, codec
->afg
, 0,
6995 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
6999 snd_hda_codec_write(codec
, codec
->afg
, 0,
7000 AC_VERB_SET_GPIO_DATA
, gpiostate
);
7003 /* set up GPIO at initialization */
7004 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
7006 alc882_gpio_mute(codec
, 0, 0);
7007 alc882_gpio_mute(codec
, 1, 0);
7010 /* set up GPIO and update auto-muting at initialization */
7011 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
7013 alc885_macpro_init_hook(codec
);
7014 alc885_imac24_automute_init_hook(codec
);
7018 * generic initialization of ADC, input mixers and output mixers
7020 static struct hda_verb alc882_auto_init_verbs
[] = {
7022 * Unmute ADC0-2 and set the default input to mic-in
7024 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
7025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7026 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7027 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7028 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7029 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7031 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7033 * Note: PASD motherboards uses the Line In 2 as the input for
7034 * front panel mic (mic 2)
7036 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7044 * Set up output mixers (0x0c - 0x0f)
7046 /* set vol=0 to output mixers */
7047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7049 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7050 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7051 /* set up input amps for analog loopback */
7052 /* Amp Indices: DAC = 0, mixer = 1 */
7053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7055 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7058 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7059 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7060 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7061 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7062 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7064 /* FIXME: use matrix-type input source selection */
7065 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7066 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7068 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7069 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7070 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7072 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7074 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7075 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7085 #ifdef CONFIG_SND_HDA_POWER_SAVE
7086 #define alc882_loopbacks alc880_loopbacks
7089 /* pcm configuration: identical with ALC880 */
7090 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
7091 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
7092 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
7093 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
7096 * configuration and preset
7098 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
7099 [ALC882_3ST_DIG
] = "3stack-dig",
7100 [ALC882_6ST_DIG
] = "6stack-dig",
7101 [ALC882_ARIMA
] = "arima",
7102 [ALC882_W2JC
] = "w2jc",
7103 [ALC882_TARGA
] = "targa",
7104 [ALC882_ASUS_A7J
] = "asus-a7j",
7105 [ALC882_ASUS_A7M
] = "asus-a7m",
7106 [ALC885_MACPRO
] = "macpro",
7107 [ALC885_MB5
] = "mb5",
7108 [ALC885_MBP3
] = "mbp3",
7109 [ALC885_IMAC24
] = "imac24",
7110 [ALC882_AUTO
] = "auto",
7113 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
7114 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
7115 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
7116 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
7117 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
7118 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
7119 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
7120 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
7121 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
7122 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
7123 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
7124 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
7125 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
7129 static struct alc_config_preset alc882_presets
[] = {
7130 [ALC882_3ST_DIG
] = {
7131 .mixers
= { alc882_base_mixer
},
7132 .init_verbs
= { alc882_init_verbs
},
7133 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7134 .dac_nids
= alc882_dac_nids
,
7135 .dig_out_nid
= ALC882_DIGOUT_NID
,
7136 .dig_in_nid
= ALC882_DIGIN_NID
,
7137 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
7138 .channel_mode
= alc882_ch_modes
,
7140 .input_mux
= &alc882_capture_source
,
7142 [ALC882_6ST_DIG
] = {
7143 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
7144 .init_verbs
= { alc882_init_verbs
},
7145 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7146 .dac_nids
= alc882_dac_nids
,
7147 .dig_out_nid
= ALC882_DIGOUT_NID
,
7148 .dig_in_nid
= ALC882_DIGIN_NID
,
7149 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
7150 .channel_mode
= alc882_sixstack_modes
,
7151 .input_mux
= &alc882_capture_source
,
7154 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
7155 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
7156 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7157 .dac_nids
= alc882_dac_nids
,
7158 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
7159 .channel_mode
= alc882_sixstack_modes
,
7160 .input_mux
= &alc882_capture_source
,
7163 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
7164 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
7165 alc880_gpio1_init_verbs
},
7166 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7167 .dac_nids
= alc882_dac_nids
,
7168 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
7169 .channel_mode
= alc880_threestack_modes
,
7171 .input_mux
= &alc882_capture_source
,
7172 .dig_out_nid
= ALC882_DIGOUT_NID
,
7175 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
7176 .init_verbs
= { alc885_mbp3_init_verbs
,
7177 alc880_gpio1_init_verbs
},
7178 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7179 .dac_nids
= alc882_dac_nids
,
7180 .channel_mode
= alc885_mbp_6ch_modes
,
7181 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_6ch_modes
),
7182 .input_mux
= &alc882_capture_source
,
7183 .dig_out_nid
= ALC882_DIGOUT_NID
,
7184 .dig_in_nid
= ALC882_DIGIN_NID
,
7185 .unsol_event
= alc_automute_amp_unsol_event
,
7186 .init_hook
= alc885_mbp3_init_hook
,
7189 .mixers
= { alc885_mb5_mixer
, alc882_chmode_mixer
},
7190 .init_verbs
= { alc885_mb5_init_verbs
,
7191 alc880_gpio1_init_verbs
},
7192 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7193 .dac_nids
= alc882_dac_nids
,
7194 .channel_mode
= alc885_mb5_6ch_modes
,
7195 .num_channel_mode
= ARRAY_SIZE(alc885_mb5_6ch_modes
),
7196 .input_mux
= &mb5_capture_source
,
7197 .dig_out_nid
= ALC882_DIGOUT_NID
,
7198 .dig_in_nid
= ALC882_DIGIN_NID
,
7201 .mixers
= { alc882_macpro_mixer
},
7202 .init_verbs
= { alc882_macpro_init_verbs
},
7203 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7204 .dac_nids
= alc882_dac_nids
,
7205 .dig_out_nid
= ALC882_DIGOUT_NID
,
7206 .dig_in_nid
= ALC882_DIGIN_NID
,
7207 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
7208 .channel_mode
= alc882_ch_modes
,
7209 .input_mux
= &alc882_capture_source
,
7210 .init_hook
= alc885_macpro_init_hook
,
7213 .mixers
= { alc885_imac24_mixer
},
7214 .init_verbs
= { alc885_imac24_init_verbs
},
7215 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7216 .dac_nids
= alc882_dac_nids
,
7217 .dig_out_nid
= ALC882_DIGOUT_NID
,
7218 .dig_in_nid
= ALC882_DIGIN_NID
,
7219 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
7220 .channel_mode
= alc882_ch_modes
,
7221 .input_mux
= &alc882_capture_source
,
7222 .unsol_event
= alc_automute_amp_unsol_event
,
7223 .init_hook
= alc885_imac24_init_hook
,
7226 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
},
7227 .init_verbs
= { alc882_init_verbs
, alc882_targa_verbs
},
7228 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7229 .dac_nids
= alc882_dac_nids
,
7230 .dig_out_nid
= ALC882_DIGOUT_NID
,
7231 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
7232 .adc_nids
= alc882_adc_nids
,
7233 .capsrc_nids
= alc882_capsrc_nids
,
7234 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
7235 .channel_mode
= alc882_3ST_6ch_modes
,
7237 .input_mux
= &alc882_capture_source
,
7238 .unsol_event
= alc882_targa_unsol_event
,
7239 .init_hook
= alc882_targa_init_hook
,
7241 [ALC882_ASUS_A7J
] = {
7242 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
},
7243 .init_verbs
= { alc882_init_verbs
, alc882_asus_a7j_verbs
},
7244 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7245 .dac_nids
= alc882_dac_nids
,
7246 .dig_out_nid
= ALC882_DIGOUT_NID
,
7247 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
7248 .adc_nids
= alc882_adc_nids
,
7249 .capsrc_nids
= alc882_capsrc_nids
,
7250 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
7251 .channel_mode
= alc882_3ST_6ch_modes
,
7253 .input_mux
= &alc882_capture_source
,
7255 [ALC882_ASUS_A7M
] = {
7256 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
7257 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
7258 alc880_gpio1_init_verbs
,
7259 alc882_asus_a7m_verbs
},
7260 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7261 .dac_nids
= alc882_dac_nids
,
7262 .dig_out_nid
= ALC882_DIGOUT_NID
,
7263 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
7264 .channel_mode
= alc880_threestack_modes
,
7266 .input_mux
= &alc882_capture_source
,
7275 PINFIX_ABIT_AW9D_MAX
7278 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
7279 { 0x15, 0x01080104 }, /* side */
7280 { 0x16, 0x01011012 }, /* rear */
7281 { 0x17, 0x01016011 }, /* clfe */
7285 static const struct alc_pincfg
*alc882_pin_fixes
[] = {
7286 [PINFIX_ABIT_AW9D_MAX
] = alc882_abit_aw9d_pinfix
,
7289 static struct snd_pci_quirk alc882_pinfix_tbl
[] = {
7290 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
7295 * BIOS auto configuration
7297 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
7298 hda_nid_t nid
, int pin_type
,
7302 struct alc_spec
*spec
= codec
->spec
;
7305 alc_set_pin_output(codec
, nid
, pin_type
);
7306 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
7309 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
7310 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
7314 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
7316 struct alc_spec
*spec
= codec
->spec
;
7319 for (i
= 0; i
<= HDA_SIDE
; i
++) {
7320 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
7321 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
7323 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
7328 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
7330 struct alc_spec
*spec
= codec
->spec
;
7333 pin
= spec
->autocfg
.hp_pins
[0];
7334 if (pin
) /* connect to front */
7336 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
7337 pin
= spec
->autocfg
.speaker_pins
[0];
7339 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
7342 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7343 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7345 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
7347 struct alc_spec
*spec
= codec
->spec
;
7350 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
7351 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
7354 alc_set_input_pin(codec
, nid
, AUTO_PIN_FRONT_MIC
/*i*/);
7355 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
7356 snd_hda_codec_write(codec
, nid
, 0,
7357 AC_VERB_SET_AMP_GAIN_MUTE
,
7362 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
7364 struct alc_spec
*spec
= codec
->spec
;
7367 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
7368 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
7369 hda_nid_t nid
= spec
->capsrc_nids
[c
];
7370 unsigned int mux_idx
;
7371 const struct hda_input_mux
*imux
;
7372 int conns
, mute
, idx
, item
;
7374 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
7375 ARRAY_SIZE(conn_list
));
7378 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
7379 imux
= &spec
->input_mux
[mux_idx
];
7380 for (idx
= 0; idx
< conns
; idx
++) {
7381 /* if the current connection is the selected one,
7382 * unmute it as default - otherwise mute it
7384 mute
= AMP_IN_MUTE(idx
);
7385 for (item
= 0; item
< imux
->num_items
; item
++) {
7386 if (imux
->items
[item
].index
== idx
) {
7387 if (spec
->cur_mux
[c
] == item
)
7388 mute
= AMP_IN_UNMUTE(idx
);
7392 /* check if we have a selector or mixer
7393 * we could check for the widget type instead, but
7394 * just check for Amp-In presence (in case of mixer
7395 * without amp-in there is something wrong, this
7396 * function shouldn't be used or capsrc nid is wrong)
7398 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)
7399 snd_hda_codec_write(codec
, nid
, 0,
7400 AC_VERB_SET_AMP_GAIN_MUTE
,
7402 else if (mute
!= AMP_IN_MUTE(idx
))
7403 snd_hda_codec_write(codec
, nid
, 0,
7404 AC_VERB_SET_CONNECT_SEL
,
7410 /* add mic boosts if needed */
7411 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
7413 struct alc_spec
*spec
= codec
->spec
;
7417 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
7418 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
7419 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
7421 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
7425 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
7426 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
7427 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
7429 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
7436 /* almost identical with ALC880 parser... */
7437 static int alc882_parse_auto_config(struct hda_codec
*codec
)
7439 struct alc_spec
*spec
= codec
->spec
;
7440 int err
= alc880_parse_auto_config(codec
);
7445 return 0; /* no config found */
7447 err
= alc_auto_add_mic_boost(codec
);
7451 /* hack - override the init verbs */
7452 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
7454 return 1; /* config found */
7457 /* additional initialization for auto-configuration model */
7458 static void alc882_auto_init(struct hda_codec
*codec
)
7460 struct alc_spec
*spec
= codec
->spec
;
7461 alc882_auto_init_multi_out(codec
);
7462 alc882_auto_init_hp_out(codec
);
7463 alc882_auto_init_analog_input(codec
);
7464 alc882_auto_init_input_src(codec
);
7465 if (spec
->unsol_event
)
7466 alc_inithook(codec
);
7469 static int patch_alc883(struct hda_codec
*codec
); /* called in patch_alc882() */
7471 static int patch_alc882(struct hda_codec
*codec
)
7473 struct alc_spec
*spec
;
7474 int err
, board_config
;
7476 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
7482 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
7486 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
7487 /* Pick up systems that don't supply PCI SSID */
7488 switch (codec
->subsystem_id
) {
7489 case 0x106b0c00: /* Mac Pro */
7490 board_config
= ALC885_MACPRO
;
7492 case 0x106b1000: /* iMac 24 */
7493 case 0x106b2800: /* AppleTV */
7494 case 0x106b3e00: /* iMac 24 Aluminium */
7495 board_config
= ALC885_IMAC24
;
7497 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7498 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7499 case 0x106b00a4: /* MacbookPro4,1 */
7500 case 0x106b2c00: /* Macbook Pro rev3 */
7501 /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */
7502 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7503 board_config
= ALC885_MBP3
;
7505 case 0x106b3f00: /* Macbook 5,1 */
7506 case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense
7507 * seems not working, so apparently
7508 * no perfect solution yet
7510 board_config
= ALC885_MB5
;
7513 /* ALC889A is handled better as ALC888-compatible */
7514 if (codec
->revision_id
== 0x100101 ||
7515 codec
->revision_id
== 0x100103) {
7517 return patch_alc883(codec
);
7519 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
7520 "trying auto-probe from BIOS...\n",
7522 board_config
= ALC882_AUTO
;
7526 alc_fix_pincfg(codec
, alc882_pinfix_tbl
, alc882_pin_fixes
);
7528 if (board_config
== ALC882_AUTO
) {
7529 /* automatic parse from the BIOS config */
7530 err
= alc882_parse_auto_config(codec
);
7536 "hda_codec: Cannot set up configuration "
7537 "from BIOS. Using base mode...\n");
7538 board_config
= ALC882_3ST_DIG
;
7542 err
= snd_hda_attach_beep_device(codec
, 0x1);
7548 if (board_config
!= ALC882_AUTO
)
7549 setup_preset(spec
, &alc882_presets
[board_config
]);
7551 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
7552 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
7553 /* FIXME: setup DAC5 */
7554 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7555 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
7557 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
7558 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
7560 spec
->capture_style
= CAPT_MIX
; /* matrix-style capture */
7561 if (!spec
->adc_nids
&& spec
->input_mux
) {
7562 /* check whether NID 0x07 is valid */
7563 unsigned int wcap
= get_wcaps(codec
, 0x07);
7565 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
7566 if (wcap
!= AC_WID_AUD_IN
) {
7567 spec
->adc_nids
= alc882_adc_nids_alt
;
7568 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
7569 spec
->capsrc_nids
= alc882_capsrc_nids_alt
;
7571 spec
->adc_nids
= alc882_adc_nids
;
7572 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
7573 spec
->capsrc_nids
= alc882_capsrc_nids
;
7576 set_capture_mixer(spec
);
7577 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
7579 spec
->vmaster_nid
= 0x0c;
7581 codec
->patch_ops
= alc_patch_ops
;
7582 if (board_config
== ALC882_AUTO
)
7583 spec
->init_hook
= alc882_auto_init
;
7584 #ifdef CONFIG_SND_HDA_POWER_SAVE
7585 if (!spec
->loopback
.amplist
)
7586 spec
->loopback
.amplist
= alc882_loopbacks
;
7588 codec
->proc_widget_hook
= print_realtek_coef
;
7596 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7597 * configuration. Each pin widget can choose any input DACs and a mixer.
7598 * Each ADC is connected from a mixer of all inputs. This makes possible
7599 * 6-channel independent captures.
7601 * In addition, an independent DAC for the multi-playback (not used in this
7604 #define ALC883_DIGOUT_NID 0x06
7605 #define ALC883_DIGIN_NID 0x0a
7607 #define ALC1200_DIGOUT_NID 0x10
7609 static hda_nid_t alc883_dac_nids
[4] = {
7610 /* front, rear, clfe, rear_surr */
7611 0x02, 0x03, 0x04, 0x05
7614 static hda_nid_t alc883_adc_nids
[2] = {
7619 static hda_nid_t alc883_adc_nids_alt
[1] = {
7624 static hda_nid_t alc883_adc_nids_rev
[2] = {
7629 #define alc889_adc_nids alc880_adc_nids
7631 static hda_nid_t alc883_capsrc_nids
[2] = { 0x23, 0x22 };
7633 static hda_nid_t alc883_capsrc_nids_rev
[2] = { 0x22, 0x23 };
7635 #define alc889_capsrc_nids alc882_capsrc_nids
7638 /* FIXME: should be a matrix-type input source selection */
7640 static struct hda_input_mux alc883_capture_source
= {
7644 { "Front Mic", 0x1 },
7650 static struct hda_input_mux alc883_3stack_6ch_intel
= {
7654 { "Front Mic", 0x0 },
7660 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
7668 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
7678 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
7686 static struct hda_input_mux alc883_lenovo_sky_capture_source
= {
7690 { "Front Mic", 0x1 },
7695 static struct hda_input_mux alc883_asus_eee1601_capture_source
= {
7703 static struct hda_input_mux alc889A_mb31_capture_source
= {
7707 /* Front Mic (0x01) unused */
7709 /* Line 2 (0x03) unused */
7710 /* CD (0x04) unsused? */
7717 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
7724 static struct hda_verb alc883_3ST_ch2_init
[] = {
7725 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7726 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7727 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7728 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7735 static struct hda_verb alc883_3ST_ch4_init
[] = {
7736 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7737 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7738 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7739 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7740 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7747 static struct hda_verb alc883_3ST_ch6_init
[] = {
7748 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7749 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7750 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7751 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7752 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7753 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7757 static struct hda_channel_mode alc883_3ST_6ch_modes
[3] = {
7758 { 2, alc883_3ST_ch2_init
},
7759 { 4, alc883_3ST_ch4_init
},
7760 { 6, alc883_3ST_ch6_init
},
7767 static struct hda_verb alc883_4ST_ch2_init
[] = {
7768 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7769 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7770 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7771 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7772 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7773 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7780 static struct hda_verb alc883_4ST_ch4_init
[] = {
7781 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7782 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7783 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7784 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7785 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7786 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7787 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7794 static struct hda_verb alc883_4ST_ch6_init
[] = {
7795 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7796 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7797 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7798 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7799 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7800 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7801 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7802 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7809 static struct hda_verb alc883_4ST_ch8_init
[] = {
7810 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7811 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7812 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7813 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7814 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7815 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7816 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7817 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7818 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7822 static struct hda_channel_mode alc883_4ST_8ch_modes
[4] = {
7823 { 2, alc883_4ST_ch2_init
},
7824 { 4, alc883_4ST_ch4_init
},
7825 { 6, alc883_4ST_ch6_init
},
7826 { 8, alc883_4ST_ch8_init
},
7833 static struct hda_verb alc883_3ST_ch2_intel_init
[] = {
7834 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7835 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7836 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7837 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7844 static struct hda_verb alc883_3ST_ch4_intel_init
[] = {
7845 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7846 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7849 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7856 static struct hda_verb alc883_3ST_ch6_intel_init
[] = {
7857 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7858 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7859 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7860 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7861 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7862 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7866 static struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
7867 { 2, alc883_3ST_ch2_intel_init
},
7868 { 4, alc883_3ST_ch4_intel_init
},
7869 { 6, alc883_3ST_ch6_intel_init
},
7875 static struct hda_verb alc883_sixstack_ch6_init
[] = {
7876 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7877 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7878 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7879 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7886 static struct hda_verb alc883_sixstack_ch8_init
[] = {
7887 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7888 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7889 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7890 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7894 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
7895 { 6, alc883_sixstack_ch6_init
},
7896 { 8, alc883_sixstack_ch8_init
},
7899 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7900 static struct hda_verb alc889A_mb31_ch2_init
[] = {
7901 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
7902 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
7903 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
7904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
7908 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7909 static struct hda_verb alc889A_mb31_ch4_init
[] = {
7910 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
7911 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
7912 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
7913 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
7917 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7918 static struct hda_verb alc889A_mb31_ch5_init
[] = {
7919 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as rear */
7920 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
7921 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
7922 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
7926 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7927 static struct hda_verb alc889A_mb31_ch6_init
[] = {
7928 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as front */
7929 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Subwoofer off */
7930 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
7931 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
7935 static struct hda_channel_mode alc889A_mb31_6ch_modes
[4] = {
7936 { 2, alc889A_mb31_ch2_init
},
7937 { 4, alc889A_mb31_ch4_init
},
7938 { 5, alc889A_mb31_ch5_init
},
7939 { 6, alc889A_mb31_ch6_init
},
7942 static struct hda_verb alc883_medion_eapd_verbs
[] = {
7943 /* eanable EAPD on medion laptop */
7944 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7945 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
7949 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7950 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7953 static struct snd_kcontrol_new alc883_base_mixer
[] = {
7954 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7955 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7956 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7957 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7958 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7959 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7960 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7961 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7962 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
7963 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
7964 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7965 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7966 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7970 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7971 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7972 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7973 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7974 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7978 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
7979 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7980 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7981 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7982 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7983 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7984 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7985 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7986 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7987 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7989 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7990 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7991 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7995 static struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
7996 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7997 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
7998 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7999 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8001 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8003 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8004 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8005 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8009 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
8010 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8011 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8012 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8013 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8015 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8017 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8018 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8019 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8023 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
8024 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8025 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8026 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8027 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8028 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8029 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8030 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8032 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8034 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8035 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8036 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8040 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
8041 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8042 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8043 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8044 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8045 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8046 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8047 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8048 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8049 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8050 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8051 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8052 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8053 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8054 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8055 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8056 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8057 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8058 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8059 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8063 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
8064 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8065 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8066 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8067 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8068 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8070 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8071 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8072 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8073 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8074 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8075 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8076 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8077 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8079 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
8080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8081 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8082 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT
),
8083 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8087 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
8088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8090 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8091 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8092 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8093 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8094 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8095 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8096 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8097 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8098 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8100 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8102 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8104 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8105 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8106 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8110 static struct snd_kcontrol_new alc883_targa_mixer
[] = {
8111 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8112 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8113 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8114 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8115 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8116 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8117 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8118 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8119 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8120 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8121 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8122 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8123 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8125 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8126 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8130 static struct snd_kcontrol_new alc883_targa_2ch_mixer
[] = {
8131 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8132 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8133 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8134 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8135 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8139 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8140 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8141 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8145 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
8146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8147 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8148 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8149 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8150 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8152 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8153 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8157 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
8158 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8159 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
8160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8161 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8162 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8165 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8166 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8170 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
8171 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8172 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8173 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8174 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8175 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8178 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8179 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8183 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
8184 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8185 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8186 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8187 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8188 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8189 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8190 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8195 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer
[] = {
8196 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8197 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8198 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8199 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT
),
8200 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8201 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8203 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8208 static struct snd_kcontrol_new alc888_lenovo_sky_mixer
[] = {
8209 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8210 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8211 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
8212 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
8213 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8214 0x0d, 1, 0x0, HDA_OUTPUT
),
8215 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
8216 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
8217 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
8218 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8219 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
8220 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8221 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8222 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8223 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8224 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8225 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8226 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8227 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8228 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8229 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8233 static struct snd_kcontrol_new alc889A_mb31_mixer
[] = {
8235 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8236 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8237 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8238 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
8239 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8241 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT
),
8242 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT
),
8243 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT
),
8244 /* Output switches */
8245 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT
),
8246 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT
),
8247 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT
),
8249 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
8250 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
8252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
8253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
8254 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8255 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8259 static struct snd_kcontrol_new alc883_vaiott_mixer
[] = {
8260 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8261 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8262 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8264 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
8265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8269 static struct hda_bind_ctls alc883_bind_cap_vol
= {
8270 .ops
= &snd_hda_bind_vol
,
8272 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
8273 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
8278 static struct hda_bind_ctls alc883_bind_cap_switch
= {
8279 .ops
= &snd_hda_bind_sw
,
8281 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
8282 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
8287 static struct snd_kcontrol_new alc883_asus_eee1601_mixer
[] = {
8288 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8289 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8290 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8291 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8292 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8294 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8295 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8299 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer
[] = {
8300 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol
),
8301 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch
),
8303 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8304 /* .name = "Capture Source", */
8305 .name
= "Input Source",
8307 .info
= alc_mux_enum_info
,
8308 .get
= alc_mux_enum_get
,
8309 .put
= alc_mux_enum_put
,
8314 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
8316 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8317 .name
= "Channel Mode",
8318 .info
= alc_ch_mode_info
,
8319 .get
= alc_ch_mode_get
,
8320 .put
= alc_ch_mode_put
,
8325 static struct hda_verb alc883_init_verbs
[] = {
8326 /* ADC1: mute amp left and right */
8327 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8328 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8329 /* ADC2: mute amp left and right */
8330 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8331 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8332 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8337 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8338 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8339 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8342 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8343 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8345 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8346 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8349 /* mute analog input loopbacks */
8350 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8351 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8352 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8356 /* Front Pin: output 0 (0x0c) */
8357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8358 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8359 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8360 /* Rear Pin: output 1 (0x0d) */
8361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8362 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8363 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8364 /* CLFE Pin: output 2 (0x0e) */
8365 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8366 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8367 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8368 /* Side Pin: output 3 (0x0f) */
8369 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8370 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8371 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8372 /* Mic (rear) pin: input vref at 80% */
8373 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8374 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8375 /* Front Mic pin: input vref at 80% */
8376 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8377 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8378 /* Line In pin: input */
8379 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8380 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8381 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8382 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8383 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8384 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8385 /* CD pin widget for input */
8386 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8388 /* FIXME: use matrix-type input source selection */
8389 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8391 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8397 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8398 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8403 /* toggle speaker-output according to the hp-jack state */
8404 static void alc883_mitac_init_hook(struct hda_codec
*codec
)
8406 struct alc_spec
*spec
= codec
->spec
;
8408 spec
->autocfg
.hp_pins
[0] = 0x15;
8409 spec
->autocfg
.speaker_pins
[0] = 0x14;
8410 spec
->autocfg
.speaker_pins
[1] = 0x17;
8411 alc_automute_amp(codec
);
8414 /* auto-toggle front mic */
8416 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8418 unsigned int present;
8421 present = snd_hda_codec_read(codec, 0x18, 0,
8422 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8423 bits = present ? HDA_AMP_MUTE : 0;
8424 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8428 static struct hda_verb alc883_mitac_verbs
[] = {
8430 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8431 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8433 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
8434 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8436 /* enable unsolicited event */
8437 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8438 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8443 static struct hda_verb alc883_clevo_m720_verbs
[] = {
8445 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8446 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8448 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
8449 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8451 /* enable unsolicited event */
8452 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8453 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
8458 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
8460 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8461 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8463 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8466 /* enable unsolicited event */
8467 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8472 static struct hda_verb alc883_targa_verbs
[] = {
8473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8476 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8477 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8479 /* Connect Line-Out side jack (SPDIF) to Side */
8480 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8481 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8482 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8483 /* Connect Mic jack to CLFE */
8484 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8485 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8486 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
8487 /* Connect Line-in jack to Surround */
8488 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8489 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8490 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
8491 /* Connect HP out jack to Front */
8492 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8493 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8494 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8496 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8501 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
8502 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8503 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
8504 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
8508 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
8509 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8510 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8511 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8516 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
8517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8519 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8520 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
8521 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8525 static struct hda_verb alc883_haier_w66_verbs
[] = {
8526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8531 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8532 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8533 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8534 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8538 static struct hda_verb alc888_lenovo_sky_verbs
[] = {
8539 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8540 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8541 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8542 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8543 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8544 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8545 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8546 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8550 static struct hda_verb alc888_6st_dell_verbs
[] = {
8551 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8555 static struct hda_verb alc883_vaiott_verbs
[] = {
8557 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8560 /* enable unsolicited event */
8561 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8566 static void alc888_3st_hp_init_hook(struct hda_codec
*codec
)
8568 struct alc_spec
*spec
= codec
->spec
;
8570 spec
->autocfg
.hp_pins
[0] = 0x1b;
8571 spec
->autocfg
.speaker_pins
[0] = 0x14;
8572 spec
->autocfg
.speaker_pins
[1] = 0x16;
8573 spec
->autocfg
.speaker_pins
[2] = 0x18;
8574 alc_automute_amp(codec
);
8577 static struct hda_verb alc888_3st_hp_verbs
[] = {
8578 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
8579 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
8580 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
8581 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8588 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
8589 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8590 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8591 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8592 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8599 static struct hda_verb alc888_3st_hp_4ch_init
[] = {
8600 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8601 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8602 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8603 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8604 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8611 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
8612 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8613 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8614 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8615 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8616 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8617 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8621 static struct hda_channel_mode alc888_3st_hp_modes
[3] = {
8622 { 2, alc888_3st_hp_2ch_init
},
8623 { 4, alc888_3st_hp_4ch_init
},
8624 { 6, alc888_3st_hp_6ch_init
},
8627 /* toggle front-jack and RCA according to the hp-jack state */
8628 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
8630 unsigned int present
;
8632 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8633 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8634 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8635 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8636 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8637 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8640 /* toggle RCA according to the front-jack state */
8641 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
8643 unsigned int present
;
8645 present
= snd_hda_codec_read(codec
, 0x14, 0,
8646 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8647 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8648 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8651 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
8654 if ((res
>> 26) == ALC880_HP_EVENT
)
8655 alc888_lenovo_ms7195_front_automute(codec
);
8656 if ((res
>> 26) == ALC880_FRONT_EVENT
)
8657 alc888_lenovo_ms7195_rca_automute(codec
);
8660 static struct hda_verb alc883_medion_md2_verbs
[] = {
8661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8666 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8670 /* toggle speaker-output according to the hp-jack state */
8671 static void alc883_medion_md2_init_hook(struct hda_codec
*codec
)
8673 struct alc_spec
*spec
= codec
->spec
;
8675 spec
->autocfg
.hp_pins
[0] = 0x14;
8676 spec
->autocfg
.speaker_pins
[0] = 0x15;
8677 alc_automute_amp(codec
);
8680 /* toggle speaker-output according to the hp-jack state */
8681 #define alc883_targa_init_hook alc882_targa_init_hook
8682 #define alc883_targa_unsol_event alc882_targa_unsol_event
8684 static void alc883_clevo_m720_mic_automute(struct hda_codec
*codec
)
8686 unsigned int present
;
8688 present
= snd_hda_codec_read(codec
, 0x18, 0,
8689 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8690 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
8691 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8694 static void alc883_clevo_m720_init_hook(struct hda_codec
*codec
)
8696 struct alc_spec
*spec
= codec
->spec
;
8698 spec
->autocfg
.hp_pins
[0] = 0x15;
8699 spec
->autocfg
.speaker_pins
[0] = 0x14;
8700 alc_automute_amp(codec
);
8701 alc883_clevo_m720_mic_automute(codec
);
8704 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
8707 switch (res
>> 26) {
8708 case ALC880_MIC_EVENT
:
8709 alc883_clevo_m720_mic_automute(codec
);
8712 alc_automute_amp_unsol_event(codec
, res
);
8717 /* toggle speaker-output according to the hp-jack state */
8718 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec
*codec
)
8720 struct alc_spec
*spec
= codec
->spec
;
8722 spec
->autocfg
.hp_pins
[0] = 0x14;
8723 spec
->autocfg
.speaker_pins
[0] = 0x15;
8724 alc_automute_amp(codec
);
8727 static void alc883_haier_w66_init_hook(struct hda_codec
*codec
)
8729 struct alc_spec
*spec
= codec
->spec
;
8731 spec
->autocfg
.hp_pins
[0] = 0x1b;
8732 spec
->autocfg
.speaker_pins
[0] = 0x14;
8733 alc_automute_amp(codec
);
8736 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
8738 unsigned int present
;
8741 present
= snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_GET_PIN_SENSE
, 0)
8742 & AC_PINSENSE_PRESENCE
;
8743 bits
= present
? HDA_AMP_MUTE
: 0;
8744 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8745 HDA_AMP_MUTE
, bits
);
8748 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
8750 unsigned int present
;
8753 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8754 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8755 bits
= present
? HDA_AMP_MUTE
: 0;
8756 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8757 HDA_AMP_MUTE
, bits
);
8758 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8759 HDA_AMP_MUTE
, bits
);
8762 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
8765 if ((res
>> 26) == ALC880_HP_EVENT
)
8766 alc883_lenovo_101e_all_automute(codec
);
8767 if ((res
>> 26) == ALC880_FRONT_EVENT
)
8768 alc883_lenovo_101e_ispeaker_automute(codec
);
8771 /* toggle speaker-output according to the hp-jack state */
8772 static void alc883_acer_aspire_init_hook(struct hda_codec
*codec
)
8774 struct alc_spec
*spec
= codec
->spec
;
8776 spec
->autocfg
.hp_pins
[0] = 0x14;
8777 spec
->autocfg
.speaker_pins
[0] = 0x15;
8778 spec
->autocfg
.speaker_pins
[1] = 0x16;
8779 alc_automute_amp(codec
);
8782 static struct hda_verb alc883_acer_eapd_verbs
[] = {
8783 /* HP Pin: output 0 (0x0c) */
8784 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8785 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8786 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8787 /* Front Pin: output 0 (0x0c) */
8788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8789 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8790 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8791 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
8792 /* eanable EAPD on medion laptop */
8793 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8794 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
8795 /* enable unsolicited event */
8796 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8800 static void alc888_6st_dell_init_hook(struct hda_codec
*codec
)
8802 struct alc_spec
*spec
= codec
->spec
;
8804 spec
->autocfg
.hp_pins
[0] = 0x1b;
8805 spec
->autocfg
.speaker_pins
[0] = 0x14;
8806 spec
->autocfg
.speaker_pins
[1] = 0x15;
8807 spec
->autocfg
.speaker_pins
[2] = 0x16;
8808 spec
->autocfg
.speaker_pins
[3] = 0x17;
8809 alc_automute_amp(codec
);
8812 static void alc888_lenovo_sky_init_hook(struct hda_codec
*codec
)
8814 struct alc_spec
*spec
= codec
->spec
;
8816 spec
->autocfg
.hp_pins
[0] = 0x1b;
8817 spec
->autocfg
.speaker_pins
[0] = 0x14;
8818 spec
->autocfg
.speaker_pins
[1] = 0x15;
8819 spec
->autocfg
.speaker_pins
[2] = 0x16;
8820 spec
->autocfg
.speaker_pins
[3] = 0x17;
8821 spec
->autocfg
.speaker_pins
[4] = 0x1a;
8822 alc_automute_amp(codec
);
8825 static void alc883_vaiott_init_hook(struct hda_codec
*codec
)
8827 struct alc_spec
*spec
= codec
->spec
;
8829 spec
->autocfg
.hp_pins
[0] = 0x15;
8830 spec
->autocfg
.speaker_pins
[0] = 0x14;
8831 spec
->autocfg
.speaker_pins
[1] = 0x17;
8832 alc_automute_amp(codec
);
8836 * generic initialization of ADC, input mixers and output mixers
8838 static struct hda_verb alc883_auto_init_verbs
[] = {
8840 * Unmute ADC0-2 and set the default input to mic-in
8842 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8843 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8844 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8845 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8847 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8849 * Note: PASD motherboards uses the Line In 2 as the input for
8850 * front panel mic (mic 2)
8852 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8855 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8860 * Set up output mixers (0x0c - 0x0f)
8862 /* set vol=0 to output mixers */
8863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8864 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8865 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8866 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8867 /* set up input amps for analog loopback */
8868 /* Amp Indices: DAC = 0, mixer = 1 */
8869 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8870 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8871 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8872 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8873 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8874 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8875 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8876 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8877 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8878 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8880 /* FIXME: use matrix-type input source selection */
8881 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8883 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8884 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8885 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8886 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8887 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
8889 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8890 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8891 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8892 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8893 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
8898 static struct hda_verb alc888_asus_m90v_verbs
[] = {
8899 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8900 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8901 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8902 /* enable unsolicited event */
8903 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8904 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
8908 static void alc883_nb_mic_automute(struct hda_codec
*codec
)
8910 unsigned int present
;
8912 present
= snd_hda_codec_read(codec
, 0x18, 0,
8913 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8914 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
8915 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
8916 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
8917 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
8920 static void alc883_M90V_init_hook(struct hda_codec
*codec
)
8922 struct alc_spec
*spec
= codec
->spec
;
8924 spec
->autocfg
.hp_pins
[0] = 0x1b;
8925 spec
->autocfg
.speaker_pins
[0] = 0x14;
8926 spec
->autocfg
.speaker_pins
[1] = 0x15;
8927 spec
->autocfg
.speaker_pins
[2] = 0x16;
8928 alc_automute_pin(codec
);
8931 static void alc883_mode2_unsol_event(struct hda_codec
*codec
,
8934 switch (res
>> 26) {
8935 case ALC880_MIC_EVENT
:
8936 alc883_nb_mic_automute(codec
);
8939 alc_sku_unsol_event(codec
, res
);
8944 static void alc883_mode2_inithook(struct hda_codec
*codec
)
8946 alc883_M90V_init_hook(codec
);
8947 alc883_nb_mic_automute(codec
);
8950 static struct hda_verb alc888_asus_eee1601_verbs
[] = {
8951 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8952 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8954 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8955 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8956 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
8957 {0x20, AC_VERB_SET_PROC_COEF
, 0x0838},
8958 /* enable unsolicited event */
8959 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8963 static void alc883_eee1601_inithook(struct hda_codec
*codec
)
8965 struct alc_spec
*spec
= codec
->spec
;
8967 spec
->autocfg
.hp_pins
[0] = 0x14;
8968 spec
->autocfg
.speaker_pins
[0] = 0x1b;
8969 alc_automute_pin(codec
);
8972 static struct hda_verb alc889A_mb31_verbs
[] = {
8973 /* Init rear pin (used as headphone output) */
8974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4}, /* Apple Headphones */
8975 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Connect to front */
8976 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8977 /* Init line pin (used as output in 4ch and 6ch mode) */
8978 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Connect to CLFE */
8979 /* Init line 2 pin (used as headphone out by default) */
8980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Use as input */
8981 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Mute output */
8985 /* Mute speakers according to the headphone jack state */
8986 static void alc889A_mb31_automute(struct hda_codec
*codec
)
8988 unsigned int present
;
8990 /* Mute only in 2ch or 4ch mode */
8991 if (snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_CONNECT_SEL
, 0)
8993 present
= snd_hda_codec_read(codec
, 0x15, 0,
8994 AC_VERB_GET_PIN_SENSE
, 0) & AC_PINSENSE_PRESENCE
;
8995 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8996 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8997 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
8998 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9002 static void alc889A_mb31_unsol_event(struct hda_codec
*codec
, unsigned int res
)
9004 if ((res
>> 26) == ALC880_HP_EVENT
)
9005 alc889A_mb31_automute(codec
);
9008 #ifdef CONFIG_SND_HDA_POWER_SAVE
9009 #define alc883_loopbacks alc880_loopbacks
9012 /* pcm configuration: identical with ALC880 */
9013 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
9014 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
9015 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
9016 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
9017 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
9020 * configuration and preset
9022 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
9023 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
9024 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
9025 [ALC883_3ST_6ch
] = "3stack-6ch",
9026 [ALC883_6ST_DIG
] = "6stack-dig",
9027 [ALC883_TARGA_DIG
] = "targa-dig",
9028 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
9029 [ALC883_TARGA_8ch_DIG
] = "targa-8ch-dig",
9030 [ALC883_ACER
] = "acer",
9031 [ALC883_ACER_ASPIRE
] = "acer-aspire",
9032 [ALC888_ACER_ASPIRE_4930G
] = "acer-aspire-4930g",
9033 [ALC888_ACER_ASPIRE_6530G
] = "acer-aspire-6530g",
9034 [ALC888_ACER_ASPIRE_8930G
] = "acer-aspire-8930g",
9035 [ALC883_MEDION
] = "medion",
9036 [ALC883_MEDION_MD2
] = "medion-md2",
9037 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
9038 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
9039 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
9040 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
9041 [ALC888_LENOVO_SKY
] = "lenovo-sky",
9042 [ALC883_HAIER_W66
] = "haier-w66",
9043 [ALC888_3ST_HP
] = "3stack-hp",
9044 [ALC888_6ST_DELL
] = "6stack-dell",
9045 [ALC883_MITAC
] = "mitac",
9046 [ALC883_CLEVO_M720
] = "clevo-m720",
9047 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
9048 [ALC888_FUJITSU_XA3530
] = "fujitsu-xa3530",
9049 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
9050 [ALC1200_ASUS_P5Q
] = "asus-p5q",
9051 [ALC889A_MB31
] = "mb31",
9052 [ALC883_SONY_VAIO_TT
] = "sony-vaio-tt",
9053 [ALC883_AUTO
] = "auto",
9056 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
9057 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
9058 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
9059 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE
),
9060 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE
),
9061 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
9062 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
9063 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
9064 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9065 ALC888_ACER_ASPIRE_4930G
),
9066 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9067 ALC888_ACER_ASPIRE_4930G
),
9068 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9069 ALC888_ACER_ASPIRE_8930G
),
9070 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9071 ALC888_ACER_ASPIRE_8930G
),
9072 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO
),
9073 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO
),
9074 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9075 ALC888_ACER_ASPIRE_4930G
),
9076 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9077 ALC888_ACER_ASPIRE_6530G
),
9078 /* default Acer -- disabled as it causes more problems.
9079 * model=auto should work fine now
9081 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9082 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
9083 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
9084 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
9085 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
9086 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
9087 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP
),
9088 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP
),
9089 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V
),
9090 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
9091 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG
),
9092 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q
),
9093 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601
),
9094 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
9095 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
9096 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC
),
9097 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
9098 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
9099 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL
),
9100 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
9101 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG
),
9102 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
9103 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
9104 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
9105 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG
),
9106 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
9107 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
9108 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
9109 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
9110 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
9111 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
9112 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
9113 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
9114 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
9115 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
9116 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
9117 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG
),
9118 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
9119 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
9120 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
9121 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG
),
9122 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
9123 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
9124 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
9125 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG
),
9126 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
9127 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
9128 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
9129 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
9130 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD
),
9131 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
9132 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
9133 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9134 ALC883_FUJITSU_PI2515
),
9135 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9136 ALC888_FUJITSU_XA3530
),
9137 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
9138 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9139 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9140 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9141 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY
),
9142 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
9143 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG
),
9144 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
9145 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
9146 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
9147 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
9148 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC
),
9149 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL
),
9150 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
9151 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT
),
9155 static hda_nid_t alc883_slave_dig_outs
[] = {
9156 ALC1200_DIGOUT_NID
, 0,
9159 static hda_nid_t alc1200_slave_dig_outs
[] = {
9160 ALC883_DIGOUT_NID
, 0,
9163 static struct alc_config_preset alc883_presets
[] = {
9164 [ALC883_3ST_2ch_DIG
] = {
9165 .mixers
= { alc883_3ST_2ch_mixer
},
9166 .init_verbs
= { alc883_init_verbs
},
9167 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9168 .dac_nids
= alc883_dac_nids
,
9169 .dig_out_nid
= ALC883_DIGOUT_NID
,
9170 .dig_in_nid
= ALC883_DIGIN_NID
,
9171 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9172 .channel_mode
= alc883_3ST_2ch_modes
,
9173 .input_mux
= &alc883_capture_source
,
9175 [ALC883_3ST_6ch_DIG
] = {
9176 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9177 .init_verbs
= { alc883_init_verbs
},
9178 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9179 .dac_nids
= alc883_dac_nids
,
9180 .dig_out_nid
= ALC883_DIGOUT_NID
,
9181 .dig_in_nid
= ALC883_DIGIN_NID
,
9182 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9183 .channel_mode
= alc883_3ST_6ch_modes
,
9185 .input_mux
= &alc883_capture_source
,
9187 [ALC883_3ST_6ch
] = {
9188 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9189 .init_verbs
= { alc883_init_verbs
},
9190 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9191 .dac_nids
= alc883_dac_nids
,
9192 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9193 .channel_mode
= alc883_3ST_6ch_modes
,
9195 .input_mux
= &alc883_capture_source
,
9197 [ALC883_3ST_6ch_INTEL
] = {
9198 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
9199 .init_verbs
= { alc883_init_verbs
},
9200 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9201 .dac_nids
= alc883_dac_nids
,
9202 .dig_out_nid
= ALC883_DIGOUT_NID
,
9203 .dig_in_nid
= ALC883_DIGIN_NID
,
9204 .slave_dig_outs
= alc883_slave_dig_outs
,
9205 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
9206 .channel_mode
= alc883_3ST_6ch_intel_modes
,
9208 .input_mux
= &alc883_3stack_6ch_intel
,
9210 [ALC883_6ST_DIG
] = {
9211 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
9212 .init_verbs
= { alc883_init_verbs
},
9213 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9214 .dac_nids
= alc883_dac_nids
,
9215 .dig_out_nid
= ALC883_DIGOUT_NID
,
9216 .dig_in_nid
= ALC883_DIGIN_NID
,
9217 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9218 .channel_mode
= alc883_sixstack_modes
,
9219 .input_mux
= &alc883_capture_source
,
9221 [ALC883_TARGA_DIG
] = {
9222 .mixers
= { alc883_targa_mixer
, alc883_chmode_mixer
},
9223 .init_verbs
= { alc883_init_verbs
, alc883_targa_verbs
},
9224 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9225 .dac_nids
= alc883_dac_nids
,
9226 .dig_out_nid
= ALC883_DIGOUT_NID
,
9227 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9228 .channel_mode
= alc883_3ST_6ch_modes
,
9230 .input_mux
= &alc883_capture_source
,
9231 .unsol_event
= alc883_targa_unsol_event
,
9232 .init_hook
= alc883_targa_init_hook
,
9234 [ALC883_TARGA_2ch_DIG
] = {
9235 .mixers
= { alc883_targa_2ch_mixer
},
9236 .init_verbs
= { alc883_init_verbs
, alc883_targa_verbs
},
9237 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9238 .dac_nids
= alc883_dac_nids
,
9239 .adc_nids
= alc883_adc_nids_alt
,
9240 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
9241 .dig_out_nid
= ALC883_DIGOUT_NID
,
9242 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9243 .channel_mode
= alc883_3ST_2ch_modes
,
9244 .input_mux
= &alc883_capture_source
,
9245 .unsol_event
= alc883_targa_unsol_event
,
9246 .init_hook
= alc883_targa_init_hook
,
9248 [ALC883_TARGA_8ch_DIG
] = {
9249 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
9250 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
9251 alc883_targa_verbs
},
9252 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9253 .dac_nids
= alc883_dac_nids
,
9254 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9255 .adc_nids
= alc883_adc_nids_rev
,
9256 .capsrc_nids
= alc883_capsrc_nids_rev
,
9257 .dig_out_nid
= ALC883_DIGOUT_NID
,
9258 .dig_in_nid
= ALC883_DIGIN_NID
,
9259 .num_channel_mode
= ARRAY_SIZE(alc883_4ST_8ch_modes
),
9260 .channel_mode
= alc883_4ST_8ch_modes
,
9262 .input_mux
= &alc883_capture_source
,
9263 .unsol_event
= alc883_targa_unsol_event
,
9264 .init_hook
= alc883_targa_init_hook
,
9267 .mixers
= { alc883_base_mixer
},
9268 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9269 * and the headphone jack. Turn this on and rely on the
9270 * standard mute methods whenever the user wants to turn
9271 * these outputs off.
9273 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
9274 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9275 .dac_nids
= alc883_dac_nids
,
9276 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9277 .channel_mode
= alc883_3ST_2ch_modes
,
9278 .input_mux
= &alc883_capture_source
,
9280 [ALC883_ACER_ASPIRE
] = {
9281 .mixers
= { alc883_acer_aspire_mixer
},
9282 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
9283 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9284 .dac_nids
= alc883_dac_nids
,
9285 .dig_out_nid
= ALC883_DIGOUT_NID
,
9286 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9287 .channel_mode
= alc883_3ST_2ch_modes
,
9288 .input_mux
= &alc883_capture_source
,
9289 .unsol_event
= alc_automute_amp_unsol_event
,
9290 .init_hook
= alc883_acer_aspire_init_hook
,
9292 [ALC888_ACER_ASPIRE_4930G
] = {
9293 .mixers
= { alc888_base_mixer
,
9294 alc883_chmode_mixer
},
9295 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
9296 alc888_acer_aspire_4930g_verbs
},
9297 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9298 .dac_nids
= alc883_dac_nids
,
9299 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9300 .adc_nids
= alc883_adc_nids_rev
,
9301 .capsrc_nids
= alc883_capsrc_nids_rev
,
9302 .dig_out_nid
= ALC883_DIGOUT_NID
,
9303 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9304 .channel_mode
= alc883_3ST_6ch_modes
,
9307 ARRAY_SIZE(alc888_2_capture_sources
),
9308 .input_mux
= alc888_2_capture_sources
,
9309 .unsol_event
= alc_automute_amp_unsol_event
,
9310 .init_hook
= alc888_acer_aspire_4930g_init_hook
,
9312 [ALC888_ACER_ASPIRE_6530G
] = {
9313 .mixers
= { alc888_acer_aspire_6530_mixer
},
9314 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
9315 alc888_acer_aspire_6530g_verbs
},
9316 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9317 .dac_nids
= alc883_dac_nids
,
9318 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9319 .adc_nids
= alc883_adc_nids_rev
,
9320 .capsrc_nids
= alc883_capsrc_nids_rev
,
9321 .dig_out_nid
= ALC883_DIGOUT_NID
,
9322 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9323 .channel_mode
= alc883_3ST_2ch_modes
,
9325 ARRAY_SIZE(alc888_2_capture_sources
),
9326 .input_mux
= alc888_acer_aspire_6530_sources
,
9327 .unsol_event
= alc_automute_amp_unsol_event
,
9328 .init_hook
= alc888_acer_aspire_4930g_init_hook
,
9330 [ALC888_ACER_ASPIRE_8930G
] = {
9331 .mixers
= { alc888_base_mixer
,
9332 alc883_chmode_mixer
},
9333 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
9334 alc889_acer_aspire_8930g_verbs
},
9335 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9336 .dac_nids
= alc883_dac_nids
,
9337 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
9338 .adc_nids
= alc889_adc_nids
,
9339 .capsrc_nids
= alc889_capsrc_nids
,
9340 .dig_out_nid
= ALC883_DIGOUT_NID
,
9341 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9342 .channel_mode
= alc883_3ST_6ch_modes
,
9344 .const_channel_count
= 6,
9346 ARRAY_SIZE(alc889_capture_sources
),
9347 .input_mux
= alc889_capture_sources
,
9348 .unsol_event
= alc_automute_amp_unsol_event
,
9349 .init_hook
= alc889_acer_aspire_8930g_init_hook
,
9352 .mixers
= { alc883_fivestack_mixer
,
9353 alc883_chmode_mixer
},
9354 .init_verbs
= { alc883_init_verbs
,
9355 alc883_medion_eapd_verbs
},
9356 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9357 .dac_nids
= alc883_dac_nids
,
9358 .adc_nids
= alc883_adc_nids_alt
,
9359 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
9360 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9361 .channel_mode
= alc883_sixstack_modes
,
9362 .input_mux
= &alc883_capture_source
,
9364 [ALC883_MEDION_MD2
] = {
9365 .mixers
= { alc883_medion_md2_mixer
},
9366 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
9367 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9368 .dac_nids
= alc883_dac_nids
,
9369 .dig_out_nid
= ALC883_DIGOUT_NID
,
9370 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9371 .channel_mode
= alc883_3ST_2ch_modes
,
9372 .input_mux
= &alc883_capture_source
,
9373 .unsol_event
= alc_automute_amp_unsol_event
,
9374 .init_hook
= alc883_medion_md2_init_hook
,
9376 [ALC883_LAPTOP_EAPD
] = {
9377 .mixers
= { alc883_base_mixer
},
9378 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
9379 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9380 .dac_nids
= alc883_dac_nids
,
9381 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9382 .channel_mode
= alc883_3ST_2ch_modes
,
9383 .input_mux
= &alc883_capture_source
,
9385 [ALC883_CLEVO_M720
] = {
9386 .mixers
= { alc883_clevo_m720_mixer
},
9387 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
9388 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9389 .dac_nids
= alc883_dac_nids
,
9390 .dig_out_nid
= ALC883_DIGOUT_NID
,
9391 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9392 .channel_mode
= alc883_3ST_2ch_modes
,
9393 .input_mux
= &alc883_capture_source
,
9394 .unsol_event
= alc883_clevo_m720_unsol_event
,
9395 .init_hook
= alc883_clevo_m720_init_hook
,
9397 [ALC883_LENOVO_101E_2ch
] = {
9398 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
9399 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
9400 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9401 .dac_nids
= alc883_dac_nids
,
9402 .adc_nids
= alc883_adc_nids_alt
,
9403 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
9404 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9405 .channel_mode
= alc883_3ST_2ch_modes
,
9406 .input_mux
= &alc883_lenovo_101e_capture_source
,
9407 .unsol_event
= alc883_lenovo_101e_unsol_event
,
9408 .init_hook
= alc883_lenovo_101e_all_automute
,
9410 [ALC883_LENOVO_NB0763
] = {
9411 .mixers
= { alc883_lenovo_nb0763_mixer
},
9412 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
9413 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9414 .dac_nids
= alc883_dac_nids
,
9415 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9416 .channel_mode
= alc883_3ST_2ch_modes
,
9418 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
9419 .unsol_event
= alc_automute_amp_unsol_event
,
9420 .init_hook
= alc883_medion_md2_init_hook
,
9422 [ALC888_LENOVO_MS7195_DIG
] = {
9423 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9424 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
9425 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9426 .dac_nids
= alc883_dac_nids
,
9427 .dig_out_nid
= ALC883_DIGOUT_NID
,
9428 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9429 .channel_mode
= alc883_3ST_6ch_modes
,
9431 .input_mux
= &alc883_capture_source
,
9432 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
9433 .init_hook
= alc888_lenovo_ms7195_front_automute
,
9435 [ALC883_HAIER_W66
] = {
9436 .mixers
= { alc883_targa_2ch_mixer
},
9437 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
9438 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9439 .dac_nids
= alc883_dac_nids
,
9440 .dig_out_nid
= ALC883_DIGOUT_NID
,
9441 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9442 .channel_mode
= alc883_3ST_2ch_modes
,
9443 .input_mux
= &alc883_capture_source
,
9444 .unsol_event
= alc_automute_amp_unsol_event
,
9445 .init_hook
= alc883_haier_w66_init_hook
,
9448 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9449 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
9450 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9451 .dac_nids
= alc883_dac_nids
,
9452 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
9453 .channel_mode
= alc888_3st_hp_modes
,
9455 .input_mux
= &alc883_capture_source
,
9456 .unsol_event
= alc_automute_amp_unsol_event
,
9457 .init_hook
= alc888_3st_hp_init_hook
,
9459 [ALC888_6ST_DELL
] = {
9460 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
9461 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
9462 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9463 .dac_nids
= alc883_dac_nids
,
9464 .dig_out_nid
= ALC883_DIGOUT_NID
,
9465 .dig_in_nid
= ALC883_DIGIN_NID
,
9466 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9467 .channel_mode
= alc883_sixstack_modes
,
9468 .input_mux
= &alc883_capture_source
,
9469 .unsol_event
= alc_automute_amp_unsol_event
,
9470 .init_hook
= alc888_6st_dell_init_hook
,
9473 .mixers
= { alc883_mitac_mixer
},
9474 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
9475 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9476 .dac_nids
= alc883_dac_nids
,
9477 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9478 .channel_mode
= alc883_3ST_2ch_modes
,
9479 .input_mux
= &alc883_capture_source
,
9480 .unsol_event
= alc_automute_amp_unsol_event
,
9481 .init_hook
= alc883_mitac_init_hook
,
9483 [ALC883_FUJITSU_PI2515
] = {
9484 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
9485 .init_verbs
= { alc883_init_verbs
,
9486 alc883_2ch_fujitsu_pi2515_verbs
},
9487 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9488 .dac_nids
= alc883_dac_nids
,
9489 .dig_out_nid
= ALC883_DIGOUT_NID
,
9490 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9491 .channel_mode
= alc883_3ST_2ch_modes
,
9492 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
9493 .unsol_event
= alc_automute_amp_unsol_event
,
9494 .init_hook
= alc883_2ch_fujitsu_pi2515_init_hook
,
9496 [ALC888_FUJITSU_XA3530
] = {
9497 .mixers
= { alc888_base_mixer
, alc883_chmode_mixer
},
9498 .init_verbs
= { alc883_init_verbs
,
9499 alc888_fujitsu_xa3530_verbs
},
9500 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9501 .dac_nids
= alc883_dac_nids
,
9502 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9503 .adc_nids
= alc883_adc_nids_rev
,
9504 .capsrc_nids
= alc883_capsrc_nids_rev
,
9505 .dig_out_nid
= ALC883_DIGOUT_NID
,
9506 .num_channel_mode
= ARRAY_SIZE(alc888_4ST_8ch_intel_modes
),
9507 .channel_mode
= alc888_4ST_8ch_intel_modes
,
9509 ARRAY_SIZE(alc888_2_capture_sources
),
9510 .input_mux
= alc888_2_capture_sources
,
9511 .unsol_event
= alc_automute_amp_unsol_event
,
9512 .init_hook
= alc888_fujitsu_xa3530_init_hook
,
9514 [ALC888_LENOVO_SKY
] = {
9515 .mixers
= { alc888_lenovo_sky_mixer
, alc883_chmode_mixer
},
9516 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_sky_verbs
},
9517 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9518 .dac_nids
= alc883_dac_nids
,
9519 .dig_out_nid
= ALC883_DIGOUT_NID
,
9520 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9521 .channel_mode
= alc883_sixstack_modes
,
9523 .input_mux
= &alc883_lenovo_sky_capture_source
,
9524 .unsol_event
= alc_automute_amp_unsol_event
,
9525 .init_hook
= alc888_lenovo_sky_init_hook
,
9527 [ALC888_ASUS_M90V
] = {
9528 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9529 .init_verbs
= { alc883_init_verbs
, alc888_asus_m90v_verbs
},
9530 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9531 .dac_nids
= alc883_dac_nids
,
9532 .dig_out_nid
= ALC883_DIGOUT_NID
,
9533 .dig_in_nid
= ALC883_DIGIN_NID
,
9534 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9535 .channel_mode
= alc883_3ST_6ch_modes
,
9537 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
9538 .unsol_event
= alc883_mode2_unsol_event
,
9539 .init_hook
= alc883_mode2_inithook
,
9541 [ALC888_ASUS_EEE1601
] = {
9542 .mixers
= { alc883_asus_eee1601_mixer
},
9543 .cap_mixer
= alc883_asus_eee1601_cap_mixer
,
9544 .init_verbs
= { alc883_init_verbs
, alc888_asus_eee1601_verbs
},
9545 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9546 .dac_nids
= alc883_dac_nids
,
9547 .dig_out_nid
= ALC883_DIGOUT_NID
,
9548 .dig_in_nid
= ALC883_DIGIN_NID
,
9549 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9550 .channel_mode
= alc883_3ST_2ch_modes
,
9552 .input_mux
= &alc883_asus_eee1601_capture_source
,
9553 .unsol_event
= alc_sku_unsol_event
,
9554 .init_hook
= alc883_eee1601_inithook
,
9556 [ALC1200_ASUS_P5Q
] = {
9557 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
9558 .init_verbs
= { alc883_init_verbs
},
9559 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9560 .dac_nids
= alc883_dac_nids
,
9561 .dig_out_nid
= ALC1200_DIGOUT_NID
,
9562 .dig_in_nid
= ALC883_DIGIN_NID
,
9563 .slave_dig_outs
= alc1200_slave_dig_outs
,
9564 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9565 .channel_mode
= alc883_sixstack_modes
,
9566 .input_mux
= &alc883_capture_source
,
9569 .mixers
= { alc889A_mb31_mixer
, alc883_chmode_mixer
},
9570 .init_verbs
= { alc883_init_verbs
, alc889A_mb31_verbs
,
9571 alc880_gpio1_init_verbs
},
9572 .adc_nids
= alc883_adc_nids
,
9573 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
9574 .dac_nids
= alc883_dac_nids
,
9575 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9576 .channel_mode
= alc889A_mb31_6ch_modes
,
9577 .num_channel_mode
= ARRAY_SIZE(alc889A_mb31_6ch_modes
),
9578 .input_mux
= &alc889A_mb31_capture_source
,
9579 .dig_out_nid
= ALC883_DIGOUT_NID
,
9580 .unsol_event
= alc889A_mb31_unsol_event
,
9581 .init_hook
= alc889A_mb31_automute
,
9583 [ALC883_SONY_VAIO_TT
] = {
9584 .mixers
= { alc883_vaiott_mixer
},
9585 .init_verbs
= { alc883_init_verbs
, alc883_vaiott_verbs
},
9586 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9587 .dac_nids
= alc883_dac_nids
,
9588 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9589 .channel_mode
= alc883_3ST_2ch_modes
,
9590 .input_mux
= &alc883_capture_source
,
9591 .unsol_event
= alc_automute_amp_unsol_event
,
9592 .init_hook
= alc883_vaiott_init_hook
,
9598 * BIOS auto configuration
9600 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
9601 hda_nid_t nid
, int pin_type
,
9605 struct alc_spec
*spec
= codec
->spec
;
9608 alc_set_pin_output(codec
, nid
, pin_type
);
9609 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
9612 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
9613 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
9617 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
9619 struct alc_spec
*spec
= codec
->spec
;
9622 for (i
= 0; i
<= HDA_SIDE
; i
++) {
9623 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
9624 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
9626 alc883_auto_set_output_and_unmute(codec
, nid
, pin_type
,
9631 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
9633 struct alc_spec
*spec
= codec
->spec
;
9636 pin
= spec
->autocfg
.hp_pins
[0];
9637 if (pin
) /* connect to front */
9639 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
9640 pin
= spec
->autocfg
.speaker_pins
[0];
9642 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
9645 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9646 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9648 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
9650 struct alc_spec
*spec
= codec
->spec
;
9653 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
9654 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
9655 if (alc883_is_input_pin(nid
)) {
9656 alc_set_input_pin(codec
, nid
, i
);
9657 if (nid
!= ALC883_PIN_CD_NID
&&
9658 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
9659 snd_hda_codec_write(codec
, nid
, 0,
9660 AC_VERB_SET_AMP_GAIN_MUTE
,
9666 #define alc883_auto_init_input_src alc882_auto_init_input_src
9668 /* almost identical with ALC880 parser... */
9669 static int alc883_parse_auto_config(struct hda_codec
*codec
)
9671 struct alc_spec
*spec
= codec
->spec
;
9672 int err
= alc880_parse_auto_config(codec
);
9673 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
9679 return 0; /* no config found */
9681 err
= alc_auto_add_mic_boost(codec
);
9685 /* hack - override the init verbs */
9686 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
9688 /* setup input_mux for ALC889 */
9689 if (codec
->vendor_id
== 0x10ec0889) {
9690 /* digital-mic input pin is excluded in alc880_auto_create..()
9691 * because it's under 0x18
9693 if (cfg
->input_pins
[AUTO_PIN_MIC
] == 0x12 ||
9694 cfg
->input_pins
[AUTO_PIN_FRONT_MIC
] == 0x12) {
9695 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
9696 for (i
= 1; i
< 3; i
++)
9697 memcpy(&spec
->private_imux
[i
],
9698 &spec
->private_imux
[0],
9699 sizeof(spec
->private_imux
[0]));
9700 imux
->items
[imux
->num_items
].label
= "Int DMic";
9701 imux
->items
[imux
->num_items
].index
= 0x0b;
9703 spec
->num_mux_defs
= 3;
9704 spec
->input_mux
= spec
->private_imux
;
9708 return 1; /* config found */
9711 /* additional initialization for auto-configuration model */
9712 static void alc883_auto_init(struct hda_codec
*codec
)
9714 struct alc_spec
*spec
= codec
->spec
;
9715 alc883_auto_init_multi_out(codec
);
9716 alc883_auto_init_hp_out(codec
);
9717 alc883_auto_init_analog_input(codec
);
9718 alc883_auto_init_input_src(codec
);
9719 if (spec
->unsol_event
)
9720 alc_inithook(codec
);
9723 static int patch_alc883(struct hda_codec
*codec
)
9725 struct alc_spec
*spec
;
9726 int err
, board_config
;
9728 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
9734 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
9736 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
9739 if (board_config
< 0 || board_config
>= ALC883_MODEL_LAST
) {
9740 /* Pick up systems that don't supply PCI SSID */
9741 switch (codec
->subsystem_id
) {
9742 case 0x106b3600: /* Macbook 3.1 */
9743 board_config
= ALC889A_MB31
;
9747 "hda_codec: Unknown model for %s, trying "
9748 "auto-probe from BIOS...\n", codec
->chip_name
);
9749 board_config
= ALC883_AUTO
;
9753 if (board_config
== ALC883_AUTO
) {
9754 /* automatic parse from the BIOS config */
9755 err
= alc883_parse_auto_config(codec
);
9761 "hda_codec: Cannot set up configuration "
9762 "from BIOS. Using base mode...\n");
9763 board_config
= ALC883_3ST_2ch_DIG
;
9767 err
= snd_hda_attach_beep_device(codec
, 0x1);
9773 if (board_config
!= ALC883_AUTO
)
9774 setup_preset(spec
, &alc883_presets
[board_config
]);
9776 switch (codec
->vendor_id
) {
9778 if (!spec
->num_adc_nids
) {
9779 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
9780 spec
->adc_nids
= alc883_adc_nids
;
9782 if (!spec
->capsrc_nids
)
9783 spec
->capsrc_nids
= alc883_capsrc_nids
;
9784 spec
->capture_style
= CAPT_MIX
; /* matrix-style capture */
9785 spec
->init_amp
= ALC_INIT_DEFAULT
; /* always initialize */
9788 if (!spec
->num_adc_nids
) {
9789 spec
->num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
);
9790 spec
->adc_nids
= alc889_adc_nids
;
9792 if (!spec
->capsrc_nids
)
9793 spec
->capsrc_nids
= alc889_capsrc_nids
;
9794 spec
->capture_style
= CAPT_1MUX_MIX
; /* 1mux/Nmix-style
9798 if (!spec
->num_adc_nids
) {
9799 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
9800 spec
->adc_nids
= alc883_adc_nids
;
9802 if (!spec
->capsrc_nids
)
9803 spec
->capsrc_nids
= alc883_capsrc_nids
;
9804 spec
->capture_style
= CAPT_MIX
; /* matrix-style capture */
9808 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
9809 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
9810 spec
->stream_analog_alt_capture
= &alc883_pcm_analog_alt_capture
;
9812 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
9813 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
9815 if (!spec
->cap_mixer
)
9816 set_capture_mixer(spec
);
9817 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
9819 spec
->vmaster_nid
= 0x0c;
9821 codec
->patch_ops
= alc_patch_ops
;
9822 if (board_config
== ALC883_AUTO
)
9823 spec
->init_hook
= alc883_auto_init
;
9825 #ifdef CONFIG_SND_HDA_POWER_SAVE
9826 if (!spec
->loopback
.amplist
)
9827 spec
->loopback
.amplist
= alc883_loopbacks
;
9829 codec
->proc_widget_hook
= print_realtek_coef
;
9838 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9839 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9841 #define alc262_dac_nids alc260_dac_nids
9842 #define alc262_adc_nids alc882_adc_nids
9843 #define alc262_adc_nids_alt alc882_adc_nids_alt
9844 #define alc262_capsrc_nids alc882_capsrc_nids
9845 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9847 #define alc262_modes alc260_modes
9848 #define alc262_capture_source alc882_capture_source
9850 static hda_nid_t alc262_dmic_adc_nids
[1] = {
9855 static hda_nid_t alc262_dmic_capsrc_nids
[1] = { 0x22 };
9857 static struct snd_kcontrol_new alc262_base_mixer
[] = {
9858 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9859 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9860 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9861 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9862 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9863 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9864 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9865 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9866 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9867 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9868 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9869 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9870 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
9871 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9872 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9873 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
9877 /* update HP, line and mono-out pins according to the master switch */
9878 static void alc262_hp_master_update(struct hda_codec
*codec
)
9880 struct alc_spec
*spec
= codec
->spec
;
9881 int val
= spec
->master_sw
;
9884 snd_hda_codec_write_cache(codec
, 0x1b, 0,
9885 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9887 snd_hda_codec_write_cache(codec
, 0x15, 0,
9888 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9890 /* mono (speaker) depending on the HP jack sense */
9891 val
= val
&& !spec
->jack_present
;
9892 snd_hda_codec_write_cache(codec
, 0x16, 0,
9893 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9897 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
9899 struct alc_spec
*spec
= codec
->spec
;
9900 unsigned int presence
;
9901 presence
= snd_hda_codec_read(codec
, 0x1b, 0,
9902 AC_VERB_GET_PIN_SENSE
, 0);
9903 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
9904 alc262_hp_master_update(codec
);
9907 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
9909 if ((res
>> 26) != ALC880_HP_EVENT
)
9911 alc262_hp_bpc_automute(codec
);
9914 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
9916 struct alc_spec
*spec
= codec
->spec
;
9917 unsigned int presence
;
9918 presence
= snd_hda_codec_read(codec
, 0x15, 0,
9919 AC_VERB_GET_PIN_SENSE
, 0);
9920 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
9921 alc262_hp_master_update(codec
);
9924 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
9927 if ((res
>> 26) != ALC880_HP_EVENT
)
9929 alc262_hp_wildwest_automute(codec
);
9932 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9934 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
9935 struct snd_ctl_elem_value
*ucontrol
)
9937 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9938 struct alc_spec
*spec
= codec
->spec
;
9939 int val
= !!*ucontrol
->value
.integer
.value
;
9941 if (val
== spec
->master_sw
)
9943 spec
->master_sw
= val
;
9944 alc262_hp_master_update(codec
);
9948 #define ALC262_HP_MASTER_SWITCH \
9950 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9951 .name = "Master Playback Switch", \
9952 .info = snd_ctl_boolean_mono_info, \
9953 .get = alc262_hp_master_sw_get, \
9954 .put = alc262_hp_master_sw_put, \
9957 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
9958 ALC262_HP_MASTER_SWITCH
,
9959 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9960 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9961 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9962 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9964 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9966 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9967 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9968 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9969 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9970 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9971 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9972 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9973 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9974 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9975 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9976 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
9977 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
9981 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
9982 ALC262_HP_MASTER_SWITCH
,
9983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9984 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9985 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9986 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9987 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9989 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9991 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9992 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9993 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
9994 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9995 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9996 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9997 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10001 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
10002 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10003 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10004 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
10008 /* mute/unmute internal speaker according to the hp jack and mute state */
10009 static void alc262_hp_t5735_init_hook(struct hda_codec
*codec
)
10011 struct alc_spec
*spec
= codec
->spec
;
10013 spec
->autocfg
.hp_pins
[0] = 0x15;
10014 spec
->autocfg
.speaker_pins
[0] = 0x0c; /* HACK: not actually a pin */
10015 alc_automute_amp(codec
);
10018 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
10019 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10020 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10021 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
10022 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10024 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10025 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10029 static struct hda_verb alc262_hp_t5735_verbs
[] = {
10030 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10031 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10033 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10037 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
10038 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10039 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10040 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
10041 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
10042 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10043 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10047 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
10048 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10049 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10050 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10052 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10053 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10054 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
10055 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
10056 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
10057 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
10061 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
10068 /* bind hp and internal speaker mute (with plug check) as master switch */
10069 static void alc262_hippo_master_update(struct hda_codec
*codec
)
10071 struct alc_spec
*spec
= codec
->spec
;
10072 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
10073 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
10074 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
10078 mute
= spec
->master_sw
? 0 : HDA_AMP_MUTE
;
10079 snd_hda_codec_amp_stereo(codec
, hp_nid
, HDA_OUTPUT
, 0,
10080 HDA_AMP_MUTE
, mute
);
10081 /* mute internal speaker per jack sense */
10082 if (spec
->jack_present
)
10083 mute
= HDA_AMP_MUTE
;
10085 snd_hda_codec_amp_stereo(codec
, line_nid
, HDA_OUTPUT
, 0,
10086 HDA_AMP_MUTE
, mute
);
10087 if (speaker_nid
&& speaker_nid
!= line_nid
)
10088 snd_hda_codec_amp_stereo(codec
, speaker_nid
, HDA_OUTPUT
, 0,
10089 HDA_AMP_MUTE
, mute
);
10092 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10094 static int alc262_hippo_master_sw_put(struct snd_kcontrol
*kcontrol
,
10095 struct snd_ctl_elem_value
*ucontrol
)
10097 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10098 struct alc_spec
*spec
= codec
->spec
;
10099 int val
= !!*ucontrol
->value
.integer
.value
;
10101 if (val
== spec
->master_sw
)
10103 spec
->master_sw
= val
;
10104 alc262_hippo_master_update(codec
);
10108 #define ALC262_HIPPO_MASTER_SWITCH \
10110 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10111 .name = "Master Playback Switch", \
10112 .info = snd_ctl_boolean_mono_info, \
10113 .get = alc262_hippo_master_sw_get, \
10114 .put = alc262_hippo_master_sw_put, \
10117 static struct snd_kcontrol_new alc262_hippo_mixer
[] = {
10118 ALC262_HIPPO_MASTER_SWITCH
,
10119 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10120 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10121 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10122 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10123 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10126 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10127 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10128 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10129 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10130 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
10134 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
10135 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10136 ALC262_HIPPO_MASTER_SWITCH
,
10137 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10138 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10139 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10140 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10143 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10144 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10145 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10146 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10150 /* mute/unmute internal speaker according to the hp jack and mute state */
10151 static void alc262_hippo_automute(struct hda_codec
*codec
)
10153 struct alc_spec
*spec
= codec
->spec
;
10154 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
10155 unsigned int present
;
10157 /* need to execute and sync at first */
10158 snd_hda_codec_read(codec
, hp_nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
10159 present
= snd_hda_codec_read(codec
, hp_nid
, 0,
10160 AC_VERB_GET_PIN_SENSE
, 0);
10161 spec
->jack_present
= (present
& 0x80000000) != 0;
10162 alc262_hippo_master_update(codec
);
10165 static void alc262_hippo_unsol_event(struct hda_codec
*codec
, unsigned int res
)
10167 if ((res
>> 26) != ALC880_HP_EVENT
)
10169 alc262_hippo_automute(codec
);
10172 static void alc262_hippo_init_hook(struct hda_codec
*codec
)
10174 struct alc_spec
*spec
= codec
->spec
;
10176 spec
->autocfg
.hp_pins
[0] = 0x15;
10177 spec
->autocfg
.speaker_pins
[0] = 0x14;
10178 alc262_hippo_automute(codec
);
10181 static void alc262_hippo1_init_hook(struct hda_codec
*codec
)
10183 struct alc_spec
*spec
= codec
->spec
;
10185 spec
->autocfg
.hp_pins
[0] = 0x1b;
10186 spec
->autocfg
.speaker_pins
[0] = 0x14;
10187 alc262_hippo_automute(codec
);
10191 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
10192 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10193 ALC262_HIPPO_MASTER_SWITCH
,
10194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10195 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10196 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10197 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10201 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
10202 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10203 ALC262_HIPPO_MASTER_SWITCH
,
10204 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10206 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10207 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10208 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10212 static struct snd_kcontrol_new alc262_tyan_mixer
[] = {
10213 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10214 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
10215 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT
),
10216 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT
),
10217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10220 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10221 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10222 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10223 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10224 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10228 static struct hda_verb alc262_tyan_verbs
[] = {
10229 /* Headphone automute */
10230 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10231 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10232 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10234 /* P11 AUX_IN, white 4-pin connector */
10235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10236 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
, 0xe1},
10237 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
, 0x93},
10238 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
, 0x19},
10243 /* unsolicited event for HP jack sensing */
10244 static void alc262_tyan_init_hook(struct hda_codec
*codec
)
10246 struct alc_spec
*spec
= codec
->spec
;
10248 spec
->autocfg
.hp_pins
[0] = 0x1b;
10249 spec
->autocfg
.speaker_pins
[0] = 0x15;
10250 alc_automute_amp(codec
);
10254 #define alc262_capture_mixer alc882_capture_mixer
10255 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10258 * generic initialization of ADC, input mixers and output mixers
10260 static struct hda_verb alc262_init_verbs
[] = {
10262 * Unmute ADC0-2 and set the default input to mic-in
10264 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10265 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10266 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10268 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10269 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10271 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10273 * Note: PASD motherboards uses the Line In 2 as the input for
10274 * front panel mic (mic 2)
10276 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10277 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10278 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10279 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10280 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10281 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10284 * Set up output mixers (0x0c - 0x0e)
10286 /* set vol=0 to output mixers */
10287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10288 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10290 /* set up input amps for analog loopback */
10291 /* Amp Indices: DAC = 0, mixer = 1 */
10292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10295 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10296 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10299 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
10300 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
10301 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
10302 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10303 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10304 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10306 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10307 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10308 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10309 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10310 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10312 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
10313 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
10315 /* FIXME: use matrix-type input source selection */
10316 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10317 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10318 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10320 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10321 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10323 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10324 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10325 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10336 static struct hda_verb alc262_eapd_verbs
[] = {
10337 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10338 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10342 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
10343 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10348 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
10349 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
10350 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10351 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10353 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10354 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10358 static struct hda_verb alc262_sony_unsol_verbs
[] = {
10359 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
10360 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10361 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
10363 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10364 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10368 static struct hda_input_mux alc262_dmic_capture_source
= {
10371 { "Int DMic", 0x9 },
10376 static struct snd_kcontrol_new alc262_toshiba_s06_mixer
[] = {
10377 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10378 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10379 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10380 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10381 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10385 static struct hda_verb alc262_toshiba_s06_verbs
[] = {
10386 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10387 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10388 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10389 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10390 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x09},
10391 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10392 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
10393 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10397 static void alc262_dmic_automute(struct hda_codec
*codec
)
10399 unsigned int present
;
10401 present
= snd_hda_codec_read(codec
, 0x18, 0,
10402 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10403 snd_hda_codec_write(codec
, 0x22, 0,
10404 AC_VERB_SET_CONNECT_SEL
, present
? 0x0 : 0x09);
10408 /* unsolicited event for HP jack sensing */
10409 static void alc262_toshiba_s06_unsol_event(struct hda_codec
*codec
,
10412 if ((res
>> 26) == ALC880_MIC_EVENT
)
10413 alc262_dmic_automute(codec
);
10415 alc_sku_unsol_event(codec
, res
);
10418 static void alc262_toshiba_s06_init_hook(struct hda_codec
*codec
)
10420 struct alc_spec
*spec
= codec
->spec
;
10422 spec
->autocfg
.hp_pins
[0] = 0x15;
10423 spec
->autocfg
.speaker_pins
[0] = 0x14;
10424 alc_automute_pin(codec
);
10425 alc262_dmic_automute(codec
);
10431 * 0x16 = internal speaker
10432 * 0x18 = external mic
10435 static struct snd_kcontrol_new alc262_nec_mixer
[] = {
10436 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
10437 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
10439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10441 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10443 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
10444 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10448 static struct hda_verb alc262_nec_verbs
[] = {
10449 /* Unmute Speaker */
10450 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10453 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10456 /* External mic to headphone */
10457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10458 /* External mic to speaker */
10459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10465 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10466 * 0x1b = port replicator headphone out
10469 #define ALC_HP_EVENT 0x37
10471 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
10472 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
10473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10474 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
10475 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10479 static struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
10480 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
10481 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10485 static struct hda_input_mux alc262_fujitsu_capture_source
= {
10489 { "Int Mic", 0x1 },
10494 static struct hda_input_mux alc262_HP_capture_source
= {
10498 { "Front Mic", 0x1 },
10505 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
10509 { "Front Mic", 0x2 },
10515 /* mute/unmute internal speaker according to the hp jacks and mute state */
10516 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
10518 struct alc_spec
*spec
= codec
->spec
;
10521 if (force
|| !spec
->sense_updated
) {
10522 unsigned int present
;
10523 /* need to execute and sync at first */
10524 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
10525 /* check laptop HP jack */
10526 present
= snd_hda_codec_read(codec
, 0x14, 0,
10527 AC_VERB_GET_PIN_SENSE
, 0);
10528 /* need to execute and sync at first */
10529 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
10530 /* check docking HP jack */
10531 present
|= snd_hda_codec_read(codec
, 0x1b, 0,
10532 AC_VERB_GET_PIN_SENSE
, 0);
10533 if (present
& AC_PINSENSE_PRESENCE
)
10534 spec
->jack_present
= 1;
10536 spec
->jack_present
= 0;
10537 spec
->sense_updated
= 1;
10539 /* unmute internal speaker only if both HPs are unplugged and
10540 * master switch is on
10542 if (spec
->jack_present
)
10543 mute
= HDA_AMP_MUTE
;
10545 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
10546 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
10547 HDA_AMP_MUTE
, mute
);
10550 /* unsolicited event for HP jack sensing */
10551 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
10554 if ((res
>> 26) != ALC_HP_EVENT
)
10556 alc262_fujitsu_automute(codec
, 1);
10559 static void alc262_fujitsu_init_hook(struct hda_codec
*codec
)
10561 alc262_fujitsu_automute(codec
, 1);
10564 /* bind volumes of both NID 0x0c and 0x0d */
10565 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
10566 .ops
= &snd_hda_bind_vol
,
10568 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
10569 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
10574 /* mute/unmute internal speaker according to the hp jack and mute state */
10575 static void alc262_lenovo_3000_automute(struct hda_codec
*codec
, int force
)
10577 struct alc_spec
*spec
= codec
->spec
;
10580 if (force
|| !spec
->sense_updated
) {
10581 unsigned int present_int_hp
;
10582 /* need to execute and sync at first */
10583 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
10584 present_int_hp
= snd_hda_codec_read(codec
, 0x1b, 0,
10585 AC_VERB_GET_PIN_SENSE
, 0);
10586 spec
->jack_present
= (present_int_hp
& 0x80000000) != 0;
10587 spec
->sense_updated
= 1;
10589 if (spec
->jack_present
) {
10590 /* mute internal speaker */
10591 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10592 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
10593 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
10594 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
10596 /* unmute internal speaker if necessary */
10597 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
10598 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10599 HDA_AMP_MUTE
, mute
);
10600 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
10601 HDA_AMP_MUTE
, mute
);
10605 /* unsolicited event for HP jack sensing */
10606 static void alc262_lenovo_3000_unsol_event(struct hda_codec
*codec
,
10609 if ((res
>> 26) != ALC_HP_EVENT
)
10611 alc262_lenovo_3000_automute(codec
, 1);
10614 /* bind hp and internal speaker mute (with plug check) */
10615 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
10616 struct snd_ctl_elem_value
*ucontrol
)
10618 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10619 long *valp
= ucontrol
->value
.integer
.value
;
10622 change
= snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10624 valp
? 0 : HDA_AMP_MUTE
);
10625 change
|= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
10627 valp
? 0 : HDA_AMP_MUTE
);
10630 alc262_fujitsu_automute(codec
, 0);
10634 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
10635 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
10637 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10638 .name
= "Master Playback Switch",
10639 .info
= snd_hda_mixer_amp_switch_info
,
10640 .get
= snd_hda_mixer_amp_switch_get
,
10641 .put
= alc262_fujitsu_master_sw_put
,
10642 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
10644 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10645 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10646 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10649 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
10650 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10651 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10655 /* bind hp and internal speaker mute (with plug check) */
10656 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol
*kcontrol
,
10657 struct snd_ctl_elem_value
*ucontrol
)
10659 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10660 long *valp
= ucontrol
->value
.integer
.value
;
10663 change
= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
10665 valp
? 0 : HDA_AMP_MUTE
);
10668 alc262_lenovo_3000_automute(codec
, 0);
10672 static struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
10673 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
10675 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10676 .name
= "Master Playback Switch",
10677 .info
= snd_hda_mixer_amp_switch_info
,
10678 .get
= snd_hda_mixer_amp_switch_get
,
10679 .put
= alc262_lenovo_3000_master_sw_put
,
10680 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
10682 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10683 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10684 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10687 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
10688 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10689 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10693 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer
[] = {
10694 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
10695 ALC262_HIPPO_MASTER_SWITCH
,
10696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10698 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10699 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10700 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10701 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10705 /* additional init verbs for Benq laptops */
10706 static struct hda_verb alc262_EAPD_verbs
[] = {
10707 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
10708 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
10712 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
10713 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10714 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10716 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
10717 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
10721 /* Samsung Q1 Ultra Vista model setup */
10722 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
10723 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10724 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
10725 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10726 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10727 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
10728 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT
),
10732 static struct hda_verb alc262_ultra_verbs
[] = {
10734 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10735 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10738 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10739 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10740 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10741 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
10743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10745 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10746 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10747 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10750 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10751 /* ADC, choose mic */
10752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10753 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10754 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10755 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10756 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10757 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10758 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
10759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
10760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
10761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
10765 /* mute/unmute internal speaker according to the hp jack and mute state */
10766 static void alc262_ultra_automute(struct hda_codec
*codec
)
10768 struct alc_spec
*spec
= codec
->spec
;
10772 /* auto-mute only when HP is used as HP */
10773 if (!spec
->cur_mux
[0]) {
10774 unsigned int present
;
10775 /* need to execute and sync at first */
10776 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
10777 present
= snd_hda_codec_read(codec
, 0x15, 0,
10778 AC_VERB_GET_PIN_SENSE
, 0);
10779 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
10780 if (spec
->jack_present
)
10781 mute
= HDA_AMP_MUTE
;
10783 /* mute/unmute internal speaker */
10784 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10785 HDA_AMP_MUTE
, mute
);
10786 /* mute/unmute HP */
10787 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
10788 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
10791 /* unsolicited event for HP jack sensing */
10792 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
10795 if ((res
>> 26) != ALC880_HP_EVENT
)
10797 alc262_ultra_automute(codec
);
10800 static struct hda_input_mux alc262_ultra_capture_source
= {
10804 { "Headphone", 0x7 },
10808 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
10809 struct snd_ctl_elem_value
*ucontrol
)
10811 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10812 struct alc_spec
*spec
= codec
->spec
;
10815 ret
= alc_mux_enum_put(kcontrol
, ucontrol
);
10818 /* reprogram the HP pin as mic or HP according to the input source */
10819 snd_hda_codec_write_cache(codec
, 0x15, 0,
10820 AC_VERB_SET_PIN_WIDGET_CONTROL
,
10821 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
10822 alc262_ultra_automute(codec
); /* mute/unmute HP */
10826 static struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
10827 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
10828 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
10830 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10831 .name
= "Capture Source",
10832 .info
= alc_mux_enum_info
,
10833 .get
= alc_mux_enum_get
,
10834 .put
= alc262_ultra_mux_enum_put
,
10839 /* add playback controls from the parsed DAC table */
10840 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
10841 const struct auto_pin_cfg
*cfg
)
10846 spec
->multiout
.num_dacs
= 1; /* only use one dac */
10847 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
10848 spec
->multiout
.dac_nids
[0] = 2;
10850 nid
= cfg
->line_out_pins
[0];
10852 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10853 "Front Playback Volume",
10854 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
));
10857 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10858 "Front Playback Switch",
10859 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
10864 nid
= cfg
->speaker_pins
[0];
10867 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10868 "Speaker Playback Volume",
10869 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10873 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10874 "Speaker Playback Switch",
10875 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
10880 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10881 "Speaker Playback Switch",
10882 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
10888 nid
= cfg
->hp_pins
[0];
10890 /* spec->multiout.hp_nid = 2; */
10892 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10893 "Headphone Playback Volume",
10894 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10898 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10899 "Headphone Playback Switch",
10900 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
10905 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10906 "Headphone Playback Switch",
10907 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
10916 /* identical with ALC880 */
10917 #define alc262_auto_create_analog_input_ctls \
10918 alc880_auto_create_analog_input_ctls
10921 * generic initialization of ADC, input mixers and output mixers
10923 static struct hda_verb alc262_volume_init_verbs
[] = {
10925 * Unmute ADC0-2 and set the default input to mic-in
10927 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10929 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10930 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10931 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10932 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10934 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10936 * Note: PASD motherboards uses the Line In 2 as the input for
10937 * front panel mic (mic 2)
10939 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10940 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10941 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10942 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10943 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10944 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10947 * Set up output mixers (0x0c - 0x0f)
10949 /* set vol=0 to output mixers */
10950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10951 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10952 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10954 /* set up input amps for analog loopback */
10955 /* Amp Indices: DAC = 0, mixer = 1 */
10956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10958 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10959 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10960 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10961 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10963 /* FIXME: use matrix-type input source selection */
10964 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10965 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10966 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10967 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10968 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10969 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10971 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10972 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10973 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10974 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10976 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10977 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10984 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
10986 * Unmute ADC0-2 and set the default input to mic-in
10988 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10989 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10990 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10991 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10992 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10993 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10995 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10997 * Note: PASD motherboards uses the Line In 2 as the input for
10998 * front panel mic (mic 2)
11000 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
11007 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
11010 * Set up output mixers (0x0c - 0x0e)
11012 /* set vol=0 to output mixers */
11013 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11014 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11015 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11017 /* set up input amps for analog loopback */
11018 /* Amp Indices: DAC = 0, mixer = 1 */
11019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11021 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11022 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11023 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11024 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11026 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11027 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11028 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11030 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11033 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11034 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11037 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11038 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11039 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11040 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11042 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11043 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11044 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11045 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11046 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11047 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11050 /* FIXME: use matrix-type input source selection */
11051 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11052 /* Input mixer1: only unmute Mic */
11053 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11054 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
11055 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11056 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11057 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11058 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
11059 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
11060 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
11061 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
11063 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11064 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
11065 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11066 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11067 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11068 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
11069 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
11070 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
11071 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
11073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11074 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
11075 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11076 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
11079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
11080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
11081 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
11083 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11088 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
11090 * Unmute ADC0-2 and set the default input to mic-in
11092 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11093 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11094 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11095 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11096 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11097 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11099 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11101 * Note: PASD motherboards uses the Line In 2 as the input for front
11102 * panel mic (mic 2)
11104 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11105 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11106 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
11111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
11112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
11114 * Set up output mixers (0x0c - 0x0e)
11116 /* set vol=0 to output mixers */
11117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11118 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11119 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11121 /* set up input amps for analog loopback */
11122 /* Amp Indices: DAC = 0, mixer = 1 */
11123 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11124 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11125 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11126 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11127 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11128 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11131 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
11132 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
11133 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
11134 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
11135 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
11136 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
11137 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
11139 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11140 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11142 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11143 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11145 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11146 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11147 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11148 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
11149 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11150 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11152 /* FIXME: use matrix-type input source selection */
11153 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11154 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11155 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11156 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
11157 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
11158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
11159 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
11160 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11161 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
11163 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11164 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11165 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
11166 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
11167 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
11168 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11169 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
11171 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11172 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11173 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
11174 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
11175 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
11176 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
11179 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11184 static struct hda_verb alc262_toshiba_rx1_unsol_verbs
[] = {
11186 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Front Speaker */
11187 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11188 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
11190 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* MIC jack */
11191 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
11192 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
11193 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
11195 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP jack */
11196 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11197 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11202 #ifdef CONFIG_SND_HDA_POWER_SAVE
11203 #define alc262_loopbacks alc880_loopbacks
11206 /* pcm configuration: identical with ALC880 */
11207 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11208 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11209 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11210 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11213 * BIOS auto configuration
11215 static int alc262_parse_auto_config(struct hda_codec
*codec
)
11217 struct alc_spec
*spec
= codec
->spec
;
11219 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
11221 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11225 if (!spec
->autocfg
.line_outs
) {
11226 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
11227 spec
->multiout
.max_channels
= 2;
11228 spec
->no_analog
= 1;
11231 return 0; /* can't find valid BIOS pin config */
11233 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11236 err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
11240 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
11243 if (spec
->autocfg
.dig_outs
) {
11244 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
11245 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
11247 if (spec
->autocfg
.dig_in_pin
)
11248 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
11250 if (spec
->kctls
.list
)
11251 add_mixer(spec
, spec
->kctls
.list
);
11253 add_verb(spec
, alc262_volume_init_verbs
);
11254 spec
->num_mux_defs
= 1;
11255 spec
->input_mux
= &spec
->private_imux
[0];
11257 err
= alc_auto_add_mic_boost(codec
);
11261 alc_ssid_check(codec
, 0x15, 0x14, 0x1b);
11266 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11267 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11268 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11269 #define alc262_auto_init_input_src alc882_auto_init_input_src
11272 /* init callback for auto-configuration model -- overriding the default init */
11273 static void alc262_auto_init(struct hda_codec
*codec
)
11275 struct alc_spec
*spec
= codec
->spec
;
11276 alc262_auto_init_multi_out(codec
);
11277 alc262_auto_init_hp_out(codec
);
11278 alc262_auto_init_analog_input(codec
);
11279 alc262_auto_init_input_src(codec
);
11280 if (spec
->unsol_event
)
11281 alc_inithook(codec
);
11285 * configuration and preset
11287 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
11288 [ALC262_BASIC
] = "basic",
11289 [ALC262_HIPPO
] = "hippo",
11290 [ALC262_HIPPO_1
] = "hippo_1",
11291 [ALC262_FUJITSU
] = "fujitsu",
11292 [ALC262_HP_BPC
] = "hp-bpc",
11293 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
11294 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
11295 [ALC262_HP_RP5700
] = "hp-rp5700",
11296 [ALC262_BENQ_ED8
] = "benq",
11297 [ALC262_BENQ_T31
] = "benq-t31",
11298 [ALC262_SONY_ASSAMD
] = "sony-assamd",
11299 [ALC262_TOSHIBA_S06
] = "toshiba-s06",
11300 [ALC262_TOSHIBA_RX1
] = "toshiba-rx1",
11301 [ALC262_ULTRA
] = "ultra",
11302 [ALC262_LENOVO_3000
] = "lenovo-3000",
11303 [ALC262_NEC
] = "nec",
11304 [ALC262_TYAN
] = "tyan",
11305 [ALC262_AUTO
] = "auto",
11308 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
11309 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
11310 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
11311 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11313 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11315 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11317 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
11318 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
11319 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
11320 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
11321 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
11322 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
11323 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
11324 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
11325 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
11326 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
11327 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
11328 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11329 ALC262_HP_TC_T5735
),
11330 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
11331 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
11332 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
11333 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
11334 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO
), /* dig-only */
11335 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11336 ALC262_SONY_ASSAMD
),
11337 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11338 ALC262_TOSHIBA_RX1
),
11339 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06
),
11340 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
11341 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
11342 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN
),
11343 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11345 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO
),
11346 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
11347 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
11348 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
11349 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
11353 static struct alc_config_preset alc262_presets
[] = {
11355 .mixers
= { alc262_base_mixer
},
11356 .init_verbs
= { alc262_init_verbs
},
11357 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11358 .dac_nids
= alc262_dac_nids
,
11360 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11361 .channel_mode
= alc262_modes
,
11362 .input_mux
= &alc262_capture_source
,
11365 .mixers
= { alc262_hippo_mixer
},
11366 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
11367 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11368 .dac_nids
= alc262_dac_nids
,
11370 .dig_out_nid
= ALC262_DIGOUT_NID
,
11371 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11372 .channel_mode
= alc262_modes
,
11373 .input_mux
= &alc262_capture_source
,
11374 .unsol_event
= alc262_hippo_unsol_event
,
11375 .init_hook
= alc262_hippo_init_hook
,
11377 [ALC262_HIPPO_1
] = {
11378 .mixers
= { alc262_hippo1_mixer
},
11379 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
11380 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11381 .dac_nids
= alc262_dac_nids
,
11383 .dig_out_nid
= ALC262_DIGOUT_NID
,
11384 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11385 .channel_mode
= alc262_modes
,
11386 .input_mux
= &alc262_capture_source
,
11387 .unsol_event
= alc262_hippo_unsol_event
,
11388 .init_hook
= alc262_hippo1_init_hook
,
11390 [ALC262_FUJITSU
] = {
11391 .mixers
= { alc262_fujitsu_mixer
},
11392 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
11393 alc262_fujitsu_unsol_verbs
},
11394 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11395 .dac_nids
= alc262_dac_nids
,
11397 .dig_out_nid
= ALC262_DIGOUT_NID
,
11398 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11399 .channel_mode
= alc262_modes
,
11400 .input_mux
= &alc262_fujitsu_capture_source
,
11401 .unsol_event
= alc262_fujitsu_unsol_event
,
11402 .init_hook
= alc262_fujitsu_init_hook
,
11404 [ALC262_HP_BPC
] = {
11405 .mixers
= { alc262_HP_BPC_mixer
},
11406 .init_verbs
= { alc262_HP_BPC_init_verbs
},
11407 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11408 .dac_nids
= alc262_dac_nids
,
11410 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11411 .channel_mode
= alc262_modes
,
11412 .input_mux
= &alc262_HP_capture_source
,
11413 .unsol_event
= alc262_hp_bpc_unsol_event
,
11414 .init_hook
= alc262_hp_bpc_automute
,
11416 [ALC262_HP_BPC_D7000_WF
] = {
11417 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
11418 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
11419 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11420 .dac_nids
= alc262_dac_nids
,
11422 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11423 .channel_mode
= alc262_modes
,
11424 .input_mux
= &alc262_HP_D7000_capture_source
,
11425 .unsol_event
= alc262_hp_wildwest_unsol_event
,
11426 .init_hook
= alc262_hp_wildwest_automute
,
11428 [ALC262_HP_BPC_D7000_WL
] = {
11429 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
11430 alc262_HP_BPC_WildWest_option_mixer
},
11431 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
11432 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11433 .dac_nids
= alc262_dac_nids
,
11435 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11436 .channel_mode
= alc262_modes
,
11437 .input_mux
= &alc262_HP_D7000_capture_source
,
11438 .unsol_event
= alc262_hp_wildwest_unsol_event
,
11439 .init_hook
= alc262_hp_wildwest_automute
,
11441 [ALC262_HP_TC_T5735
] = {
11442 .mixers
= { alc262_hp_t5735_mixer
},
11443 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
11444 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11445 .dac_nids
= alc262_dac_nids
,
11447 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11448 .channel_mode
= alc262_modes
,
11449 .input_mux
= &alc262_capture_source
,
11450 .unsol_event
= alc_automute_amp_unsol_event
,
11451 .init_hook
= alc262_hp_t5735_init_hook
,
11453 [ALC262_HP_RP5700
] = {
11454 .mixers
= { alc262_hp_rp5700_mixer
},
11455 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
11456 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11457 .dac_nids
= alc262_dac_nids
,
11458 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11459 .channel_mode
= alc262_modes
,
11460 .input_mux
= &alc262_hp_rp5700_capture_source
,
11462 [ALC262_BENQ_ED8
] = {
11463 .mixers
= { alc262_base_mixer
},
11464 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
11465 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11466 .dac_nids
= alc262_dac_nids
,
11468 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11469 .channel_mode
= alc262_modes
,
11470 .input_mux
= &alc262_capture_source
,
11472 [ALC262_SONY_ASSAMD
] = {
11473 .mixers
= { alc262_sony_mixer
},
11474 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
11475 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11476 .dac_nids
= alc262_dac_nids
,
11478 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11479 .channel_mode
= alc262_modes
,
11480 .input_mux
= &alc262_capture_source
,
11481 .unsol_event
= alc262_hippo_unsol_event
,
11482 .init_hook
= alc262_hippo_init_hook
,
11484 [ALC262_BENQ_T31
] = {
11485 .mixers
= { alc262_benq_t31_mixer
},
11486 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
, alc262_hippo_unsol_verbs
},
11487 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11488 .dac_nids
= alc262_dac_nids
,
11490 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11491 .channel_mode
= alc262_modes
,
11492 .input_mux
= &alc262_capture_source
,
11493 .unsol_event
= alc262_hippo_unsol_event
,
11494 .init_hook
= alc262_hippo_init_hook
,
11497 .mixers
= { alc262_ultra_mixer
},
11498 .cap_mixer
= alc262_ultra_capture_mixer
,
11499 .init_verbs
= { alc262_ultra_verbs
},
11500 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11501 .dac_nids
= alc262_dac_nids
,
11502 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11503 .channel_mode
= alc262_modes
,
11504 .input_mux
= &alc262_ultra_capture_source
,
11505 .adc_nids
= alc262_adc_nids
, /* ADC0 */
11506 .capsrc_nids
= alc262_capsrc_nids
,
11507 .num_adc_nids
= 1, /* single ADC */
11508 .unsol_event
= alc262_ultra_unsol_event
,
11509 .init_hook
= alc262_ultra_automute
,
11511 [ALC262_LENOVO_3000
] = {
11512 .mixers
= { alc262_lenovo_3000_mixer
},
11513 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
11514 alc262_lenovo_3000_unsol_verbs
},
11515 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11516 .dac_nids
= alc262_dac_nids
,
11518 .dig_out_nid
= ALC262_DIGOUT_NID
,
11519 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11520 .channel_mode
= alc262_modes
,
11521 .input_mux
= &alc262_fujitsu_capture_source
,
11522 .unsol_event
= alc262_lenovo_3000_unsol_event
,
11525 .mixers
= { alc262_nec_mixer
},
11526 .init_verbs
= { alc262_nec_verbs
},
11527 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11528 .dac_nids
= alc262_dac_nids
,
11530 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11531 .channel_mode
= alc262_modes
,
11532 .input_mux
= &alc262_capture_source
,
11534 [ALC262_TOSHIBA_S06
] = {
11535 .mixers
= { alc262_toshiba_s06_mixer
},
11536 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_s06_verbs
,
11537 alc262_eapd_verbs
},
11538 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11539 .capsrc_nids
= alc262_dmic_capsrc_nids
,
11540 .dac_nids
= alc262_dac_nids
,
11541 .adc_nids
= alc262_dmic_adc_nids
, /* ADC0 */
11542 .num_adc_nids
= 1, /* single ADC */
11543 .dig_out_nid
= ALC262_DIGOUT_NID
,
11544 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11545 .channel_mode
= alc262_modes
,
11546 .input_mux
= &alc262_dmic_capture_source
,
11547 .unsol_event
= alc262_toshiba_s06_unsol_event
,
11548 .init_hook
= alc262_toshiba_s06_init_hook
,
11550 [ALC262_TOSHIBA_RX1
] = {
11551 .mixers
= { alc262_toshiba_rx1_mixer
},
11552 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_rx1_unsol_verbs
},
11553 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11554 .dac_nids
= alc262_dac_nids
,
11556 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11557 .channel_mode
= alc262_modes
,
11558 .input_mux
= &alc262_capture_source
,
11559 .unsol_event
= alc262_hippo_unsol_event
,
11560 .init_hook
= alc262_hippo_init_hook
,
11563 .mixers
= { alc262_tyan_mixer
},
11564 .init_verbs
= { alc262_init_verbs
, alc262_tyan_verbs
},
11565 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11566 .dac_nids
= alc262_dac_nids
,
11568 .dig_out_nid
= ALC262_DIGOUT_NID
,
11569 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11570 .channel_mode
= alc262_modes
,
11571 .input_mux
= &alc262_capture_source
,
11572 .unsol_event
= alc_automute_amp_unsol_event
,
11573 .init_hook
= alc262_tyan_init_hook
,
11577 static int patch_alc262(struct hda_codec
*codec
)
11579 struct alc_spec
*spec
;
11583 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
11587 codec
->spec
= spec
;
11589 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11594 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
11595 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
11596 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
11597 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
11601 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
11603 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
11607 if (board_config
< 0) {
11608 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
11609 "trying auto-probe from BIOS...\n", codec
->chip_name
);
11610 board_config
= ALC262_AUTO
;
11613 if (board_config
== ALC262_AUTO
) {
11614 /* automatic parse from the BIOS config */
11615 err
= alc262_parse_auto_config(codec
);
11621 "hda_codec: Cannot set up configuration "
11622 "from BIOS. Using base mode...\n");
11623 board_config
= ALC262_BASIC
;
11627 if (!spec
->no_analog
) {
11628 err
= snd_hda_attach_beep_device(codec
, 0x1);
11635 if (board_config
!= ALC262_AUTO
)
11636 setup_preset(spec
, &alc262_presets
[board_config
]);
11638 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
11639 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
11641 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
11642 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
11644 spec
->capture_style
= CAPT_MIX
;
11645 if (!spec
->adc_nids
&& spec
->input_mux
) {
11646 /* check whether NID 0x07 is valid */
11647 unsigned int wcap
= get_wcaps(codec
, 0x07);
11650 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
11651 if (wcap
!= AC_WID_AUD_IN
) {
11652 spec
->adc_nids
= alc262_adc_nids_alt
;
11653 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
11654 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
11656 spec
->adc_nids
= alc262_adc_nids
;
11657 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
11658 spec
->capsrc_nids
= alc262_capsrc_nids
;
11661 if (!spec
->cap_mixer
&& !spec
->no_analog
)
11662 set_capture_mixer(spec
);
11663 if (!spec
->no_analog
)
11664 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
11666 spec
->vmaster_nid
= 0x0c;
11668 codec
->patch_ops
= alc_patch_ops
;
11669 if (board_config
== ALC262_AUTO
)
11670 spec
->init_hook
= alc262_auto_init
;
11671 #ifdef CONFIG_SND_HDA_POWER_SAVE
11672 if (!spec
->loopback
.amplist
)
11673 spec
->loopback
.amplist
= alc262_loopbacks
;
11675 codec
->proc_widget_hook
= print_realtek_coef
;
11681 * ALC268 channel source setting (2 channel)
11683 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11684 #define alc268_modes alc260_modes
11686 static hda_nid_t alc268_dac_nids
[2] = {
11691 static hda_nid_t alc268_adc_nids
[2] = {
11696 static hda_nid_t alc268_adc_nids_alt
[1] = {
11701 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
11703 static struct snd_kcontrol_new alc268_base_mixer
[] = {
11704 /* output mixer control */
11705 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
11706 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11707 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
11708 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11709 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11710 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
11711 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
11715 static struct snd_kcontrol_new alc268_toshiba_mixer
[] = {
11716 /* output mixer control */
11717 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
11718 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
11719 ALC262_HIPPO_MASTER_SWITCH
,
11720 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11721 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
11722 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
11726 /* bind Beep switches of both NID 0x0f and 0x10 */
11727 static struct hda_bind_ctls alc268_bind_beep_sw
= {
11728 .ops
= &snd_hda_bind_sw
,
11730 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
11731 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
11736 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
11737 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
11738 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
11742 static struct hda_verb alc268_eapd_verbs
[] = {
11743 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11744 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11748 /* Toshiba specific */
11749 static struct hda_verb alc268_toshiba_verbs
[] = {
11750 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11754 static struct hda_input_mux alc268_acer_lc_capture_source
= {
11762 /* Acer specific */
11763 /* bind volumes of both NID 0x02 and 0x03 */
11764 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
11765 .ops
= &snd_hda_bind_vol
,
11767 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
11768 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
11773 /* mute/unmute internal speaker according to the hp jack and mute state */
11774 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
11776 struct alc_spec
*spec
= codec
->spec
;
11779 if (force
|| !spec
->sense_updated
) {
11780 unsigned int present
;
11781 present
= snd_hda_codec_read(codec
, 0x14, 0,
11782 AC_VERB_GET_PIN_SENSE
, 0);
11783 spec
->jack_present
= (present
& 0x80000000) != 0;
11784 spec
->sense_updated
= 1;
11786 if (spec
->jack_present
)
11787 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
11788 else /* unmute internal speaker if necessary */
11789 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
11790 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
11791 HDA_AMP_MUTE
, mute
);
11795 /* bind hp and internal speaker mute (with plug check) */
11796 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
11797 struct snd_ctl_elem_value
*ucontrol
)
11799 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11800 long *valp
= ucontrol
->value
.integer
.value
;
11803 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
11805 valp
[0] ? 0 : HDA_AMP_MUTE
);
11806 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
11808 valp
[1] ? 0 : HDA_AMP_MUTE
);
11810 alc268_acer_automute(codec
, 0);
11814 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer
[] = {
11815 /* output mixer control */
11816 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
11818 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11819 .name
= "Master Playback Switch",
11820 .info
= snd_hda_mixer_amp_switch_info
,
11821 .get
= snd_hda_mixer_amp_switch_get
,
11822 .put
= alc268_acer_master_sw_put
,
11823 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11825 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT
),
11829 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
11830 /* output mixer control */
11831 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
11833 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11834 .name
= "Master Playback Switch",
11835 .info
= snd_hda_mixer_amp_switch_info
,
11836 .get
= snd_hda_mixer_amp_switch_get
,
11837 .put
= alc268_acer_master_sw_put
,
11838 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11840 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11841 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
11842 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
11846 static struct snd_kcontrol_new alc268_acer_dmic_mixer
[] = {
11847 /* output mixer control */
11848 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
11850 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11851 .name
= "Master Playback Switch",
11852 .info
= snd_hda_mixer_amp_switch_info
,
11853 .get
= snd_hda_mixer_amp_switch_get
,
11854 .put
= alc268_acer_master_sw_put
,
11855 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11857 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11858 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
11862 static struct hda_verb alc268_acer_aspire_one_verbs
[] = {
11863 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11865 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11867 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x06},
11868 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, 0xa017},
11872 static struct hda_verb alc268_acer_verbs
[] = {
11873 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
11874 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11877 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11878 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11879 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11883 /* unsolicited event for HP jack sensing */
11884 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11885 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11887 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
11890 if ((res
>> 26) != ALC880_HP_EVENT
)
11892 alc268_acer_automute(codec
, 1);
11895 static void alc268_acer_init_hook(struct hda_codec
*codec
)
11897 alc268_acer_automute(codec
, 1);
11900 /* toggle speaker-output according to the hp-jack state */
11901 static void alc268_aspire_one_speaker_automute(struct hda_codec
*codec
)
11903 unsigned int present
;
11904 unsigned char bits
;
11906 present
= snd_hda_codec_read(codec
, 0x15, 0,
11907 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11908 bits
= present
? AMP_IN_MUTE(0) : 0;
11909 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 0,
11910 AMP_IN_MUTE(0), bits
);
11911 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 1,
11912 AMP_IN_MUTE(0), bits
);
11916 static void alc268_acer_mic_automute(struct hda_codec
*codec
)
11918 unsigned int present
;
11920 present
= snd_hda_codec_read(codec
, 0x18, 0,
11921 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11922 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_CONNECT_SEL
,
11923 present
? 0x0 : 0x6);
11926 static void alc268_acer_lc_unsol_event(struct hda_codec
*codec
,
11929 if ((res
>> 26) == ALC880_HP_EVENT
)
11930 alc268_aspire_one_speaker_automute(codec
);
11931 if ((res
>> 26) == ALC880_MIC_EVENT
)
11932 alc268_acer_mic_automute(codec
);
11935 static void alc268_acer_lc_init_hook(struct hda_codec
*codec
)
11937 alc268_aspire_one_speaker_automute(codec
);
11938 alc268_acer_mic_automute(codec
);
11941 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
11942 /* output mixer control */
11943 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11944 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11945 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
11946 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11947 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11948 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
11952 static struct hda_verb alc268_dell_verbs
[] = {
11953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11954 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11955 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11959 /* mute/unmute internal speaker according to the hp jack and mute state */
11960 static void alc268_dell_init_hook(struct hda_codec
*codec
)
11962 struct alc_spec
*spec
= codec
->spec
;
11964 spec
->autocfg
.hp_pins
[0] = 0x15;
11965 spec
->autocfg
.speaker_pins
[0] = 0x14;
11966 alc_automute_pin(codec
);
11969 static struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
11970 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
11971 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11972 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
11973 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11974 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
11975 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
11976 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
11977 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
11981 static struct hda_verb alc267_quanta_il1_verbs
[] = {
11982 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11983 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
11987 static void alc267_quanta_il1_mic_automute(struct hda_codec
*codec
)
11989 unsigned int present
;
11991 present
= snd_hda_codec_read(codec
, 0x18, 0,
11992 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11993 snd_hda_codec_write(codec
, 0x23, 0,
11994 AC_VERB_SET_CONNECT_SEL
,
11995 present
? 0x00 : 0x01);
11998 static void alc267_quanta_il1_init_hook(struct hda_codec
*codec
)
12000 struct alc_spec
*spec
= codec
->spec
;
12002 spec
->autocfg
.hp_pins
[0] = 0x15;
12003 spec
->autocfg
.speaker_pins
[0] = 0x14;
12004 alc_automute_pin(codec
);
12005 alc267_quanta_il1_mic_automute(codec
);
12008 static void alc267_quanta_il1_unsol_event(struct hda_codec
*codec
,
12011 switch (res
>> 26) {
12012 case ALC880_MIC_EVENT
:
12013 alc267_quanta_il1_mic_automute(codec
);
12016 alc_sku_unsol_event(codec
, res
);
12022 * generic initialization of ADC, input mixers and output mixers
12024 static struct hda_verb alc268_base_init_verbs
[] = {
12025 /* Unmute DAC0-1 and set vol = 0 */
12026 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12027 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12030 * Set up output mixers (0x0c - 0x0e)
12032 /* set vol=0 to output mixers */
12033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12034 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
12036 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12037 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12039 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
12040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
12041 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
12042 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12043 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12044 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12045 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12046 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12048 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12049 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12050 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12051 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12052 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12054 /* set PCBEEP vol = 0, mute connections */
12055 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12056 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12057 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12059 /* Unmute Selector 23h,24h and set the default input to mic-in */
12061 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
12062 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12063 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
12064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12070 * generic initialization of ADC, input mixers and output mixers
12072 static struct hda_verb alc268_volume_init_verbs
[] = {
12073 /* set output DAC */
12074 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12075 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12077 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12078 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12079 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12080 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12081 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12083 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12084 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12085 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12087 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12088 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12090 /* set PCBEEP vol = 0, mute connections */
12091 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12092 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12093 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12098 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
12099 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12100 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
12102 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12103 /* The multiple "Capture Source" controls confuse alsamixer
12104 * So call somewhat different..
12106 /* .name = "Capture Source", */
12107 .name
= "Input Source",
12109 .info
= alc_mux_enum_info
,
12110 .get
= alc_mux_enum_get
,
12111 .put
= alc_mux_enum_put
,
12116 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
12117 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12118 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
12119 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
12120 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
12122 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12123 /* The multiple "Capture Source" controls confuse alsamixer
12124 * So call somewhat different..
12126 /* .name = "Capture Source", */
12127 .name
= "Input Source",
12129 .info
= alc_mux_enum_info
,
12130 .get
= alc_mux_enum_get
,
12131 .put
= alc_mux_enum_put
,
12136 static struct hda_input_mux alc268_capture_source
= {
12140 { "Front Mic", 0x1 },
12146 static struct hda_input_mux alc268_acer_capture_source
= {
12150 { "Internal Mic", 0x1 },
12155 static struct hda_input_mux alc268_acer_dmic_capture_source
= {
12159 { "Internal Mic", 0x6 },
12164 #ifdef CONFIG_SND_DEBUG
12165 static struct snd_kcontrol_new alc268_test_mixer
[] = {
12166 /* Volume widgets */
12167 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12168 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12169 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
12170 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
12171 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
12172 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
12173 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
12174 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
12175 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
12176 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
12177 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
12178 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
12179 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
12180 /* The below appears problematic on some hardwares */
12181 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12182 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12183 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
12184 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
12185 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
12187 /* Modes for retasking pin widgets */
12188 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
12189 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
12190 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
12191 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
12193 /* Controls for GPIO pins, assuming they are configured as outputs */
12194 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12195 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12196 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12197 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12199 /* Switches to allow the digital SPDIF output pin to be enabled.
12200 * The ALC268 does not have an SPDIF input.
12202 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12204 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12205 * this output to turn on an external amplifier.
12207 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12208 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12214 /* create input playback/capture controls for the given pin */
12215 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
12216 const char *ctlname
, int idx
)
12221 sprintf(name
, "%s Playback Volume", ctlname
);
12223 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
12224 HDA_COMPOSE_AMP_VAL(0x02, 3, idx
,
12228 } else if (nid
== 0x15) {
12229 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
12230 HDA_COMPOSE_AMP_VAL(0x03, 3, idx
,
12236 sprintf(name
, "%s Playback Switch", ctlname
);
12237 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
12238 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
12244 /* add playback controls from the parsed DAC table */
12245 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12246 const struct auto_pin_cfg
*cfg
)
12251 spec
->multiout
.num_dacs
= 2; /* only use one dac */
12252 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
12253 spec
->multiout
.dac_nids
[0] = 2;
12254 spec
->multiout
.dac_nids
[1] = 3;
12256 nid
= cfg
->line_out_pins
[0];
12258 alc268_new_analog_output(spec
, nid
, "Front", 0);
12260 nid
= cfg
->speaker_pins
[0];
12262 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12263 "Speaker Playback Volume",
12264 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
12268 nid
= cfg
->hp_pins
[0];
12270 alc268_new_analog_output(spec
, nid
, "Headphone", 0);
12272 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
12274 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12275 "Mono Playback Switch",
12276 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_INPUT
));
12283 /* create playback/capture controls for input pins */
12284 static int alc268_auto_create_analog_input_ctls(struct alc_spec
*spec
,
12285 const struct auto_pin_cfg
*cfg
)
12287 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
12290 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12291 switch(cfg
->input_pins
[i
]) {
12293 idx1
= 0; /* Mic 1 */
12296 idx1
= 1; /* Mic 2 */
12299 idx1
= 2; /* Line In */
12306 idx1
= 6; /* digital mics */
12311 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
12312 imux
->items
[imux
->num_items
].index
= idx1
;
12318 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
12320 struct alc_spec
*spec
= codec
->spec
;
12321 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
12322 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
12323 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
12324 unsigned int dac_vol1
, dac_vol2
;
12327 snd_hda_codec_write(codec
, speaker_nid
, 0,
12328 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
12329 snd_hda_codec_write(codec
, 0x0f, 0,
12330 AC_VERB_SET_AMP_GAIN_MUTE
,
12332 snd_hda_codec_write(codec
, 0x10, 0,
12333 AC_VERB_SET_AMP_GAIN_MUTE
,
12336 snd_hda_codec_write(codec
, 0x0f, 0,
12337 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
12338 snd_hda_codec_write(codec
, 0x10, 0,
12339 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
12342 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
12343 if (line_nid
== 0x14)
12344 dac_vol2
= AMP_OUT_ZERO
;
12345 else if (line_nid
== 0x15)
12346 dac_vol1
= AMP_OUT_ZERO
;
12347 if (hp_nid
== 0x14)
12348 dac_vol2
= AMP_OUT_ZERO
;
12349 else if (hp_nid
== 0x15)
12350 dac_vol1
= AMP_OUT_ZERO
;
12351 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
12352 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
12353 spec
->autocfg
.line_out_pins
[2] != 0x16)
12354 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
12356 snd_hda_codec_write(codec
, 0x02, 0,
12357 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
12358 snd_hda_codec_write(codec
, 0x03, 0,
12359 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
12362 /* pcm configuration: identical with ALC880 */
12363 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12364 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12365 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12366 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12369 * BIOS auto configuration
12371 static int alc268_parse_auto_config(struct hda_codec
*codec
)
12373 struct alc_spec
*spec
= codec
->spec
;
12375 static hda_nid_t alc268_ignore
[] = { 0 };
12377 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12381 if (!spec
->autocfg
.line_outs
) {
12382 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
12383 spec
->multiout
.max_channels
= 2;
12384 spec
->no_analog
= 1;
12387 return 0; /* can't find valid BIOS pin config */
12389 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12392 err
= alc268_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
12396 spec
->multiout
.max_channels
= 2;
12399 /* digital only support output */
12400 if (spec
->autocfg
.dig_outs
) {
12401 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
12402 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
12404 if (spec
->kctls
.list
)
12405 add_mixer(spec
, spec
->kctls
.list
);
12407 if (!spec
->no_analog
&& spec
->autocfg
.speaker_pins
[0] != 0x1d)
12408 add_mixer(spec
, alc268_beep_mixer
);
12410 add_verb(spec
, alc268_volume_init_verbs
);
12411 spec
->num_mux_defs
= 1;
12412 spec
->input_mux
= &spec
->private_imux
[0];
12414 err
= alc_auto_add_mic_boost(codec
);
12421 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12422 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12423 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12425 /* init callback for auto-configuration model -- overriding the default init */
12426 static void alc268_auto_init(struct hda_codec
*codec
)
12428 struct alc_spec
*spec
= codec
->spec
;
12429 alc268_auto_init_multi_out(codec
);
12430 alc268_auto_init_hp_out(codec
);
12431 alc268_auto_init_mono_speaker_out(codec
);
12432 alc268_auto_init_analog_input(codec
);
12433 if (spec
->unsol_event
)
12434 alc_inithook(codec
);
12438 * configuration and preset
12440 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
12441 [ALC267_QUANTA_IL1
] = "quanta-il1",
12442 [ALC268_3ST
] = "3stack",
12443 [ALC268_TOSHIBA
] = "toshiba",
12444 [ALC268_ACER
] = "acer",
12445 [ALC268_ACER_DMIC
] = "acer-dmic",
12446 [ALC268_ACER_ASPIRE_ONE
] = "acer-aspire",
12447 [ALC268_DELL
] = "dell",
12448 [ALC268_ZEPTO
] = "zepto",
12449 #ifdef CONFIG_SND_DEBUG
12450 [ALC268_TEST
] = "test",
12452 [ALC268_AUTO
] = "auto",
12455 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
12456 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
12457 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
12458 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
12459 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
12460 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
12461 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12462 ALC268_ACER_ASPIRE_ONE
),
12463 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
12464 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL
),
12465 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12467 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
12468 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
12469 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12471 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
12472 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
12473 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
12474 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL
),
12478 static struct alc_config_preset alc268_presets
[] = {
12479 [ALC267_QUANTA_IL1
] = {
12480 .mixers
= { alc267_quanta_il1_mixer
, alc268_beep_mixer
},
12481 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12482 alc267_quanta_il1_verbs
},
12483 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12484 .dac_nids
= alc268_dac_nids
,
12485 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12486 .adc_nids
= alc268_adc_nids_alt
,
12488 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12489 .channel_mode
= alc268_modes
,
12490 .input_mux
= &alc268_capture_source
,
12491 .unsol_event
= alc267_quanta_il1_unsol_event
,
12492 .init_hook
= alc267_quanta_il1_init_hook
,
12495 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
12496 alc268_beep_mixer
},
12497 .init_verbs
= { alc268_base_init_verbs
},
12498 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12499 .dac_nids
= alc268_dac_nids
,
12500 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12501 .adc_nids
= alc268_adc_nids_alt
,
12502 .capsrc_nids
= alc268_capsrc_nids
,
12504 .dig_out_nid
= ALC268_DIGOUT_NID
,
12505 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12506 .channel_mode
= alc268_modes
,
12507 .input_mux
= &alc268_capture_source
,
12509 [ALC268_TOSHIBA
] = {
12510 .mixers
= { alc268_toshiba_mixer
, alc268_capture_alt_mixer
,
12511 alc268_beep_mixer
},
12512 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12513 alc268_toshiba_verbs
},
12514 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12515 .dac_nids
= alc268_dac_nids
,
12516 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12517 .adc_nids
= alc268_adc_nids_alt
,
12518 .capsrc_nids
= alc268_capsrc_nids
,
12520 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12521 .channel_mode
= alc268_modes
,
12522 .input_mux
= &alc268_capture_source
,
12523 .unsol_event
= alc268_toshiba_unsol_event
,
12524 .init_hook
= alc268_toshiba_init_hook
,
12527 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
12528 alc268_beep_mixer
},
12529 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12530 alc268_acer_verbs
},
12531 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12532 .dac_nids
= alc268_dac_nids
,
12533 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12534 .adc_nids
= alc268_adc_nids_alt
,
12535 .capsrc_nids
= alc268_capsrc_nids
,
12537 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12538 .channel_mode
= alc268_modes
,
12539 .input_mux
= &alc268_acer_capture_source
,
12540 .unsol_event
= alc268_acer_unsol_event
,
12541 .init_hook
= alc268_acer_init_hook
,
12543 [ALC268_ACER_DMIC
] = {
12544 .mixers
= { alc268_acer_dmic_mixer
, alc268_capture_alt_mixer
,
12545 alc268_beep_mixer
},
12546 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12547 alc268_acer_verbs
},
12548 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12549 .dac_nids
= alc268_dac_nids
,
12550 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12551 .adc_nids
= alc268_adc_nids_alt
,
12552 .capsrc_nids
= alc268_capsrc_nids
,
12554 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12555 .channel_mode
= alc268_modes
,
12556 .input_mux
= &alc268_acer_dmic_capture_source
,
12557 .unsol_event
= alc268_acer_unsol_event
,
12558 .init_hook
= alc268_acer_init_hook
,
12560 [ALC268_ACER_ASPIRE_ONE
] = {
12561 .mixers
= { alc268_acer_aspire_one_mixer
,
12563 alc268_capture_alt_mixer
},
12564 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12565 alc268_acer_aspire_one_verbs
},
12566 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12567 .dac_nids
= alc268_dac_nids
,
12568 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12569 .adc_nids
= alc268_adc_nids_alt
,
12570 .capsrc_nids
= alc268_capsrc_nids
,
12572 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12573 .channel_mode
= alc268_modes
,
12574 .input_mux
= &alc268_acer_lc_capture_source
,
12575 .unsol_event
= alc268_acer_lc_unsol_event
,
12576 .init_hook
= alc268_acer_lc_init_hook
,
12579 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
},
12580 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12581 alc268_dell_verbs
},
12582 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12583 .dac_nids
= alc268_dac_nids
,
12585 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12586 .channel_mode
= alc268_modes
,
12587 .unsol_event
= alc_sku_unsol_event
,
12588 .init_hook
= alc268_dell_init_hook
,
12589 .input_mux
= &alc268_capture_source
,
12592 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
12593 alc268_beep_mixer
},
12594 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12595 alc268_toshiba_verbs
},
12596 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12597 .dac_nids
= alc268_dac_nids
,
12598 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12599 .adc_nids
= alc268_adc_nids_alt
,
12600 .capsrc_nids
= alc268_capsrc_nids
,
12602 .dig_out_nid
= ALC268_DIGOUT_NID
,
12603 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12604 .channel_mode
= alc268_modes
,
12605 .input_mux
= &alc268_capture_source
,
12606 .unsol_event
= alc268_toshiba_unsol_event
,
12607 .init_hook
= alc268_toshiba_init_hook
12609 #ifdef CONFIG_SND_DEBUG
12611 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
12612 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12613 alc268_volume_init_verbs
},
12614 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12615 .dac_nids
= alc268_dac_nids
,
12616 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12617 .adc_nids
= alc268_adc_nids_alt
,
12618 .capsrc_nids
= alc268_capsrc_nids
,
12620 .dig_out_nid
= ALC268_DIGOUT_NID
,
12621 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12622 .channel_mode
= alc268_modes
,
12623 .input_mux
= &alc268_capture_source
,
12628 static int patch_alc268(struct hda_codec
*codec
)
12630 struct alc_spec
*spec
;
12632 int i
, has_beep
, err
;
12634 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
12638 codec
->spec
= spec
;
12640 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
12644 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
12645 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
12646 "trying auto-probe from BIOS...\n", codec
->chip_name
);
12647 board_config
= ALC268_AUTO
;
12650 if (board_config
== ALC268_AUTO
) {
12651 /* automatic parse from the BIOS config */
12652 err
= alc268_parse_auto_config(codec
);
12658 "hda_codec: Cannot set up configuration "
12659 "from BIOS. Using base mode...\n");
12660 board_config
= ALC268_3ST
;
12664 if (board_config
!= ALC268_AUTO
)
12665 setup_preset(spec
, &alc268_presets
[board_config
]);
12667 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
12668 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
12669 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
12671 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
12674 for (i
= 0; i
< spec
->num_mixers
; i
++) {
12675 if (spec
->mixers
[i
] == alc268_beep_mixer
) {
12682 err
= snd_hda_attach_beep_device(codec
, 0x1);
12687 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
12688 /* override the amp caps for beep generator */
12689 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
12690 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
12691 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
12692 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
12693 (0 << AC_AMPCAP_MUTE_SHIFT
));
12696 if (!spec
->no_analog
&& !spec
->adc_nids
&& spec
->input_mux
) {
12697 /* check whether NID 0x07 is valid */
12698 unsigned int wcap
= get_wcaps(codec
, 0x07);
12702 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
12703 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
12704 spec
->adc_nids
= alc268_adc_nids_alt
;
12705 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
12706 add_mixer(spec
, alc268_capture_alt_mixer
);
12708 spec
->adc_nids
= alc268_adc_nids
;
12709 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
12710 add_mixer(spec
, alc268_capture_mixer
);
12712 spec
->capsrc_nids
= alc268_capsrc_nids
;
12713 /* set default input source */
12714 for (i
= 0; i
< spec
->num_adc_nids
; i
++)
12715 snd_hda_codec_write_cache(codec
, alc268_capsrc_nids
[i
],
12716 0, AC_VERB_SET_CONNECT_SEL
,
12717 spec
->input_mux
->items
[0].index
);
12720 spec
->vmaster_nid
= 0x02;
12722 codec
->patch_ops
= alc_patch_ops
;
12723 if (board_config
== ALC268_AUTO
)
12724 spec
->init_hook
= alc268_auto_init
;
12726 codec
->proc_widget_hook
= print_realtek_coef
;
12732 * ALC269 channel source setting (2 channel)
12734 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12736 #define alc269_dac_nids alc260_dac_nids
12738 static hda_nid_t alc269_adc_nids
[1] = {
12743 static hda_nid_t alc269_capsrc_nids
[1] = {
12747 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12751 static struct hda_input_mux alc269_eeepc_dmic_capture_source
= {
12759 static struct hda_input_mux alc269_eeepc_amic_capture_source
= {
12767 #define alc269_modes alc260_modes
12768 #define alc269_capture_source alc880_lg_lw_capture_source
12770 static struct snd_kcontrol_new alc269_base_mixer
[] = {
12771 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12772 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12773 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
12774 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
12775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12777 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12778 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12779 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12780 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12781 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12782 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
12786 static struct snd_kcontrol_new alc269_quanta_fl1_mixer
[] = {
12787 /* output mixer control */
12788 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12790 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12791 .name
= "Master Playback Switch",
12792 .info
= snd_hda_mixer_amp_switch_info
,
12793 .get
= snd_hda_mixer_amp_switch_get
,
12794 .put
= alc268_acer_master_sw_put
,
12795 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
12797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12799 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12800 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12801 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12802 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
12806 static struct snd_kcontrol_new alc269_lifebook_mixer
[] = {
12807 /* output mixer control */
12808 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12810 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12811 .name
= "Master Playback Switch",
12812 .info
= snd_hda_mixer_amp_switch_info
,
12813 .get
= snd_hda_mixer_amp_switch_get
,
12814 .put
= alc268_acer_master_sw_put
,
12815 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
12817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12818 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12819 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12820 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12821 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12822 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
12823 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT
),
12824 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT
),
12825 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT
),
12829 /* bind volumes of both NID 0x0c and 0x0d */
12830 static struct hda_bind_ctls alc269_epc_bind_vol
= {
12831 .ops
= &snd_hda_bind_vol
,
12833 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
12834 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
12839 static struct snd_kcontrol_new alc269_eeepc_mixer
[] = {
12840 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12841 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol
),
12842 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12846 /* capture mixer elements */
12847 static struct snd_kcontrol_new alc269_epc_capture_mixer
[] = {
12848 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12849 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12850 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12855 static struct snd_kcontrol_new alc269_fujitsu_mixer
[] = {
12856 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12857 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12858 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol
),
12862 static struct hda_verb alc269_quanta_fl1_verbs
[] = {
12863 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12864 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12865 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12866 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12867 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12868 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12872 static struct hda_verb alc269_lifebook_verbs
[] = {
12873 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12874 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
12875 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12877 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12878 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12879 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12880 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12881 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12882 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12886 /* toggle speaker-output according to the hp-jack state */
12887 static void alc269_quanta_fl1_speaker_automute(struct hda_codec
*codec
)
12889 unsigned int present
;
12890 unsigned char bits
;
12892 present
= snd_hda_codec_read(codec
, 0x15, 0,
12893 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12894 bits
= present
? AMP_IN_MUTE(0) : 0;
12895 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
12896 AMP_IN_MUTE(0), bits
);
12897 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
12898 AMP_IN_MUTE(0), bits
);
12900 snd_hda_codec_write(codec
, 0x20, 0,
12901 AC_VERB_SET_COEF_INDEX
, 0x0c);
12902 snd_hda_codec_write(codec
, 0x20, 0,
12903 AC_VERB_SET_PROC_COEF
, 0x680);
12905 snd_hda_codec_write(codec
, 0x20, 0,
12906 AC_VERB_SET_COEF_INDEX
, 0x0c);
12907 snd_hda_codec_write(codec
, 0x20, 0,
12908 AC_VERB_SET_PROC_COEF
, 0x480);
12911 /* toggle speaker-output according to the hp-jacks state */
12912 static void alc269_lifebook_speaker_automute(struct hda_codec
*codec
)
12914 unsigned int present
;
12915 unsigned char bits
;
12917 /* Check laptop headphone socket */
12918 present
= snd_hda_codec_read(codec
, 0x15, 0,
12919 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12921 /* Check port replicator headphone socket */
12922 present
|= snd_hda_codec_read(codec
, 0x1a, 0,
12923 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12925 bits
= present
? AMP_IN_MUTE(0) : 0;
12926 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
12927 AMP_IN_MUTE(0), bits
);
12928 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
12929 AMP_IN_MUTE(0), bits
);
12931 snd_hda_codec_write(codec
, 0x20, 0,
12932 AC_VERB_SET_COEF_INDEX
, 0x0c);
12933 snd_hda_codec_write(codec
, 0x20, 0,
12934 AC_VERB_SET_PROC_COEF
, 0x680);
12936 snd_hda_codec_write(codec
, 0x20, 0,
12937 AC_VERB_SET_COEF_INDEX
, 0x0c);
12938 snd_hda_codec_write(codec
, 0x20, 0,
12939 AC_VERB_SET_PROC_COEF
, 0x480);
12942 static void alc269_quanta_fl1_mic_automute(struct hda_codec
*codec
)
12944 unsigned int present
;
12946 present
= snd_hda_codec_read(codec
, 0x18, 0,
12947 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12948 snd_hda_codec_write(codec
, 0x23, 0,
12949 AC_VERB_SET_CONNECT_SEL
, present
? 0x0 : 0x1);
12952 static void alc269_lifebook_mic_autoswitch(struct hda_codec
*codec
)
12954 unsigned int present_laptop
;
12955 unsigned int present_dock
;
12957 present_laptop
= snd_hda_codec_read(codec
, 0x18, 0,
12958 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12960 present_dock
= snd_hda_codec_read(codec
, 0x1b, 0,
12961 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12963 /* Laptop mic port overrides dock mic port, design decision */
12965 snd_hda_codec_write(codec
, 0x23, 0,
12966 AC_VERB_SET_CONNECT_SEL
, 0x3);
12967 if (present_laptop
)
12968 snd_hda_codec_write(codec
, 0x23, 0,
12969 AC_VERB_SET_CONNECT_SEL
, 0x0);
12970 if (!present_dock
&& !present_laptop
)
12971 snd_hda_codec_write(codec
, 0x23, 0,
12972 AC_VERB_SET_CONNECT_SEL
, 0x1);
12975 static void alc269_quanta_fl1_unsol_event(struct hda_codec
*codec
,
12978 if ((res
>> 26) == ALC880_HP_EVENT
)
12979 alc269_quanta_fl1_speaker_automute(codec
);
12980 if ((res
>> 26) == ALC880_MIC_EVENT
)
12981 alc269_quanta_fl1_mic_automute(codec
);
12984 static void alc269_lifebook_unsol_event(struct hda_codec
*codec
,
12987 if ((res
>> 26) == ALC880_HP_EVENT
)
12988 alc269_lifebook_speaker_automute(codec
);
12989 if ((res
>> 26) == ALC880_MIC_EVENT
)
12990 alc269_lifebook_mic_autoswitch(codec
);
12993 static void alc269_quanta_fl1_init_hook(struct hda_codec
*codec
)
12995 alc269_quanta_fl1_speaker_automute(codec
);
12996 alc269_quanta_fl1_mic_automute(codec
);
12999 static void alc269_lifebook_init_hook(struct hda_codec
*codec
)
13001 alc269_lifebook_speaker_automute(codec
);
13002 alc269_lifebook_mic_autoswitch(codec
);
13005 static struct hda_verb alc269_eeepc_dmic_init_verbs
[] = {
13006 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13007 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
13008 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
13009 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
13010 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13011 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13012 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13016 static struct hda_verb alc269_eeepc_amic_init_verbs
[] = {
13017 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13018 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
13019 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
13020 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
13021 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13022 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13026 /* toggle speaker-output according to the hp-jack state */
13027 static void alc269_speaker_automute(struct hda_codec
*codec
)
13029 unsigned int present
;
13030 unsigned char bits
;
13032 present
= snd_hda_codec_read(codec
, 0x15, 0,
13033 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13034 bits
= present
? AMP_IN_MUTE(0) : 0;
13035 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
13036 AMP_IN_MUTE(0), bits
);
13037 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
13038 AMP_IN_MUTE(0), bits
);
13041 static void alc269_eeepc_dmic_automute(struct hda_codec
*codec
)
13043 unsigned int present
;
13045 present
= snd_hda_codec_read(codec
, 0x18, 0,
13046 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13047 snd_hda_codec_write(codec
, 0x23, 0,
13048 AC_VERB_SET_CONNECT_SEL
, (present
? 0 : 5));
13051 static void alc269_eeepc_amic_automute(struct hda_codec
*codec
)
13053 unsigned int present
;
13055 present
= snd_hda_codec_read(codec
, 0x18, 0,
13056 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13057 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13058 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
13059 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13060 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
13063 /* unsolicited event for HP jack sensing */
13064 static void alc269_eeepc_dmic_unsol_event(struct hda_codec
*codec
,
13067 if ((res
>> 26) == ALC880_HP_EVENT
)
13068 alc269_speaker_automute(codec
);
13070 if ((res
>> 26) == ALC880_MIC_EVENT
)
13071 alc269_eeepc_dmic_automute(codec
);
13074 static void alc269_eeepc_dmic_inithook(struct hda_codec
*codec
)
13076 alc269_speaker_automute(codec
);
13077 alc269_eeepc_dmic_automute(codec
);
13080 /* unsolicited event for HP jack sensing */
13081 static void alc269_eeepc_amic_unsol_event(struct hda_codec
*codec
,
13084 if ((res
>> 26) == ALC880_HP_EVENT
)
13085 alc269_speaker_automute(codec
);
13087 if ((res
>> 26) == ALC880_MIC_EVENT
)
13088 alc269_eeepc_amic_automute(codec
);
13091 static void alc269_eeepc_amic_inithook(struct hda_codec
*codec
)
13093 alc269_speaker_automute(codec
);
13094 alc269_eeepc_amic_automute(codec
);
13098 * generic initialization of ADC, input mixers and output mixers
13100 static struct hda_verb alc269_init_verbs
[] = {
13102 * Unmute ADC0 and set the default input to mic-in
13104 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13106 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13107 * analog-loopback mixer widget
13108 * Note: PASD motherboards uses the Line In 2 as the input for
13109 * front panel mic (mic 2)
13111 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13115 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13119 * Set up output mixers (0x0c - 0x0e)
13121 /* set vol=0 to output mixers */
13122 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13123 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13125 /* set up input amps for analog loopback */
13126 /* Amp Indices: DAC = 0, mixer = 1 */
13127 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13128 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13129 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13130 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13131 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13132 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13134 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13135 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13136 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13137 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13138 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13139 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13140 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13142 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13143 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13144 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13145 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13146 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13147 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13148 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13150 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
13151 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
13153 /* FIXME: use matrix-type input source selection */
13154 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13155 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13156 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13157 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13159 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13162 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13163 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13167 /* add playback controls from the parsed DAC table */
13168 static int alc269_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13169 const struct auto_pin_cfg
*cfg
)
13174 spec
->multiout
.num_dacs
= 1; /* only use one dac */
13175 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
13176 spec
->multiout
.dac_nids
[0] = 2;
13178 nid
= cfg
->line_out_pins
[0];
13180 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13181 "Front Playback Volume",
13182 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
));
13185 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13186 "Front Playback Switch",
13187 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
13192 nid
= cfg
->speaker_pins
[0];
13194 if (!cfg
->line_out_pins
[0]) {
13195 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13196 "Speaker Playback Volume",
13197 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13203 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13204 "Speaker Playback Switch",
13205 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
13210 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13211 "Speaker Playback Switch",
13212 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
13218 nid
= cfg
->hp_pins
[0];
13220 /* spec->multiout.hp_nid = 2; */
13221 if (!cfg
->line_out_pins
[0] && !cfg
->speaker_pins
[0]) {
13222 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13223 "Headphone Playback Volume",
13224 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13230 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13231 "Headphone Playback Switch",
13232 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
13237 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13238 "Headphone Playback Switch",
13239 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
13248 static int alc269_auto_create_analog_input_ctls(struct alc_spec
*spec
,
13249 const struct auto_pin_cfg
*cfg
)
13253 err
= alc880_auto_create_analog_input_ctls(spec
, cfg
);
13256 /* digital-mic input pin is excluded in alc880_auto_create..()
13257 * because it's under 0x18
13259 if (cfg
->input_pins
[AUTO_PIN_MIC
] == 0x12 ||
13260 cfg
->input_pins
[AUTO_PIN_FRONT_MIC
] == 0x12) {
13261 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
13262 imux
->items
[imux
->num_items
].label
= "Int Mic";
13263 imux
->items
[imux
->num_items
].index
= 0x05;
13269 #ifdef CONFIG_SND_HDA_POWER_SAVE
13270 #define alc269_loopbacks alc880_loopbacks
13273 /* pcm configuration: identical with ALC880 */
13274 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13275 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13276 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13277 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13279 static struct hda_pcm_stream alc269_44k_pcm_analog_playback
= {
13283 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
13284 /* NID is set in alc_build_pcms */
13286 .open
= alc880_playback_pcm_open
,
13287 .prepare
= alc880_playback_pcm_prepare
,
13288 .cleanup
= alc880_playback_pcm_cleanup
13292 static struct hda_pcm_stream alc269_44k_pcm_analog_capture
= {
13296 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
13297 /* NID is set in alc_build_pcms */
13301 * BIOS auto configuration
13303 static int alc269_parse_auto_config(struct hda_codec
*codec
)
13305 struct alc_spec
*spec
= codec
->spec
;
13307 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
13309 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13314 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13317 err
= alc269_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
13321 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
13323 if (spec
->autocfg
.dig_outs
)
13324 spec
->multiout
.dig_out_nid
= ALC269_DIGOUT_NID
;
13326 if (spec
->kctls
.list
)
13327 add_mixer(spec
, spec
->kctls
.list
);
13329 add_verb(spec
, alc269_init_verbs
);
13330 spec
->num_mux_defs
= 1;
13331 spec
->input_mux
= &spec
->private_imux
[0];
13332 /* set default input source */
13333 snd_hda_codec_write_cache(codec
, alc269_capsrc_nids
[0],
13334 0, AC_VERB_SET_CONNECT_SEL
,
13335 spec
->input_mux
->items
[0].index
);
13337 err
= alc_auto_add_mic_boost(codec
);
13341 if (!spec
->cap_mixer
&& !spec
->no_analog
)
13342 set_capture_mixer(spec
);
13347 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13348 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13349 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13352 /* init callback for auto-configuration model -- overriding the default init */
13353 static void alc269_auto_init(struct hda_codec
*codec
)
13355 struct alc_spec
*spec
= codec
->spec
;
13356 alc269_auto_init_multi_out(codec
);
13357 alc269_auto_init_hp_out(codec
);
13358 alc269_auto_init_analog_input(codec
);
13359 if (spec
->unsol_event
)
13360 alc_inithook(codec
);
13364 * configuration and preset
13366 static const char *alc269_models
[ALC269_MODEL_LAST
] = {
13367 [ALC269_BASIC
] = "basic",
13368 [ALC269_QUANTA_FL1
] = "quanta",
13369 [ALC269_ASUS_EEEPC_P703
] = "eeepc-p703",
13370 [ALC269_ASUS_EEEPC_P901
] = "eeepc-p901",
13371 [ALC269_FUJITSU
] = "fujitsu",
13372 [ALC269_LIFEBOOK
] = "lifebook"
13375 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
13376 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1
),
13377 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13378 ALC269_ASUS_EEEPC_P703
),
13379 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703
),
13380 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703
),
13381 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703
),
13382 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703
),
13383 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703
),
13384 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703
),
13385 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13386 ALC269_ASUS_EEEPC_P901
),
13387 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13388 ALC269_ASUS_EEEPC_P901
),
13389 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901
),
13390 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU
),
13391 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK
),
13395 static struct alc_config_preset alc269_presets
[] = {
13397 .mixers
= { alc269_base_mixer
},
13398 .init_verbs
= { alc269_init_verbs
},
13399 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13400 .dac_nids
= alc269_dac_nids
,
13402 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13403 .channel_mode
= alc269_modes
,
13404 .input_mux
= &alc269_capture_source
,
13406 [ALC269_QUANTA_FL1
] = {
13407 .mixers
= { alc269_quanta_fl1_mixer
},
13408 .init_verbs
= { alc269_init_verbs
, alc269_quanta_fl1_verbs
},
13409 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13410 .dac_nids
= alc269_dac_nids
,
13412 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13413 .channel_mode
= alc269_modes
,
13414 .input_mux
= &alc269_capture_source
,
13415 .unsol_event
= alc269_quanta_fl1_unsol_event
,
13416 .init_hook
= alc269_quanta_fl1_init_hook
,
13418 [ALC269_ASUS_EEEPC_P703
] = {
13419 .mixers
= { alc269_eeepc_mixer
},
13420 .cap_mixer
= alc269_epc_capture_mixer
,
13421 .init_verbs
= { alc269_init_verbs
,
13422 alc269_eeepc_amic_init_verbs
},
13423 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13424 .dac_nids
= alc269_dac_nids
,
13426 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13427 .channel_mode
= alc269_modes
,
13428 .input_mux
= &alc269_eeepc_amic_capture_source
,
13429 .unsol_event
= alc269_eeepc_amic_unsol_event
,
13430 .init_hook
= alc269_eeepc_amic_inithook
,
13432 [ALC269_ASUS_EEEPC_P901
] = {
13433 .mixers
= { alc269_eeepc_mixer
},
13434 .cap_mixer
= alc269_epc_capture_mixer
,
13435 .init_verbs
= { alc269_init_verbs
,
13436 alc269_eeepc_dmic_init_verbs
},
13437 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13438 .dac_nids
= alc269_dac_nids
,
13440 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13441 .channel_mode
= alc269_modes
,
13442 .input_mux
= &alc269_eeepc_dmic_capture_source
,
13443 .unsol_event
= alc269_eeepc_dmic_unsol_event
,
13444 .init_hook
= alc269_eeepc_dmic_inithook
,
13446 [ALC269_FUJITSU
] = {
13447 .mixers
= { alc269_fujitsu_mixer
},
13448 .cap_mixer
= alc269_epc_capture_mixer
,
13449 .init_verbs
= { alc269_init_verbs
,
13450 alc269_eeepc_dmic_init_verbs
},
13451 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13452 .dac_nids
= alc269_dac_nids
,
13454 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13455 .channel_mode
= alc269_modes
,
13456 .input_mux
= &alc269_eeepc_dmic_capture_source
,
13457 .unsol_event
= alc269_eeepc_dmic_unsol_event
,
13458 .init_hook
= alc269_eeepc_dmic_inithook
,
13460 [ALC269_LIFEBOOK
] = {
13461 .mixers
= { alc269_lifebook_mixer
},
13462 .init_verbs
= { alc269_init_verbs
, alc269_lifebook_verbs
},
13463 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13464 .dac_nids
= alc269_dac_nids
,
13466 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13467 .channel_mode
= alc269_modes
,
13468 .input_mux
= &alc269_capture_source
,
13469 .unsol_event
= alc269_lifebook_unsol_event
,
13470 .init_hook
= alc269_lifebook_init_hook
,
13474 static int patch_alc269(struct hda_codec
*codec
)
13476 struct alc_spec
*spec
;
13480 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13484 codec
->spec
= spec
;
13486 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
13488 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
13492 if (board_config
< 0) {
13493 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
13494 "trying auto-probe from BIOS...\n", codec
->chip_name
);
13495 board_config
= ALC269_AUTO
;
13498 if (board_config
== ALC269_AUTO
) {
13499 /* automatic parse from the BIOS config */
13500 err
= alc269_parse_auto_config(codec
);
13506 "hda_codec: Cannot set up configuration "
13507 "from BIOS. Using base mode...\n");
13508 board_config
= ALC269_BASIC
;
13512 err
= snd_hda_attach_beep_device(codec
, 0x1);
13518 if (board_config
!= ALC269_AUTO
)
13519 setup_preset(spec
, &alc269_presets
[board_config
]);
13521 if (codec
->subsystem_id
== 0x17aa3bf8) {
13522 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13523 * fix the sample rate of analog I/O to 44.1kHz
13525 spec
->stream_analog_playback
= &alc269_44k_pcm_analog_playback
;
13526 spec
->stream_analog_capture
= &alc269_44k_pcm_analog_capture
;
13528 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
13529 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
13531 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
13532 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
13534 spec
->adc_nids
= alc269_adc_nids
;
13535 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
13536 spec
->capsrc_nids
= alc269_capsrc_nids
;
13537 if (!spec
->cap_mixer
)
13538 set_capture_mixer(spec
);
13539 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
13541 codec
->patch_ops
= alc_patch_ops
;
13542 if (board_config
== ALC269_AUTO
)
13543 spec
->init_hook
= alc269_auto_init
;
13544 #ifdef CONFIG_SND_HDA_POWER_SAVE
13545 if (!spec
->loopback
.amplist
)
13546 spec
->loopback
.amplist
= alc269_loopbacks
;
13548 codec
->proc_widget_hook
= print_realtek_coef
;
13554 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13558 * set the path ways for 2 channel output
13559 * need to set the codec line out and mic 1 pin widgets to inputs
13561 static struct hda_verb alc861_threestack_ch2_init
[] = {
13562 /* set pin widget 1Ah (line in) for input */
13563 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13564 /* set pin widget 18h (mic1/2) for input, for mic also enable
13567 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13569 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
13571 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
13572 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
13578 * need to set the codec line out and mic 1 pin widgets to outputs
13580 static struct hda_verb alc861_threestack_ch6_init
[] = {
13581 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13582 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13583 /* set pin widget 18h (mic1) for output (CLFE)*/
13584 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13586 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13587 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13589 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
13591 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
13592 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
13597 static struct hda_channel_mode alc861_threestack_modes
[2] = {
13598 { 2, alc861_threestack_ch2_init
},
13599 { 6, alc861_threestack_ch6_init
},
13601 /* Set mic1 as input and unmute the mixer */
13602 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
13603 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13604 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
13607 /* Set mic1 as output and mute mixer */
13608 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
13609 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13610 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
13614 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
13615 { 2, alc861_uniwill_m31_ch2_init
},
13616 { 4, alc861_uniwill_m31_ch4_init
},
13619 /* Set mic1 and line-in as input and unmute the mixer */
13620 static struct hda_verb alc861_asus_ch2_init
[] = {
13621 /* set pin widget 1Ah (line in) for input */
13622 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13623 /* set pin widget 18h (mic1/2) for input, for mic also enable
13626 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13628 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
13630 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
13631 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
13635 /* Set mic1 nad line-in as output and mute mixer */
13636 static struct hda_verb alc861_asus_ch6_init
[] = {
13637 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13638 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13639 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13640 /* set pin widget 18h (mic1) for output (CLFE)*/
13641 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13642 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13643 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13644 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13646 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
13648 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
13649 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
13654 static struct hda_channel_mode alc861_asus_modes
[2] = {
13655 { 2, alc861_asus_ch2_init
},
13656 { 6, alc861_asus_ch6_init
},
13661 static struct snd_kcontrol_new alc861_base_mixer
[] = {
13662 /* output mixer control */
13663 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13664 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
13665 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
13666 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
13667 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
13669 /*Input mixer control */
13670 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13671 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13672 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
13673 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
13674 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
13675 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
13676 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
13677 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
13678 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
13679 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
13684 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
13685 /* output mixer control */
13686 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13687 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
13688 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
13689 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
13690 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13692 /* Input mixer control */
13693 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13694 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13695 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
13696 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
13697 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
13698 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
13699 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
13700 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
13701 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
13702 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
13705 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13706 .name
= "Channel Mode",
13707 .info
= alc_ch_mode_info
,
13708 .get
= alc_ch_mode_get
,
13709 .put
= alc_ch_mode_put
,
13710 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
13715 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
13716 /* output mixer control */
13717 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13718 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
13719 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
13724 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
13725 /* output mixer control */
13726 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13727 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
13728 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
13729 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
13730 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13732 /* Input mixer control */
13733 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13734 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13735 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
13736 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
13737 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
13738 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
13739 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
13740 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
13741 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
13742 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
13745 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13746 .name
= "Channel Mode",
13747 .info
= alc_ch_mode_info
,
13748 .get
= alc_ch_mode_get
,
13749 .put
= alc_ch_mode_put
,
13750 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
13755 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
13756 /* output mixer control */
13757 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13758 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
13759 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
13760 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
13761 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
13763 /* Input mixer control */
13764 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
13765 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13766 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
13767 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
13768 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
13769 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
13770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
13771 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
13772 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
13773 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
13776 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13777 .name
= "Channel Mode",
13778 .info
= alc_ch_mode_info
,
13779 .get
= alc_ch_mode_get
,
13780 .put
= alc_ch_mode_put
,
13781 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
13786 /* additional mixer */
13787 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
13788 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
13789 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
13794 * generic initialization of ADC, input mixers and output mixers
13796 static struct hda_verb alc861_base_init_verbs
[] = {
13798 * Unmute ADC0 and set the default input to mic-in
13800 /* port-A for surround (rear panel) */
13801 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13802 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13803 /* port-B for mic-in (rear panel) with vref */
13804 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13805 /* port-C for line-in (rear panel) */
13806 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13807 /* port-D for Front */
13808 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13809 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13810 /* port-E for HP out (front panel) */
13811 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
13812 /* route front PCM to HP */
13813 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13814 /* port-F for mic-in (front panel) with vref */
13815 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13816 /* port-G for CLFE (rear panel) */
13817 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13818 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13819 /* port-H for side (rear panel) */
13820 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13821 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13823 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13824 /* route front mic to ADC1*/
13825 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
13826 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13828 /* Unmute DAC0~3 & spdif out*/
13829 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13830 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13831 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13832 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13833 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13835 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13836 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13837 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13838 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13839 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13841 /* Unmute Stereo Mixer 15 */
13842 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13844 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13845 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
13847 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13848 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13849 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13850 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13851 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13852 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13853 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13854 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13855 /* hp used DAC 3 (Front) */
13856 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13857 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13862 static struct hda_verb alc861_threestack_init_verbs
[] = {
13864 * Unmute ADC0 and set the default input to mic-in
13866 /* port-A for surround (rear panel) */
13867 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13868 /* port-B for mic-in (rear panel) with vref */
13869 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13870 /* port-C for line-in (rear panel) */
13871 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13872 /* port-D for Front */
13873 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13874 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13875 /* port-E for HP out (front panel) */
13876 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
13877 /* route front PCM to HP */
13878 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13879 /* port-F for mic-in (front panel) with vref */
13880 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13881 /* port-G for CLFE (rear panel) */
13882 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13883 /* port-H for side (rear panel) */
13884 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13886 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13887 /* route front mic to ADC1*/
13888 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
13889 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13890 /* Unmute DAC0~3 & spdif out*/
13891 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13892 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13893 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13894 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13897 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13898 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13899 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13900 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13901 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13903 /* Unmute Stereo Mixer 15 */
13904 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13906 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13907 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
13909 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13910 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13911 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13912 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13913 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13914 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13915 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13916 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13917 /* hp used DAC 3 (Front) */
13918 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13919 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13923 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
13925 * Unmute ADC0 and set the default input to mic-in
13927 /* port-A for surround (rear panel) */
13928 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13929 /* port-B for mic-in (rear panel) with vref */
13930 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13931 /* port-C for line-in (rear panel) */
13932 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13933 /* port-D for Front */
13934 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13935 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13936 /* port-E for HP out (front panel) */
13937 /* this has to be set to VREF80 */
13938 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13939 /* route front PCM to HP */
13940 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13941 /* port-F for mic-in (front panel) with vref */
13942 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13943 /* port-G for CLFE (rear panel) */
13944 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13945 /* port-H for side (rear panel) */
13946 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13948 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13949 /* route front mic to ADC1*/
13950 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
13951 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13952 /* Unmute DAC0~3 & spdif out*/
13953 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13954 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13955 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13956 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13957 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13959 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13960 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13961 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13962 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13963 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13965 /* Unmute Stereo Mixer 15 */
13966 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13967 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13968 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
13971 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13972 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13973 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13974 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13975 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13976 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13977 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13978 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13979 /* hp used DAC 3 (Front) */
13980 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13981 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13985 static struct hda_verb alc861_asus_init_verbs
[] = {
13987 * Unmute ADC0 and set the default input to mic-in
13989 /* port-A for surround (rear panel)
13990 * according to codec#0 this is the HP jack
13992 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
13993 /* route front PCM to HP */
13994 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
13995 /* port-B for mic-in (rear panel) with vref */
13996 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13997 /* port-C for line-in (rear panel) */
13998 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13999 /* port-D for Front */
14000 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14001 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14002 /* port-E for HP out (front panel) */
14003 /* this has to be set to VREF80 */
14004 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14005 /* route front PCM to HP */
14006 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14007 /* port-F for mic-in (front panel) with vref */
14008 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14009 /* port-G for CLFE (rear panel) */
14010 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14011 /* port-H for side (rear panel) */
14012 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14014 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14015 /* route front mic to ADC1*/
14016 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
14017 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14018 /* Unmute DAC0~3 & spdif out*/
14019 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14020 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14021 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14022 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14024 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14025 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14026 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14027 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14028 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14030 /* Unmute Stereo Mixer 15 */
14031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14032 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14033 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14034 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
14036 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14037 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14038 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14039 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14040 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14041 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14042 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14043 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14044 /* hp used DAC 3 (Front) */
14045 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
14046 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14050 /* additional init verbs for ASUS laptops */
14051 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
14052 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
14053 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
14058 * generic initialization of ADC, input mixers and output mixers
14060 static struct hda_verb alc861_auto_init_verbs
[] = {
14062 * Unmute ADC0 and set the default input to mic-in
14064 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14065 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14067 /* Unmute DAC0~3 & spdif out*/
14068 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14069 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14070 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14071 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14072 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14074 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14075 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14076 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14077 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14078 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14080 /* Unmute Stereo Mixer 15 */
14081 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14082 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14083 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14084 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
14086 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14087 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14088 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14089 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14090 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14091 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14092 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14093 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14095 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14096 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14097 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14098 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
14099 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14100 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14101 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14102 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
14104 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
14109 static struct hda_verb alc861_toshiba_init_verbs
[] = {
14110 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14115 /* toggle speaker-output according to the hp-jack state */
14116 static void alc861_toshiba_automute(struct hda_codec
*codec
)
14118 unsigned int present
;
14120 present
= snd_hda_codec_read(codec
, 0x0f, 0,
14121 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14122 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
14123 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
14124 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
14125 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
14128 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
14131 if ((res
>> 26) == ALC880_HP_EVENT
)
14132 alc861_toshiba_automute(codec
);
14135 /* pcm configuration: identical with ALC880 */
14136 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14137 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14138 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14139 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14142 #define ALC861_DIGOUT_NID 0x07
14144 static struct hda_channel_mode alc861_8ch_modes
[1] = {
14148 static hda_nid_t alc861_dac_nids
[4] = {
14149 /* front, surround, clfe, side */
14150 0x03, 0x06, 0x05, 0x04
14153 static hda_nid_t alc660_dac_nids
[3] = {
14154 /* front, clfe, surround */
14158 static hda_nid_t alc861_adc_nids
[1] = {
14163 static struct hda_input_mux alc861_capture_source
= {
14167 { "Front Mic", 0x3 },
14174 /* fill in the dac_nids table from the parsed pin configuration */
14175 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
,
14176 const struct auto_pin_cfg
*cfg
)
14181 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
14182 for (i
= 0; i
< cfg
->line_outs
; i
++) {
14183 nid
= cfg
->line_out_pins
[i
];
14185 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
14187 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
14190 spec
->multiout
.num_dacs
= cfg
->line_outs
;
14194 /* add playback controls from the parsed DAC table */
14195 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
14196 const struct auto_pin_cfg
*cfg
)
14199 static const char *chname
[4] = {
14200 "Front", "Surround", NULL
/*CLFE*/, "Side"
14205 for (i
= 0; i
< cfg
->line_outs
; i
++) {
14206 nid
= spec
->multiout
.dac_nids
[i
];
14211 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14212 "Center Playback Switch",
14213 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
14217 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14218 "LFE Playback Switch",
14219 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
14224 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1;
14226 if (nid
== alc861_dac_nids
[idx
])
14228 sprintf(name
, "%s Playback Switch", chname
[idx
]);
14229 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14230 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
14239 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
14247 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
14249 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
14250 "Headphone Playback Switch",
14251 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
14254 spec
->multiout
.hp_nid
= nid
;
14259 /* create playback/capture controls for input pins */
14260 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
,
14261 const struct auto_pin_cfg
*cfg
)
14263 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
14264 int i
, err
, idx
, idx1
;
14266 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14267 switch (cfg
->input_pins
[i
]) {
14270 idx
= 2; /* Line In */
14274 idx
= 2; /* Line In */
14278 idx
= 1; /* Mic In */
14282 idx
= 1; /* Mic In */
14292 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
14293 auto_pin_cfg_labels
[i
], idx
, 0x15);
14297 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
14298 imux
->items
[imux
->num_items
].index
= idx1
;
14304 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
14306 int pin_type
, int dac_idx
)
14308 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
14310 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14314 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
14316 struct alc_spec
*spec
= codec
->spec
;
14319 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
14320 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
14321 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
14323 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
14324 spec
->multiout
.dac_nids
[i
]);
14328 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
14330 struct alc_spec
*spec
= codec
->spec
;
14333 pin
= spec
->autocfg
.hp_pins
[0];
14334 if (pin
) /* connect to front */
14335 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
14336 spec
->multiout
.dac_nids
[0]);
14337 pin
= spec
->autocfg
.speaker_pins
[0];
14339 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
14342 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
14344 struct alc_spec
*spec
= codec
->spec
;
14347 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14348 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
14349 if (nid
>= 0x0c && nid
<= 0x11)
14350 alc_set_input_pin(codec
, nid
, i
);
14354 /* parse the BIOS configuration and set up the alc_spec */
14355 /* return 1 if successful, 0 if the proper config is not found,
14356 * or a negative error code
14358 static int alc861_parse_auto_config(struct hda_codec
*codec
)
14360 struct alc_spec
*spec
= codec
->spec
;
14362 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
14364 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14368 if (!spec
->autocfg
.line_outs
)
14369 return 0; /* can't find valid BIOS pin config */
14371 err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
);
14374 err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14377 err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0]);
14380 err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
14384 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14386 if (spec
->autocfg
.dig_outs
)
14387 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
14389 if (spec
->kctls
.list
)
14390 add_mixer(spec
, spec
->kctls
.list
);
14392 add_verb(spec
, alc861_auto_init_verbs
);
14394 spec
->num_mux_defs
= 1;
14395 spec
->input_mux
= &spec
->private_imux
[0];
14397 spec
->adc_nids
= alc861_adc_nids
;
14398 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
14399 set_capture_mixer(spec
);
14401 alc_ssid_check(codec
, 0x0e, 0x0f, 0x0b);
14406 /* additional initialization for auto-configuration model */
14407 static void alc861_auto_init(struct hda_codec
*codec
)
14409 struct alc_spec
*spec
= codec
->spec
;
14410 alc861_auto_init_multi_out(codec
);
14411 alc861_auto_init_hp_out(codec
);
14412 alc861_auto_init_analog_input(codec
);
14413 if (spec
->unsol_event
)
14414 alc_inithook(codec
);
14417 #ifdef CONFIG_SND_HDA_POWER_SAVE
14418 static struct hda_amp_list alc861_loopbacks
[] = {
14419 { 0x15, HDA_INPUT
, 0 },
14420 { 0x15, HDA_INPUT
, 1 },
14421 { 0x15, HDA_INPUT
, 2 },
14422 { 0x15, HDA_INPUT
, 3 },
14429 * configuration and preset
14431 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
14432 [ALC861_3ST
] = "3stack",
14433 [ALC660_3ST
] = "3stack-660",
14434 [ALC861_3ST_DIG
] = "3stack-dig",
14435 [ALC861_6ST_DIG
] = "6stack-dig",
14436 [ALC861_UNIWILL_M31
] = "uniwill-m31",
14437 [ALC861_TOSHIBA
] = "toshiba",
14438 [ALC861_ASUS
] = "asus",
14439 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
14440 [ALC861_AUTO
] = "auto",
14443 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
14444 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
14445 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
14446 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
14447 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
14448 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
14449 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
14450 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
14451 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14452 * Any other models that need this preset?
14454 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14455 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
14456 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
14457 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
14458 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
14459 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
14460 /* FIXME: the below seems conflict */
14461 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14462 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
14463 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
14467 static struct alc_config_preset alc861_presets
[] = {
14469 .mixers
= { alc861_3ST_mixer
},
14470 .init_verbs
= { alc861_threestack_init_verbs
},
14471 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14472 .dac_nids
= alc861_dac_nids
,
14473 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
14474 .channel_mode
= alc861_threestack_modes
,
14476 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14477 .adc_nids
= alc861_adc_nids
,
14478 .input_mux
= &alc861_capture_source
,
14480 [ALC861_3ST_DIG
] = {
14481 .mixers
= { alc861_base_mixer
},
14482 .init_verbs
= { alc861_threestack_init_verbs
},
14483 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14484 .dac_nids
= alc861_dac_nids
,
14485 .dig_out_nid
= ALC861_DIGOUT_NID
,
14486 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
14487 .channel_mode
= alc861_threestack_modes
,
14489 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14490 .adc_nids
= alc861_adc_nids
,
14491 .input_mux
= &alc861_capture_source
,
14493 [ALC861_6ST_DIG
] = {
14494 .mixers
= { alc861_base_mixer
},
14495 .init_verbs
= { alc861_base_init_verbs
},
14496 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14497 .dac_nids
= alc861_dac_nids
,
14498 .dig_out_nid
= ALC861_DIGOUT_NID
,
14499 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
14500 .channel_mode
= alc861_8ch_modes
,
14501 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14502 .adc_nids
= alc861_adc_nids
,
14503 .input_mux
= &alc861_capture_source
,
14506 .mixers
= { alc861_3ST_mixer
},
14507 .init_verbs
= { alc861_threestack_init_verbs
},
14508 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
14509 .dac_nids
= alc660_dac_nids
,
14510 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
14511 .channel_mode
= alc861_threestack_modes
,
14513 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14514 .adc_nids
= alc861_adc_nids
,
14515 .input_mux
= &alc861_capture_source
,
14517 [ALC861_UNIWILL_M31
] = {
14518 .mixers
= { alc861_uniwill_m31_mixer
},
14519 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
14520 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14521 .dac_nids
= alc861_dac_nids
,
14522 .dig_out_nid
= ALC861_DIGOUT_NID
,
14523 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
14524 .channel_mode
= alc861_uniwill_m31_modes
,
14526 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14527 .adc_nids
= alc861_adc_nids
,
14528 .input_mux
= &alc861_capture_source
,
14530 [ALC861_TOSHIBA
] = {
14531 .mixers
= { alc861_toshiba_mixer
},
14532 .init_verbs
= { alc861_base_init_verbs
,
14533 alc861_toshiba_init_verbs
},
14534 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14535 .dac_nids
= alc861_dac_nids
,
14536 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
14537 .channel_mode
= alc883_3ST_2ch_modes
,
14538 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14539 .adc_nids
= alc861_adc_nids
,
14540 .input_mux
= &alc861_capture_source
,
14541 .unsol_event
= alc861_toshiba_unsol_event
,
14542 .init_hook
= alc861_toshiba_automute
,
14545 .mixers
= { alc861_asus_mixer
},
14546 .init_verbs
= { alc861_asus_init_verbs
},
14547 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14548 .dac_nids
= alc861_dac_nids
,
14549 .dig_out_nid
= ALC861_DIGOUT_NID
,
14550 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
14551 .channel_mode
= alc861_asus_modes
,
14554 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14555 .adc_nids
= alc861_adc_nids
,
14556 .input_mux
= &alc861_capture_source
,
14558 [ALC861_ASUS_LAPTOP
] = {
14559 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
14560 .init_verbs
= { alc861_asus_init_verbs
,
14561 alc861_asus_laptop_init_verbs
},
14562 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14563 .dac_nids
= alc861_dac_nids
,
14564 .dig_out_nid
= ALC861_DIGOUT_NID
,
14565 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
14566 .channel_mode
= alc883_3ST_2ch_modes
,
14568 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14569 .adc_nids
= alc861_adc_nids
,
14570 .input_mux
= &alc861_capture_source
,
14575 static int patch_alc861(struct hda_codec
*codec
)
14577 struct alc_spec
*spec
;
14581 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14585 codec
->spec
= spec
;
14587 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
14591 if (board_config
< 0) {
14592 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
14593 "trying auto-probe from BIOS...\n", codec
->chip_name
);
14594 board_config
= ALC861_AUTO
;
14597 if (board_config
== ALC861_AUTO
) {
14598 /* automatic parse from the BIOS config */
14599 err
= alc861_parse_auto_config(codec
);
14605 "hda_codec: Cannot set up configuration "
14606 "from BIOS. Using base mode...\n");
14607 board_config
= ALC861_3ST_DIG
;
14611 err
= snd_hda_attach_beep_device(codec
, 0x23);
14617 if (board_config
!= ALC861_AUTO
)
14618 setup_preset(spec
, &alc861_presets
[board_config
]);
14620 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
14621 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
14623 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
14624 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
14626 set_beep_amp(spec
, 0x23, 0, HDA_OUTPUT
);
14628 spec
->vmaster_nid
= 0x03;
14630 codec
->patch_ops
= alc_patch_ops
;
14631 if (board_config
== ALC861_AUTO
)
14632 spec
->init_hook
= alc861_auto_init
;
14633 #ifdef CONFIG_SND_HDA_POWER_SAVE
14634 if (!spec
->loopback
.amplist
)
14635 spec
->loopback
.amplist
= alc861_loopbacks
;
14637 codec
->proc_widget_hook
= print_realtek_coef
;
14643 * ALC861-VD support
14647 * In addition, an independent DAC
14649 #define ALC861VD_DIGOUT_NID 0x06
14651 static hda_nid_t alc861vd_dac_nids
[4] = {
14652 /* front, surr, clfe, side surr */
14653 0x02, 0x03, 0x04, 0x05
14656 /* dac_nids for ALC660vd are in a different order - according to
14657 * Realtek's driver.
14658 * This should probably result in a different mixer for 6stack models
14659 * of ALC660vd codecs, but for now there is only 3stack mixer
14660 * - and it is the same as in 861vd.
14661 * adc_nids in ALC660vd are (is) the same as in 861vd
14663 static hda_nid_t alc660vd_dac_nids
[3] = {
14664 /* front, rear, clfe, rear_surr */
14668 static hda_nid_t alc861vd_adc_nids
[1] = {
14673 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
14676 /* FIXME: should be a matrix-type input source selection */
14677 static struct hda_input_mux alc861vd_capture_source
= {
14681 { "Front Mic", 0x1 },
14687 static struct hda_input_mux alc861vd_dallas_capture_source
= {
14690 { "Ext Mic", 0x0 },
14691 { "Int Mic", 0x1 },
14695 static struct hda_input_mux alc861vd_hp_capture_source
= {
14698 { "Front Mic", 0x0 },
14699 { "ATAPI Mic", 0x1 },
14706 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
14713 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
14714 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14715 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14716 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14717 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14724 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
14725 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14726 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14727 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14728 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14732 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
14733 { 6, alc861vd_6stack_ch6_init
},
14734 { 8, alc861vd_6stack_ch8_init
},
14737 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
14739 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14740 .name
= "Channel Mode",
14741 .info
= alc_ch_mode_info
,
14742 .get
= alc_ch_mode_get
,
14743 .put
= alc_ch_mode_put
,
14748 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14749 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14751 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
14752 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14753 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
14755 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14756 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
14758 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14760 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14762 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
14763 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
14765 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
14766 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
14768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14770 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
14771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14772 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14774 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
14775 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14776 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14778 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14779 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14781 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
14782 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14787 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
14788 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14789 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
14791 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14793 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
14794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14795 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14797 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
14798 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14799 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14801 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14802 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14804 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
14805 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14810 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
14811 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14812 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14813 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14815 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14817 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
14818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14819 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14821 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
14822 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14823 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14825 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
14826 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14831 /* Pin assignment: Speaker=0x14, HP = 0x15,
14832 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14834 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
14835 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14836 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
14837 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14838 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
14839 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
14840 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14841 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14842 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
14843 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14844 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14848 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14849 * Front Mic=0x18, ATAPI Mic = 0x19,
14851 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
14852 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14853 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
14854 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14855 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
14856 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14857 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14858 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14859 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14865 * generic initialization of ADC, input mixers and output mixers
14867 static struct hda_verb alc861vd_volume_init_verbs
[] = {
14869 * Unmute ADC0 and set the default input to mic-in
14871 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
14872 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14874 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14875 * the analog-loopback mixer widget
14877 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
14881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
14882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
14884 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14885 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14886 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14887 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14888 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
14891 * Set up output mixers (0x02 - 0x05)
14893 /* set vol=0 to output mixers */
14894 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14895 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14896 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14897 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14899 /* set up input amps for analog loopback */
14900 /* Amp Indices: DAC = 0, mixer = 1 */
14901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14903 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14904 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14905 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14906 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14907 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14908 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14914 * 3-stack pin configuration:
14915 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14917 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
14919 * Set pin mode and muting
14921 /* set front pin widgets 0x14 for output */
14922 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14923 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14924 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
14926 /* Mic (rear) pin: input vref at 80% */
14927 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14928 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14929 /* Front Mic pin: input vref at 80% */
14930 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14931 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14932 /* Line In pin: input */
14933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14935 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14936 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14937 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14938 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
14939 /* CD pin widget for input */
14940 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14946 * 6-stack pin configuration:
14948 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
14950 * Set pin mode and muting
14952 /* set front pin widgets 0x14 for output */
14953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14954 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14955 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
14957 /* Rear Pin: output 1 (0x0d) */
14958 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14959 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14960 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14961 /* CLFE Pin: output 2 (0x0e) */
14962 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14963 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14964 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
14965 /* Side Pin: output 3 (0x0f) */
14966 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14967 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14968 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
14970 /* Mic (rear) pin: input vref at 80% */
14971 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14972 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14973 /* Front Mic pin: input vref at 80% */
14974 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14975 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14976 /* Line In pin: input */
14977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14978 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14979 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14981 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14982 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
14983 /* CD pin widget for input */
14984 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14989 static struct hda_verb alc861vd_eapd_verbs
[] = {
14990 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14994 static struct hda_verb alc660vd_eapd_verbs
[] = {
14995 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14996 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
15000 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
15001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
15004 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15005 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15009 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
15011 unsigned int present
;
15012 unsigned char bits
;
15014 present
= snd_hda_codec_read(codec
, 0x18, 0,
15015 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
15016 bits
= present
? HDA_AMP_MUTE
: 0;
15017 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
15018 HDA_AMP_MUTE
, bits
);
15021 static void alc861vd_lenovo_init_hook(struct hda_codec
*codec
)
15023 struct alc_spec
*spec
= codec
->spec
;
15025 spec
->autocfg
.hp_pins
[0] = 0x1b;
15026 spec
->autocfg
.speaker_pins
[0] = 0x14;
15027 alc_automute_amp(codec
);
15028 alc861vd_lenovo_mic_automute(codec
);
15031 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
15034 switch (res
>> 26) {
15035 case ALC880_MIC_EVENT
:
15036 alc861vd_lenovo_mic_automute(codec
);
15039 alc_automute_amp_unsol_event(codec
, res
);
15044 static struct hda_verb alc861vd_dallas_verbs
[] = {
15045 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15046 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15047 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15048 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15053 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15055 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15056 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15057 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15059 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15060 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15061 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15062 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15063 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15064 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15065 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15066 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15068 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
15069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15070 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
15071 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15072 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15073 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15074 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15075 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
15082 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15083 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
15084 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15089 /* toggle speaker-output according to the hp-jack state */
15090 static void alc861vd_dallas_init_hook(struct hda_codec
*codec
)
15092 struct alc_spec
*spec
= codec
->spec
;
15094 spec
->autocfg
.hp_pins
[0] = 0x15;
15095 spec
->autocfg
.speaker_pins
[0] = 0x14;
15096 alc_automute_amp(codec
);
15099 #ifdef CONFIG_SND_HDA_POWER_SAVE
15100 #define alc861vd_loopbacks alc880_loopbacks
15103 /* pcm configuration: identical with ALC880 */
15104 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15105 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15106 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15107 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15110 * configuration and preset
15112 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
15113 [ALC660VD_3ST
] = "3stack-660",
15114 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
15115 [ALC660VD_ASUS_V1S
] = "asus-v1s",
15116 [ALC861VD_3ST
] = "3stack",
15117 [ALC861VD_3ST_DIG
] = "3stack-digout",
15118 [ALC861VD_6ST_DIG
] = "6stack-digout",
15119 [ALC861VD_LENOVO
] = "lenovo",
15120 [ALC861VD_DALLAS
] = "dallas",
15121 [ALC861VD_HP
] = "hp",
15122 [ALC861VD_AUTO
] = "auto",
15125 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
15126 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
15127 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
15128 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
15129 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST
),
15130 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S
),
15131 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
15132 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
15133 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
15134 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15135 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS
),
15136 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
15137 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
15138 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
15139 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO
),
15140 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
15144 static struct alc_config_preset alc861vd_presets
[] = {
15146 .mixers
= { alc861vd_3st_mixer
},
15147 .init_verbs
= { alc861vd_volume_init_verbs
,
15148 alc861vd_3stack_init_verbs
},
15149 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
15150 .dac_nids
= alc660vd_dac_nids
,
15151 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15152 .channel_mode
= alc861vd_3stack_2ch_modes
,
15153 .input_mux
= &alc861vd_capture_source
,
15155 [ALC660VD_3ST_DIG
] = {
15156 .mixers
= { alc861vd_3st_mixer
},
15157 .init_verbs
= { alc861vd_volume_init_verbs
,
15158 alc861vd_3stack_init_verbs
},
15159 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
15160 .dac_nids
= alc660vd_dac_nids
,
15161 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
15162 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15163 .channel_mode
= alc861vd_3stack_2ch_modes
,
15164 .input_mux
= &alc861vd_capture_source
,
15167 .mixers
= { alc861vd_3st_mixer
},
15168 .init_verbs
= { alc861vd_volume_init_verbs
,
15169 alc861vd_3stack_init_verbs
},
15170 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
15171 .dac_nids
= alc861vd_dac_nids
,
15172 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15173 .channel_mode
= alc861vd_3stack_2ch_modes
,
15174 .input_mux
= &alc861vd_capture_source
,
15176 [ALC861VD_3ST_DIG
] = {
15177 .mixers
= { alc861vd_3st_mixer
},
15178 .init_verbs
= { alc861vd_volume_init_verbs
,
15179 alc861vd_3stack_init_verbs
},
15180 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
15181 .dac_nids
= alc861vd_dac_nids
,
15182 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
15183 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15184 .channel_mode
= alc861vd_3stack_2ch_modes
,
15185 .input_mux
= &alc861vd_capture_source
,
15187 [ALC861VD_6ST_DIG
] = {
15188 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
15189 .init_verbs
= { alc861vd_volume_init_verbs
,
15190 alc861vd_6stack_init_verbs
},
15191 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
15192 .dac_nids
= alc861vd_dac_nids
,
15193 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
15194 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
15195 .channel_mode
= alc861vd_6stack_modes
,
15196 .input_mux
= &alc861vd_capture_source
,
15198 [ALC861VD_LENOVO
] = {
15199 .mixers
= { alc861vd_lenovo_mixer
},
15200 .init_verbs
= { alc861vd_volume_init_verbs
,
15201 alc861vd_3stack_init_verbs
,
15202 alc861vd_eapd_verbs
,
15203 alc861vd_lenovo_unsol_verbs
},
15204 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
15205 .dac_nids
= alc660vd_dac_nids
,
15206 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15207 .channel_mode
= alc861vd_3stack_2ch_modes
,
15208 .input_mux
= &alc861vd_capture_source
,
15209 .unsol_event
= alc861vd_lenovo_unsol_event
,
15210 .init_hook
= alc861vd_lenovo_init_hook
,
15212 [ALC861VD_DALLAS
] = {
15213 .mixers
= { alc861vd_dallas_mixer
},
15214 .init_verbs
= { alc861vd_dallas_verbs
},
15215 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
15216 .dac_nids
= alc861vd_dac_nids
,
15217 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15218 .channel_mode
= alc861vd_3stack_2ch_modes
,
15219 .input_mux
= &alc861vd_dallas_capture_source
,
15220 .unsol_event
= alc_automute_amp_unsol_event
,
15221 .init_hook
= alc861vd_dallas_init_hook
,
15224 .mixers
= { alc861vd_hp_mixer
},
15225 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
15226 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
15227 .dac_nids
= alc861vd_dac_nids
,
15228 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
15229 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15230 .channel_mode
= alc861vd_3stack_2ch_modes
,
15231 .input_mux
= &alc861vd_hp_capture_source
,
15232 .unsol_event
= alc_automute_amp_unsol_event
,
15233 .init_hook
= alc861vd_dallas_init_hook
,
15235 [ALC660VD_ASUS_V1S
] = {
15236 .mixers
= { alc861vd_lenovo_mixer
},
15237 .init_verbs
= { alc861vd_volume_init_verbs
,
15238 alc861vd_3stack_init_verbs
,
15239 alc861vd_eapd_verbs
,
15240 alc861vd_lenovo_unsol_verbs
},
15241 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
15242 .dac_nids
= alc660vd_dac_nids
,
15243 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
15244 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15245 .channel_mode
= alc861vd_3stack_2ch_modes
,
15246 .input_mux
= &alc861vd_capture_source
,
15247 .unsol_event
= alc861vd_lenovo_unsol_event
,
15248 .init_hook
= alc861vd_lenovo_init_hook
,
15253 * BIOS auto configuration
15255 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
15256 hda_nid_t nid
, int pin_type
, int dac_idx
)
15258 alc_set_pin_output(codec
, nid
, pin_type
);
15261 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
15263 struct alc_spec
*spec
= codec
->spec
;
15266 for (i
= 0; i
<= HDA_SIDE
; i
++) {
15267 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
15268 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
15270 alc861vd_auto_set_output_and_unmute(codec
, nid
,
15276 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
15278 struct alc_spec
*spec
= codec
->spec
;
15281 pin
= spec
->autocfg
.hp_pins
[0];
15282 if (pin
) /* connect to front and use dac 0 */
15283 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
15284 pin
= spec
->autocfg
.speaker_pins
[0];
15286 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
15289 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15290 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15292 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
15294 struct alc_spec
*spec
= codec
->spec
;
15297 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
15298 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
15299 if (alc861vd_is_input_pin(nid
)) {
15300 alc_set_input_pin(codec
, nid
, i
);
15301 if (nid
!= ALC861VD_PIN_CD_NID
&&
15302 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
15303 snd_hda_codec_write(codec
, nid
, 0,
15304 AC_VERB_SET_AMP_GAIN_MUTE
,
15310 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15312 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15313 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15315 /* add playback controls from the parsed DAC table */
15316 /* Based on ALC880 version. But ALC861VD has separate,
15317 * different NIDs for mute/unmute switch and volume control */
15318 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
15319 const struct auto_pin_cfg
*cfg
)
15322 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
15323 hda_nid_t nid_v
, nid_s
;
15326 for (i
= 0; i
< cfg
->line_outs
; i
++) {
15327 if (!spec
->multiout
.dac_nids
[i
])
15329 nid_v
= alc861vd_idx_to_mixer_vol(
15331 spec
->multiout
.dac_nids
[i
]));
15332 nid_s
= alc861vd_idx_to_mixer_switch(
15334 spec
->multiout
.dac_nids
[i
]));
15338 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
15339 "Center Playback Volume",
15340 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
15344 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
15345 "LFE Playback Volume",
15346 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
15350 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
15351 "Center Playback Switch",
15352 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
15356 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
15357 "LFE Playback Switch",
15358 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
15363 sprintf(name
, "%s Playback Volume", chname
[i
]);
15364 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
15365 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
15369 sprintf(name
, "%s Playback Switch", chname
[i
]);
15370 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
15371 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
15380 /* add playback controls for speaker and HP outputs */
15381 /* Based on ALC880 version. But ALC861VD has separate,
15382 * different NIDs for mute/unmute switch and volume control */
15383 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
15384 hda_nid_t pin
, const char *pfx
)
15386 hda_nid_t nid_v
, nid_s
;
15393 if (alc880_is_fixed_pin(pin
)) {
15394 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
15395 /* specify the DAC as the extra output */
15396 if (!spec
->multiout
.hp_nid
)
15397 spec
->multiout
.hp_nid
= nid_v
;
15399 spec
->multiout
.extra_out_nid
[0] = nid_v
;
15400 /* control HP volume/switch on the output mixer amp */
15401 nid_v
= alc861vd_idx_to_mixer_vol(
15402 alc880_fixed_pin_idx(pin
));
15403 nid_s
= alc861vd_idx_to_mixer_switch(
15404 alc880_fixed_pin_idx(pin
));
15406 sprintf(name
, "%s Playback Volume", pfx
);
15407 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
15408 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
15411 sprintf(name
, "%s Playback Switch", pfx
);
15412 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
15413 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
15416 } else if (alc880_is_multi_pin(pin
)) {
15417 /* set manual connection */
15418 /* we have only a switch on HP-out PIN */
15419 sprintf(name
, "%s Playback Switch", pfx
);
15420 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
15421 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
15428 /* parse the BIOS configuration and set up the alc_spec
15429 * return 1 if successful, 0 if the proper config is not found,
15430 * or a negative error code
15431 * Based on ALC880 version - had to change it to override
15432 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15433 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
15435 struct alc_spec
*spec
= codec
->spec
;
15437 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
15439 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
15443 if (!spec
->autocfg
.line_outs
)
15444 return 0; /* can't find valid BIOS pin config */
15446 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
15449 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
15452 err
= alc861vd_auto_create_extra_out(spec
,
15453 spec
->autocfg
.speaker_pins
[0],
15457 err
= alc861vd_auto_create_extra_out(spec
,
15458 spec
->autocfg
.hp_pins
[0],
15462 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
15466 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
15468 if (spec
->autocfg
.dig_outs
)
15469 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
15471 if (spec
->kctls
.list
)
15472 add_mixer(spec
, spec
->kctls
.list
);
15474 add_verb(spec
, alc861vd_volume_init_verbs
);
15476 spec
->num_mux_defs
= 1;
15477 spec
->input_mux
= &spec
->private_imux
[0];
15479 err
= alc_auto_add_mic_boost(codec
);
15483 alc_ssid_check(codec
, 0x15, 0x1b, 0x14);
15488 /* additional initialization for auto-configuration model */
15489 static void alc861vd_auto_init(struct hda_codec
*codec
)
15491 struct alc_spec
*spec
= codec
->spec
;
15492 alc861vd_auto_init_multi_out(codec
);
15493 alc861vd_auto_init_hp_out(codec
);
15494 alc861vd_auto_init_analog_input(codec
);
15495 alc861vd_auto_init_input_src(codec
);
15496 if (spec
->unsol_event
)
15497 alc_inithook(codec
);
15500 static int patch_alc861vd(struct hda_codec
*codec
)
15502 struct alc_spec
*spec
;
15503 int err
, board_config
;
15505 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
15509 codec
->spec
= spec
;
15511 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
15515 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
15516 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
15517 "trying auto-probe from BIOS...\n", codec
->chip_name
);
15518 board_config
= ALC861VD_AUTO
;
15521 if (board_config
== ALC861VD_AUTO
) {
15522 /* automatic parse from the BIOS config */
15523 err
= alc861vd_parse_auto_config(codec
);
15529 "hda_codec: Cannot set up configuration "
15530 "from BIOS. Using base mode...\n");
15531 board_config
= ALC861VD_3ST
;
15535 err
= snd_hda_attach_beep_device(codec
, 0x23);
15541 if (board_config
!= ALC861VD_AUTO
)
15542 setup_preset(spec
, &alc861vd_presets
[board_config
]);
15544 if (codec
->vendor_id
== 0x10ec0660) {
15545 /* always turn on EAPD */
15546 add_verb(spec
, alc660vd_eapd_verbs
);
15549 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
15550 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
15552 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
15553 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
15555 spec
->adc_nids
= alc861vd_adc_nids
;
15556 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
15557 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
15558 spec
->capture_style
= CAPT_MIX
;
15560 set_capture_mixer(spec
);
15561 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
15563 spec
->vmaster_nid
= 0x02;
15565 codec
->patch_ops
= alc_patch_ops
;
15567 if (board_config
== ALC861VD_AUTO
)
15568 spec
->init_hook
= alc861vd_auto_init
;
15569 #ifdef CONFIG_SND_HDA_POWER_SAVE
15570 if (!spec
->loopback
.amplist
)
15571 spec
->loopback
.amplist
= alc861vd_loopbacks
;
15573 codec
->proc_widget_hook
= print_realtek_coef
;
15581 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15582 * configuration. Each pin widget can choose any input DACs and a mixer.
15583 * Each ADC is connected from a mixer of all inputs. This makes possible
15584 * 6-channel independent captures.
15586 * In addition, an independent DAC for the multi-playback (not used in this
15589 #define ALC662_DIGOUT_NID 0x06
15590 #define ALC662_DIGIN_NID 0x0a
15592 static hda_nid_t alc662_dac_nids
[4] = {
15593 /* front, rear, clfe, rear_surr */
15597 static hda_nid_t alc272_dac_nids
[2] = {
15601 static hda_nid_t alc662_adc_nids
[1] = {
15606 static hda_nid_t alc272_adc_nids
[1] = {
15611 static hda_nid_t alc662_capsrc_nids
[1] = { 0x22 };
15612 static hda_nid_t alc272_capsrc_nids
[1] = { 0x23 };
15616 /* FIXME: should be a matrix-type input source selection */
15617 static struct hda_input_mux alc662_capture_source
= {
15621 { "Front Mic", 0x1 },
15627 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
15635 static struct hda_input_mux alc662_eeepc_capture_source
= {
15643 static struct hda_input_mux alc663_capture_source
= {
15647 { "Front Mic", 0x1 },
15652 static struct hda_input_mux alc663_m51va_capture_source
= {
15655 { "Ext-Mic", 0x0 },
15660 #if 1 /* set to 0 for testing other input sources below */
15661 static struct hda_input_mux alc272_nc10_capture_source
= {
15664 { "Autoselect Mic", 0x0 },
15665 { "Internal Mic", 0x1 },
15669 static struct hda_input_mux alc272_nc10_capture_source
= {
15672 { "Autoselect Mic", 0x0 },
15673 { "Internal Mic", 0x1 },
15674 { "In-0x02", 0x2 },
15675 { "In-0x03", 0x3 },
15676 { "In-0x04", 0x4 },
15677 { "In-0x05", 0x5 },
15678 { "In-0x06", 0x6 },
15679 { "In-0x07", 0x7 },
15680 { "In-0x08", 0x8 },
15681 { "In-0x09", 0x9 },
15682 { "In-0x0a", 0x0a },
15683 { "In-0x0b", 0x0b },
15684 { "In-0x0c", 0x0c },
15685 { "In-0x0d", 0x0d },
15686 { "In-0x0e", 0x0e },
15687 { "In-0x0f", 0x0f },
15695 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
15702 static struct hda_verb alc662_3ST_ch2_init
[] = {
15703 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
15704 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15705 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15706 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15713 static struct hda_verb alc662_3ST_ch6_init
[] = {
15714 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15715 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15716 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
15717 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15718 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15719 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
15723 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
15724 { 2, alc662_3ST_ch2_init
},
15725 { 6, alc662_3ST_ch6_init
},
15731 static struct hda_verb alc662_sixstack_ch6_init
[] = {
15732 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15733 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15734 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15741 static struct hda_verb alc662_sixstack_ch8_init
[] = {
15742 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15743 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15744 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15748 static struct hda_channel_mode alc662_5stack_modes
[2] = {
15749 { 2, alc662_sixstack_ch6_init
},
15750 { 6, alc662_sixstack_ch8_init
},
15753 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15754 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15757 static struct snd_kcontrol_new alc662_base_mixer
[] = {
15758 /* output mixer control */
15759 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
15760 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
15761 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
15762 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
15763 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
15764 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
15765 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
15766 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
15767 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15769 /*Input mixer control */
15770 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
15771 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
15772 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
15773 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
15774 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
15775 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
15776 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
15777 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
15781 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
15782 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15783 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
15784 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15785 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
15786 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
15787 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15788 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15789 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15790 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15791 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15792 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15796 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
15797 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15798 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
15799 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15800 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
15801 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
15802 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
15803 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
15804 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
15805 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15806 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
15807 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
15808 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15809 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15811 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15812 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15813 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15817 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
15818 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15819 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
15820 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15821 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
15822 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15823 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15824 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15825 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15826 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15830 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
15831 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15832 ALC262_HIPPO_MASTER_SWITCH
,
15834 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
15835 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15836 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15838 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
15839 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15840 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15844 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
15845 ALC262_HIPPO_MASTER_SWITCH
,
15846 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15847 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15848 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
15849 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
15850 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
15851 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15852 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15853 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15854 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15858 static struct hda_bind_ctls alc663_asus_bind_master_vol
= {
15859 .ops
= &snd_hda_bind_vol
,
15861 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
15862 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
15867 static struct hda_bind_ctls alc663_asus_one_bind_switch
= {
15868 .ops
= &snd_hda_bind_sw
,
15870 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15871 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
15876 static struct snd_kcontrol_new alc663_m51va_mixer
[] = {
15877 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15878 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch
),
15879 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15880 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15884 static struct hda_bind_ctls alc663_asus_tree_bind_switch
= {
15885 .ops
= &snd_hda_bind_sw
,
15887 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15888 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
15889 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
15894 static struct snd_kcontrol_new alc663_two_hp_m1_mixer
[] = {
15895 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15896 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch
),
15897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15898 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15899 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15900 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15905 static struct hda_bind_ctls alc663_asus_four_bind_switch
= {
15906 .ops
= &snd_hda_bind_sw
,
15908 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15909 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
15910 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
15915 static struct snd_kcontrol_new alc663_two_hp_m2_mixer
[] = {
15916 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15917 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch
),
15918 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15919 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15920 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15921 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15925 static struct snd_kcontrol_new alc662_1bjd_mixer
[] = {
15926 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15927 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
15928 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15931 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15932 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15936 static struct hda_bind_ctls alc663_asus_two_bind_master_vol
= {
15937 .ops
= &snd_hda_bind_vol
,
15939 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
15940 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT
),
15945 static struct hda_bind_ctls alc663_asus_two_bind_switch
= {
15946 .ops
= &snd_hda_bind_sw
,
15948 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15949 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT
),
15954 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer
[] = {
15955 HDA_BIND_VOL("Master Playback Volume",
15956 &alc663_asus_two_bind_master_vol
),
15957 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
15958 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15959 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
15960 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15961 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15965 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer
[] = {
15966 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15967 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
15968 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15969 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15970 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15971 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15975 static struct snd_kcontrol_new alc663_g71v_mixer
[] = {
15976 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15977 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
15978 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15979 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
15982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15984 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15985 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15989 static struct snd_kcontrol_new alc663_g50v_mixer
[] = {
15990 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15991 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
15992 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
15994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15996 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15997 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15998 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15999 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16003 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
16005 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
16006 .name
= "Channel Mode",
16007 .info
= alc_ch_mode_info
,
16008 .get
= alc_ch_mode_get
,
16009 .put
= alc_ch_mode_put
,
16014 static struct hda_verb alc662_init_verbs
[] = {
16015 /* ADC: mute amp left and right */
16016 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16017 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16018 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16026 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16027 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16028 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16029 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16030 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16031 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16033 /* Front Pin: output 0 (0x0c) */
16034 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16035 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16037 /* Rear Pin: output 1 (0x0d) */
16038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16039 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16041 /* CLFE Pin: output 2 (0x0e) */
16042 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16043 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16045 /* Mic (rear) pin: input vref at 80% */
16046 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16047 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16048 /* Front Mic pin: input vref at 80% */
16049 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16050 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16051 /* Line In pin: input */
16052 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16053 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16054 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16055 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16056 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16057 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16058 /* CD pin widget for input */
16059 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16061 /* FIXME: use matrix-type input source selection */
16062 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16064 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16065 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16067 /* always trun on EAPD */
16068 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16069 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16074 static struct hda_verb alc662_sue_init_verbs
[] = {
16075 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
16076 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
16080 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
16081 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16082 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16086 /* Set Unsolicited Event*/
16087 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
16088 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16089 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16094 * generic initialization of ADC, input mixers and output mixers
16096 static struct hda_verb alc662_auto_init_verbs
[] = {
16098 * Unmute ADC and set the default input to mic-in
16100 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16101 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16103 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16105 * Note: PASD motherboards uses the Line In 2 as the input for front
16106 * panel mic (mic 2)
16108 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16116 * Set up output mixers (0x0c - 0x0f)
16118 /* set vol=0 to output mixers */
16119 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16120 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16121 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16123 /* set up input amps for analog loopback */
16124 /* Amp Indices: DAC = 0, mixer = 1 */
16125 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16126 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16127 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16128 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16129 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16130 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16133 /* FIXME: use matrix-type input source selection */
16134 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16136 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16137 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16141 /* additional verbs for ALC663 */
16142 static struct hda_verb alc663_auto_init_verbs
[] = {
16143 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16144 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16148 static struct hda_verb alc663_m51va_init_verbs
[] = {
16149 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16150 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16151 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16152 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16153 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16154 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
16156 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16157 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16161 static struct hda_verb alc663_21jd_amic_init_verbs
[] = {
16162 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16163 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16164 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16165 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16166 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16167 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16168 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16172 static struct hda_verb alc662_1bjd_amic_init_verbs
[] = {
16173 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16174 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16175 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16176 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
16177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16180 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16184 static struct hda_verb alc663_15jd_amic_init_verbs
[] = {
16185 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16186 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16187 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16190 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16191 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16195 static struct hda_verb alc663_two_hp_amic_m1_init_verbs
[] = {
16196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16197 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16198 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16199 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
16200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16202 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
16203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16205 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16206 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16207 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16211 static struct hda_verb alc663_two_hp_amic_m2_init_verbs
[] = {
16212 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16213 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16214 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16215 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16216 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16217 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16218 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16220 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16221 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16222 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16223 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16227 static struct hda_verb alc663_g71v_init_verbs
[] = {
16228 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16229 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16230 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16232 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16233 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16234 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
16236 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
16237 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
16238 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
16242 static struct hda_verb alc663_g50v_init_verbs
[] = {
16243 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16244 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16245 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
16247 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16248 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16252 static struct hda_verb alc662_ecs_init_verbs
[] = {
16253 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
16254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16255 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16256 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16260 static struct hda_verb alc272_dell_zm1_init_verbs
[] = {
16261 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16262 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16263 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16264 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16265 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16266 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16267 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16268 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16269 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
16270 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16271 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16275 static struct hda_verb alc272_dell_init_verbs
[] = {
16276 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16277 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16278 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16279 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16280 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16281 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16282 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
16285 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16286 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16290 static struct snd_kcontrol_new alc662_auto_capture_mixer
[] = {
16291 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
16292 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
16296 static struct snd_kcontrol_new alc272_auto_capture_mixer
[] = {
16297 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
16298 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
16302 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
16304 unsigned int present
;
16305 unsigned char bits
;
16307 present
= snd_hda_codec_read(codec
, 0x14, 0,
16308 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
16309 bits
= present
? HDA_AMP_MUTE
: 0;
16310 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
16311 HDA_AMP_MUTE
, bits
);
16314 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
16316 unsigned int present
;
16317 unsigned char bits
;
16319 present
= snd_hda_codec_read(codec
, 0x1b, 0,
16320 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
16321 bits
= present
? HDA_AMP_MUTE
: 0;
16322 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
16323 HDA_AMP_MUTE
, bits
);
16324 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
16325 HDA_AMP_MUTE
, bits
);
16328 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
16331 if ((res
>> 26) == ALC880_HP_EVENT
)
16332 alc662_lenovo_101e_all_automute(codec
);
16333 if ((res
>> 26) == ALC880_FRONT_EVENT
)
16334 alc662_lenovo_101e_ispeaker_automute(codec
);
16337 static void alc662_eeepc_mic_automute(struct hda_codec
*codec
)
16339 unsigned int present
;
16341 present
= snd_hda_codec_read(codec
, 0x18, 0,
16342 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
16343 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16344 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
16345 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16346 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
16347 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16348 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
16349 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16350 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
16353 /* unsolicited event for HP jack sensing */
16354 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
16357 if ((res
>> 26) == ALC880_MIC_EVENT
)
16358 alc662_eeepc_mic_automute(codec
);
16360 alc262_hippo_unsol_event(codec
, res
);
16363 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
16365 alc262_hippo1_init_hook(codec
);
16366 alc662_eeepc_mic_automute(codec
);
16369 static void alc662_eeepc_ep20_inithook(struct hda_codec
*codec
)
16371 struct alc_spec
*spec
= codec
->spec
;
16373 spec
->autocfg
.hp_pins
[0] = 0x14;
16374 spec
->autocfg
.speaker_pins
[0] = 0x1b;
16375 alc262_hippo_master_update(codec
);
16378 static void alc663_m51va_speaker_automute(struct hda_codec
*codec
)
16380 unsigned int present
;
16381 unsigned char bits
;
16383 present
= snd_hda_codec_read(codec
, 0x21, 0,
16384 AC_VERB_GET_PIN_SENSE
, 0)
16385 & AC_PINSENSE_PRESENCE
;
16386 bits
= present
? HDA_AMP_MUTE
: 0;
16387 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
16388 AMP_IN_MUTE(0), bits
);
16389 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
16390 AMP_IN_MUTE(0), bits
);
16393 static void alc663_21jd_two_speaker_automute(struct hda_codec
*codec
)
16395 unsigned int present
;
16396 unsigned char bits
;
16398 present
= snd_hda_codec_read(codec
, 0x21, 0,
16399 AC_VERB_GET_PIN_SENSE
, 0)
16400 & AC_PINSENSE_PRESENCE
;
16401 bits
= present
? HDA_AMP_MUTE
: 0;
16402 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
16403 AMP_IN_MUTE(0), bits
);
16404 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
16405 AMP_IN_MUTE(0), bits
);
16406 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
16407 AMP_IN_MUTE(0), bits
);
16408 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
16409 AMP_IN_MUTE(0), bits
);
16412 static void alc663_15jd_two_speaker_automute(struct hda_codec
*codec
)
16414 unsigned int present
;
16415 unsigned char bits
;
16417 present
= snd_hda_codec_read(codec
, 0x15, 0,
16418 AC_VERB_GET_PIN_SENSE
, 0)
16419 & AC_PINSENSE_PRESENCE
;
16420 bits
= present
? HDA_AMP_MUTE
: 0;
16421 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
16422 AMP_IN_MUTE(0), bits
);
16423 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
16424 AMP_IN_MUTE(0), bits
);
16425 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
16426 AMP_IN_MUTE(0), bits
);
16427 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
16428 AMP_IN_MUTE(0), bits
);
16431 static void alc662_f5z_speaker_automute(struct hda_codec
*codec
)
16433 unsigned int present
;
16434 unsigned char bits
;
16436 present
= snd_hda_codec_read(codec
, 0x1b, 0,
16437 AC_VERB_GET_PIN_SENSE
, 0)
16438 & AC_PINSENSE_PRESENCE
;
16439 bits
= present
? 0 : PIN_OUT
;
16440 snd_hda_codec_write(codec
, 0x14, 0,
16441 AC_VERB_SET_PIN_WIDGET_CONTROL
, bits
);
16444 static void alc663_two_hp_m1_speaker_automute(struct hda_codec
*codec
)
16446 unsigned int present1
, present2
;
16448 present1
= snd_hda_codec_read(codec
, 0x21, 0,
16449 AC_VERB_GET_PIN_SENSE
, 0)
16450 & AC_PINSENSE_PRESENCE
;
16451 present2
= snd_hda_codec_read(codec
, 0x15, 0,
16452 AC_VERB_GET_PIN_SENSE
, 0)
16453 & AC_PINSENSE_PRESENCE
;
16455 if (present1
|| present2
) {
16456 snd_hda_codec_write_cache(codec
, 0x14, 0,
16457 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
16459 snd_hda_codec_write_cache(codec
, 0x14, 0,
16460 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
16464 static void alc663_two_hp_m2_speaker_automute(struct hda_codec
*codec
)
16466 unsigned int present1
, present2
;
16468 present1
= snd_hda_codec_read(codec
, 0x1b, 0,
16469 AC_VERB_GET_PIN_SENSE
, 0)
16470 & AC_PINSENSE_PRESENCE
;
16471 present2
= snd_hda_codec_read(codec
, 0x15, 0,
16472 AC_VERB_GET_PIN_SENSE
, 0)
16473 & AC_PINSENSE_PRESENCE
;
16475 if (present1
|| present2
) {
16476 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
16477 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16478 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
16479 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16481 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
16482 AMP_IN_MUTE(0), 0);
16483 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
16484 AMP_IN_MUTE(0), 0);
16488 static void alc663_m51va_mic_automute(struct hda_codec
*codec
)
16490 unsigned int present
;
16492 present
= snd_hda_codec_read(codec
, 0x18, 0,
16493 AC_VERB_GET_PIN_SENSE
, 0)
16494 & AC_PINSENSE_PRESENCE
;
16495 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16496 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
16497 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16498 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
16499 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16500 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
16501 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16502 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
16505 static void alc663_m51va_unsol_event(struct hda_codec
*codec
,
16508 switch (res
>> 26) {
16509 case ALC880_HP_EVENT
:
16510 alc663_m51va_speaker_automute(codec
);
16512 case ALC880_MIC_EVENT
:
16513 alc663_m51va_mic_automute(codec
);
16518 static void alc663_m51va_inithook(struct hda_codec
*codec
)
16520 alc663_m51va_speaker_automute(codec
);
16521 alc663_m51va_mic_automute(codec
);
16524 /* ***************** Mode1 ******************************/
16525 static void alc663_mode1_unsol_event(struct hda_codec
*codec
,
16528 switch (res
>> 26) {
16529 case ALC880_HP_EVENT
:
16530 alc663_m51va_speaker_automute(codec
);
16532 case ALC880_MIC_EVENT
:
16533 alc662_eeepc_mic_automute(codec
);
16538 static void alc663_mode1_inithook(struct hda_codec
*codec
)
16540 alc663_m51va_speaker_automute(codec
);
16541 alc662_eeepc_mic_automute(codec
);
16543 /* ***************** Mode2 ******************************/
16544 static void alc662_mode2_unsol_event(struct hda_codec
*codec
,
16547 switch (res
>> 26) {
16548 case ALC880_HP_EVENT
:
16549 alc662_f5z_speaker_automute(codec
);
16551 case ALC880_MIC_EVENT
:
16552 alc662_eeepc_mic_automute(codec
);
16557 static void alc662_mode2_inithook(struct hda_codec
*codec
)
16559 alc662_f5z_speaker_automute(codec
);
16560 alc662_eeepc_mic_automute(codec
);
16562 /* ***************** Mode3 ******************************/
16563 static void alc663_mode3_unsol_event(struct hda_codec
*codec
,
16566 switch (res
>> 26) {
16567 case ALC880_HP_EVENT
:
16568 alc663_two_hp_m1_speaker_automute(codec
);
16570 case ALC880_MIC_EVENT
:
16571 alc662_eeepc_mic_automute(codec
);
16576 static void alc663_mode3_inithook(struct hda_codec
*codec
)
16578 alc663_two_hp_m1_speaker_automute(codec
);
16579 alc662_eeepc_mic_automute(codec
);
16581 /* ***************** Mode4 ******************************/
16582 static void alc663_mode4_unsol_event(struct hda_codec
*codec
,
16585 switch (res
>> 26) {
16586 case ALC880_HP_EVENT
:
16587 alc663_21jd_two_speaker_automute(codec
);
16589 case ALC880_MIC_EVENT
:
16590 alc662_eeepc_mic_automute(codec
);
16595 static void alc663_mode4_inithook(struct hda_codec
*codec
)
16597 alc663_21jd_two_speaker_automute(codec
);
16598 alc662_eeepc_mic_automute(codec
);
16600 /* ***************** Mode5 ******************************/
16601 static void alc663_mode5_unsol_event(struct hda_codec
*codec
,
16604 switch (res
>> 26) {
16605 case ALC880_HP_EVENT
:
16606 alc663_15jd_two_speaker_automute(codec
);
16608 case ALC880_MIC_EVENT
:
16609 alc662_eeepc_mic_automute(codec
);
16614 static void alc663_mode5_inithook(struct hda_codec
*codec
)
16616 alc663_15jd_two_speaker_automute(codec
);
16617 alc662_eeepc_mic_automute(codec
);
16619 /* ***************** Mode6 ******************************/
16620 static void alc663_mode6_unsol_event(struct hda_codec
*codec
,
16623 switch (res
>> 26) {
16624 case ALC880_HP_EVENT
:
16625 alc663_two_hp_m2_speaker_automute(codec
);
16627 case ALC880_MIC_EVENT
:
16628 alc662_eeepc_mic_automute(codec
);
16633 static void alc663_mode6_inithook(struct hda_codec
*codec
)
16635 alc663_two_hp_m2_speaker_automute(codec
);
16636 alc662_eeepc_mic_automute(codec
);
16639 static void alc663_g71v_hp_automute(struct hda_codec
*codec
)
16641 unsigned int present
;
16642 unsigned char bits
;
16644 present
= snd_hda_codec_read(codec
, 0x21, 0,
16645 AC_VERB_GET_PIN_SENSE
, 0)
16646 & AC_PINSENSE_PRESENCE
;
16647 bits
= present
? HDA_AMP_MUTE
: 0;
16648 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
16649 HDA_AMP_MUTE
, bits
);
16650 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
16651 HDA_AMP_MUTE
, bits
);
16654 static void alc663_g71v_front_automute(struct hda_codec
*codec
)
16656 unsigned int present
;
16657 unsigned char bits
;
16659 present
= snd_hda_codec_read(codec
, 0x15, 0,
16660 AC_VERB_GET_PIN_SENSE
, 0)
16661 & AC_PINSENSE_PRESENCE
;
16662 bits
= present
? HDA_AMP_MUTE
: 0;
16663 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
16664 HDA_AMP_MUTE
, bits
);
16667 static void alc663_g71v_unsol_event(struct hda_codec
*codec
,
16670 switch (res
>> 26) {
16671 case ALC880_HP_EVENT
:
16672 alc663_g71v_hp_automute(codec
);
16674 case ALC880_FRONT_EVENT
:
16675 alc663_g71v_front_automute(codec
);
16677 case ALC880_MIC_EVENT
:
16678 alc662_eeepc_mic_automute(codec
);
16683 static void alc663_g71v_inithook(struct hda_codec
*codec
)
16685 alc663_g71v_front_automute(codec
);
16686 alc663_g71v_hp_automute(codec
);
16687 alc662_eeepc_mic_automute(codec
);
16690 static void alc663_g50v_unsol_event(struct hda_codec
*codec
,
16693 switch (res
>> 26) {
16694 case ALC880_HP_EVENT
:
16695 alc663_m51va_speaker_automute(codec
);
16697 case ALC880_MIC_EVENT
:
16698 alc662_eeepc_mic_automute(codec
);
16703 static void alc663_g50v_inithook(struct hda_codec
*codec
)
16705 alc663_m51va_speaker_automute(codec
);
16706 alc662_eeepc_mic_automute(codec
);
16709 static struct snd_kcontrol_new alc662_ecs_mixer
[] = {
16710 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16711 ALC262_HIPPO_MASTER_SWITCH
,
16713 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT
),
16714 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16715 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16717 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
16718 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16719 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16723 static struct snd_kcontrol_new alc272_nc10_mixer
[] = {
16724 /* Master Playback automatically created from Speaker and Headphone */
16725 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16726 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
16727 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16728 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
16730 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16731 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16732 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
16734 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16735 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16736 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
16740 #ifdef CONFIG_SND_HDA_POWER_SAVE
16741 #define alc662_loopbacks alc880_loopbacks
16745 /* pcm configuration: identical with ALC880 */
16746 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16747 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16748 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16749 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16752 * configuration and preset
16754 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
16755 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
16756 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
16757 [ALC662_3ST_6ch
] = "3stack-6ch",
16758 [ALC662_5ST_DIG
] = "6stack-dig",
16759 [ALC662_LENOVO_101E
] = "lenovo-101e",
16760 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
16761 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
16762 [ALC662_ECS
] = "ecs",
16763 [ALC663_ASUS_M51VA
] = "m51va",
16764 [ALC663_ASUS_G71V
] = "g71v",
16765 [ALC663_ASUS_H13
] = "h13",
16766 [ALC663_ASUS_G50V
] = "g50v",
16767 [ALC663_ASUS_MODE1
] = "asus-mode1",
16768 [ALC662_ASUS_MODE2
] = "asus-mode2",
16769 [ALC663_ASUS_MODE3
] = "asus-mode3",
16770 [ALC663_ASUS_MODE4
] = "asus-mode4",
16771 [ALC663_ASUS_MODE5
] = "asus-mode5",
16772 [ALC663_ASUS_MODE6
] = "asus-mode6",
16773 [ALC272_DELL
] = "dell",
16774 [ALC272_DELL_ZM1
] = "dell-zm1",
16775 [ALC272_SAMSUNG_NC10
] = "samsung-nc10",
16776 [ALC662_AUTO
] = "auto",
16779 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
16780 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS
),
16781 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL
),
16782 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1
),
16783 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1
),
16784 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3
),
16785 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3
),
16786 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1
),
16787 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2
),
16788 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1
),
16789 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2
),
16790 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2
),
16791 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2
),
16792 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6
),
16793 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6
),
16794 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2
),
16795 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3
),
16796 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA
),
16797 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2
),
16798 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2
),
16799 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5
),
16800 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6
),
16801 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2
),
16802 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1
),
16803 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2
),
16804 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2
),
16805 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
16806 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16807 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3
),
16808 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3
),
16809 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1
),
16810 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1
),
16811 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1
),
16812 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1
),
16813 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2
),
16814 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2
),
16815 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1
),
16816 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1
),
16817 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3
),
16818 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1
),
16819 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1
),
16820 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V
),
16821 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16822 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1
),
16823 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2
),
16824 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA
),
16825 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1
),
16826 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4
),
16827 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
16828 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
16829 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
16830 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS
),
16831 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16832 ALC662_3ST_6ch_DIG
),
16833 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10
),
16834 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16835 ALC662_3ST_6ch_DIG
),
16836 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG
),
16837 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA
),
16838 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
16839 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16840 ALC662_3ST_6ch_DIG
),
16841 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16846 static struct alc_config_preset alc662_presets
[] = {
16847 [ALC662_3ST_2ch_DIG
] = {
16848 .mixers
= { alc662_3ST_2ch_mixer
},
16849 .init_verbs
= { alc662_init_verbs
},
16850 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16851 .dac_nids
= alc662_dac_nids
,
16852 .dig_out_nid
= ALC662_DIGOUT_NID
,
16853 .dig_in_nid
= ALC662_DIGIN_NID
,
16854 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16855 .channel_mode
= alc662_3ST_2ch_modes
,
16856 .input_mux
= &alc662_capture_source
,
16858 [ALC662_3ST_6ch_DIG
] = {
16859 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
16860 .init_verbs
= { alc662_init_verbs
},
16861 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16862 .dac_nids
= alc662_dac_nids
,
16863 .dig_out_nid
= ALC662_DIGOUT_NID
,
16864 .dig_in_nid
= ALC662_DIGIN_NID
,
16865 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16866 .channel_mode
= alc662_3ST_6ch_modes
,
16868 .input_mux
= &alc662_capture_source
,
16870 [ALC662_3ST_6ch
] = {
16871 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
16872 .init_verbs
= { alc662_init_verbs
},
16873 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16874 .dac_nids
= alc662_dac_nids
,
16875 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16876 .channel_mode
= alc662_3ST_6ch_modes
,
16878 .input_mux
= &alc662_capture_source
,
16880 [ALC662_5ST_DIG
] = {
16881 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
},
16882 .init_verbs
= { alc662_init_verbs
},
16883 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16884 .dac_nids
= alc662_dac_nids
,
16885 .dig_out_nid
= ALC662_DIGOUT_NID
,
16886 .dig_in_nid
= ALC662_DIGIN_NID
,
16887 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
16888 .channel_mode
= alc662_5stack_modes
,
16889 .input_mux
= &alc662_capture_source
,
16891 [ALC662_LENOVO_101E
] = {
16892 .mixers
= { alc662_lenovo_101e_mixer
},
16893 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
16894 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16895 .dac_nids
= alc662_dac_nids
,
16896 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16897 .channel_mode
= alc662_3ST_2ch_modes
,
16898 .input_mux
= &alc662_lenovo_101e_capture_source
,
16899 .unsol_event
= alc662_lenovo_101e_unsol_event
,
16900 .init_hook
= alc662_lenovo_101e_all_automute
,
16902 [ALC662_ASUS_EEEPC_P701
] = {
16903 .mixers
= { alc662_eeepc_p701_mixer
},
16904 .init_verbs
= { alc662_init_verbs
,
16905 alc662_eeepc_sue_init_verbs
},
16906 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16907 .dac_nids
= alc662_dac_nids
,
16908 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16909 .channel_mode
= alc662_3ST_2ch_modes
,
16910 .input_mux
= &alc662_eeepc_capture_source
,
16911 .unsol_event
= alc662_eeepc_unsol_event
,
16912 .init_hook
= alc662_eeepc_inithook
,
16914 [ALC662_ASUS_EEEPC_EP20
] = {
16915 .mixers
= { alc662_eeepc_ep20_mixer
,
16916 alc662_chmode_mixer
},
16917 .init_verbs
= { alc662_init_verbs
,
16918 alc662_eeepc_ep20_sue_init_verbs
},
16919 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16920 .dac_nids
= alc662_dac_nids
,
16921 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16922 .channel_mode
= alc662_3ST_6ch_modes
,
16923 .input_mux
= &alc662_lenovo_101e_capture_source
,
16924 .unsol_event
= alc662_eeepc_unsol_event
,
16925 .init_hook
= alc662_eeepc_ep20_inithook
,
16928 .mixers
= { alc662_ecs_mixer
},
16929 .init_verbs
= { alc662_init_verbs
,
16930 alc662_ecs_init_verbs
},
16931 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16932 .dac_nids
= alc662_dac_nids
,
16933 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16934 .channel_mode
= alc662_3ST_2ch_modes
,
16935 .input_mux
= &alc662_eeepc_capture_source
,
16936 .unsol_event
= alc662_eeepc_unsol_event
,
16937 .init_hook
= alc662_eeepc_inithook
,
16939 [ALC663_ASUS_M51VA
] = {
16940 .mixers
= { alc663_m51va_mixer
},
16941 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
16942 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16943 .dac_nids
= alc662_dac_nids
,
16944 .dig_out_nid
= ALC662_DIGOUT_NID
,
16945 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16946 .channel_mode
= alc662_3ST_2ch_modes
,
16947 .input_mux
= &alc663_m51va_capture_source
,
16948 .unsol_event
= alc663_m51va_unsol_event
,
16949 .init_hook
= alc663_m51va_inithook
,
16951 [ALC663_ASUS_G71V
] = {
16952 .mixers
= { alc663_g71v_mixer
},
16953 .init_verbs
= { alc662_init_verbs
, alc663_g71v_init_verbs
},
16954 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16955 .dac_nids
= alc662_dac_nids
,
16956 .dig_out_nid
= ALC662_DIGOUT_NID
,
16957 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16958 .channel_mode
= alc662_3ST_2ch_modes
,
16959 .input_mux
= &alc662_eeepc_capture_source
,
16960 .unsol_event
= alc663_g71v_unsol_event
,
16961 .init_hook
= alc663_g71v_inithook
,
16963 [ALC663_ASUS_H13
] = {
16964 .mixers
= { alc663_m51va_mixer
},
16965 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
16966 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16967 .dac_nids
= alc662_dac_nids
,
16968 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16969 .channel_mode
= alc662_3ST_2ch_modes
,
16970 .input_mux
= &alc663_m51va_capture_source
,
16971 .unsol_event
= alc663_m51va_unsol_event
,
16972 .init_hook
= alc663_m51va_inithook
,
16974 [ALC663_ASUS_G50V
] = {
16975 .mixers
= { alc663_g50v_mixer
},
16976 .init_verbs
= { alc662_init_verbs
, alc663_g50v_init_verbs
},
16977 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16978 .dac_nids
= alc662_dac_nids
,
16979 .dig_out_nid
= ALC662_DIGOUT_NID
,
16980 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16981 .channel_mode
= alc662_3ST_6ch_modes
,
16982 .input_mux
= &alc663_capture_source
,
16983 .unsol_event
= alc663_g50v_unsol_event
,
16984 .init_hook
= alc663_g50v_inithook
,
16986 [ALC663_ASUS_MODE1
] = {
16987 .mixers
= { alc663_m51va_mixer
},
16988 .cap_mixer
= alc662_auto_capture_mixer
,
16989 .init_verbs
= { alc662_init_verbs
,
16990 alc663_21jd_amic_init_verbs
},
16991 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16993 .dac_nids
= alc662_dac_nids
,
16994 .dig_out_nid
= ALC662_DIGOUT_NID
,
16995 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16996 .channel_mode
= alc662_3ST_2ch_modes
,
16997 .input_mux
= &alc662_eeepc_capture_source
,
16998 .unsol_event
= alc663_mode1_unsol_event
,
16999 .init_hook
= alc663_mode1_inithook
,
17001 [ALC662_ASUS_MODE2
] = {
17002 .mixers
= { alc662_1bjd_mixer
},
17003 .cap_mixer
= alc662_auto_capture_mixer
,
17004 .init_verbs
= { alc662_init_verbs
,
17005 alc662_1bjd_amic_init_verbs
},
17006 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17007 .dac_nids
= alc662_dac_nids
,
17008 .dig_out_nid
= ALC662_DIGOUT_NID
,
17009 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17010 .channel_mode
= alc662_3ST_2ch_modes
,
17011 .input_mux
= &alc662_eeepc_capture_source
,
17012 .unsol_event
= alc662_mode2_unsol_event
,
17013 .init_hook
= alc662_mode2_inithook
,
17015 [ALC663_ASUS_MODE3
] = {
17016 .mixers
= { alc663_two_hp_m1_mixer
},
17017 .cap_mixer
= alc662_auto_capture_mixer
,
17018 .init_verbs
= { alc662_init_verbs
,
17019 alc663_two_hp_amic_m1_init_verbs
},
17020 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17022 .dac_nids
= alc662_dac_nids
,
17023 .dig_out_nid
= ALC662_DIGOUT_NID
,
17024 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17025 .channel_mode
= alc662_3ST_2ch_modes
,
17026 .input_mux
= &alc662_eeepc_capture_source
,
17027 .unsol_event
= alc663_mode3_unsol_event
,
17028 .init_hook
= alc663_mode3_inithook
,
17030 [ALC663_ASUS_MODE4
] = {
17031 .mixers
= { alc663_asus_21jd_clfe_mixer
},
17032 .cap_mixer
= alc662_auto_capture_mixer
,
17033 .init_verbs
= { alc662_init_verbs
,
17034 alc663_21jd_amic_init_verbs
},
17035 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17037 .dac_nids
= alc662_dac_nids
,
17038 .dig_out_nid
= ALC662_DIGOUT_NID
,
17039 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17040 .channel_mode
= alc662_3ST_2ch_modes
,
17041 .input_mux
= &alc662_eeepc_capture_source
,
17042 .unsol_event
= alc663_mode4_unsol_event
,
17043 .init_hook
= alc663_mode4_inithook
,
17045 [ALC663_ASUS_MODE5
] = {
17046 .mixers
= { alc663_asus_15jd_clfe_mixer
},
17047 .cap_mixer
= alc662_auto_capture_mixer
,
17048 .init_verbs
= { alc662_init_verbs
,
17049 alc663_15jd_amic_init_verbs
},
17050 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17052 .dac_nids
= alc662_dac_nids
,
17053 .dig_out_nid
= ALC662_DIGOUT_NID
,
17054 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17055 .channel_mode
= alc662_3ST_2ch_modes
,
17056 .input_mux
= &alc662_eeepc_capture_source
,
17057 .unsol_event
= alc663_mode5_unsol_event
,
17058 .init_hook
= alc663_mode5_inithook
,
17060 [ALC663_ASUS_MODE6
] = {
17061 .mixers
= { alc663_two_hp_m2_mixer
},
17062 .cap_mixer
= alc662_auto_capture_mixer
,
17063 .init_verbs
= { alc662_init_verbs
,
17064 alc663_two_hp_amic_m2_init_verbs
},
17065 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17067 .dac_nids
= alc662_dac_nids
,
17068 .dig_out_nid
= ALC662_DIGOUT_NID
,
17069 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17070 .channel_mode
= alc662_3ST_2ch_modes
,
17071 .input_mux
= &alc662_eeepc_capture_source
,
17072 .unsol_event
= alc663_mode6_unsol_event
,
17073 .init_hook
= alc663_mode6_inithook
,
17076 .mixers
= { alc663_m51va_mixer
},
17077 .cap_mixer
= alc272_auto_capture_mixer
,
17078 .init_verbs
= { alc662_init_verbs
, alc272_dell_init_verbs
},
17079 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
17080 .dac_nids
= alc662_dac_nids
,
17081 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17082 .adc_nids
= alc272_adc_nids
,
17083 .num_adc_nids
= ARRAY_SIZE(alc272_adc_nids
),
17084 .capsrc_nids
= alc272_capsrc_nids
,
17085 .channel_mode
= alc662_3ST_2ch_modes
,
17086 .input_mux
= &alc663_m51va_capture_source
,
17087 .unsol_event
= alc663_m51va_unsol_event
,
17088 .init_hook
= alc663_m51va_inithook
,
17090 [ALC272_DELL_ZM1
] = {
17091 .mixers
= { alc663_m51va_mixer
},
17092 .cap_mixer
= alc662_auto_capture_mixer
,
17093 .init_verbs
= { alc662_init_verbs
, alc272_dell_zm1_init_verbs
},
17094 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
17095 .dac_nids
= alc662_dac_nids
,
17096 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17097 .adc_nids
= alc662_adc_nids
,
17098 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
17099 .capsrc_nids
= alc662_capsrc_nids
,
17100 .channel_mode
= alc662_3ST_2ch_modes
,
17101 .input_mux
= &alc663_m51va_capture_source
,
17102 .unsol_event
= alc663_m51va_unsol_event
,
17103 .init_hook
= alc663_m51va_inithook
,
17105 [ALC272_SAMSUNG_NC10
] = {
17106 .mixers
= { alc272_nc10_mixer
},
17107 .init_verbs
= { alc662_init_verbs
,
17108 alc663_21jd_amic_init_verbs
},
17109 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
17110 .dac_nids
= alc272_dac_nids
,
17111 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17112 .channel_mode
= alc662_3ST_2ch_modes
,
17113 .input_mux
= &alc272_nc10_capture_source
,
17114 .unsol_event
= alc663_mode4_unsol_event
,
17115 .init_hook
= alc663_mode4_inithook
,
17121 * BIOS auto configuration
17124 /* add playback controls from the parsed DAC table */
17125 static int alc662_auto_create_multi_out_ctls(struct alc_spec
*spec
,
17126 const struct auto_pin_cfg
*cfg
)
17129 static const char *chname
[4] = {
17130 "Front", "Surround", NULL
/*CLFE*/, "Side"
17135 for (i
= 0; i
< cfg
->line_outs
; i
++) {
17136 if (!spec
->multiout
.dac_nids
[i
])
17138 nid
= alc880_idx_to_dac(i
);
17141 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
17142 "Center Playback Volume",
17143 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
17147 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
17148 "LFE Playback Volume",
17149 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
17153 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
17154 "Center Playback Switch",
17155 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17159 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
17160 "LFE Playback Switch",
17161 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17166 sprintf(name
, "%s Playback Volume", chname
[i
]);
17167 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
17168 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
17172 sprintf(name
, "%s Playback Switch", chname
[i
]);
17173 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
17174 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i
),
17183 /* add playback controls for speaker and HP outputs */
17184 static int alc662_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
17195 /* ALC663 has a mono output pin on 0x17 */
17196 sprintf(name
, "%s Playback Switch", pfx
);
17197 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
17198 HDA_COMPOSE_AMP_VAL(pin
, 2, 0, HDA_OUTPUT
));
17202 if (alc880_is_fixed_pin(pin
)) {
17203 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
17204 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17205 /* specify the DAC as the extra output */
17206 if (!spec
->multiout
.hp_nid
)
17207 spec
->multiout
.hp_nid
= nid
;
17209 spec
->multiout
.extra_out_nid
[0] = nid
;
17210 /* control HP volume/switch on the output mixer amp */
17211 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
17212 sprintf(name
, "%s Playback Volume", pfx
);
17213 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
17214 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
17217 sprintf(name
, "%s Playback Switch", pfx
);
17218 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
17219 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
17222 } else if (alc880_is_multi_pin(pin
)) {
17223 /* set manual connection */
17224 /* we have only a switch on HP-out PIN */
17225 sprintf(name
, "%s Playback Switch", pfx
);
17226 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
17227 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
17234 /* return the index of the src widget from the connection list of the nid.
17235 * return -1 if not found
17237 static int alc662_input_pin_idx(struct hda_codec
*codec
, hda_nid_t nid
,
17240 hda_nid_t conn_list
[HDA_MAX_CONNECTIONS
];
17243 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
17244 ARRAY_SIZE(conn_list
));
17247 for (i
= 0; i
< conns
; i
++)
17248 if (conn_list
[i
] == src
)
17253 static int alc662_is_input_pin(struct hda_codec
*codec
, hda_nid_t nid
)
17255 unsigned int pincap
= snd_hda_query_pin_caps(codec
, nid
);
17256 return (pincap
& AC_PINCAP_IN
) != 0;
17259 /* create playback/capture controls for input pins */
17260 static int alc662_auto_create_analog_input_ctls(struct hda_codec
*codec
,
17261 const struct auto_pin_cfg
*cfg
)
17263 struct alc_spec
*spec
= codec
->spec
;
17264 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
17267 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
17268 if (alc662_is_input_pin(codec
, cfg
->input_pins
[i
])) {
17269 idx
= alc662_input_pin_idx(codec
, 0x0b,
17270 cfg
->input_pins
[i
]);
17272 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
17273 auto_pin_cfg_labels
[i
],
17278 idx
= alc662_input_pin_idx(codec
, 0x22,
17279 cfg
->input_pins
[i
]);
17281 imux
->items
[imux
->num_items
].label
=
17282 auto_pin_cfg_labels
[i
];
17283 imux
->items
[imux
->num_items
].index
= idx
;
17291 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
17292 hda_nid_t nid
, int pin_type
,
17295 alc_set_pin_output(codec
, nid
, pin_type
);
17296 /* need the manual connection? */
17297 if (alc880_is_multi_pin(nid
)) {
17298 struct alc_spec
*spec
= codec
->spec
;
17299 int idx
= alc880_multi_pin_idx(nid
);
17300 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
17301 AC_VERB_SET_CONNECT_SEL
,
17302 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
17306 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
17308 struct alc_spec
*spec
= codec
->spec
;
17311 for (i
= 0; i
<= HDA_SIDE
; i
++) {
17312 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
17313 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
17315 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
17320 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
17322 struct alc_spec
*spec
= codec
->spec
;
17325 pin
= spec
->autocfg
.hp_pins
[0];
17326 if (pin
) /* connect to front */
17328 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
17329 pin
= spec
->autocfg
.speaker_pins
[0];
17331 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
17334 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17336 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
17338 struct alc_spec
*spec
= codec
->spec
;
17341 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
17342 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
17343 if (alc662_is_input_pin(codec
, nid
)) {
17344 alc_set_input_pin(codec
, nid
, i
);
17345 if (nid
!= ALC662_PIN_CD_NID
&&
17346 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
17347 snd_hda_codec_write(codec
, nid
, 0,
17348 AC_VERB_SET_AMP_GAIN_MUTE
,
17354 #define alc662_auto_init_input_src alc882_auto_init_input_src
17356 static int alc662_parse_auto_config(struct hda_codec
*codec
)
17358 struct alc_spec
*spec
= codec
->spec
;
17360 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
17362 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
17366 if (!spec
->autocfg
.line_outs
)
17367 return 0; /* can't find valid BIOS pin config */
17369 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
17372 err
= alc662_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
17375 err
= alc662_auto_create_extra_out(spec
,
17376 spec
->autocfg
.speaker_pins
[0],
17380 err
= alc662_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
17384 err
= alc662_auto_create_analog_input_ctls(codec
, &spec
->autocfg
);
17388 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
17390 if (spec
->autocfg
.dig_outs
)
17391 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
17393 if (spec
->kctls
.list
)
17394 add_mixer(spec
, spec
->kctls
.list
);
17396 spec
->num_mux_defs
= 1;
17397 spec
->input_mux
= &spec
->private_imux
[0];
17399 add_verb(spec
, alc662_auto_init_verbs
);
17400 if (codec
->vendor_id
== 0x10ec0663)
17401 add_verb(spec
, alc663_auto_init_verbs
);
17403 err
= alc_auto_add_mic_boost(codec
);
17407 alc_ssid_check(codec
, 0x15, 0x1b, 0x14);
17412 /* additional initialization for auto-configuration model */
17413 static void alc662_auto_init(struct hda_codec
*codec
)
17415 struct alc_spec
*spec
= codec
->spec
;
17416 alc662_auto_init_multi_out(codec
);
17417 alc662_auto_init_hp_out(codec
);
17418 alc662_auto_init_analog_input(codec
);
17419 alc662_auto_init_input_src(codec
);
17420 if (spec
->unsol_event
)
17421 alc_inithook(codec
);
17424 static int patch_alc662(struct hda_codec
*codec
)
17426 struct alc_spec
*spec
;
17427 int err
, board_config
;
17429 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
17433 codec
->spec
= spec
;
17435 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
17437 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
17440 if (board_config
< 0) {
17441 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
17442 "trying auto-probe from BIOS...\n", codec
->chip_name
);
17443 board_config
= ALC662_AUTO
;
17446 if (board_config
== ALC662_AUTO
) {
17447 /* automatic parse from the BIOS config */
17448 err
= alc662_parse_auto_config(codec
);
17454 "hda_codec: Cannot set up configuration "
17455 "from BIOS. Using base mode...\n");
17456 board_config
= ALC662_3ST_2ch_DIG
;
17460 err
= snd_hda_attach_beep_device(codec
, 0x1);
17466 if (board_config
!= ALC662_AUTO
)
17467 setup_preset(spec
, &alc662_presets
[board_config
]);
17469 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
17470 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
17472 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
17473 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
17475 spec
->adc_nids
= alc662_adc_nids
;
17476 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
17477 spec
->capsrc_nids
= alc662_capsrc_nids
;
17478 spec
->capture_style
= CAPT_MIX
;
17480 if (!spec
->cap_mixer
)
17481 set_capture_mixer(spec
);
17482 if (codec
->vendor_id
== 0x10ec0662)
17483 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
17485 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
17487 spec
->vmaster_nid
= 0x02;
17489 codec
->patch_ops
= alc_patch_ops
;
17490 if (board_config
== ALC662_AUTO
)
17491 spec
->init_hook
= alc662_auto_init
;
17492 #ifdef CONFIG_SND_HDA_POWER_SAVE
17493 if (!spec
->loopback
.amplist
)
17494 spec
->loopback
.amplist
= alc662_loopbacks
;
17496 codec
->proc_widget_hook
= print_realtek_coef
;
17504 static struct hda_codec_preset snd_hda_preset_realtek
[] = {
17505 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
17506 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
17507 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
17508 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
17509 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
17510 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
17511 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
17512 .patch
= patch_alc861
},
17513 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
17514 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
17515 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
17516 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
17517 .patch
= patch_alc883
},
17518 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
17519 .patch
= patch_alc662
},
17520 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
17521 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
17522 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
17523 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
17524 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
17525 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
17526 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
17527 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
17528 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
17529 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc883
},
17530 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
17531 .patch
= patch_alc883
},
17532 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
17533 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc883
},
17534 {} /* terminator */
17537 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17539 MODULE_LICENSE("GPL");
17540 MODULE_DESCRIPTION("Realtek HD-audio codec");
17542 static struct hda_codec_preset_list realtek_list
= {
17543 .preset
= snd_hda_preset_realtek
,
17544 .owner
= THIS_MODULE
,
17547 static int __init
patch_realtek_init(void)
17549 return snd_hda_add_codec_preset(&realtek_list
);
17552 static void __exit
patch_realtek_exit(void)
17554 snd_hda_delete_codec_preset(&realtek_list
);
17557 module_init(patch_realtek_init
)
17558 module_exit(patch_realtek_exit
)