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
,
254 #define GPIO_MASK 0x03
256 /* extra amp-initialization sequence types */
266 /* codec parameterization */
267 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
268 unsigned int num_mixers
;
269 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
270 unsigned int beep_amp
; /* beep amp value, set via set_beep_amp() */
272 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
276 unsigned int num_init_verbs
;
278 char stream_name_analog
[16]; /* analog PCM stream */
279 struct hda_pcm_stream
*stream_analog_playback
;
280 struct hda_pcm_stream
*stream_analog_capture
;
281 struct hda_pcm_stream
*stream_analog_alt_playback
;
282 struct hda_pcm_stream
*stream_analog_alt_capture
;
284 char stream_name_digital
[16]; /* digital PCM stream */
285 struct hda_pcm_stream
*stream_digital_playback
;
286 struct hda_pcm_stream
*stream_digital_capture
;
289 struct hda_multi_out multiout
; /* playback set-up
290 * max_channels, dacs must be set
291 * dig_out_nid and hp_nid are optional
293 hda_nid_t alt_dac_nid
;
294 hda_nid_t slave_dig_outs
[3]; /* optional - for auto-parsing */
298 unsigned int num_adc_nids
;
300 hda_nid_t
*capsrc_nids
;
301 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
304 unsigned int num_mux_defs
;
305 const struct hda_input_mux
*input_mux
;
306 unsigned int cur_mux
[3];
309 const struct hda_channel_mode
*channel_mode
;
310 int num_channel_mode
;
312 int const_channel_count
;
313 int ext_channel_count
;
315 /* PCM information */
316 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
318 /* dynamic controls, init_verbs and input_mux */
319 struct auto_pin_cfg autocfg
;
320 struct snd_array kctls
;
321 struct hda_input_mux private_imux
[3];
322 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
325 void (*init_hook
)(struct hda_codec
*codec
);
326 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
328 /* for pin sensing */
329 unsigned int sense_updated
: 1;
330 unsigned int jack_present
: 1;
331 unsigned int master_sw
: 1;
334 unsigned int no_analog
:1; /* digital I/O only */
337 /* for virtual master */
338 hda_nid_t vmaster_nid
;
339 #ifdef CONFIG_SND_HDA_POWER_SAVE
340 struct hda_loopback_check loopback
;
345 unsigned int pll_coef_idx
, pll_coef_bit
;
349 * configuration template - to be copied to the spec instance
351 struct alc_config_preset
{
352 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
355 struct snd_kcontrol_new
*cap_mixer
; /* capture mixer */
356 const struct hda_verb
*init_verbs
[5];
357 unsigned int num_dacs
;
359 hda_nid_t dig_out_nid
; /* optional */
360 hda_nid_t hp_nid
; /* optional */
361 hda_nid_t
*slave_dig_outs
;
362 unsigned int num_adc_nids
;
364 hda_nid_t
*capsrc_nids
;
365 hda_nid_t dig_in_nid
;
366 unsigned int num_channel_mode
;
367 const struct hda_channel_mode
*channel_mode
;
369 int const_channel_count
;
370 unsigned int num_mux_defs
;
371 const struct hda_input_mux
*input_mux
;
372 void (*unsol_event
)(struct hda_codec
*, unsigned int);
373 void (*init_hook
)(struct hda_codec
*);
374 #ifdef CONFIG_SND_HDA_POWER_SAVE
375 struct hda_amp_list
*loopbacks
;
383 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
384 struct snd_ctl_elem_info
*uinfo
)
386 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
387 struct alc_spec
*spec
= codec
->spec
;
388 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
389 if (mux_idx
>= spec
->num_mux_defs
)
391 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
394 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
395 struct snd_ctl_elem_value
*ucontrol
)
397 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
398 struct alc_spec
*spec
= codec
->spec
;
399 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
401 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
405 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
406 struct snd_ctl_elem_value
*ucontrol
)
408 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
409 struct alc_spec
*spec
= codec
->spec
;
410 const struct hda_input_mux
*imux
;
411 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
412 unsigned int mux_idx
;
413 hda_nid_t nid
= spec
->capsrc_nids
?
414 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
417 mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
418 imux
= &spec
->input_mux
[mux_idx
];
420 type
= (get_wcaps(codec
, nid
) & AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
421 if (type
== AC_WID_AUD_MIX
) {
422 /* Matrix-mixer style (e.g. ALC882) */
423 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
426 idx
= ucontrol
->value
.enumerated
.item
[0];
427 if (idx
>= imux
->num_items
)
428 idx
= imux
->num_items
- 1;
431 for (i
= 0; i
< imux
->num_items
; i
++) {
432 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
433 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
434 imux
->items
[i
].index
,
440 /* MUX style (e.g. ALC880) */
441 return snd_hda_input_mux_put(codec
, imux
, ucontrol
, nid
,
442 &spec
->cur_mux
[adc_idx
]);
447 * channel mode setting
449 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
450 struct snd_ctl_elem_info
*uinfo
)
452 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
453 struct alc_spec
*spec
= codec
->spec
;
454 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
455 spec
->num_channel_mode
);
458 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
459 struct snd_ctl_elem_value
*ucontrol
)
461 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
462 struct alc_spec
*spec
= codec
->spec
;
463 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
464 spec
->num_channel_mode
,
465 spec
->ext_channel_count
);
468 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
469 struct snd_ctl_elem_value
*ucontrol
)
471 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
472 struct alc_spec
*spec
= codec
->spec
;
473 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
474 spec
->num_channel_mode
,
475 &spec
->ext_channel_count
);
476 if (err
>= 0 && !spec
->const_channel_count
) {
477 spec
->multiout
.max_channels
= spec
->ext_channel_count
;
478 if (spec
->need_dac_fix
)
479 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
485 * Control the mode of pin widget settings via the mixer. "pc" is used
486 * instead of "%" to avoid consequences of accidently treating the % as
487 * being part of a format specifier. Maximum allowed length of a value is
488 * 63 characters plus NULL terminator.
490 * Note: some retasking pin complexes seem to ignore requests for input
491 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
492 * are requested. Therefore order this list so that this behaviour will not
493 * cause problems when mixer clients move through the enum sequentially.
494 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
497 static char *alc_pin_mode_names
[] = {
498 "Mic 50pc bias", "Mic 80pc bias",
499 "Line in", "Line out", "Headphone out",
501 static unsigned char alc_pin_mode_values
[] = {
502 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
504 /* The control can present all 5 options, or it can limit the options based
505 * in the pin being assumed to be exclusively an input or an output pin. In
506 * addition, "input" pins may or may not process the mic bias option
507 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
508 * accept requests for bias as of chip versions up to March 2006) and/or
509 * wiring in the computer.
511 #define ALC_PIN_DIR_IN 0x00
512 #define ALC_PIN_DIR_OUT 0x01
513 #define ALC_PIN_DIR_INOUT 0x02
514 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
515 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
517 /* Info about the pin modes supported by the different pin direction modes.
518 * For each direction the minimum and maximum values are given.
520 static signed char alc_pin_mode_dir_info
[5][2] = {
521 { 0, 2 }, /* ALC_PIN_DIR_IN */
522 { 3, 4 }, /* ALC_PIN_DIR_OUT */
523 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
524 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
525 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
527 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
528 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
529 #define alc_pin_mode_n_items(_dir) \
530 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
532 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
533 struct snd_ctl_elem_info
*uinfo
)
535 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
536 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
538 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
540 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
542 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
543 item_num
= alc_pin_mode_min(dir
);
544 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
548 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
549 struct snd_ctl_elem_value
*ucontrol
)
552 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
553 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
554 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
555 long *valp
= ucontrol
->value
.integer
.value
;
556 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
557 AC_VERB_GET_PIN_WIDGET_CONTROL
,
560 /* Find enumerated value for current pinctl setting */
561 i
= alc_pin_mode_min(dir
);
562 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
564 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
568 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
569 struct snd_ctl_elem_value
*ucontrol
)
572 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
573 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
574 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
575 long val
= *ucontrol
->value
.integer
.value
;
576 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
577 AC_VERB_GET_PIN_WIDGET_CONTROL
,
580 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
581 val
= alc_pin_mode_min(dir
);
583 change
= pinctl
!= alc_pin_mode_values
[val
];
585 /* Set pin mode to that requested */
586 snd_hda_codec_write_cache(codec
, nid
, 0,
587 AC_VERB_SET_PIN_WIDGET_CONTROL
,
588 alc_pin_mode_values
[val
]);
590 /* Also enable the retasking pin's input/output as required
591 * for the requested pin mode. Enum values of 2 or less are
594 * Dynamically switching the input/output buffers probably
595 * reduces noise slightly (particularly on input) so we'll
596 * do it. However, having both input and output buffers
597 * enabled simultaneously doesn't seem to be problematic if
598 * this turns out to be necessary in the future.
601 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
602 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
603 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
606 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
607 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
608 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
615 #define ALC_PIN_MODE(xname, nid, dir) \
616 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
617 .info = alc_pin_mode_info, \
618 .get = alc_pin_mode_get, \
619 .put = alc_pin_mode_put, \
620 .private_value = nid | (dir<<16) }
622 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
623 * together using a mask with more than one bit set. This control is
624 * currently used only by the ALC260 test model. At this stage they are not
625 * needed for any "production" models.
627 #ifdef CONFIG_SND_DEBUG
628 #define alc_gpio_data_info snd_ctl_boolean_mono_info
630 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
631 struct snd_ctl_elem_value
*ucontrol
)
633 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
634 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
635 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
636 long *valp
= ucontrol
->value
.integer
.value
;
637 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
638 AC_VERB_GET_GPIO_DATA
, 0x00);
640 *valp
= (val
& mask
) != 0;
643 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
644 struct snd_ctl_elem_value
*ucontrol
)
647 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
648 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
649 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
650 long val
= *ucontrol
->value
.integer
.value
;
651 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
652 AC_VERB_GET_GPIO_DATA
,
655 /* Set/unset the masked GPIO bit(s) as needed */
656 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
661 snd_hda_codec_write_cache(codec
, nid
, 0,
662 AC_VERB_SET_GPIO_DATA
, gpio_data
);
666 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
667 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
668 .info = alc_gpio_data_info, \
669 .get = alc_gpio_data_get, \
670 .put = alc_gpio_data_put, \
671 .private_value = nid | (mask<<16) }
672 #endif /* CONFIG_SND_DEBUG */
674 /* A switch control to allow the enabling of the digital IO pins on the
675 * ALC260. This is incredibly simplistic; the intention of this control is
676 * to provide something in the test model allowing digital outputs to be
677 * identified if present. If models are found which can utilise these
678 * outputs a more complete mixer control can be devised for those models if
681 #ifdef CONFIG_SND_DEBUG
682 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
684 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
685 struct snd_ctl_elem_value
*ucontrol
)
687 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
688 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
689 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
690 long *valp
= ucontrol
->value
.integer
.value
;
691 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
692 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
694 *valp
= (val
& mask
) != 0;
697 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
698 struct snd_ctl_elem_value
*ucontrol
)
701 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
702 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
703 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
704 long val
= *ucontrol
->value
.integer
.value
;
705 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
706 AC_VERB_GET_DIGI_CONVERT_1
,
709 /* Set/unset the masked control bit(s) as needed */
710 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
715 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
720 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
721 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
722 .info = alc_spdif_ctrl_info, \
723 .get = alc_spdif_ctrl_get, \
724 .put = alc_spdif_ctrl_put, \
725 .private_value = nid | (mask<<16) }
726 #endif /* CONFIG_SND_DEBUG */
728 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
729 * Again, this is only used in the ALC26x test models to help identify when
730 * the EAPD line must be asserted for features to work.
732 #ifdef CONFIG_SND_DEBUG
733 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
735 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
736 struct snd_ctl_elem_value
*ucontrol
)
738 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
739 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
740 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
741 long *valp
= ucontrol
->value
.integer
.value
;
742 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
743 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
745 *valp
= (val
& mask
) != 0;
749 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
750 struct snd_ctl_elem_value
*ucontrol
)
753 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
754 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
755 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
756 long val
= *ucontrol
->value
.integer
.value
;
757 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
758 AC_VERB_GET_EAPD_BTLENABLE
,
761 /* Set/unset the masked control bit(s) as needed */
762 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
767 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
773 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
774 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
775 .info = alc_eapd_ctrl_info, \
776 .get = alc_eapd_ctrl_get, \
777 .put = alc_eapd_ctrl_put, \
778 .private_value = nid | (mask<<16) }
779 #endif /* CONFIG_SND_DEBUG */
782 * set up the input pin config (depending on the given auto-pin type)
784 static void alc_set_input_pin(struct hda_codec
*codec
, hda_nid_t nid
,
787 unsigned int val
= PIN_IN
;
789 if (auto_pin_type
<= AUTO_PIN_FRONT_MIC
) {
791 pincap
= snd_hda_query_pin_caps(codec
, nid
);
792 pincap
= (pincap
& AC_PINCAP_VREF
) >> AC_PINCAP_VREF_SHIFT
;
793 if (pincap
& AC_PINCAP_VREF_80
)
795 else if (pincap
& AC_PINCAP_VREF_50
)
797 else if (pincap
& AC_PINCAP_VREF_100
)
799 else if (pincap
& AC_PINCAP_VREF_GRD
)
802 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, val
);
807 static void add_mixer(struct alc_spec
*spec
, struct snd_kcontrol_new
*mix
)
809 if (snd_BUG_ON(spec
->num_mixers
>= ARRAY_SIZE(spec
->mixers
)))
811 spec
->mixers
[spec
->num_mixers
++] = mix
;
814 static void add_verb(struct alc_spec
*spec
, const struct hda_verb
*verb
)
816 if (snd_BUG_ON(spec
->num_init_verbs
>= ARRAY_SIZE(spec
->init_verbs
)))
818 spec
->init_verbs
[spec
->num_init_verbs
++] = verb
;
821 #ifdef CONFIG_PROC_FS
825 static void print_realtek_coef(struct snd_info_buffer
*buffer
,
826 struct hda_codec
*codec
, hda_nid_t nid
)
832 coeff
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_PROC_COEF
, 0);
833 snd_iprintf(buffer
, " Processing Coefficient: 0x%02x\n", coeff
);
834 coeff
= snd_hda_codec_read(codec
, nid
, 0,
835 AC_VERB_GET_COEF_INDEX
, 0);
836 snd_iprintf(buffer
, " Coefficient Index: 0x%02x\n", coeff
);
839 #define print_realtek_coef NULL
843 * set up from the preset table
845 static void setup_preset(struct alc_spec
*spec
,
846 const struct alc_config_preset
*preset
)
850 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
851 add_mixer(spec
, preset
->mixers
[i
]);
852 spec
->cap_mixer
= preset
->cap_mixer
;
853 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
855 add_verb(spec
, preset
->init_verbs
[i
]);
857 spec
->channel_mode
= preset
->channel_mode
;
858 spec
->num_channel_mode
= preset
->num_channel_mode
;
859 spec
->need_dac_fix
= preset
->need_dac_fix
;
860 spec
->const_channel_count
= preset
->const_channel_count
;
862 if (preset
->const_channel_count
)
863 spec
->multiout
.max_channels
= preset
->const_channel_count
;
865 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
866 spec
->ext_channel_count
= spec
->channel_mode
[0].channels
;
868 spec
->multiout
.num_dacs
= preset
->num_dacs
;
869 spec
->multiout
.dac_nids
= preset
->dac_nids
;
870 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
871 spec
->multiout
.slave_dig_outs
= preset
->slave_dig_outs
;
872 spec
->multiout
.hp_nid
= preset
->hp_nid
;
874 spec
->num_mux_defs
= preset
->num_mux_defs
;
875 if (!spec
->num_mux_defs
)
876 spec
->num_mux_defs
= 1;
877 spec
->input_mux
= preset
->input_mux
;
879 spec
->num_adc_nids
= preset
->num_adc_nids
;
880 spec
->adc_nids
= preset
->adc_nids
;
881 spec
->capsrc_nids
= preset
->capsrc_nids
;
882 spec
->dig_in_nid
= preset
->dig_in_nid
;
884 spec
->unsol_event
= preset
->unsol_event
;
885 spec
->init_hook
= preset
->init_hook
;
886 #ifdef CONFIG_SND_HDA_POWER_SAVE
887 spec
->loopback
.amplist
= preset
->loopbacks
;
891 /* Enable GPIO mask and set output */
892 static struct hda_verb alc_gpio1_init_verbs
[] = {
893 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
894 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
895 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
899 static struct hda_verb alc_gpio2_init_verbs
[] = {
900 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
901 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
902 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
906 static struct hda_verb alc_gpio3_init_verbs
[] = {
907 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
908 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
909 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
914 * Fix hardware PLL issue
915 * On some codecs, the analog PLL gating control must be off while
916 * the default value is 1.
918 static void alc_fix_pll(struct hda_codec
*codec
)
920 struct alc_spec
*spec
= codec
->spec
;
925 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
927 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
928 AC_VERB_GET_PROC_COEF
, 0);
929 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
931 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
932 val
& ~(1 << spec
->pll_coef_bit
));
935 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
936 unsigned int coef_idx
, unsigned int coef_bit
)
938 struct alc_spec
*spec
= codec
->spec
;
940 spec
->pll_coef_idx
= coef_idx
;
941 spec
->pll_coef_bit
= coef_bit
;
945 static void alc_automute_pin(struct hda_codec
*codec
)
947 struct alc_spec
*spec
= codec
->spec
;
948 unsigned int present
, pincap
;
949 unsigned int nid
= spec
->autocfg
.hp_pins
[0];
952 pincap
= snd_hda_query_pin_caps(codec
, nid
);
953 if (pincap
& AC_PINCAP_TRIG_REQ
) /* need trigger? */
954 snd_hda_codec_read(codec
, nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
955 present
= snd_hda_codec_read(codec
, nid
, 0,
956 AC_VERB_GET_PIN_SENSE
, 0);
957 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
958 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
959 nid
= spec
->autocfg
.speaker_pins
[i
];
962 snd_hda_codec_write(codec
, nid
, 0,
963 AC_VERB_SET_PIN_WIDGET_CONTROL
,
964 spec
->jack_present
? 0 : PIN_OUT
);
968 #if 0 /* it's broken in some cases -- temporarily disabled */
969 static void alc_mic_automute(struct hda_codec
*codec
)
971 struct alc_spec
*spec
= codec
->spec
;
972 unsigned int present
;
973 unsigned int mic_nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
974 unsigned int fmic_nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
975 unsigned int mix_nid
= spec
->capsrc_nids
[0];
976 unsigned int capsrc_idx_mic
, capsrc_idx_fmic
;
978 capsrc_idx_mic
= mic_nid
- 0x18;
979 capsrc_idx_fmic
= fmic_nid
- 0x18;
980 present
= snd_hda_codec_read(codec
, mic_nid
, 0,
981 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
982 snd_hda_codec_write(codec
, mix_nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
983 0x7000 | (capsrc_idx_mic
<< 8) | (present
? 0 : 0x80));
984 snd_hda_codec_write(codec
, mix_nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
985 0x7000 | (capsrc_idx_fmic
<< 8) | (present
? 0x80 : 0));
986 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, capsrc_idx_fmic
,
987 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
990 #define alc_mic_automute(codec) do {} while(0) /* NOP */
991 #endif /* disabled */
993 /* unsolicited event for HP jack sensing */
994 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
996 if (codec
->vendor_id
== 0x10ec0880)
1001 case ALC880_HP_EVENT
:
1002 alc_automute_pin(codec
);
1004 case ALC880_MIC_EVENT
:
1005 alc_mic_automute(codec
);
1010 static void alc_inithook(struct hda_codec
*codec
)
1012 alc_automute_pin(codec
);
1013 alc_mic_automute(codec
);
1016 /* additional initialization for ALC888 variants */
1017 static void alc888_coef_init(struct hda_codec
*codec
)
1021 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
1022 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
1023 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
1024 if ((tmp
& 0xf0) == 0x20)
1026 snd_hda_codec_read(codec
, 0x20, 0,
1027 AC_VERB_SET_PROC_COEF
, 0x830);
1030 snd_hda_codec_read(codec
, 0x20, 0,
1031 AC_VERB_SET_PROC_COEF
, 0x3030);
1034 static void alc_auto_init_amp(struct hda_codec
*codec
, int type
)
1039 case ALC_INIT_GPIO1
:
1040 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
1042 case ALC_INIT_GPIO2
:
1043 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
1045 case ALC_INIT_GPIO3
:
1046 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
1048 case ALC_INIT_DEFAULT
:
1049 switch (codec
->vendor_id
) {
1051 snd_hda_codec_write(codec
, 0x0f, 0,
1052 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1053 snd_hda_codec_write(codec
, 0x10, 0,
1054 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1066 snd_hda_codec_write(codec
, 0x14, 0,
1067 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1068 snd_hda_codec_write(codec
, 0x15, 0,
1069 AC_VERB_SET_EAPD_BTLENABLE
, 2);
1072 switch (codec
->vendor_id
) {
1074 snd_hda_codec_write(codec
, 0x1a, 0,
1075 AC_VERB_SET_COEF_INDEX
, 7);
1076 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
1077 AC_VERB_GET_PROC_COEF
, 0);
1078 snd_hda_codec_write(codec
, 0x1a, 0,
1079 AC_VERB_SET_COEF_INDEX
, 7);
1080 snd_hda_codec_write(codec
, 0x1a, 0,
1081 AC_VERB_SET_PROC_COEF
,
1091 snd_hda_codec_write(codec
, 0x20, 0,
1092 AC_VERB_SET_COEF_INDEX
, 7);
1093 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1094 AC_VERB_GET_PROC_COEF
, 0);
1095 snd_hda_codec_write(codec
, 0x20, 0,
1096 AC_VERB_SET_COEF_INDEX
, 7);
1097 snd_hda_codec_write(codec
, 0x20, 0,
1098 AC_VERB_SET_PROC_COEF
,
1102 alc888_coef_init(codec
);
1106 snd_hda_codec_write(codec
, 0x20, 0,
1107 AC_VERB_SET_COEF_INDEX
, 7);
1108 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1109 AC_VERB_GET_PROC_COEF
, 0);
1110 snd_hda_codec_write(codec
, 0x20, 0,
1111 AC_VERB_SET_COEF_INDEX
, 7);
1112 snd_hda_codec_write(codec
, 0x20, 0,
1113 AC_VERB_SET_PROC_COEF
,
1121 static void alc_init_auto_hp(struct hda_codec
*codec
)
1123 struct alc_spec
*spec
= codec
->spec
;
1125 if (!spec
->autocfg
.hp_pins
[0])
1128 if (!spec
->autocfg
.speaker_pins
[0]) {
1129 if (spec
->autocfg
.line_out_pins
[0] &&
1130 spec
->autocfg
.line_out_type
== AUTO_PIN_SPEAKER_OUT
)
1131 spec
->autocfg
.speaker_pins
[0] =
1132 spec
->autocfg
.line_out_pins
[0];
1137 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1138 spec
->autocfg
.hp_pins
[0]);
1139 snd_hda_codec_write_cache(codec
, spec
->autocfg
.hp_pins
[0], 0,
1140 AC_VERB_SET_UNSOLICITED_ENABLE
,
1141 AC_USRSP_EN
| ALC880_HP_EVENT
);
1142 spec
->unsol_event
= alc_sku_unsol_event
;
1145 /* check subsystem ID and set up device-specific initialization;
1146 * return 1 if initialized, 0 if invalid SSID
1148 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1149 * 31 ~ 16 : Manufacture ID
1151 * 7 ~ 0 : Assembly ID
1152 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1154 static int alc_subsystem_id(struct hda_codec
*codec
,
1155 hda_nid_t porta
, hda_nid_t porte
,
1158 unsigned int ass
, tmp
, i
;
1160 struct alc_spec
*spec
= codec
->spec
;
1162 ass
= codec
->subsystem_id
& 0xffff;
1163 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
1166 /* invalid SSID, check the special NID pin defcfg instead */
1168 * 31~30 : port connectivity
1171 * 19~16 : Check sum (15:1)
1176 if (codec
->vendor_id
== 0x10ec0260)
1178 ass
= snd_hda_codec_get_pincfg(codec
, nid
);
1179 snd_printd("realtek: No valid SSID, "
1180 "checking pincfg 0x%08x for NID 0x%x\n",
1182 if (!(ass
& 1) && !(ass
& 0x100000))
1184 if ((ass
>> 30) != 1) /* no physical connection */
1189 for (i
= 1; i
< 16; i
++) {
1193 if (((ass
>> 16) & 0xf) != tmp
)
1196 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1197 ass
& 0xffff, codec
->vendor_id
);
1201 * 2 : 0 --> Desktop, 1 --> Laptop
1202 * 3~5 : External Amplifier control
1205 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
1208 spec
->init_amp
= ALC_INIT_GPIO1
;
1211 spec
->init_amp
= ALC_INIT_GPIO2
;
1214 spec
->init_amp
= ALC_INIT_GPIO3
;
1217 spec
->init_amp
= ALC_INIT_DEFAULT
;
1221 /* is laptop or Desktop and enable the function "Mute internal speaker
1222 * when the external headphone out jack is plugged"
1224 if (!(ass
& 0x8000))
1227 * 10~8 : Jack location
1228 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1230 * 15 : 1 --> enable the function "Mute internal speaker
1231 * when the external headphone out jack is plugged"
1233 if (!spec
->autocfg
.hp_pins
[0]) {
1234 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
1236 spec
->autocfg
.hp_pins
[0] = porta
;
1238 spec
->autocfg
.hp_pins
[0] = porte
;
1240 spec
->autocfg
.hp_pins
[0] = portd
;
1245 alc_init_auto_hp(codec
);
1249 static void alc_ssid_check(struct hda_codec
*codec
,
1250 hda_nid_t porta
, hda_nid_t porte
, hda_nid_t portd
)
1252 if (!alc_subsystem_id(codec
, porta
, porte
, portd
)) {
1253 struct alc_spec
*spec
= codec
->spec
;
1254 snd_printd("realtek: "
1255 "Enable default setup for auto mode as fallback\n");
1256 spec
->init_amp
= ALC_INIT_DEFAULT
;
1257 alc_init_auto_hp(codec
);
1262 * Fix-up pin default configurations
1270 static void alc_fix_pincfg(struct hda_codec
*codec
,
1271 const struct snd_pci_quirk
*quirk
,
1272 const struct alc_pincfg
**pinfix
)
1274 const struct alc_pincfg
*cfg
;
1276 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
1280 cfg
= pinfix
[quirk
->value
];
1281 for (; cfg
->nid
; cfg
++)
1282 snd_hda_codec_set_pincfg(codec
, cfg
->nid
, cfg
->val
);
1292 static struct hda_verb alc888_4ST_ch2_intel_init
[] = {
1293 /* Mic-in jack as mic in */
1294 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1295 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1296 /* Line-in jack as Line in */
1297 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1298 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1299 /* Line-Out as Front */
1300 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1307 static struct hda_verb alc888_4ST_ch4_intel_init
[] = {
1308 /* Mic-in jack as mic in */
1309 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1310 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1311 /* Line-in jack as Surround */
1312 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1313 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1314 /* Line-Out as Front */
1315 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x00},
1322 static struct hda_verb alc888_4ST_ch6_intel_init
[] = {
1323 /* Mic-in jack as CLFE */
1324 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1325 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1326 /* Line-in jack as Surround */
1327 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1328 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1329 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1330 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1337 static struct hda_verb alc888_4ST_ch8_intel_init
[] = {
1338 /* Mic-in jack as CLFE */
1339 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1340 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1341 /* Line-in jack as Surround */
1342 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1343 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1344 /* Line-Out as Side */
1345 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1349 static struct hda_channel_mode alc888_4ST_8ch_intel_modes
[4] = {
1350 { 2, alc888_4ST_ch2_intel_init
},
1351 { 4, alc888_4ST_ch4_intel_init
},
1352 { 6, alc888_4ST_ch6_intel_init
},
1353 { 8, alc888_4ST_ch8_intel_init
},
1357 * ALC888 Fujitsu Siemens Amillo xa3530
1360 static struct hda_verb alc888_fujitsu_xa3530_verbs
[] = {
1361 /* Front Mic: set to PIN_IN (empty by default) */
1362 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1363 /* Connect Internal HP to Front */
1364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1365 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1366 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1367 /* Connect Bass HP to Front */
1368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1370 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1371 /* Connect Line-Out side jack (SPDIF) to Side */
1372 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1373 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1374 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
1375 /* Connect Mic jack to CLFE */
1376 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1377 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1378 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
1379 /* Connect Line-in jack to Surround */
1380 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1381 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1382 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
1383 /* Connect HP out jack to Front */
1384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1385 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1386 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1387 /* Enable unsolicited event for HP jack and Line-out jack */
1388 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1389 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1393 static void alc_automute_amp(struct hda_codec
*codec
)
1395 struct alc_spec
*spec
= codec
->spec
;
1396 unsigned int val
, mute
, pincap
;
1400 spec
->jack_present
= 0;
1401 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.hp_pins
); i
++) {
1402 nid
= spec
->autocfg
.hp_pins
[i
];
1405 pincap
= snd_hda_query_pin_caps(codec
, nid
);
1406 if (pincap
& AC_PINCAP_TRIG_REQ
) /* need trigger? */
1407 snd_hda_codec_read(codec
, nid
, 0,
1408 AC_VERB_SET_PIN_SENSE
, 0);
1409 val
= snd_hda_codec_read(codec
, nid
, 0,
1410 AC_VERB_GET_PIN_SENSE
, 0);
1411 if (val
& AC_PINSENSE_PRESENCE
) {
1412 spec
->jack_present
= 1;
1417 mute
= spec
->jack_present
? HDA_AMP_MUTE
: 0;
1418 /* Toggle internal speakers muting */
1419 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.speaker_pins
); i
++) {
1420 nid
= spec
->autocfg
.speaker_pins
[i
];
1423 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
1424 HDA_AMP_MUTE
, mute
);
1428 static void alc_automute_amp_unsol_event(struct hda_codec
*codec
,
1431 if (codec
->vendor_id
== 0x10ec0880)
1435 if (res
== ALC880_HP_EVENT
)
1436 alc_automute_amp(codec
);
1439 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec
*codec
)
1441 struct alc_spec
*spec
= codec
->spec
;
1443 spec
->autocfg
.hp_pins
[0] = 0x17; /* line-out */
1444 spec
->autocfg
.hp_pins
[1] = 0x1b; /* hp */
1445 spec
->autocfg
.speaker_pins
[0] = 0x14; /* speaker */
1446 spec
->autocfg
.speaker_pins
[1] = 0x15; /* bass */
1447 alc_automute_amp(codec
);
1451 * ALC888 Acer Aspire 4930G model
1454 static struct hda_verb alc888_acer_aspire_4930g_verbs
[] = {
1455 /* Front Mic: set to PIN_IN (empty by default) */
1456 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1457 /* Unselect Front Mic by default in input mixer 3 */
1458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
1459 /* Enable unsolicited event for HP jack */
1460 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1461 /* Connect Internal HP to front */
1462 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1464 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1465 /* Connect HP out to front */
1466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1468 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1473 * ALC888 Acer Aspire 6530G model
1476 static struct hda_verb alc888_acer_aspire_6530g_verbs
[] = {
1477 /* Bias voltage on for external mic port */
1478 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
| PIN_VREF80
},
1479 /* Front Mic: set to PIN_IN (empty by default) */
1480 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1481 /* Unselect Front Mic by default in input mixer 3 */
1482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
1483 /* Enable unsolicited event for HP jack */
1484 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1485 /* Enable speaker output */
1486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1487 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1488 /* Enable headphone output */
1489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
1490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1491 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1496 * ALC889 Acer Aspire 8930G model
1499 static struct hda_verb alc889_acer_aspire_8930g_verbs
[] = {
1500 /* Front Mic: set to PIN_IN (empty by default) */
1501 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1502 /* Unselect Front Mic by default in input mixer 3 */
1503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0xb)},
1504 /* Enable unsolicited event for HP jack */
1505 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
1506 /* Connect Internal Front to Front */
1507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1509 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
1510 /* Connect Internal Rear to Rear */
1511 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1512 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1513 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01},
1514 /* Connect Internal CLFE to CLFE */
1515 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1516 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1517 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
1518 /* Connect HP out to Front */
1519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| PIN_HP
},
1520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1521 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
1522 /* Enable all DACs */
1523 /* DAC DISABLE/MUTE 1? */
1524 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1525 {0x20, AC_VERB_SET_COEF_INDEX
, 0x03},
1526 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
1527 /* DAC DISABLE/MUTE 2? */
1528 /* some bit here disables the other DACs. Init=0x4900 */
1529 {0x20, AC_VERB_SET_COEF_INDEX
, 0x08},
1530 {0x20, AC_VERB_SET_PROC_COEF
, 0x0000},
1531 /* Enable amplifiers */
1532 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
1533 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
1535 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1536 * which makes the stereo useless. However, either the mic or the ALC889
1537 * makes the signal become a difference/sum signal instead of standard
1538 * stereo, which is annoying. So instead we flip this bit which makes the
1539 * codec replicate the sum signal to both channels, turning it into a
1542 /* DMIC_CONTROL? Init value = 0x0001 */
1543 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
1544 {0x20, AC_VERB_SET_PROC_COEF
, 0x0003},
1548 static struct hda_input_mux alc888_2_capture_sources
[2] = {
1549 /* Front mic only available on one ADC */
1556 { "Front Mic", 0xb },
1569 static struct hda_input_mux alc888_acer_aspire_6530_sources
[2] = {
1570 /* Interal mic only available on one ADC */
1577 { "Input Mix", 0xa },
1587 { "Input Mix", 0xa },
1592 static struct hda_input_mux alc889_capture_sources
[3] = {
1593 /* Digital mic only available on first "ADC" */
1600 { "Front Mic", 0xb },
1601 { "Input Mix", 0xa },
1610 { "Input Mix", 0xa },
1619 { "Input Mix", 0xa },
1624 static struct snd_kcontrol_new alc888_base_mixer
[] = {
1625 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1626 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1627 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1628 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1629 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1631 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1632 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1633 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1634 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1635 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1636 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1637 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1638 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1639 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1641 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
1642 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1646 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec
*codec
)
1648 struct alc_spec
*spec
= codec
->spec
;
1650 spec
->autocfg
.hp_pins
[0] = 0x15;
1651 spec
->autocfg
.speaker_pins
[0] = 0x14;
1652 alc_automute_amp(codec
);
1655 static void alc888_acer_aspire_6530g_init_hook(struct hda_codec
*codec
)
1657 struct alc_spec
*spec
= codec
->spec
;
1659 spec
->autocfg
.hp_pins
[0] = 0x15;
1660 spec
->autocfg
.speaker_pins
[0] = 0x14;
1661 spec
->autocfg
.speaker_pins
[1] = 0x16;
1662 spec
->autocfg
.speaker_pins
[2] = 0x17;
1663 alc_automute_amp(codec
);
1666 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec
*codec
)
1668 struct alc_spec
*spec
= codec
->spec
;
1670 spec
->autocfg
.hp_pins
[0] = 0x15;
1671 spec
->autocfg
.speaker_pins
[0] = 0x14;
1672 spec
->autocfg
.speaker_pins
[1] = 0x16;
1673 spec
->autocfg
.speaker_pins
[2] = 0x1b;
1674 alc_automute_amp(codec
);
1678 * ALC880 3-stack model
1680 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1681 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1682 * F-Mic = 0x1b, HP = 0x19
1685 static hda_nid_t alc880_dac_nids
[4] = {
1686 /* front, rear, clfe, rear_surr */
1687 0x02, 0x05, 0x04, 0x03
1690 static hda_nid_t alc880_adc_nids
[3] = {
1695 /* The datasheet says the node 0x07 is connected from inputs,
1696 * but it shows zero connection in the real implementation on some devices.
1697 * Note: this is a 915GAV bug, fixed on 915GLV
1699 static hda_nid_t alc880_adc_nids_alt
[2] = {
1704 #define ALC880_DIGOUT_NID 0x06
1705 #define ALC880_DIGIN_NID 0x0a
1707 static struct hda_input_mux alc880_capture_source
= {
1711 { "Front Mic", 0x3 },
1717 /* channel source setting (2/6 channel selection for 3-stack) */
1719 static struct hda_verb alc880_threestack_ch2_init
[] = {
1720 /* set line-in to input, mute it */
1721 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1722 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1723 /* set mic-in to input vref 80%, mute it */
1724 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1725 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1730 static struct hda_verb alc880_threestack_ch6_init
[] = {
1731 /* set line-in to output, unmute it */
1732 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1733 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1734 /* set mic-in to output, unmute it */
1735 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1736 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1740 static struct hda_channel_mode alc880_threestack_modes
[2] = {
1741 { 2, alc880_threestack_ch2_init
},
1742 { 6, alc880_threestack_ch6_init
},
1745 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
1746 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1747 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1748 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1749 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
1750 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1751 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1752 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1753 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1754 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1755 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1756 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1757 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1759 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1760 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
1761 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
1762 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
1764 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1765 .name
= "Channel Mode",
1766 .info
= alc_ch_mode_info
,
1767 .get
= alc_ch_mode_get
,
1768 .put
= alc_ch_mode_put
,
1773 /* capture mixer elements */
1774 static int alc_cap_vol_info(struct snd_kcontrol
*kcontrol
,
1775 struct snd_ctl_elem_info
*uinfo
)
1777 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1778 struct alc_spec
*spec
= codec
->spec
;
1781 mutex_lock(&codec
->control_mutex
);
1782 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
1784 err
= snd_hda_mixer_amp_volume_info(kcontrol
, uinfo
);
1785 mutex_unlock(&codec
->control_mutex
);
1789 static int alc_cap_vol_tlv(struct snd_kcontrol
*kcontrol
, int op_flag
,
1790 unsigned int size
, unsigned int __user
*tlv
)
1792 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1793 struct alc_spec
*spec
= codec
->spec
;
1796 mutex_lock(&codec
->control_mutex
);
1797 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[0], 3, 0,
1799 err
= snd_hda_mixer_amp_tlv(kcontrol
, op_flag
, size
, tlv
);
1800 mutex_unlock(&codec
->control_mutex
);
1804 typedef int (*getput_call_t
)(struct snd_kcontrol
*kcontrol
,
1805 struct snd_ctl_elem_value
*ucontrol
);
1807 static int alc_cap_getput_caller(struct snd_kcontrol
*kcontrol
,
1808 struct snd_ctl_elem_value
*ucontrol
,
1811 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1812 struct alc_spec
*spec
= codec
->spec
;
1813 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
1816 mutex_lock(&codec
->control_mutex
);
1817 kcontrol
->private_value
= HDA_COMPOSE_AMP_VAL(spec
->adc_nids
[adc_idx
],
1819 err
= func(kcontrol
, ucontrol
);
1820 mutex_unlock(&codec
->control_mutex
);
1824 static int alc_cap_vol_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_volume_get
);
1831 static int alc_cap_vol_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_volume_put
);
1838 /* capture mixer elements */
1839 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1841 static int alc_cap_sw_get(struct snd_kcontrol
*kcontrol
,
1842 struct snd_ctl_elem_value
*ucontrol
)
1844 return alc_cap_getput_caller(kcontrol
, ucontrol
,
1845 snd_hda_mixer_amp_switch_get
);
1848 static int alc_cap_sw_put(struct snd_kcontrol
*kcontrol
,
1849 struct snd_ctl_elem_value
*ucontrol
)
1851 return alc_cap_getput_caller(kcontrol
, ucontrol
,
1852 snd_hda_mixer_amp_switch_put
);
1855 #define _DEFINE_CAPMIX(num) \
1857 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1858 .name = "Capture Switch", \
1859 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1861 .info = alc_cap_sw_info, \
1862 .get = alc_cap_sw_get, \
1863 .put = alc_cap_sw_put, \
1866 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1867 .name = "Capture Volume", \
1868 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1869 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1870 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1872 .info = alc_cap_vol_info, \
1873 .get = alc_cap_vol_get, \
1874 .put = alc_cap_vol_put, \
1875 .tlv = { .c = alc_cap_vol_tlv }, \
1878 #define _DEFINE_CAPSRC(num) \
1880 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1881 /* .name = "Capture Source", */ \
1882 .name = "Input Source", \
1884 .info = alc_mux_enum_info, \
1885 .get = alc_mux_enum_get, \
1886 .put = alc_mux_enum_put, \
1889 #define DEFINE_CAPMIX(num) \
1890 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1891 _DEFINE_CAPMIX(num), \
1892 _DEFINE_CAPSRC(num), \
1896 #define DEFINE_CAPMIX_NOSRC(num) \
1897 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1898 _DEFINE_CAPMIX(num), \
1902 /* up to three ADCs */
1906 DEFINE_CAPMIX_NOSRC(1);
1907 DEFINE_CAPMIX_NOSRC(2);
1908 DEFINE_CAPMIX_NOSRC(3);
1911 * ALC880 5-stack model
1913 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1915 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1916 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1919 /* additional mixers to alc880_three_stack_mixer */
1920 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
1921 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1922 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
1926 /* channel source setting (6/8 channel selection for 5-stack) */
1928 static struct hda_verb alc880_fivestack_ch6_init
[] = {
1929 /* set line-in to input, mute it */
1930 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1931 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1936 static struct hda_verb alc880_fivestack_ch8_init
[] = {
1937 /* set line-in to output, unmute it */
1938 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1939 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1943 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
1944 { 6, alc880_fivestack_ch6_init
},
1945 { 8, alc880_fivestack_ch8_init
},
1950 * ALC880 6-stack model
1952 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1953 * Side = 0x05 (0x0f)
1954 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1955 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1958 static hda_nid_t alc880_6st_dac_nids
[4] = {
1959 /* front, rear, clfe, rear_surr */
1960 0x02, 0x03, 0x04, 0x05
1963 static struct hda_input_mux alc880_6stack_capture_source
= {
1967 { "Front Mic", 0x1 },
1973 /* fixed 8-channels */
1974 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
1978 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
1979 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1980 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1981 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1982 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1983 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1984 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1985 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1986 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1987 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1988 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1989 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1990 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1991 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1992 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1998 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1999 .name
= "Channel Mode",
2000 .info
= alc_ch_mode_info
,
2001 .get
= alc_ch_mode_get
,
2002 .put
= alc_ch_mode_put
,
2011 * W810 has rear IO for:
2014 * Center/LFE (DAC 04)
2017 * The system also has a pair of internal speakers, and a headphone jack.
2018 * These are both connected to Line2 on the codec, hence to DAC 02.
2020 * There is a variable resistor to control the speaker or headphone
2021 * volume. This is a hardware-only device without a software API.
2023 * Plugging headphones in will disable the internal speakers. This is
2024 * implemented in hardware, not via the driver using jack sense. In
2025 * a similar fashion, plugging into the rear socket marked "front" will
2026 * disable both the speakers and headphones.
2028 * For input, there's a microphone jack, and an "audio in" jack.
2029 * These may not do anything useful with this driver yet, because I
2030 * haven't setup any initialization verbs for these yet...
2033 static hda_nid_t alc880_w810_dac_nids
[3] = {
2034 /* front, rear/surround, clfe */
2038 /* fixed 6 channels */
2039 static struct hda_channel_mode alc880_w810_modes
[1] = {
2043 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2044 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
2045 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2046 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2047 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2048 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2049 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2050 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2051 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2052 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2053 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2061 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2062 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2066 static hda_nid_t alc880_z71v_dac_nids
[1] = {
2069 #define ALC880_Z71V_HP_DAC 0x03
2071 /* fixed 2 channels */
2072 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
2076 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
2077 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2078 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2079 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2080 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
2081 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2082 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2083 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2084 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2090 * ALC880 F1734 model
2092 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2093 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2096 static hda_nid_t alc880_f1734_dac_nids
[1] = {
2099 #define ALC880_F1734_HP_DAC 0x02
2101 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
2102 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2103 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2104 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2105 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2113 static struct hda_input_mux alc880_f1734_capture_source
= {
2125 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2126 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2127 * Mic = 0x18, Line = 0x1a
2130 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2131 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2133 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
2134 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2135 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2136 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2137 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2138 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2139 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2140 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2141 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2142 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2143 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2144 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2145 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2149 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2150 .name
= "Channel Mode",
2151 .info
= alc_ch_mode_info
,
2152 .get
= alc_ch_mode_get
,
2153 .put
= alc_ch_mode_put
,
2159 * ALC880 ASUS W1V model
2161 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2162 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2163 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2166 /* additional mixers to alc880_asus_mixer */
2167 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
2168 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
2169 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
2174 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
2175 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2176 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
2177 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
2178 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
2179 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
2180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
2181 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
2182 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
2183 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
2188 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
2189 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2190 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2191 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2192 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2193 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2194 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2195 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2196 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2200 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2203 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2204 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2206 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2207 .name
= "Channel Mode",
2208 .info
= alc_ch_mode_info
,
2209 .get
= alc_ch_mode_get
,
2210 .put
= alc_ch_mode_put
,
2215 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
2216 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2217 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2218 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2219 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2220 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
2221 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
2222 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2223 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2224 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2225 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2229 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
2230 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2231 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
2232 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2233 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
2234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2240 * virtual master controls
2244 * slave controls for virtual master
2246 static const char *alc_slave_vols
[] = {
2247 "Front Playback Volume",
2248 "Surround Playback Volume",
2249 "Center Playback Volume",
2250 "LFE Playback Volume",
2251 "Side Playback Volume",
2252 "Headphone Playback Volume",
2253 "Speaker Playback Volume",
2254 "Mono Playback Volume",
2255 "Line-Out Playback Volume",
2256 "PCM Playback Volume",
2260 static const char *alc_slave_sws
[] = {
2261 "Front Playback Switch",
2262 "Surround Playback Switch",
2263 "Center Playback Switch",
2264 "LFE Playback Switch",
2265 "Side Playback Switch",
2266 "Headphone Playback Switch",
2267 "Speaker Playback Switch",
2268 "Mono Playback Switch",
2269 "IEC958 Playback Switch",
2274 * build control elements
2277 static void alc_free_kctls(struct hda_codec
*codec
);
2279 /* additional beep mixers; the actual parameters are overwritten at build */
2280 static struct snd_kcontrol_new alc_beep_mixer
[] = {
2281 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT
),
2282 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT
),
2286 static int alc_build_controls(struct hda_codec
*codec
)
2288 struct alc_spec
*spec
= codec
->spec
;
2292 for (i
= 0; i
< spec
->num_mixers
; i
++) {
2293 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
2297 if (spec
->cap_mixer
) {
2298 err
= snd_hda_add_new_ctls(codec
, spec
->cap_mixer
);
2302 if (spec
->multiout
.dig_out_nid
) {
2303 err
= snd_hda_create_spdif_out_ctls(codec
,
2304 spec
->multiout
.dig_out_nid
);
2307 if (!spec
->no_analog
) {
2308 err
= snd_hda_create_spdif_share_sw(codec
,
2312 spec
->multiout
.share_spdif
= 1;
2315 if (spec
->dig_in_nid
) {
2316 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
2321 /* create beep controls if needed */
2322 if (spec
->beep_amp
) {
2323 struct snd_kcontrol_new
*knew
;
2324 for (knew
= alc_beep_mixer
; knew
->name
; knew
++) {
2325 struct snd_kcontrol
*kctl
;
2326 kctl
= snd_ctl_new1(knew
, codec
);
2329 kctl
->private_value
= spec
->beep_amp
;
2330 err
= snd_hda_ctl_add(codec
, kctl
);
2336 /* if we have no master control, let's create it */
2337 if (!spec
->no_analog
&&
2338 !snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
2339 unsigned int vmaster_tlv
[4];
2340 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
2341 HDA_OUTPUT
, vmaster_tlv
);
2342 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
2343 vmaster_tlv
, alc_slave_vols
);
2347 if (!spec
->no_analog
&&
2348 !snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
2349 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
2350 NULL
, alc_slave_sws
);
2355 alc_free_kctls(codec
); /* no longer needed */
2361 * initialize the codec volumes, etc
2365 * generic initialization of ADC, input mixers and output mixers
2367 static struct hda_verb alc880_volume_init_verbs
[] = {
2369 * Unmute ADC0-2 and set the default input to mic-in
2371 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2373 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2374 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2375 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2376 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2378 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2380 * Note: PASD motherboards uses the Line In 2 as the input for front
2383 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2384 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
2389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2393 * Set up output mixers (0x0c - 0x0f)
2395 /* set vol=0 to output mixers */
2396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2397 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2398 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2399 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2400 /* set up input amps for analog loopback */
2401 /* Amp Indices: DAC = 0, mixer = 1 */
2402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2405 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2408 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2409 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2415 * 3-stack pin configuration:
2416 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2418 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
2420 * preset connection lists of input pins
2421 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2423 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2424 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2425 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2428 * Set pin mode and muting
2430 /* set front pin widgets 0x14 for output */
2431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2432 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2433 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2434 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2435 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2436 /* Mic2 (as headphone out) for HP output */
2437 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2438 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2439 /* Line In pin widget for input */
2440 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2441 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2442 /* Line2 (as front mic) pin widget for input and vref at 80% */
2443 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2444 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2445 /* CD pin widget for input */
2446 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2452 * 5-stack pin configuration:
2453 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2454 * line-in/side = 0x1a, f-mic = 0x1b
2456 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
2458 * preset connection lists of input pins
2459 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2461 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2462 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
2465 * Set pin mode and muting
2467 /* set pin widgets 0x14-0x17 for output */
2468 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2470 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2471 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2472 /* unmute pins for output (no gain on this amp) */
2473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2474 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2475 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2476 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2478 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2479 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2480 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2481 /* Mic2 (as headphone out) for HP output */
2482 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2483 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2484 /* Line In pin widget for input */
2485 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2486 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2487 /* Line2 (as front mic) pin widget for input and vref at 80% */
2488 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2489 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2490 /* CD pin widget for input */
2491 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2497 * W810 pin configuration:
2498 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2500 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
2501 /* hphone/speaker input selector: front DAC */
2502 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
2504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2506 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2507 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2508 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2509 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2511 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2512 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2518 * Z71V pin configuration:
2519 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2521 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
2522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2523 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2524 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2525 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2527 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2528 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2529 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2530 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2536 * 6-stack pin configuration:
2537 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2538 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2540 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
2541 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2543 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2544 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2546 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2547 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2548 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2549 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2550 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2552 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2553 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2555 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2556 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2557 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2558 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2559 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2560 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2566 * Uniwill pin configuration:
2567 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2570 static struct hda_verb alc880_uniwill_init_verbs
[] = {
2571 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2573 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2574 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2577 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2578 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2579 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2580 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2585 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2588 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2589 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2590 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2591 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2592 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2593 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2594 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2595 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2596 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2598 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2599 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
2606 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2608 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
2609 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2611 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2612 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2615 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2616 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
2622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
2624 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2625 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2626 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2627 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2628 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2629 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2631 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2632 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
2637 static struct hda_verb alc880_beep_init_verbs
[] = {
2638 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
2642 /* auto-toggle front mic */
2643 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
2645 unsigned int present
;
2648 present
= snd_hda_codec_read(codec
, 0x18, 0,
2649 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2650 bits
= present
? HDA_AMP_MUTE
: 0;
2651 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
2654 static void alc880_uniwill_init_hook(struct hda_codec
*codec
)
2656 struct alc_spec
*spec
= codec
->spec
;
2658 spec
->autocfg
.hp_pins
[0] = 0x14;
2659 spec
->autocfg
.speaker_pins
[0] = 0x15;
2660 spec
->autocfg
.speaker_pins
[0] = 0x16;
2661 alc_automute_amp(codec
);
2662 alc880_uniwill_mic_automute(codec
);
2665 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
2668 /* Looks like the unsol event is incompatible with the standard
2669 * definition. 4bit tag is placed at 28 bit!
2671 switch (res
>> 28) {
2672 case ALC880_MIC_EVENT
:
2673 alc880_uniwill_mic_automute(codec
);
2676 alc_automute_amp_unsol_event(codec
, res
);
2681 static void alc880_uniwill_p53_init_hook(struct hda_codec
*codec
)
2683 struct alc_spec
*spec
= codec
->spec
;
2685 spec
->autocfg
.hp_pins
[0] = 0x14;
2686 spec
->autocfg
.speaker_pins
[0] = 0x15;
2687 alc_automute_amp(codec
);
2690 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
2692 unsigned int present
;
2694 present
= snd_hda_codec_read(codec
, 0x21, 0,
2695 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
2696 present
&= HDA_AMP_VOLMASK
;
2697 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
2698 HDA_AMP_VOLMASK
, present
);
2699 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
2700 HDA_AMP_VOLMASK
, present
);
2703 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
2706 /* Looks like the unsol event is incompatible with the standard
2707 * definition. 4bit tag is placed at 28 bit!
2709 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
2710 alc880_uniwill_p53_dcvol_automute(codec
);
2712 alc_automute_amp_unsol_event(codec
, res
);
2716 * F1734 pin configuration:
2717 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2719 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
2720 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
2721 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2722 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2723 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2724 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2727 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2731 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2732 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2733 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
2734 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2735 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2736 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2737 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2738 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2739 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2741 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
2742 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
2748 * ASUS pin configuration:
2749 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2751 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
2752 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2753 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2754 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2755 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2757 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2758 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2759 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2760 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2761 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2762 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2763 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2764 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2766 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2768 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2770 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2771 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2772 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2774 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2779 /* Enable GPIO mask and set output */
2780 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2781 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2782 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2784 /* Clevo m520g init */
2785 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
2786 /* headphone output */
2787 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2793 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2795 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2796 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2797 /* Mic1 (rear panel) */
2798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2800 /* Mic2 (front panel) */
2801 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2802 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2804 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2805 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2806 /* change to EAPD mode */
2807 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2808 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2813 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
2814 /* change to EAPD mode */
2815 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2816 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2818 /* Headphone output */
2819 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2821 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2822 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2824 /* Line In pin widget for input */
2825 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2826 /* CD pin widget for input */
2827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2828 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2829 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2831 /* change to EAPD mode */
2832 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2833 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
2839 * LG m1 express dual
2842 * Rear Line-In/Out (blue): 0x14
2843 * Build-in Mic-In: 0x15
2845 * HP-Out (green): 0x1b
2846 * Mic-In/Out (red): 0x19
2850 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2851 static hda_nid_t alc880_lg_dac_nids
[3] = {
2855 /* seems analog CD is not working */
2856 static struct hda_input_mux alc880_lg_capture_source
= {
2861 { "Internal Mic", 0x6 },
2865 /* 2,4,6 channel modes */
2866 static struct hda_verb alc880_lg_ch2_init
[] = {
2867 /* set line-in and mic-in to input */
2868 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2869 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2873 static struct hda_verb alc880_lg_ch4_init
[] = {
2874 /* set line-in to out and mic-in to input */
2875 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2876 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2880 static struct hda_verb alc880_lg_ch6_init
[] = {
2881 /* set line-in and mic-in to output */
2882 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2883 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2887 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
2888 { 2, alc880_lg_ch2_init
},
2889 { 4, alc880_lg_ch4_init
},
2890 { 6, alc880_lg_ch6_init
},
2893 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
2894 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2895 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
2896 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2897 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
2898 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
2899 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
2900 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
2901 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
2902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2904 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
2905 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
2906 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
2907 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
2909 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2910 .name
= "Channel Mode",
2911 .info
= alc_ch_mode_info
,
2912 .get
= alc_ch_mode_get
,
2913 .put
= alc_ch_mode_put
,
2918 static struct hda_verb alc880_lg_init_verbs
[] = {
2919 /* set capture source to mic-in */
2920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2921 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2922 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2923 /* mute all amp mixer inputs */
2924 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
2925 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2926 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2927 /* line-in to input */
2928 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2929 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2931 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2934 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2935 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2936 /* mic-in to input */
2937 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2938 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2939 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2941 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
2942 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2943 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2945 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2949 /* toggle speaker-output according to the hp-jack state */
2950 static void alc880_lg_init_hook(struct hda_codec
*codec
)
2952 struct alc_spec
*spec
= codec
->spec
;
2954 spec
->autocfg
.hp_pins
[0] = 0x1b;
2955 spec
->autocfg
.speaker_pins
[0] = 0x17;
2956 alc_automute_amp(codec
);
2965 * Built-in Mic-In: 0x19
2971 static struct hda_input_mux alc880_lg_lw_capture_source
= {
2975 { "Internal Mic", 0x1 },
2980 #define alc880_lg_lw_modes alc880_threestack_modes
2982 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
2983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2984 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2985 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2986 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2987 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2988 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2989 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2990 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2991 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2992 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2995 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
2996 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
2998 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2999 .name
= "Channel Mode",
3000 .info
= alc_ch_mode_info
,
3001 .get
= alc_ch_mode_get
,
3002 .put
= alc_ch_mode_put
,
3007 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
3008 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3009 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
3010 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
3012 /* set capture source to mic-in */
3013 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3014 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3015 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
3018 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3019 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3021 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3022 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3023 /* mic-in to input */
3024 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3025 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3027 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3028 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3030 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3034 /* toggle speaker-output according to the hp-jack state */
3035 static void alc880_lg_lw_init_hook(struct hda_codec
*codec
)
3037 struct alc_spec
*spec
= codec
->spec
;
3039 spec
->autocfg
.hp_pins
[0] = 0x1b;
3040 spec
->autocfg
.speaker_pins
[0] = 0x14;
3041 alc_automute_amp(codec
);
3044 static struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
3045 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3046 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
3047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3049 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3050 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3054 static struct hda_input_mux alc880_medion_rim_capture_source
= {
3058 { "Internal Mic", 0x1 },
3062 static struct hda_verb alc880_medion_rim_init_verbs
[] = {
3063 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
3065 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3066 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3068 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3070 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3071 /* Mic2 (as headphone out) for HP output */
3072 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3073 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3074 /* Internal Speaker */
3075 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3076 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3078 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
3079 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
3081 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3085 /* toggle speaker-output according to the hp-jack state */
3086 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
3088 struct alc_spec
*spec
= codec
->spec
;
3089 alc_automute_amp(codec
);
3091 if (spec
->jack_present
)
3092 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
3094 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
3097 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
3100 /* Looks like the unsol event is incompatible with the standard
3101 * definition. 4bit tag is placed at 28 bit!
3103 if ((res
>> 28) == ALC880_HP_EVENT
)
3104 alc880_medion_rim_automute(codec
);
3107 static void alc880_medion_rim_init_hook(struct hda_codec
*codec
)
3109 struct alc_spec
*spec
= codec
->spec
;
3111 spec
->autocfg
.hp_pins
[0] = 0x14;
3112 spec
->autocfg
.speaker_pins
[0] = 0x1b;
3113 alc880_medion_rim_automute(codec
);
3116 #ifdef CONFIG_SND_HDA_POWER_SAVE
3117 static struct hda_amp_list alc880_loopbacks
[] = {
3118 { 0x0b, HDA_INPUT
, 0 },
3119 { 0x0b, HDA_INPUT
, 1 },
3120 { 0x0b, HDA_INPUT
, 2 },
3121 { 0x0b, HDA_INPUT
, 3 },
3122 { 0x0b, HDA_INPUT
, 4 },
3126 static struct hda_amp_list alc880_lg_loopbacks
[] = {
3127 { 0x0b, HDA_INPUT
, 1 },
3128 { 0x0b, HDA_INPUT
, 6 },
3129 { 0x0b, HDA_INPUT
, 7 },
3138 static int alc_init(struct hda_codec
*codec
)
3140 struct alc_spec
*spec
= codec
->spec
;
3144 alc_auto_init_amp(codec
, spec
->init_amp
);
3146 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
3147 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
3149 if (spec
->init_hook
)
3150 spec
->init_hook(codec
);
3155 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
3157 struct alc_spec
*spec
= codec
->spec
;
3159 if (spec
->unsol_event
)
3160 spec
->unsol_event(codec
, res
);
3163 #ifdef CONFIG_SND_HDA_POWER_SAVE
3164 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
3166 struct alc_spec
*spec
= codec
->spec
;
3167 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
3172 * Analog playback callbacks
3174 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3175 struct hda_codec
*codec
,
3176 struct snd_pcm_substream
*substream
)
3178 struct alc_spec
*spec
= codec
->spec
;
3179 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
3183 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3184 struct hda_codec
*codec
,
3185 unsigned int stream_tag
,
3186 unsigned int format
,
3187 struct snd_pcm_substream
*substream
)
3189 struct alc_spec
*spec
= codec
->spec
;
3190 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
3191 stream_tag
, format
, substream
);
3194 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3195 struct hda_codec
*codec
,
3196 struct snd_pcm_substream
*substream
)
3198 struct alc_spec
*spec
= codec
->spec
;
3199 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
3205 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
3206 struct hda_codec
*codec
,
3207 struct snd_pcm_substream
*substream
)
3209 struct alc_spec
*spec
= codec
->spec
;
3210 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
3213 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3214 struct hda_codec
*codec
,
3215 unsigned int stream_tag
,
3216 unsigned int format
,
3217 struct snd_pcm_substream
*substream
)
3219 struct alc_spec
*spec
= codec
->spec
;
3220 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
3221 stream_tag
, format
, substream
);
3224 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3225 struct hda_codec
*codec
,
3226 struct snd_pcm_substream
*substream
)
3228 struct alc_spec
*spec
= codec
->spec
;
3229 return snd_hda_multi_out_dig_cleanup(codec
, &spec
->multiout
);
3232 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
3233 struct hda_codec
*codec
,
3234 struct snd_pcm_substream
*substream
)
3236 struct alc_spec
*spec
= codec
->spec
;
3237 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
3243 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
3244 struct hda_codec
*codec
,
3245 unsigned int stream_tag
,
3246 unsigned int format
,
3247 struct snd_pcm_substream
*substream
)
3249 struct alc_spec
*spec
= codec
->spec
;
3251 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
3252 stream_tag
, 0, format
);
3256 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
3257 struct hda_codec
*codec
,
3258 struct snd_pcm_substream
*substream
)
3260 struct alc_spec
*spec
= codec
->spec
;
3262 snd_hda_codec_cleanup_stream(codec
,
3263 spec
->adc_nids
[substream
->number
+ 1]);
3270 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
3274 /* NID is set in alc_build_pcms */
3276 .open
= alc880_playback_pcm_open
,
3277 .prepare
= alc880_playback_pcm_prepare
,
3278 .cleanup
= alc880_playback_pcm_cleanup
3282 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
3286 /* NID is set in alc_build_pcms */
3289 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
3293 /* NID is set in alc_build_pcms */
3296 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
3297 .substreams
= 2, /* can be overridden */
3300 /* NID is set in alc_build_pcms */
3302 .prepare
= alc880_alt_capture_pcm_prepare
,
3303 .cleanup
= alc880_alt_capture_pcm_cleanup
3307 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
3311 /* NID is set in alc_build_pcms */
3313 .open
= alc880_dig_playback_pcm_open
,
3314 .close
= alc880_dig_playback_pcm_close
,
3315 .prepare
= alc880_dig_playback_pcm_prepare
,
3316 .cleanup
= alc880_dig_playback_pcm_cleanup
3320 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
3324 /* NID is set in alc_build_pcms */
3327 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3328 static struct hda_pcm_stream alc_pcm_null_stream
= {
3334 static int alc_build_pcms(struct hda_codec
*codec
)
3336 struct alc_spec
*spec
= codec
->spec
;
3337 struct hda_pcm
*info
= spec
->pcm_rec
;
3340 codec
->num_pcms
= 1;
3341 codec
->pcm_info
= info
;
3343 if (spec
->no_analog
)
3346 snprintf(spec
->stream_name_analog
, sizeof(spec
->stream_name_analog
),
3347 "%s Analog", codec
->chip_name
);
3348 info
->name
= spec
->stream_name_analog
;
3350 if (spec
->stream_analog_playback
) {
3351 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
3353 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
3354 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
3356 if (spec
->stream_analog_capture
) {
3357 if (snd_BUG_ON(!spec
->adc_nids
))
3359 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
3360 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
3363 if (spec
->channel_mode
) {
3364 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
3365 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
3366 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
3367 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
3373 /* SPDIF for stream index #1 */
3374 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
3375 snprintf(spec
->stream_name_digital
,
3376 sizeof(spec
->stream_name_digital
),
3377 "%s Digital", codec
->chip_name
);
3378 codec
->num_pcms
= 2;
3379 codec
->slave_dig_outs
= spec
->multiout
.slave_dig_outs
;
3380 info
= spec
->pcm_rec
+ 1;
3381 info
->name
= spec
->stream_name_digital
;
3382 if (spec
->dig_out_type
)
3383 info
->pcm_type
= spec
->dig_out_type
;
3385 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
3386 if (spec
->multiout
.dig_out_nid
&&
3387 spec
->stream_digital_playback
) {
3388 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
3389 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
3391 if (spec
->dig_in_nid
&&
3392 spec
->stream_digital_capture
) {
3393 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
3394 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
3396 /* FIXME: do we need this for all Realtek codec models? */
3397 codec
->spdif_status_reset
= 1;
3400 if (spec
->no_analog
)
3403 /* If the use of more than one ADC is requested for the current
3404 * model, configure a second analog capture-only PCM.
3406 /* Additional Analaog capture for index #2 */
3407 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
3408 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
3409 codec
->num_pcms
= 3;
3410 info
= spec
->pcm_rec
+ 2;
3411 info
->name
= spec
->stream_name_analog
;
3412 if (spec
->alt_dac_nid
) {
3413 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
3414 *spec
->stream_analog_alt_playback
;
3415 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
3418 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
3419 alc_pcm_null_stream
;
3420 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
3422 if (spec
->num_adc_nids
> 1) {
3423 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
3424 *spec
->stream_analog_alt_capture
;
3425 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
3427 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
3428 spec
->num_adc_nids
- 1;
3430 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
3431 alc_pcm_null_stream
;
3432 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
3439 static void alc_free_kctls(struct hda_codec
*codec
)
3441 struct alc_spec
*spec
= codec
->spec
;
3443 if (spec
->kctls
.list
) {
3444 struct snd_kcontrol_new
*kctl
= spec
->kctls
.list
;
3446 for (i
= 0; i
< spec
->kctls
.used
; i
++)
3447 kfree(kctl
[i
].name
);
3449 snd_array_free(&spec
->kctls
);
3452 static void alc_free(struct hda_codec
*codec
)
3454 struct alc_spec
*spec
= codec
->spec
;
3459 alc_free_kctls(codec
);
3461 snd_hda_detach_beep_device(codec
);
3464 #ifdef SND_HDA_NEEDS_RESUME
3465 static int alc_resume(struct hda_codec
*codec
)
3467 codec
->patch_ops
.init(codec
);
3468 snd_hda_codec_resume_amp(codec
);
3469 snd_hda_codec_resume_cache(codec
);
3476 static struct hda_codec_ops alc_patch_ops
= {
3477 .build_controls
= alc_build_controls
,
3478 .build_pcms
= alc_build_pcms
,
3481 .unsol_event
= alc_unsol_event
,
3482 #ifdef SND_HDA_NEEDS_RESUME
3483 .resume
= alc_resume
,
3485 #ifdef CONFIG_SND_HDA_POWER_SAVE
3486 .check_power_status
= alc_check_power_status
,
3492 * Test configuration for debugging
3494 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3497 #ifdef CONFIG_SND_DEBUG
3498 static hda_nid_t alc880_test_dac_nids
[4] = {
3499 0x02, 0x03, 0x04, 0x05
3502 static struct hda_input_mux alc880_test_capture_source
= {
3511 { "Surround", 0x6 },
3515 static struct hda_channel_mode alc880_test_modes
[4] = {
3522 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
3523 struct snd_ctl_elem_info
*uinfo
)
3525 static char *texts
[] = {
3526 "N/A", "Line Out", "HP Out",
3527 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3529 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
3531 uinfo
->value
.enumerated
.items
= 8;
3532 if (uinfo
->value
.enumerated
.item
>= 8)
3533 uinfo
->value
.enumerated
.item
= 7;
3534 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
3538 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
3539 struct snd_ctl_elem_value
*ucontrol
)
3541 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3542 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3543 unsigned int pin_ctl
, item
= 0;
3545 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
3546 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3547 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
3548 if (pin_ctl
& AC_PINCTL_HP_EN
)
3552 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
3553 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
3554 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
3555 case AC_PINCTL_VREF_50
: item
= 4; break;
3556 case AC_PINCTL_VREF_GRD
: item
= 5; break;
3557 case AC_PINCTL_VREF_80
: item
= 6; break;
3558 case AC_PINCTL_VREF_100
: item
= 7; break;
3561 ucontrol
->value
.enumerated
.item
[0] = item
;
3565 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
3566 struct snd_ctl_elem_value
*ucontrol
)
3568 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3569 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3570 static unsigned int ctls
[] = {
3571 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
3572 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
3573 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
3574 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
3575 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
3576 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
3578 unsigned int old_ctl
, new_ctl
;
3580 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
3581 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
3582 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
3583 if (old_ctl
!= new_ctl
) {
3585 snd_hda_codec_write_cache(codec
, nid
, 0,
3586 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3588 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
3590 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
3597 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
3598 struct snd_ctl_elem_info
*uinfo
)
3600 static char *texts
[] = {
3601 "Front", "Surround", "CLFE", "Side"
3603 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
3605 uinfo
->value
.enumerated
.items
= 4;
3606 if (uinfo
->value
.enumerated
.item
>= 4)
3607 uinfo
->value
.enumerated
.item
= 3;
3608 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
3612 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
3613 struct snd_ctl_elem_value
*ucontrol
)
3615 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3616 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3619 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
3620 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
3624 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
3625 struct snd_ctl_elem_value
*ucontrol
)
3627 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3628 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
3631 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
3632 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
3633 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
3634 snd_hda_codec_write_cache(codec
, nid
, 0,
3635 AC_VERB_SET_CONNECT_SEL
, sel
);
3641 #define PIN_CTL_TEST(xname,nid) { \
3642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3644 .info = alc_test_pin_ctl_info, \
3645 .get = alc_test_pin_ctl_get, \
3646 .put = alc_test_pin_ctl_put, \
3647 .private_value = nid \
3650 #define PIN_SRC_TEST(xname,nid) { \
3651 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3653 .info = alc_test_pin_src_info, \
3654 .get = alc_test_pin_src_get, \
3655 .put = alc_test_pin_src_put, \
3656 .private_value = nid \
3659 static struct snd_kcontrol_new alc880_test_mixer
[] = {
3660 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
3661 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
3662 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
3663 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
3664 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
3665 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
3666 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
3667 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
3668 PIN_CTL_TEST("Front Pin Mode", 0x14),
3669 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3670 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3671 PIN_CTL_TEST("Side Pin Mode", 0x17),
3672 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3673 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3674 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3675 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3676 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3677 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3678 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3679 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3680 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
3681 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
3682 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
3683 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
3684 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
3685 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
3686 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
3687 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
3688 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
3689 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
3691 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3692 .name
= "Channel Mode",
3693 .info
= alc_ch_mode_info
,
3694 .get
= alc_ch_mode_get
,
3695 .put
= alc_ch_mode_put
,
3700 static struct hda_verb alc880_test_init_verbs
[] = {
3701 /* Unmute inputs of 0x0c - 0x0f */
3702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3704 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3705 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3706 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3707 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3708 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3709 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3710 /* Vol output for 0x0c-0x0f */
3711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3712 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3713 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3714 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3715 /* Set output pins 0x14-0x17 */
3716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3717 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3718 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3719 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3720 /* Unmute output pins 0x14-0x17 */
3721 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3723 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3724 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3725 /* Set input pins 0x18-0x1c */
3726 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3727 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3728 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3730 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3731 /* Mute input pins 0x18-0x1b */
3732 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3733 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3734 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3735 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3738 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
3739 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3740 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
3741 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3742 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
3743 /* Analog input/passthru */
3744 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3745 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3746 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3747 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3748 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3756 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
3757 [ALC880_3ST
] = "3stack",
3758 [ALC880_TCL_S700
] = "tcl",
3759 [ALC880_3ST_DIG
] = "3stack-digout",
3760 [ALC880_CLEVO
] = "clevo",
3761 [ALC880_5ST
] = "5stack",
3762 [ALC880_5ST_DIG
] = "5stack-digout",
3763 [ALC880_W810
] = "w810",
3764 [ALC880_Z71V
] = "z71v",
3765 [ALC880_6ST
] = "6stack",
3766 [ALC880_6ST_DIG
] = "6stack-digout",
3767 [ALC880_ASUS
] = "asus",
3768 [ALC880_ASUS_W1V
] = "asus-w1v",
3769 [ALC880_ASUS_DIG
] = "asus-dig",
3770 [ALC880_ASUS_DIG2
] = "asus-dig2",
3771 [ALC880_UNIWILL_DIG
] = "uniwill",
3772 [ALC880_UNIWILL_P53
] = "uniwill-p53",
3773 [ALC880_FUJITSU
] = "fujitsu",
3774 [ALC880_F1734
] = "F1734",
3776 [ALC880_LG_LW
] = "lg-lw",
3777 [ALC880_MEDION_RIM
] = "medion",
3778 #ifdef CONFIG_SND_DEBUG
3779 [ALC880_TEST
] = "test",
3781 [ALC880_AUTO
] = "auto",
3784 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
3785 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
3786 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
3787 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
3788 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
3789 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
3790 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
3791 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
3792 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
3793 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
3794 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
3795 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
3796 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
3797 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
3798 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
3799 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
3800 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
3801 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
3802 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
3803 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3804 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
3805 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
3806 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
3807 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
3808 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
3809 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
3810 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS
), /* default ASUS */
3811 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
3812 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
3813 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
3814 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
3815 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
3816 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
3817 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
3818 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
3819 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
3820 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
3821 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
3822 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
3823 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
3824 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
3825 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
3826 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
3827 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
3828 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
3829 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
3830 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
3831 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
3832 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
3833 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
3834 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
3835 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
3836 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
3837 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
3838 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
3839 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
3840 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
3841 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
3842 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
3843 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
3844 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
3845 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
3846 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
3847 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
3848 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
3849 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
3850 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
3851 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
3852 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
3854 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST
),
3855 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
3856 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
3861 * ALC880 codec presets
3863 static struct alc_config_preset alc880_presets
[] = {
3865 .mixers
= { alc880_three_stack_mixer
},
3866 .init_verbs
= { alc880_volume_init_verbs
,
3867 alc880_pin_3stack_init_verbs
},
3868 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3869 .dac_nids
= alc880_dac_nids
,
3870 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3871 .channel_mode
= alc880_threestack_modes
,
3873 .input_mux
= &alc880_capture_source
,
3875 [ALC880_3ST_DIG
] = {
3876 .mixers
= { alc880_three_stack_mixer
},
3877 .init_verbs
= { alc880_volume_init_verbs
,
3878 alc880_pin_3stack_init_verbs
},
3879 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3880 .dac_nids
= alc880_dac_nids
,
3881 .dig_out_nid
= ALC880_DIGOUT_NID
,
3882 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3883 .channel_mode
= alc880_threestack_modes
,
3885 .input_mux
= &alc880_capture_source
,
3887 [ALC880_TCL_S700
] = {
3888 .mixers
= { alc880_tcl_s700_mixer
},
3889 .init_verbs
= { alc880_volume_init_verbs
,
3890 alc880_pin_tcl_S700_init_verbs
,
3891 alc880_gpio2_init_verbs
},
3892 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3893 .dac_nids
= alc880_dac_nids
,
3894 .adc_nids
= alc880_adc_nids_alt
, /* FIXME: correct? */
3895 .num_adc_nids
= 1, /* single ADC */
3897 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3898 .channel_mode
= alc880_2_jack_modes
,
3899 .input_mux
= &alc880_capture_source
,
3902 .mixers
= { alc880_three_stack_mixer
,
3903 alc880_five_stack_mixer
},
3904 .init_verbs
= { alc880_volume_init_verbs
,
3905 alc880_pin_5stack_init_verbs
},
3906 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3907 .dac_nids
= alc880_dac_nids
,
3908 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3909 .channel_mode
= alc880_fivestack_modes
,
3910 .input_mux
= &alc880_capture_source
,
3912 [ALC880_5ST_DIG
] = {
3913 .mixers
= { alc880_three_stack_mixer
,
3914 alc880_five_stack_mixer
},
3915 .init_verbs
= { alc880_volume_init_verbs
,
3916 alc880_pin_5stack_init_verbs
},
3917 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3918 .dac_nids
= alc880_dac_nids
,
3919 .dig_out_nid
= ALC880_DIGOUT_NID
,
3920 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3921 .channel_mode
= alc880_fivestack_modes
,
3922 .input_mux
= &alc880_capture_source
,
3925 .mixers
= { alc880_six_stack_mixer
},
3926 .init_verbs
= { alc880_volume_init_verbs
,
3927 alc880_pin_6stack_init_verbs
},
3928 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3929 .dac_nids
= alc880_6st_dac_nids
,
3930 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3931 .channel_mode
= alc880_sixstack_modes
,
3932 .input_mux
= &alc880_6stack_capture_source
,
3934 [ALC880_6ST_DIG
] = {
3935 .mixers
= { alc880_six_stack_mixer
},
3936 .init_verbs
= { alc880_volume_init_verbs
,
3937 alc880_pin_6stack_init_verbs
},
3938 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3939 .dac_nids
= alc880_6st_dac_nids
,
3940 .dig_out_nid
= ALC880_DIGOUT_NID
,
3941 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3942 .channel_mode
= alc880_sixstack_modes
,
3943 .input_mux
= &alc880_6stack_capture_source
,
3946 .mixers
= { alc880_w810_base_mixer
},
3947 .init_verbs
= { alc880_volume_init_verbs
,
3948 alc880_pin_w810_init_verbs
,
3949 alc880_gpio2_init_verbs
},
3950 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
3951 .dac_nids
= alc880_w810_dac_nids
,
3952 .dig_out_nid
= ALC880_DIGOUT_NID
,
3953 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3954 .channel_mode
= alc880_w810_modes
,
3955 .input_mux
= &alc880_capture_source
,
3958 .mixers
= { alc880_z71v_mixer
},
3959 .init_verbs
= { alc880_volume_init_verbs
,
3960 alc880_pin_z71v_init_verbs
},
3961 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
3962 .dac_nids
= alc880_z71v_dac_nids
,
3963 .dig_out_nid
= ALC880_DIGOUT_NID
,
3965 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3966 .channel_mode
= alc880_2_jack_modes
,
3967 .input_mux
= &alc880_capture_source
,
3970 .mixers
= { alc880_f1734_mixer
},
3971 .init_verbs
= { alc880_volume_init_verbs
,
3972 alc880_pin_f1734_init_verbs
},
3973 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
3974 .dac_nids
= alc880_f1734_dac_nids
,
3976 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3977 .channel_mode
= alc880_2_jack_modes
,
3978 .input_mux
= &alc880_f1734_capture_source
,
3979 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3980 .init_hook
= alc880_uniwill_p53_init_hook
,
3983 .mixers
= { alc880_asus_mixer
},
3984 .init_verbs
= { alc880_volume_init_verbs
,
3985 alc880_pin_asus_init_verbs
,
3986 alc880_gpio1_init_verbs
},
3987 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3988 .dac_nids
= alc880_asus_dac_nids
,
3989 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3990 .channel_mode
= alc880_asus_modes
,
3992 .input_mux
= &alc880_capture_source
,
3994 [ALC880_ASUS_DIG
] = {
3995 .mixers
= { alc880_asus_mixer
},
3996 .init_verbs
= { alc880_volume_init_verbs
,
3997 alc880_pin_asus_init_verbs
,
3998 alc880_gpio1_init_verbs
},
3999 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4000 .dac_nids
= alc880_asus_dac_nids
,
4001 .dig_out_nid
= ALC880_DIGOUT_NID
,
4002 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4003 .channel_mode
= alc880_asus_modes
,
4005 .input_mux
= &alc880_capture_source
,
4007 [ALC880_ASUS_DIG2
] = {
4008 .mixers
= { alc880_asus_mixer
},
4009 .init_verbs
= { alc880_volume_init_verbs
,
4010 alc880_pin_asus_init_verbs
,
4011 alc880_gpio2_init_verbs
}, /* use GPIO2 */
4012 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4013 .dac_nids
= alc880_asus_dac_nids
,
4014 .dig_out_nid
= ALC880_DIGOUT_NID
,
4015 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4016 .channel_mode
= alc880_asus_modes
,
4018 .input_mux
= &alc880_capture_source
,
4020 [ALC880_ASUS_W1V
] = {
4021 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
4022 .init_verbs
= { alc880_volume_init_verbs
,
4023 alc880_pin_asus_init_verbs
,
4024 alc880_gpio1_init_verbs
},
4025 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4026 .dac_nids
= alc880_asus_dac_nids
,
4027 .dig_out_nid
= ALC880_DIGOUT_NID
,
4028 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4029 .channel_mode
= alc880_asus_modes
,
4031 .input_mux
= &alc880_capture_source
,
4033 [ALC880_UNIWILL_DIG
] = {
4034 .mixers
= { alc880_asus_mixer
},
4035 .init_verbs
= { alc880_volume_init_verbs
,
4036 alc880_pin_asus_init_verbs
},
4037 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4038 .dac_nids
= alc880_asus_dac_nids
,
4039 .dig_out_nid
= ALC880_DIGOUT_NID
,
4040 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
4041 .channel_mode
= alc880_asus_modes
,
4043 .input_mux
= &alc880_capture_source
,
4045 [ALC880_UNIWILL
] = {
4046 .mixers
= { alc880_uniwill_mixer
},
4047 .init_verbs
= { alc880_volume_init_verbs
,
4048 alc880_uniwill_init_verbs
},
4049 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4050 .dac_nids
= alc880_asus_dac_nids
,
4051 .dig_out_nid
= ALC880_DIGOUT_NID
,
4052 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4053 .channel_mode
= alc880_threestack_modes
,
4055 .input_mux
= &alc880_capture_source
,
4056 .unsol_event
= alc880_uniwill_unsol_event
,
4057 .init_hook
= alc880_uniwill_init_hook
,
4059 [ALC880_UNIWILL_P53
] = {
4060 .mixers
= { alc880_uniwill_p53_mixer
},
4061 .init_verbs
= { alc880_volume_init_verbs
,
4062 alc880_uniwill_p53_init_verbs
},
4063 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
4064 .dac_nids
= alc880_asus_dac_nids
,
4065 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
4066 .channel_mode
= alc880_threestack_modes
,
4067 .input_mux
= &alc880_capture_source
,
4068 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4069 .init_hook
= alc880_uniwill_p53_init_hook
,
4071 [ALC880_FUJITSU
] = {
4072 .mixers
= { alc880_fujitsu_mixer
},
4073 .init_verbs
= { alc880_volume_init_verbs
,
4074 alc880_uniwill_p53_init_verbs
,
4075 alc880_beep_init_verbs
},
4076 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4077 .dac_nids
= alc880_dac_nids
,
4078 .dig_out_nid
= ALC880_DIGOUT_NID
,
4079 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4080 .channel_mode
= alc880_2_jack_modes
,
4081 .input_mux
= &alc880_capture_source
,
4082 .unsol_event
= alc880_uniwill_p53_unsol_event
,
4083 .init_hook
= alc880_uniwill_p53_init_hook
,
4086 .mixers
= { alc880_three_stack_mixer
},
4087 .init_verbs
= { alc880_volume_init_verbs
,
4088 alc880_pin_clevo_init_verbs
},
4089 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4090 .dac_nids
= alc880_dac_nids
,
4092 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
4093 .channel_mode
= alc880_threestack_modes
,
4095 .input_mux
= &alc880_capture_source
,
4098 .mixers
= { alc880_lg_mixer
},
4099 .init_verbs
= { alc880_volume_init_verbs
,
4100 alc880_lg_init_verbs
},
4101 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
4102 .dac_nids
= alc880_lg_dac_nids
,
4103 .dig_out_nid
= ALC880_DIGOUT_NID
,
4104 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
4105 .channel_mode
= alc880_lg_ch_modes
,
4107 .input_mux
= &alc880_lg_capture_source
,
4108 .unsol_event
= alc_automute_amp_unsol_event
,
4109 .init_hook
= alc880_lg_init_hook
,
4110 #ifdef CONFIG_SND_HDA_POWER_SAVE
4111 .loopbacks
= alc880_lg_loopbacks
,
4115 .mixers
= { alc880_lg_lw_mixer
},
4116 .init_verbs
= { alc880_volume_init_verbs
,
4117 alc880_lg_lw_init_verbs
},
4118 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4119 .dac_nids
= alc880_dac_nids
,
4120 .dig_out_nid
= ALC880_DIGOUT_NID
,
4121 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
4122 .channel_mode
= alc880_lg_lw_modes
,
4123 .input_mux
= &alc880_lg_lw_capture_source
,
4124 .unsol_event
= alc_automute_amp_unsol_event
,
4125 .init_hook
= alc880_lg_lw_init_hook
,
4127 [ALC880_MEDION_RIM
] = {
4128 .mixers
= { alc880_medion_rim_mixer
},
4129 .init_verbs
= { alc880_volume_init_verbs
,
4130 alc880_medion_rim_init_verbs
,
4131 alc_gpio2_init_verbs
},
4132 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
4133 .dac_nids
= alc880_dac_nids
,
4134 .dig_out_nid
= ALC880_DIGOUT_NID
,
4135 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
4136 .channel_mode
= alc880_2_jack_modes
,
4137 .input_mux
= &alc880_medion_rim_capture_source
,
4138 .unsol_event
= alc880_medion_rim_unsol_event
,
4139 .init_hook
= alc880_medion_rim_init_hook
,
4141 #ifdef CONFIG_SND_DEBUG
4143 .mixers
= { alc880_test_mixer
},
4144 .init_verbs
= { alc880_test_init_verbs
},
4145 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
4146 .dac_nids
= alc880_test_dac_nids
,
4147 .dig_out_nid
= ALC880_DIGOUT_NID
,
4148 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
4149 .channel_mode
= alc880_test_modes
,
4150 .input_mux
= &alc880_test_capture_source
,
4156 * Automatic parse of I/O pins from the BIOS configuration
4161 ALC_CTL_WIDGET_MUTE
,
4164 static struct snd_kcontrol_new alc880_control_templates
[] = {
4165 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
4166 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
4167 HDA_BIND_MUTE(NULL
, 0, 0, 0),
4170 /* add dynamic controls */
4171 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
4174 struct snd_kcontrol_new
*knew
;
4176 snd_array_init(&spec
->kctls
, sizeof(*knew
), 32);
4177 knew
= snd_array_new(&spec
->kctls
);
4180 *knew
= alc880_control_templates
[type
];
4181 knew
->name
= kstrdup(name
, GFP_KERNEL
);
4184 knew
->private_value
= val
;
4188 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4189 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4190 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4191 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4192 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4193 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4194 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4195 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4196 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4197 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4198 #define ALC880_PIN_CD_NID 0x1c
4200 /* fill in the dac_nids table from the parsed pin configuration */
4201 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
4202 const struct auto_pin_cfg
*cfg
)
4208 memset(assigned
, 0, sizeof(assigned
));
4209 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
4211 /* check the pins hardwired to audio widget */
4212 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4213 nid
= cfg
->line_out_pins
[i
];
4214 if (alc880_is_fixed_pin(nid
)) {
4215 int idx
= alc880_fixed_pin_idx(nid
);
4216 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
4220 /* left pins can be connect to any audio widget */
4221 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4222 nid
= cfg
->line_out_pins
[i
];
4223 if (alc880_is_fixed_pin(nid
))
4225 /* search for an empty channel */
4226 for (j
= 0; j
< cfg
->line_outs
; j
++) {
4228 spec
->multiout
.dac_nids
[i
] =
4229 alc880_idx_to_dac(j
);
4235 spec
->multiout
.num_dacs
= cfg
->line_outs
;
4239 /* add playback controls from the parsed DAC table */
4240 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
4241 const struct auto_pin_cfg
*cfg
)
4244 static const char *chname
[4] = {
4245 "Front", "Surround", NULL
/*CLFE*/, "Side"
4250 for (i
= 0; i
< cfg
->line_outs
; i
++) {
4251 if (!spec
->multiout
.dac_nids
[i
])
4253 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
4256 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
4257 "Center Playback Volume",
4258 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
4262 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
4263 "LFE Playback Volume",
4264 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
4268 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
4269 "Center Playback Switch",
4270 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
4274 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
4275 "LFE Playback Switch",
4276 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
4281 sprintf(name
, "%s Playback Volume", chname
[i
]);
4282 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
4283 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
4287 sprintf(name
, "%s Playback Switch", chname
[i
]);
4288 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
4289 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
4298 /* add playback controls for speaker and HP outputs */
4299 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
4309 if (alc880_is_fixed_pin(pin
)) {
4310 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
4311 /* specify the DAC as the extra output */
4312 if (!spec
->multiout
.hp_nid
)
4313 spec
->multiout
.hp_nid
= nid
;
4315 spec
->multiout
.extra_out_nid
[0] = nid
;
4316 /* control HP volume/switch on the output mixer amp */
4317 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
4318 sprintf(name
, "%s Playback Volume", pfx
);
4319 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
4320 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
4323 sprintf(name
, "%s Playback Switch", pfx
);
4324 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
4325 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
4328 } else if (alc880_is_multi_pin(pin
)) {
4329 /* set manual connection */
4330 /* we have only a switch on HP-out PIN */
4331 sprintf(name
, "%s Playback Switch", pfx
);
4332 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
4333 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
4340 /* create input playback/capture controls for the given pin */
4341 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
4342 const char *ctlname
,
4343 int idx
, hda_nid_t mix_nid
)
4348 sprintf(name
, "%s Playback Volume", ctlname
);
4349 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
4350 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
4353 sprintf(name
, "%s Playback Switch", ctlname
);
4354 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
4355 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
4361 /* create playback/capture controls for input pins */
4362 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
4363 const struct auto_pin_cfg
*cfg
)
4365 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
4368 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4369 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
4370 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
4371 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4372 auto_pin_cfg_labels
[i
],
4376 imux
->items
[imux
->num_items
].label
=
4377 auto_pin_cfg_labels
[i
];
4378 imux
->items
[imux
->num_items
].index
=
4379 alc880_input_pin_idx(cfg
->input_pins
[i
]);
4386 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
4387 unsigned int pin_type
)
4389 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4392 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4396 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
4397 hda_nid_t nid
, int pin_type
,
4400 alc_set_pin_output(codec
, nid
, pin_type
);
4401 /* need the manual connection? */
4402 if (alc880_is_multi_pin(nid
)) {
4403 struct alc_spec
*spec
= codec
->spec
;
4404 int idx
= alc880_multi_pin_idx(nid
);
4405 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
4406 AC_VERB_SET_CONNECT_SEL
,
4407 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
4411 static int get_pin_type(int line_out_type
)
4413 if (line_out_type
== AUTO_PIN_HP_OUT
)
4419 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
4421 struct alc_spec
*spec
= codec
->spec
;
4424 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
4425 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
4426 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
4427 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
4431 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
4433 struct alc_spec
*spec
= codec
->spec
;
4436 pin
= spec
->autocfg
.speaker_pins
[0];
4437 if (pin
) /* connect to front */
4438 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
4439 pin
= spec
->autocfg
.hp_pins
[0];
4440 if (pin
) /* connect to front */
4441 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
4444 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
4446 struct alc_spec
*spec
= codec
->spec
;
4449 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4450 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4451 if (alc880_is_input_pin(nid
)) {
4452 alc_set_input_pin(codec
, nid
, i
);
4453 if (nid
!= ALC880_PIN_CD_NID
&&
4454 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
4455 snd_hda_codec_write(codec
, nid
, 0,
4456 AC_VERB_SET_AMP_GAIN_MUTE
,
4462 /* parse the BIOS configuration and set up the alc_spec */
4463 /* return 1 if successful, 0 if the proper config is not found,
4464 * or a negative error code
4466 static int alc880_parse_auto_config(struct hda_codec
*codec
)
4468 struct alc_spec
*spec
= codec
->spec
;
4470 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
4472 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
4476 if (!spec
->autocfg
.line_outs
)
4477 return 0; /* can't find valid BIOS pin config */
4479 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
4482 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
4485 err
= alc880_auto_create_extra_out(spec
,
4486 spec
->autocfg
.speaker_pins
[0],
4490 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
4494 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
4498 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
4500 /* check multiple SPDIF-out (for recent codecs) */
4501 for (i
= 0; i
< spec
->autocfg
.dig_outs
; i
++) {
4503 err
= snd_hda_get_connections(codec
,
4504 spec
->autocfg
.dig_out_pins
[i
],
4509 spec
->multiout
.dig_out_nid
= dig_nid
;
4511 spec
->multiout
.slave_dig_outs
= spec
->slave_dig_outs
;
4512 spec
->slave_dig_outs
[i
- 1] = dig_nid
;
4513 if (i
== ARRAY_SIZE(spec
->slave_dig_outs
) - 1)
4517 if (spec
->autocfg
.dig_in_pin
)
4518 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
4520 if (spec
->kctls
.list
)
4521 add_mixer(spec
, spec
->kctls
.list
);
4523 add_verb(spec
, alc880_volume_init_verbs
);
4525 spec
->num_mux_defs
= 1;
4526 spec
->input_mux
= &spec
->private_imux
[0];
4528 alc_ssid_check(codec
, 0x15, 0x1b, 0x14);
4533 /* additional initialization for auto-configuration model */
4534 static void alc880_auto_init(struct hda_codec
*codec
)
4536 struct alc_spec
*spec
= codec
->spec
;
4537 alc880_auto_init_multi_out(codec
);
4538 alc880_auto_init_extra_out(codec
);
4539 alc880_auto_init_analog_input(codec
);
4540 if (spec
->unsol_event
)
4541 alc_inithook(codec
);
4544 static void set_capture_mixer(struct alc_spec
*spec
)
4546 static struct snd_kcontrol_new
*caps
[2][3] = {
4547 { alc_capture_mixer_nosrc1
,
4548 alc_capture_mixer_nosrc2
,
4549 alc_capture_mixer_nosrc3
},
4550 { alc_capture_mixer1
,
4552 alc_capture_mixer3
},
4554 if (spec
->num_adc_nids
> 0 && spec
->num_adc_nids
<= 3) {
4556 if (spec
->input_mux
&& spec
->input_mux
->num_items
> 1)
4560 spec
->cap_mixer
= caps
[mux
][spec
->num_adc_nids
- 1];
4564 #define set_beep_amp(spec, nid, idx, dir) \
4565 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4568 * OK, here we have finally the patch for ALC880
4571 static int patch_alc880(struct hda_codec
*codec
)
4573 struct alc_spec
*spec
;
4577 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4583 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
4586 if (board_config
< 0) {
4587 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
4588 "trying auto-probe from BIOS...\n", codec
->chip_name
);
4589 board_config
= ALC880_AUTO
;
4592 if (board_config
== ALC880_AUTO
) {
4593 /* automatic parse from the BIOS config */
4594 err
= alc880_parse_auto_config(codec
);
4600 "hda_codec: Cannot set up configuration "
4601 "from BIOS. Using 3-stack mode...\n");
4602 board_config
= ALC880_3ST
;
4606 err
= snd_hda_attach_beep_device(codec
, 0x1);
4612 if (board_config
!= ALC880_AUTO
)
4613 setup_preset(spec
, &alc880_presets
[board_config
]);
4615 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
4616 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
4617 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
4619 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
4620 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
4622 if (!spec
->adc_nids
&& spec
->input_mux
) {
4623 /* check whether NID 0x07 is valid */
4624 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
4626 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
4627 if (wcap
!= AC_WID_AUD_IN
) {
4628 spec
->adc_nids
= alc880_adc_nids_alt
;
4629 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
4631 spec
->adc_nids
= alc880_adc_nids
;
4632 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
4635 set_capture_mixer(spec
);
4636 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
4638 spec
->vmaster_nid
= 0x0c;
4640 codec
->patch_ops
= alc_patch_ops
;
4641 if (board_config
== ALC880_AUTO
)
4642 spec
->init_hook
= alc880_auto_init
;
4643 #ifdef CONFIG_SND_HDA_POWER_SAVE
4644 if (!spec
->loopback
.amplist
)
4645 spec
->loopback
.amplist
= alc880_loopbacks
;
4647 codec
->proc_widget_hook
= print_realtek_coef
;
4657 static hda_nid_t alc260_dac_nids
[1] = {
4662 static hda_nid_t alc260_adc_nids
[1] = {
4667 static hda_nid_t alc260_adc_nids_alt
[1] = {
4672 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4673 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4675 static hda_nid_t alc260_dual_adc_nids
[2] = {
4680 #define ALC260_DIGOUT_NID 0x03
4681 #define ALC260_DIGIN_NID 0x06
4683 static struct hda_input_mux alc260_capture_source
= {
4687 { "Front Mic", 0x1 },
4693 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4694 * headphone jack and the internal CD lines since these are the only pins at
4695 * which audio can appear. For flexibility, also allow the option of
4696 * recording the mixer output on the second ADC (ADC0 doesn't have a
4697 * connection to the mixer output).
4699 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
4703 { "Mic/Line", 0x0 },
4705 { "Headphone", 0x2 },
4711 { "Mic/Line", 0x0 },
4713 { "Headphone", 0x2 },
4720 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4721 * the Fujitsu S702x, but jacks are marked differently.
4723 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
4730 { "Headphone", 0x5 },
4739 { "Headphone", 0x6 },
4745 /* Maxdata Favorit 100XS */
4746 static struct hda_input_mux alc260_favorit100_capture_sources
[2] = {
4750 { "Line/Mic", 0x0 },
4757 { "Line/Mic", 0x0 },
4765 * This is just place-holder, so there's something for alc_build_pcms to look
4766 * at when it calculates the maximum number of channels. ALC260 has no mixer
4767 * element which allows changing the channel mode, so the verb list is
4770 static struct hda_channel_mode alc260_modes
[1] = {
4775 /* Mixer combinations
4777 * basic: base_output + input + pc_beep + capture
4778 * HP: base_output + input + capture_alt
4779 * HP_3013: hp_3013 + input + capture
4780 * fujitsu: fujitsu + capture
4781 * acer: acer + capture
4784 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
4785 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4786 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4787 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4788 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4789 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4790 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4794 static struct snd_kcontrol_new alc260_input_mixer
[] = {
4795 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4796 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4797 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4798 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4800 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4801 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
4802 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
4806 /* update HP, line and mono out pins according to the master switch */
4807 static void alc260_hp_master_update(struct hda_codec
*codec
,
4808 hda_nid_t hp
, hda_nid_t line
,
4811 struct alc_spec
*spec
= codec
->spec
;
4812 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
4813 /* change HP and line-out pins */
4814 snd_hda_codec_write(codec
, hp
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4816 snd_hda_codec_write(codec
, line
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4818 /* mono (speaker) depending on the HP jack sense */
4819 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
4820 snd_hda_codec_write(codec
, mono
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4824 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
4825 struct snd_ctl_elem_value
*ucontrol
)
4827 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4828 struct alc_spec
*spec
= codec
->spec
;
4829 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
4833 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
4834 struct snd_ctl_elem_value
*ucontrol
)
4836 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4837 struct alc_spec
*spec
= codec
->spec
;
4838 int val
= !!*ucontrol
->value
.integer
.value
;
4839 hda_nid_t hp
, line
, mono
;
4841 if (val
== spec
->master_sw
)
4843 spec
->master_sw
= val
;
4844 hp
= (kcontrol
->private_value
>> 16) & 0xff;
4845 line
= (kcontrol
->private_value
>> 8) & 0xff;
4846 mono
= kcontrol
->private_value
& 0xff;
4847 alc260_hp_master_update(codec
, hp
, line
, mono
);
4851 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
4853 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4854 .name
= "Master Playback Switch",
4855 .info
= snd_ctl_boolean_mono_info
,
4856 .get
= alc260_hp_master_sw_get
,
4857 .put
= alc260_hp_master_sw_put
,
4858 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
4860 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4861 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4862 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4863 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4864 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4866 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4870 static struct hda_verb alc260_hp_unsol_verbs
[] = {
4871 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4875 static void alc260_hp_automute(struct hda_codec
*codec
)
4877 struct alc_spec
*spec
= codec
->spec
;
4878 unsigned int present
;
4880 present
= snd_hda_codec_read(codec
, 0x10, 0,
4881 AC_VERB_GET_PIN_SENSE
, 0);
4882 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4883 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
4886 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4888 if ((res
>> 26) == ALC880_HP_EVENT
)
4889 alc260_hp_automute(codec
);
4892 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
4894 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4895 .name
= "Master Playback Switch",
4896 .info
= snd_ctl_boolean_mono_info
,
4897 .get
= alc260_hp_master_sw_get
,
4898 .put
= alc260_hp_master_sw_put
,
4899 .private_value
= (0x15 << 16) | (0x10 << 8) | 0x11
4901 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4902 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4903 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
4904 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
4905 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4906 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
4907 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4908 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
4912 static struct hda_bind_ctls alc260_dc7600_bind_master_vol
= {
4913 .ops
= &snd_hda_bind_vol
,
4915 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT
),
4916 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
4917 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT
),
4922 static struct hda_bind_ctls alc260_dc7600_bind_switch
= {
4923 .ops
= &snd_hda_bind_sw
,
4925 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT
),
4926 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
4931 static struct snd_kcontrol_new alc260_hp_dc7600_mixer
[] = {
4932 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol
),
4933 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch
),
4934 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT
),
4935 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4939 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
4940 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4944 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
4946 struct alc_spec
*spec
= codec
->spec
;
4947 unsigned int present
;
4949 present
= snd_hda_codec_read(codec
, 0x15, 0,
4950 AC_VERB_GET_PIN_SENSE
, 0);
4951 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4952 alc260_hp_master_update(codec
, 0x15, 0x10, 0x11);
4955 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
4958 if ((res
>> 26) == ALC880_HP_EVENT
)
4959 alc260_hp_3013_automute(codec
);
4962 static void alc260_hp_3012_automute(struct hda_codec
*codec
)
4964 unsigned int present
, bits
;
4966 present
= snd_hda_codec_read(codec
, 0x10, 0,
4967 AC_VERB_GET_PIN_SENSE
, 0) & AC_PINSENSE_PRESENCE
;
4969 bits
= present
? 0 : PIN_OUT
;
4970 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4972 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4974 snd_hda_codec_write(codec
, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4978 static void alc260_hp_3012_unsol_event(struct hda_codec
*codec
,
4981 if ((res
>> 26) == ALC880_HP_EVENT
)
4982 alc260_hp_3012_automute(codec
);
4985 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4986 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4988 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
4989 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4990 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
4991 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4992 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4993 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4994 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
4995 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
4996 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4997 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4998 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
5002 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5003 * versions of the ALC260 don't act on requests to enable mic bias from NID
5004 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5005 * datasheet doesn't mention this restriction. At this stage it's not clear
5006 * whether this behaviour is intentional or is a hardware bug in chip
5007 * revisions available in early 2006. Therefore for now allow the
5008 * "Headphone Jack Mode" control to span all choices, but if it turns out
5009 * that the lack of mic bias for this NID is intentional we could change the
5010 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5012 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5013 * don't appear to make the mic bias available from the "line" jack, even
5014 * though the NID used for this jack (0x14) can supply it. The theory is
5015 * that perhaps Acer have included blocking capacitors between the ALC260
5016 * and the output jack. If this turns out to be the case for all such
5017 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5018 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5020 * The C20x Tablet series have a mono internal speaker which is controlled
5021 * via the chip's Mono sum widget and pin complex, so include the necessary
5022 * controls for such models. On models without a "mono speaker" the control
5023 * won't do anything.
5025 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
5026 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5027 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
5028 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
5029 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5031 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5033 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5034 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5036 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5037 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5038 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5039 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5040 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
5044 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5046 static struct snd_kcontrol_new alc260_favorit100_mixer
[] = {
5047 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5048 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
5049 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
5050 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5051 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5052 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5056 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5057 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5059 static struct snd_kcontrol_new alc260_will_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("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5066 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5067 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
5068 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5069 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5073 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5074 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5076 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
5077 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5078 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
5079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
5080 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
5081 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
5082 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
5083 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
5084 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
5085 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
5086 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
5091 * initialization verbs
5093 static struct hda_verb alc260_init_verbs
[] = {
5094 /* Line In pin widget for input */
5095 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5096 /* CD pin widget for input */
5097 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5098 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5099 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5100 /* Mic2 (front panel) pin widget for input and vref at 80% */
5101 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5102 /* LINE-2 is used for line-out in rear */
5103 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5104 /* select line-out */
5105 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
5107 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5109 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5111 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5112 /* mute capture amp left and right */
5113 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5114 /* set connection select to line in (default select for this ADC) */
5115 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
5116 /* mute capture amp left and right */
5117 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5118 /* set connection select to line in (default select for this ADC) */
5119 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
5120 /* set vol=0 Line-Out mixer amp left and right */
5121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5122 /* unmute pin widget amp left and right (no gain on this amp) */
5123 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5124 /* set vol=0 HP mixer amp left and right */
5125 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5126 /* unmute pin widget amp left and right (no gain on this amp) */
5127 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5128 /* set vol=0 Mono mixer amp left and right */
5129 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5130 /* unmute pin widget amp left and right (no gain on this amp) */
5131 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5132 /* unmute LINE-2 out pin */
5133 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5134 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5137 /* mute analog inputs */
5138 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5139 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5140 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5141 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5142 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5143 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5144 /* mute Front out path */
5145 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5146 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5147 /* mute Headphone out path */
5148 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5149 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5150 /* mute Mono out path */
5151 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5152 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5156 #if 0 /* should be identical with alc260_init_verbs? */
5157 static struct hda_verb alc260_hp_init_verbs
[] = {
5158 /* Headphone and output */
5159 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5161 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5162 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5163 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5164 /* Mic2 (front panel) pin widget for input and vref at 80% */
5165 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5166 /* Line In pin widget for input */
5167 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5168 /* Line-2 pin widget for output */
5169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5170 /* CD pin widget for input */
5171 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5172 /* unmute amp left and right */
5173 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
5174 /* set connection select to line in (default select for this ADC) */
5175 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
5176 /* unmute Line-Out mixer amp left and right (volume = 0) */
5177 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5178 /* mute pin widget amp left and right (no gain on this amp) */
5179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5180 /* unmute HP mixer amp left and right (volume = 0) */
5181 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5182 /* mute pin widget amp left and right (no gain on this amp) */
5183 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5184 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5187 /* mute analog inputs */
5188 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5189 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5190 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5191 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5192 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5193 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5194 /* Unmute Front out path */
5195 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5196 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5197 /* Unmute Headphone out path */
5198 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5199 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5200 /* Unmute Mono out path */
5201 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5202 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5207 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
5208 /* Line out and output */
5209 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5211 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5212 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5213 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5214 /* Mic2 (front panel) pin widget for input and vref at 80% */
5215 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5216 /* Line In pin widget for input */
5217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5218 /* Headphone pin widget for output */
5219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5220 /* CD pin widget for input */
5221 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5222 /* unmute amp left and right */
5223 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
5224 /* set connection select to line in (default select for this ADC) */
5225 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
5226 /* unmute Line-Out mixer amp left and right (volume = 0) */
5227 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5228 /* mute pin widget amp left and right (no gain on this amp) */
5229 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5230 /* unmute HP mixer amp left and right (volume = 0) */
5231 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
5232 /* mute pin widget amp left and right (no gain on this amp) */
5233 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5234 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5237 /* mute analog inputs */
5238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5239 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5240 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5242 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5243 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5244 /* Unmute Front out path */
5245 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5246 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5247 /* Unmute Headphone out path */
5248 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5249 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5250 /* Unmute Mono out path */
5251 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5252 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
5256 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5257 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5258 * audio = 0x16, internal speaker = 0x10.
5260 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
5261 /* Disable all GPIOs */
5262 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
5263 /* Internal speaker is connected to headphone pin */
5264 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5265 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5266 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5267 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5268 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5269 /* Ensure all other unused pins are disabled and muted. */
5270 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5271 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5272 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5273 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5274 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5275 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5276 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5277 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5279 /* Disable digital (SPDIF) pins */
5280 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5281 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5283 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5284 * when acting as an output.
5286 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5288 /* Start with output sum widgets muted and their output gains at min */
5289 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5291 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5292 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5293 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5295 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5296 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5297 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5299 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5300 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5301 /* Unmute Line1 pin widget output buffer since it starts as an output.
5302 * If the pin mode is changed by the user the pin mode control will
5303 * take care of enabling the pin's input/output buffers as needed.
5304 * Therefore there's no need to enable the input buffer at this
5307 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5308 /* Unmute input buffer of pin widget used for Line-in (no equiv
5311 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5313 /* Mute capture amp left and right */
5314 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5315 /* Set ADC connection select to match default mixer setting - line
5318 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5320 /* Do the same for the second ADC: mute capture input amp and
5321 * set ADC connection to line in (on mic1 pin)
5323 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5324 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5326 /* Mute all inputs to mixer widget (even unconnected ones) */
5327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5339 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5340 * similar laptops (adapted from Fujitsu init verbs).
5342 static struct hda_verb alc260_acer_init_verbs
[] = {
5343 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5344 * the headphone jack. Turn this on and rely on the standard mute
5345 * methods whenever the user wants to turn these outputs off.
5347 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
5348 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
5349 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
5350 /* Internal speaker/Headphone jack is connected to Line-out pin */
5351 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5352 /* Internal microphone/Mic jack is connected to Mic1 pin */
5353 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
5354 /* Line In jack is connected to Line1 pin */
5355 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5356 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5357 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5358 /* Ensure all other unused pins are disabled and muted. */
5359 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5360 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5361 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5362 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5364 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5365 /* Disable digital (SPDIF) pins */
5366 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5367 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5369 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5370 * bus when acting as outputs.
5372 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
5373 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5375 /* Start with output sum widgets muted and their output gains at min */
5376 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5377 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5378 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5379 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5380 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5381 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5382 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5383 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5384 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5386 /* Unmute Line-out pin widget amp left and right
5387 * (no equiv mixer ctrl)
5389 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5390 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5391 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5392 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5393 * inputs. If the pin mode is changed by the user the pin mode control
5394 * will take care of enabling the pin's input/output buffers as needed.
5395 * Therefore there's no need to enable the input buffer at this
5398 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5399 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5401 /* Mute capture amp left and right */
5402 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5403 /* Set ADC connection select to match default mixer setting - mic
5406 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5408 /* Do similar with the second ADC: mute capture input amp and
5409 * set ADC connection to mic to match ALSA's default state.
5411 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5412 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5414 /* Mute all inputs to mixer widget (even unconnected ones) */
5415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5427 /* Initialisation sequence for Maxdata Favorit 100XS
5428 * (adapted from Acer init verbs).
5430 static struct hda_verb alc260_favorit100_init_verbs
[] = {
5431 /* GPIO 0 enables the output jack.
5432 * Turn this on and rely on the standard mute
5433 * methods whenever the user wants to turn these outputs off.
5435 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
5436 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
5437 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
5438 /* Line/Mic input jack is connected to Mic1 pin */
5439 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
5440 /* Ensure all other unused pins are disabled and muted. */
5441 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5442 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5443 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5444 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5445 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5446 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5447 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5448 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5449 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
5450 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5451 /* Disable digital (SPDIF) pins */
5452 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5453 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5455 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5456 * bus when acting as outputs.
5458 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
5459 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5461 /* Start with output sum widgets muted and their output gains at min */
5462 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5463 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5465 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5466 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5468 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5469 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5470 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5472 /* Unmute Line-out pin widget amp left and right
5473 * (no equiv mixer ctrl)
5475 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5476 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5477 * inputs. If the pin mode is changed by the user the pin mode control
5478 * will take care of enabling the pin's input/output buffers as needed.
5479 * Therefore there's no need to enable the input buffer at this
5482 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5484 /* Mute capture amp left and right */
5485 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5486 /* Set ADC connection select to match default mixer setting - mic
5489 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5491 /* Do similar with the second ADC: mute capture input amp and
5492 * set ADC connection to mic to match ALSA's default state.
5494 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5495 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5497 /* Mute all inputs to mixer widget (even unconnected ones) */
5498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5503 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5504 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5505 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5510 static struct hda_verb alc260_will_verbs
[] = {
5511 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5512 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5513 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
5514 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
5515 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
5516 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
5520 static struct hda_verb alc260_replacer_672v_verbs
[] = {
5521 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
5522 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
5523 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
5525 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
5526 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
5527 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
5529 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5533 /* toggle speaker-output according to the hp-jack state */
5534 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
5536 unsigned int present
;
5538 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5539 present
= snd_hda_codec_read(codec
, 0x0f, 0,
5540 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5542 snd_hda_codec_write_cache(codec
, 0x01, 0,
5543 AC_VERB_SET_GPIO_DATA
, 1);
5544 snd_hda_codec_write_cache(codec
, 0x0f, 0,
5545 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5548 snd_hda_codec_write_cache(codec
, 0x01, 0,
5549 AC_VERB_SET_GPIO_DATA
, 0);
5550 snd_hda_codec_write_cache(codec
, 0x0f, 0,
5551 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5556 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
5559 if ((res
>> 26) == ALC880_HP_EVENT
)
5560 alc260_replacer_672v_automute(codec
);
5563 static struct hda_verb alc260_hp_dc7600_verbs
[] = {
5564 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x01},
5565 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5566 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5567 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5568 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5570 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5571 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5572 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5573 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5577 /* Test configuration for debugging, modelled after the ALC880 test
5580 #ifdef CONFIG_SND_DEBUG
5581 static hda_nid_t alc260_test_dac_nids
[1] = {
5584 static hda_nid_t alc260_test_adc_nids
[2] = {
5587 /* For testing the ALC260, each input MUX needs its own definition since
5588 * the signal assignments are different. This assumes that the first ADC
5591 static struct hda_input_mux alc260_test_capture_sources
[2] = {
5595 { "MIC1 pin", 0x0 },
5596 { "MIC2 pin", 0x1 },
5597 { "LINE1 pin", 0x2 },
5598 { "LINE2 pin", 0x3 },
5600 { "LINE-OUT pin", 0x5 },
5601 { "HP-OUT pin", 0x6 },
5607 { "MIC1 pin", 0x0 },
5608 { "MIC2 pin", 0x1 },
5609 { "LINE1 pin", 0x2 },
5610 { "LINE2 pin", 0x3 },
5613 { "LINE-OUT pin", 0x6 },
5614 { "HP-OUT pin", 0x7 },
5618 static struct snd_kcontrol_new alc260_test_mixer
[] = {
5619 /* Output driver widgets */
5620 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
5621 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
5622 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
5623 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
5624 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
5625 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
5627 /* Modes for retasking pin widgets
5628 * Note: the ALC260 doesn't seem to act on requests to enable mic
5629 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5630 * mention this restriction. At this stage it's not clear whether
5631 * this behaviour is intentional or is a hardware bug in chip
5632 * revisions available at least up until early 2006. Therefore for
5633 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5634 * choices, but if it turns out that the lack of mic bias for these
5635 * NIDs is intentional we could change their modes from
5636 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5638 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
5639 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
5640 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
5641 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
5642 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
5643 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
5645 /* Loopback mixer controls */
5646 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
5647 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
5648 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
5649 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
5650 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
5651 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
5652 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
5653 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
5654 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
5655 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
5656 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
5657 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
5658 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
5659 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
5661 /* Controls for GPIO pins, assuming they are configured as outputs */
5662 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5663 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5664 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5665 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5667 /* Switches to allow the digital IO pins to be enabled. The datasheet
5668 * is ambigious as to which NID is which; testing on laptops which
5669 * make this output available should provide clarification.
5671 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5672 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5674 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5675 * this output to turn on an external amplifier.
5677 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5678 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5682 static struct hda_verb alc260_test_init_verbs
[] = {
5683 /* Enable all GPIOs as outputs with an initial value of 0 */
5684 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
5685 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
5686 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
5688 /* Enable retasking pins as output, initially without power amp */
5689 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5690 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5691 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5693 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5694 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5696 /* Disable digital (SPDIF) pins initially, but users can enable
5697 * them via a mixer switch. In the case of SPDIF-out, this initverb
5698 * payload also sets the generation to 0, output to be in "consumer"
5699 * PCM format, copyright asserted, no pre-emphasis and no validity
5702 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5703 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
5705 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5706 * OUT1 sum bus when acting as an output.
5708 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
5709 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
5710 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
5711 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
5713 /* Start with output sum widgets muted and their output gains at min */
5714 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5716 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5717 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5718 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5719 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5720 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5721 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5722 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5724 /* Unmute retasking pin widget output buffers since the default
5725 * state appears to be output. As the pin mode is changed by the
5726 * user the pin mode control will take care of enabling the pin's
5727 * input/output buffers as needed.
5729 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5732 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5733 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5734 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5735 /* Also unmute the mono-out pin widget */
5736 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5738 /* Mute capture amp left and right */
5739 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5740 /* Set ADC connection select to match default mixer setting (mic1
5743 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5745 /* Do the same for the second ADC: mute capture input amp and
5746 * set ADC connection to mic1 pin
5748 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5749 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5751 /* Mute all inputs to mixer widget (even unconnected ones) */
5752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
5753 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
5754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
5755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
5756 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
5757 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5758 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
5759 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
5765 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5766 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5768 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5769 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5772 * for BIOS auto-configuration
5775 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
5776 const char *pfx
, int *vol_bits
)
5779 unsigned long vol_val
, sw_val
;
5783 if (nid
>= 0x0f && nid
< 0x11) {
5784 nid_vol
= nid
- 0x7;
5785 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
5786 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
5787 } else if (nid
== 0x11) {
5788 nid_vol
= nid
- 0x7;
5789 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
5790 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
5791 } else if (nid
>= 0x12 && nid
<= 0x15) {
5793 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
5794 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
5798 if (!(*vol_bits
& (1 << nid_vol
))) {
5799 /* first control for the volume widget */
5800 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
5801 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
);
5804 *vol_bits
|= (1 << nid_vol
);
5806 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
5807 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
);
5813 /* add playback controls from the parsed DAC table */
5814 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
5815 const struct auto_pin_cfg
*cfg
)
5821 spec
->multiout
.num_dacs
= 1;
5822 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
5823 spec
->multiout
.dac_nids
[0] = 0x02;
5825 nid
= cfg
->line_out_pins
[0];
5827 err
= alc260_add_playback_controls(spec
, nid
, "Front", &vols
);
5832 nid
= cfg
->speaker_pins
[0];
5834 err
= alc260_add_playback_controls(spec
, nid
, "Speaker", &vols
);
5839 nid
= cfg
->hp_pins
[0];
5841 err
= alc260_add_playback_controls(spec
, nid
, "Headphone",
5849 /* create playback/capture controls for input pins */
5850 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
5851 const struct auto_pin_cfg
*cfg
)
5853 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
5856 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5857 if (cfg
->input_pins
[i
] >= 0x12) {
5858 idx
= cfg
->input_pins
[i
] - 0x12;
5859 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
5860 auto_pin_cfg_labels
[i
], idx
,
5864 imux
->items
[imux
->num_items
].label
=
5865 auto_pin_cfg_labels
[i
];
5866 imux
->items
[imux
->num_items
].index
= idx
;
5869 if (cfg
->input_pins
[i
] >= 0x0f && cfg
->input_pins
[i
] <= 0x10){
5870 idx
= cfg
->input_pins
[i
] - 0x09;
5871 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
5872 auto_pin_cfg_labels
[i
], idx
,
5876 imux
->items
[imux
->num_items
].label
=
5877 auto_pin_cfg_labels
[i
];
5878 imux
->items
[imux
->num_items
].index
= idx
;
5885 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
5886 hda_nid_t nid
, int pin_type
,
5889 alc_set_pin_output(codec
, nid
, pin_type
);
5890 /* need the manual connection? */
5892 int idx
= nid
- 0x12;
5893 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
5894 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
5898 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
5900 struct alc_spec
*spec
= codec
->spec
;
5903 nid
= spec
->autocfg
.line_out_pins
[0];
5905 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5906 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
5909 nid
= spec
->autocfg
.speaker_pins
[0];
5911 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
5913 nid
= spec
->autocfg
.hp_pins
[0];
5915 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
5918 #define ALC260_PIN_CD_NID 0x16
5919 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
5921 struct alc_spec
*spec
= codec
->spec
;
5924 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5925 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5927 alc_set_input_pin(codec
, nid
, i
);
5928 if (nid
!= ALC260_PIN_CD_NID
&&
5929 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
5930 snd_hda_codec_write(codec
, nid
, 0,
5931 AC_VERB_SET_AMP_GAIN_MUTE
,
5938 * generic initialization of ADC, input mixers and output mixers
5940 static struct hda_verb alc260_volume_init_verbs
[] = {
5942 * Unmute ADC0-1 and set the default input to mic-in
5944 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5945 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5946 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5947 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5949 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5951 * Note: PASD motherboards uses the Line In 2 as the input for
5952 * front panel mic (mic 2)
5954 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5955 /* mute analog inputs */
5956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5957 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5958 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5959 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5960 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5963 * Set up output mixers (0x08 - 0x0a)
5965 /* set vol=0 to output mixers */
5966 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5967 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5968 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5969 /* set up input amps for analog loopback */
5970 /* Amp Indices: DAC = 0, mixer = 1 */
5971 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5972 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5973 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5974 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5975 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5976 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5981 static int alc260_parse_auto_config(struct hda_codec
*codec
)
5983 struct alc_spec
*spec
= codec
->spec
;
5985 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
5987 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5991 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5994 if (!spec
->kctls
.list
)
5995 return 0; /* can't find valid BIOS pin config */
5996 err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
6000 spec
->multiout
.max_channels
= 2;
6002 if (spec
->autocfg
.dig_outs
)
6003 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
6004 if (spec
->kctls
.list
)
6005 add_mixer(spec
, spec
->kctls
.list
);
6007 add_verb(spec
, alc260_volume_init_verbs
);
6009 spec
->num_mux_defs
= 1;
6010 spec
->input_mux
= &spec
->private_imux
[0];
6012 alc_ssid_check(codec
, 0x10, 0x15, 0x0f);
6017 /* additional initialization for auto-configuration model */
6018 static void alc260_auto_init(struct hda_codec
*codec
)
6020 struct alc_spec
*spec
= codec
->spec
;
6021 alc260_auto_init_multi_out(codec
);
6022 alc260_auto_init_analog_input(codec
);
6023 if (spec
->unsol_event
)
6024 alc_inithook(codec
);
6027 #ifdef CONFIG_SND_HDA_POWER_SAVE
6028 static struct hda_amp_list alc260_loopbacks
[] = {
6029 { 0x07, HDA_INPUT
, 0 },
6030 { 0x07, HDA_INPUT
, 1 },
6031 { 0x07, HDA_INPUT
, 2 },
6032 { 0x07, HDA_INPUT
, 3 },
6033 { 0x07, HDA_INPUT
, 4 },
6039 * ALC260 configurations
6041 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
6042 [ALC260_BASIC
] = "basic",
6044 [ALC260_HP_3013
] = "hp-3013",
6045 [ALC260_HP_DC7600
] = "hp-dc7600",
6046 [ALC260_FUJITSU_S702X
] = "fujitsu",
6047 [ALC260_ACER
] = "acer",
6048 [ALC260_WILL
] = "will",
6049 [ALC260_REPLACER_672V
] = "replacer",
6050 [ALC260_FAVORIT100
] = "favorit100",
6051 #ifdef CONFIG_SND_DEBUG
6052 [ALC260_TEST
] = "test",
6054 [ALC260_AUTO
] = "auto",
6057 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
6058 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
6059 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
6060 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100
),
6061 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
6062 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013
),
6063 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
6064 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
6065 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600
),
6066 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
6067 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
6068 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
6069 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
6070 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
6071 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
6072 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
6073 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
6074 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
6075 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
6076 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
6080 static struct alc_config_preset alc260_presets
[] = {
6082 .mixers
= { alc260_base_output_mixer
,
6083 alc260_input_mixer
},
6084 .init_verbs
= { alc260_init_verbs
},
6085 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6086 .dac_nids
= alc260_dac_nids
,
6087 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6088 .adc_nids
= alc260_adc_nids
,
6089 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6090 .channel_mode
= alc260_modes
,
6091 .input_mux
= &alc260_capture_source
,
6094 .mixers
= { alc260_hp_output_mixer
,
6095 alc260_input_mixer
},
6096 .init_verbs
= { alc260_init_verbs
,
6097 alc260_hp_unsol_verbs
},
6098 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6099 .dac_nids
= alc260_dac_nids
,
6100 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
6101 .adc_nids
= alc260_adc_nids_alt
,
6102 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6103 .channel_mode
= alc260_modes
,
6104 .input_mux
= &alc260_capture_source
,
6105 .unsol_event
= alc260_hp_unsol_event
,
6106 .init_hook
= alc260_hp_automute
,
6108 [ALC260_HP_DC7600
] = {
6109 .mixers
= { alc260_hp_dc7600_mixer
,
6110 alc260_input_mixer
},
6111 .init_verbs
= { alc260_init_verbs
,
6112 alc260_hp_dc7600_verbs
},
6113 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6114 .dac_nids
= alc260_dac_nids
,
6115 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
6116 .adc_nids
= alc260_adc_nids_alt
,
6117 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6118 .channel_mode
= alc260_modes
,
6119 .input_mux
= &alc260_capture_source
,
6120 .unsol_event
= alc260_hp_3012_unsol_event
,
6121 .init_hook
= alc260_hp_3012_automute
,
6123 [ALC260_HP_3013
] = {
6124 .mixers
= { alc260_hp_3013_mixer
,
6125 alc260_input_mixer
},
6126 .init_verbs
= { alc260_hp_3013_init_verbs
,
6127 alc260_hp_3013_unsol_verbs
},
6128 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6129 .dac_nids
= alc260_dac_nids
,
6130 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
),
6131 .adc_nids
= alc260_adc_nids_alt
,
6132 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6133 .channel_mode
= alc260_modes
,
6134 .input_mux
= &alc260_capture_source
,
6135 .unsol_event
= alc260_hp_3013_unsol_event
,
6136 .init_hook
= alc260_hp_3013_automute
,
6138 [ALC260_FUJITSU_S702X
] = {
6139 .mixers
= { alc260_fujitsu_mixer
},
6140 .init_verbs
= { alc260_fujitsu_init_verbs
},
6141 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6142 .dac_nids
= alc260_dac_nids
,
6143 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6144 .adc_nids
= alc260_dual_adc_nids
,
6145 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6146 .channel_mode
= alc260_modes
,
6147 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
6148 .input_mux
= alc260_fujitsu_capture_sources
,
6151 .mixers
= { alc260_acer_mixer
},
6152 .init_verbs
= { alc260_acer_init_verbs
},
6153 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6154 .dac_nids
= alc260_dac_nids
,
6155 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6156 .adc_nids
= alc260_dual_adc_nids
,
6157 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6158 .channel_mode
= alc260_modes
,
6159 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
6160 .input_mux
= alc260_acer_capture_sources
,
6162 [ALC260_FAVORIT100
] = {
6163 .mixers
= { alc260_favorit100_mixer
},
6164 .init_verbs
= { alc260_favorit100_init_verbs
},
6165 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6166 .dac_nids
= alc260_dac_nids
,
6167 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
6168 .adc_nids
= alc260_dual_adc_nids
,
6169 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6170 .channel_mode
= alc260_modes
,
6171 .num_mux_defs
= ARRAY_SIZE(alc260_favorit100_capture_sources
),
6172 .input_mux
= alc260_favorit100_capture_sources
,
6175 .mixers
= { alc260_will_mixer
},
6176 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
6177 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6178 .dac_nids
= alc260_dac_nids
,
6179 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
6180 .adc_nids
= alc260_adc_nids
,
6181 .dig_out_nid
= ALC260_DIGOUT_NID
,
6182 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6183 .channel_mode
= alc260_modes
,
6184 .input_mux
= &alc260_capture_source
,
6186 [ALC260_REPLACER_672V
] = {
6187 .mixers
= { alc260_replacer_672v_mixer
},
6188 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
6189 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
6190 .dac_nids
= alc260_dac_nids
,
6191 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
6192 .adc_nids
= alc260_adc_nids
,
6193 .dig_out_nid
= ALC260_DIGOUT_NID
,
6194 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6195 .channel_mode
= alc260_modes
,
6196 .input_mux
= &alc260_capture_source
,
6197 .unsol_event
= alc260_replacer_672v_unsol_event
,
6198 .init_hook
= alc260_replacer_672v_automute
,
6200 #ifdef CONFIG_SND_DEBUG
6202 .mixers
= { alc260_test_mixer
},
6203 .init_verbs
= { alc260_test_init_verbs
},
6204 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
6205 .dac_nids
= alc260_test_dac_nids
,
6206 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
6207 .adc_nids
= alc260_test_adc_nids
,
6208 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
6209 .channel_mode
= alc260_modes
,
6210 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
6211 .input_mux
= alc260_test_capture_sources
,
6216 static int patch_alc260(struct hda_codec
*codec
)
6218 struct alc_spec
*spec
;
6219 int err
, board_config
;
6221 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6227 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
6230 if (board_config
< 0) {
6231 snd_printd(KERN_INFO
"hda_codec: Unknown model for %s, "
6232 "trying auto-probe from BIOS...\n",
6234 board_config
= ALC260_AUTO
;
6237 if (board_config
== ALC260_AUTO
) {
6238 /* automatic parse from the BIOS config */
6239 err
= alc260_parse_auto_config(codec
);
6245 "hda_codec: Cannot set up configuration "
6246 "from BIOS. Using base mode...\n");
6247 board_config
= ALC260_BASIC
;
6251 err
= snd_hda_attach_beep_device(codec
, 0x1);
6257 if (board_config
!= ALC260_AUTO
)
6258 setup_preset(spec
, &alc260_presets
[board_config
]);
6260 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
6261 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
6263 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
6264 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
6266 if (!spec
->adc_nids
&& spec
->input_mux
) {
6267 /* check whether NID 0x04 is valid */
6268 unsigned int wcap
= get_wcaps(codec
, 0x04);
6269 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
6271 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
6272 spec
->adc_nids
= alc260_adc_nids_alt
;
6273 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
6275 spec
->adc_nids
= alc260_adc_nids
;
6276 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
6279 set_capture_mixer(spec
);
6280 set_beep_amp(spec
, 0x07, 0x05, HDA_INPUT
);
6282 spec
->vmaster_nid
= 0x08;
6284 codec
->patch_ops
= alc_patch_ops
;
6285 if (board_config
== ALC260_AUTO
)
6286 spec
->init_hook
= alc260_auto_init
;
6287 #ifdef CONFIG_SND_HDA_POWER_SAVE
6288 if (!spec
->loopback
.amplist
)
6289 spec
->loopback
.amplist
= alc260_loopbacks
;
6291 codec
->proc_widget_hook
= print_realtek_coef
;
6300 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6301 * configuration. Each pin widget can choose any input DACs and a mixer.
6302 * Each ADC is connected from a mixer of all inputs. This makes possible
6303 * 6-channel independent captures.
6305 * In addition, an independent DAC for the multi-playback (not used in this
6308 #define ALC882_DIGOUT_NID 0x06
6309 #define ALC882_DIGIN_NID 0x0a
6311 static struct hda_channel_mode alc882_ch_modes
[1] = {
6315 static hda_nid_t alc882_dac_nids
[4] = {
6316 /* front, rear, clfe, rear_surr */
6317 0x02, 0x03, 0x04, 0x05
6320 /* identical with ALC880 */
6321 #define alc882_adc_nids alc880_adc_nids
6322 #define alc882_adc_nids_alt alc880_adc_nids_alt
6324 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
6325 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
6328 /* FIXME: should be a matrix-type input source selection */
6330 static struct hda_input_mux alc882_capture_source
= {
6334 { "Front Mic", 0x1 },
6340 static struct hda_input_mux mb5_capture_source
= {
6352 static struct hda_verb alc882_3ST_ch2_init
[] = {
6353 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6354 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6355 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6356 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6363 static struct hda_verb alc882_3ST_ch6_init
[] = {
6364 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6365 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6366 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6367 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6368 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6369 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6373 static struct hda_channel_mode alc882_3ST_6ch_modes
[2] = {
6374 { 2, alc882_3ST_ch2_init
},
6375 { 6, alc882_3ST_ch6_init
},
6381 static struct hda_verb alc882_sixstack_ch6_init
[] = {
6382 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6383 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6384 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6385 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6392 static struct hda_verb alc882_sixstack_ch8_init
[] = {
6393 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6394 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6395 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6396 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6400 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
6401 { 6, alc882_sixstack_ch6_init
},
6402 { 8, alc882_sixstack_ch8_init
},
6406 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6412 static struct hda_verb alc885_mbp_ch2_init
[] = {
6413 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6414 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6415 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6422 static struct hda_verb alc885_mbp_ch6_init
[] = {
6423 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6424 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6425 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6426 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6427 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6431 static struct hda_channel_mode alc885_mbp_6ch_modes
[2] = {
6432 { 2, alc885_mbp_ch2_init
},
6433 { 6, alc885_mbp_ch6_init
},
6438 * Speakers/Woofer/HP = Front
6441 static struct hda_verb alc885_mb5_ch2_init
[] = {
6442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6443 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6449 * Speakers/HP = Front
6453 static struct hda_verb alc885_mb5_ch6_init
[] = {
6454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6455 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6456 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6460 static struct hda_channel_mode alc885_mb5_6ch_modes
[2] = {
6461 { 2, alc885_mb5_ch2_init
},
6462 { 6, alc885_mb5_ch6_init
},
6465 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6466 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6468 static struct snd_kcontrol_new alc882_base_mixer
[] = {
6469 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6470 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6471 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6472 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6473 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6474 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6475 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6476 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6477 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6478 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6479 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6480 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6481 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6482 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6483 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6485 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6487 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6488 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6489 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6493 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
6494 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
6495 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
6496 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT
),
6497 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
6498 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6499 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6500 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
6501 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
6502 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
6503 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
6507 static struct snd_kcontrol_new alc885_mb5_mixer
[] = {
6508 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
6509 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
6510 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
6511 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
6512 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT
),
6513 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT
),
6514 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT
),
6515 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT
),
6516 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6517 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6518 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
6519 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
6520 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT
),
6521 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT
),
6525 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
6526 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6527 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6528 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6529 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6530 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6531 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6533 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6534 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6538 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
6539 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6540 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6541 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6542 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6543 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6544 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6545 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6546 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6547 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6548 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6549 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6550 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6551 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6555 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6556 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6558 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
6559 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6560 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6561 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6562 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
6563 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6564 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6565 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6566 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6567 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
6568 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
6569 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6570 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6571 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6575 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
6576 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6577 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6579 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6580 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6581 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6582 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6584 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6585 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6589 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
6591 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6592 .name
= "Channel Mode",
6593 .info
= alc_ch_mode_info
,
6594 .get
= alc_ch_mode_get
,
6595 .put
= alc_ch_mode_put
,
6600 static struct hda_verb alc882_init_verbs
[] = {
6601 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6602 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6606 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6607 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6608 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6610 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6611 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6612 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6614 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6615 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6616 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6618 /* Front Pin: output 0 (0x0c) */
6619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6620 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6621 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6622 /* Rear Pin: output 1 (0x0d) */
6623 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6624 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6625 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6626 /* CLFE Pin: output 2 (0x0e) */
6627 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6628 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6629 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
6630 /* Side Pin: output 3 (0x0f) */
6631 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6632 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6633 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
6634 /* Mic (rear) pin: input vref at 80% */
6635 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6636 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6637 /* Front Mic pin: input vref at 80% */
6638 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6639 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6640 /* Line In pin: input */
6641 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6642 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6643 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6644 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6645 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6646 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6647 /* CD pin widget for input */
6648 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6650 /* FIXME: use matrix-type input source selection */
6651 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6652 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6653 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6654 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6658 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6659 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6663 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6667 /* ADC1: mute amp left and right */
6668 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6669 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6670 /* ADC2: mute amp left and right */
6671 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6672 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6673 /* ADC3: mute amp left and right */
6674 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6675 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6680 static struct hda_verb alc882_eapd_verbs
[] = {
6681 /* change to EAPD mode */
6682 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6683 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
6688 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
6689 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6690 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
6692 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
6693 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
6694 /* FIXME: this looks suspicious...
6695 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6696 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6701 static struct hda_verb alc882_macpro_init_verbs
[] = {
6702 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6704 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6706 /* Front Pin: output 0 (0x0c) */
6707 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6708 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6709 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6710 /* Front Mic pin: input vref at 80% */
6711 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6712 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6713 /* Speaker: output */
6714 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6715 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6716 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
6717 /* Headphone output (output 0 - 0x0c) */
6718 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6719 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6720 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
6722 /* FIXME: use matrix-type input source selection */
6723 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6724 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6725 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6726 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6727 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6728 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6730 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6731 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6732 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6733 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6738 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6739 /* ADC1: mute amp left and right */
6740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6741 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6742 /* ADC2: mute amp left and right */
6743 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6744 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6745 /* ADC3: mute amp left and right */
6746 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6747 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6753 static struct hda_verb alc885_mb5_init_verbs
[] = {
6755 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6756 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6757 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6758 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6760 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6761 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6762 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6763 /* Surround mixer */
6764 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6765 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6766 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6768 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6769 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6770 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6772 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6773 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6774 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6775 /* Front Pin (0x0c) */
6776 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
6777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6778 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
6779 /* LFE Pin (0x0e) */
6780 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
| 0x01},
6781 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6782 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02},
6784 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6785 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6786 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x03},
6787 /* Front Mic pin: input vref at 80% */
6788 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6789 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6794 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6795 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6796 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6797 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6801 /* Macbook Pro rev3 */
6802 static struct hda_verb alc885_mbp3_init_verbs
[] = {
6803 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6810 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6811 /* Front Pin: output 0 (0x0c) */
6812 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6813 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6814 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6815 /* HP Pin: output 0 (0x0d) */
6816 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
6817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6818 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6819 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6820 /* Mic (rear) pin: input vref at 80% */
6821 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6822 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6823 /* Front Mic pin: input vref at 80% */
6824 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6825 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6826 /* Line In pin: use output 1 when in LineOut mode */
6827 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6828 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6829 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
6831 /* FIXME: use matrix-type input source selection */
6832 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6833 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6834 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6835 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6836 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6837 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6839 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6840 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6841 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6842 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6845 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6848 /* ADC1: mute amp left and right */
6849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6850 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6851 /* ADC2: mute amp left and right */
6852 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6853 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6854 /* ADC3: mute amp left and right */
6855 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6856 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6861 /* iMac 24 mixer. */
6862 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
6863 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
6864 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
6868 /* iMac 24 init verbs. */
6869 static struct hda_verb alc885_imac24_init_verbs
[] = {
6870 /* Internal speakers: output 0 (0x0c) */
6871 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6872 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6873 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
6874 /* Internal speakers: output 0 (0x0c) */
6875 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6876 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6877 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
6878 /* Headphone: output 0 (0x0c) */
6879 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6881 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6882 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6883 /* Front Mic: input vref at 80% */
6884 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6885 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6889 /* Toggle speaker-output according to the hp-jack state */
6890 static void alc885_imac24_automute_init_hook(struct hda_codec
*codec
)
6892 struct alc_spec
*spec
= codec
->spec
;
6894 spec
->autocfg
.hp_pins
[0] = 0x14;
6895 spec
->autocfg
.speaker_pins
[0] = 0x18;
6896 spec
->autocfg
.speaker_pins
[1] = 0x1a;
6897 alc_automute_amp(codec
);
6900 static void alc885_mbp3_init_hook(struct hda_codec
*codec
)
6902 struct alc_spec
*spec
= codec
->spec
;
6904 spec
->autocfg
.hp_pins
[0] = 0x15;
6905 spec
->autocfg
.speaker_pins
[0] = 0x14;
6906 alc_automute_amp(codec
);
6910 static struct hda_verb alc882_targa_verbs
[] = {
6911 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6914 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6915 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6917 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6918 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6919 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6921 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6922 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
6923 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
6924 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
6928 /* toggle speaker-output according to the hp-jack state */
6929 static void alc882_targa_automute(struct hda_codec
*codec
)
6931 struct alc_spec
*spec
= codec
->spec
;
6932 alc_automute_amp(codec
);
6933 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
6934 spec
->jack_present
? 1 : 3);
6937 static void alc882_targa_init_hook(struct hda_codec
*codec
)
6939 struct alc_spec
*spec
= codec
->spec
;
6941 spec
->autocfg
.hp_pins
[0] = 0x14;
6942 spec
->autocfg
.speaker_pins
[0] = 0x1b;
6943 alc882_targa_automute(codec
);
6946 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
6948 if ((res
>> 26) == ALC880_HP_EVENT
)
6949 alc882_targa_automute(codec
);
6952 static struct hda_verb alc882_asus_a7j_verbs
[] = {
6953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6956 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6957 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6958 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6960 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6961 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6962 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6964 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6965 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6966 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6970 static struct hda_verb alc882_asus_a7m_verbs
[] = {
6971 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6972 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6975 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6976 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6978 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6979 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6980 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6982 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6983 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6984 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6988 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
6990 unsigned int gpiostate
, gpiomask
, gpiodir
;
6992 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6993 AC_VERB_GET_GPIO_DATA
, 0);
6996 gpiostate
|= (1 << pin
);
6998 gpiostate
&= ~(1 << pin
);
7000 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
7001 AC_VERB_GET_GPIO_MASK
, 0);
7002 gpiomask
|= (1 << pin
);
7004 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
7005 AC_VERB_GET_GPIO_DIRECTION
, 0);
7006 gpiodir
|= (1 << pin
);
7009 snd_hda_codec_write(codec
, codec
->afg
, 0,
7010 AC_VERB_SET_GPIO_MASK
, gpiomask
);
7011 snd_hda_codec_write(codec
, codec
->afg
, 0,
7012 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
7016 snd_hda_codec_write(codec
, codec
->afg
, 0,
7017 AC_VERB_SET_GPIO_DATA
, gpiostate
);
7020 /* set up GPIO at initialization */
7021 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
7023 alc882_gpio_mute(codec
, 0, 0);
7024 alc882_gpio_mute(codec
, 1, 0);
7027 /* set up GPIO and update auto-muting at initialization */
7028 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
7030 alc885_macpro_init_hook(codec
);
7031 alc885_imac24_automute_init_hook(codec
);
7035 * generic initialization of ADC, input mixers and output mixers
7037 static struct hda_verb alc882_auto_init_verbs
[] = {
7039 * Unmute ADC0-2 and set the default input to mic-in
7041 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
7042 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7043 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7044 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7045 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7046 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7048 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7050 * Note: PASD motherboards uses the Line In 2 as the input for
7051 * front panel mic (mic 2)
7053 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7054 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7055 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7056 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7057 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7058 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7061 * Set up output mixers (0x0c - 0x0f)
7063 /* set vol=0 to output mixers */
7064 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7065 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7066 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7067 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7068 /* set up input amps for analog loopback */
7069 /* Amp Indices: DAC = 0, mixer = 1 */
7070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7071 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7072 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7073 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7076 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7077 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7078 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7079 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7081 /* FIXME: use matrix-type input source selection */
7082 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7083 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7089 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7090 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7091 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7094 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7095 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7096 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7102 #ifdef CONFIG_SND_HDA_POWER_SAVE
7103 #define alc882_loopbacks alc880_loopbacks
7106 /* pcm configuration: identical with ALC880 */
7107 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
7108 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
7109 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
7110 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
7113 * configuration and preset
7115 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
7116 [ALC882_3ST_DIG
] = "3stack-dig",
7117 [ALC882_6ST_DIG
] = "6stack-dig",
7118 [ALC882_ARIMA
] = "arima",
7119 [ALC882_W2JC
] = "w2jc",
7120 [ALC882_TARGA
] = "targa",
7121 [ALC882_ASUS_A7J
] = "asus-a7j",
7122 [ALC882_ASUS_A7M
] = "asus-a7m",
7123 [ALC885_MACPRO
] = "macpro",
7124 [ALC885_MB5
] = "mb5",
7125 [ALC885_MBP3
] = "mbp3",
7126 [ALC885_IMAC24
] = "imac24",
7127 [ALC882_AUTO
] = "auto",
7130 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
7131 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
7132 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
7133 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
7134 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
7135 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
7136 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
7137 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
7138 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
7139 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
7140 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
7141 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
7142 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
7146 static struct alc_config_preset alc882_presets
[] = {
7147 [ALC882_3ST_DIG
] = {
7148 .mixers
= { alc882_base_mixer
},
7149 .init_verbs
= { alc882_init_verbs
},
7150 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7151 .dac_nids
= alc882_dac_nids
,
7152 .dig_out_nid
= ALC882_DIGOUT_NID
,
7153 .dig_in_nid
= ALC882_DIGIN_NID
,
7154 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
7155 .channel_mode
= alc882_ch_modes
,
7157 .input_mux
= &alc882_capture_source
,
7159 [ALC882_6ST_DIG
] = {
7160 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
7161 .init_verbs
= { alc882_init_verbs
},
7162 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7163 .dac_nids
= alc882_dac_nids
,
7164 .dig_out_nid
= ALC882_DIGOUT_NID
,
7165 .dig_in_nid
= ALC882_DIGIN_NID
,
7166 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
7167 .channel_mode
= alc882_sixstack_modes
,
7168 .input_mux
= &alc882_capture_source
,
7171 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
7172 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
7173 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7174 .dac_nids
= alc882_dac_nids
,
7175 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
7176 .channel_mode
= alc882_sixstack_modes
,
7177 .input_mux
= &alc882_capture_source
,
7180 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
7181 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
7182 alc880_gpio1_init_verbs
},
7183 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7184 .dac_nids
= alc882_dac_nids
,
7185 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
7186 .channel_mode
= alc880_threestack_modes
,
7188 .input_mux
= &alc882_capture_source
,
7189 .dig_out_nid
= ALC882_DIGOUT_NID
,
7192 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
7193 .init_verbs
= { alc885_mbp3_init_verbs
,
7194 alc880_gpio1_init_verbs
},
7195 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7196 .dac_nids
= alc882_dac_nids
,
7197 .channel_mode
= alc885_mbp_6ch_modes
,
7198 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_6ch_modes
),
7199 .input_mux
= &alc882_capture_source
,
7200 .dig_out_nid
= ALC882_DIGOUT_NID
,
7201 .dig_in_nid
= ALC882_DIGIN_NID
,
7202 .unsol_event
= alc_automute_amp_unsol_event
,
7203 .init_hook
= alc885_mbp3_init_hook
,
7206 .mixers
= { alc885_mb5_mixer
, alc882_chmode_mixer
},
7207 .init_verbs
= { alc885_mb5_init_verbs
,
7208 alc880_gpio1_init_verbs
},
7209 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7210 .dac_nids
= alc882_dac_nids
,
7211 .channel_mode
= alc885_mb5_6ch_modes
,
7212 .num_channel_mode
= ARRAY_SIZE(alc885_mb5_6ch_modes
),
7213 .input_mux
= &mb5_capture_source
,
7214 .dig_out_nid
= ALC882_DIGOUT_NID
,
7215 .dig_in_nid
= ALC882_DIGIN_NID
,
7218 .mixers
= { alc882_macpro_mixer
},
7219 .init_verbs
= { alc882_macpro_init_verbs
},
7220 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7221 .dac_nids
= alc882_dac_nids
,
7222 .dig_out_nid
= ALC882_DIGOUT_NID
,
7223 .dig_in_nid
= ALC882_DIGIN_NID
,
7224 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
7225 .channel_mode
= alc882_ch_modes
,
7226 .input_mux
= &alc882_capture_source
,
7227 .init_hook
= alc885_macpro_init_hook
,
7230 .mixers
= { alc885_imac24_mixer
},
7231 .init_verbs
= { alc885_imac24_init_verbs
},
7232 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7233 .dac_nids
= alc882_dac_nids
,
7234 .dig_out_nid
= ALC882_DIGOUT_NID
,
7235 .dig_in_nid
= ALC882_DIGIN_NID
,
7236 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
7237 .channel_mode
= alc882_ch_modes
,
7238 .input_mux
= &alc882_capture_source
,
7239 .unsol_event
= alc_automute_amp_unsol_event
,
7240 .init_hook
= alc885_imac24_init_hook
,
7243 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
},
7244 .init_verbs
= { alc882_init_verbs
, alc882_targa_verbs
},
7245 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7246 .dac_nids
= alc882_dac_nids
,
7247 .dig_out_nid
= ALC882_DIGOUT_NID
,
7248 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
7249 .adc_nids
= alc882_adc_nids
,
7250 .capsrc_nids
= alc882_capsrc_nids
,
7251 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
7252 .channel_mode
= alc882_3ST_6ch_modes
,
7254 .input_mux
= &alc882_capture_source
,
7255 .unsol_event
= alc882_targa_unsol_event
,
7256 .init_hook
= alc882_targa_init_hook
,
7258 [ALC882_ASUS_A7J
] = {
7259 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
},
7260 .init_verbs
= { alc882_init_verbs
, alc882_asus_a7j_verbs
},
7261 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7262 .dac_nids
= alc882_dac_nids
,
7263 .dig_out_nid
= ALC882_DIGOUT_NID
,
7264 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
7265 .adc_nids
= alc882_adc_nids
,
7266 .capsrc_nids
= alc882_capsrc_nids
,
7267 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
7268 .channel_mode
= alc882_3ST_6ch_modes
,
7270 .input_mux
= &alc882_capture_source
,
7272 [ALC882_ASUS_A7M
] = {
7273 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
7274 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
7275 alc880_gpio1_init_verbs
,
7276 alc882_asus_a7m_verbs
},
7277 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
7278 .dac_nids
= alc882_dac_nids
,
7279 .dig_out_nid
= ALC882_DIGOUT_NID
,
7280 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
7281 .channel_mode
= alc880_threestack_modes
,
7283 .input_mux
= &alc882_capture_source
,
7292 PINFIX_ABIT_AW9D_MAX
7295 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
7296 { 0x15, 0x01080104 }, /* side */
7297 { 0x16, 0x01011012 }, /* rear */
7298 { 0x17, 0x01016011 }, /* clfe */
7302 static const struct alc_pincfg
*alc882_pin_fixes
[] = {
7303 [PINFIX_ABIT_AW9D_MAX
] = alc882_abit_aw9d_pinfix
,
7306 static struct snd_pci_quirk alc882_pinfix_tbl
[] = {
7307 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
7312 * BIOS auto configuration
7314 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
7315 hda_nid_t nid
, int pin_type
,
7319 struct alc_spec
*spec
= codec
->spec
;
7322 alc_set_pin_output(codec
, nid
, pin_type
);
7323 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
7326 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
7327 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
7331 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
7333 struct alc_spec
*spec
= codec
->spec
;
7336 for (i
= 0; i
<= HDA_SIDE
; i
++) {
7337 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
7338 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
7340 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
7345 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
7347 struct alc_spec
*spec
= codec
->spec
;
7350 pin
= spec
->autocfg
.hp_pins
[0];
7351 if (pin
) /* connect to front */
7353 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
7354 pin
= spec
->autocfg
.speaker_pins
[0];
7356 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
7359 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7360 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7362 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
7364 struct alc_spec
*spec
= codec
->spec
;
7367 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
7368 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
7371 alc_set_input_pin(codec
, nid
, AUTO_PIN_FRONT_MIC
/*i*/);
7372 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
7373 snd_hda_codec_write(codec
, nid
, 0,
7374 AC_VERB_SET_AMP_GAIN_MUTE
,
7379 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
7381 struct alc_spec
*spec
= codec
->spec
;
7384 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
7385 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
7386 hda_nid_t nid
= spec
->capsrc_nids
[c
];
7387 unsigned int mux_idx
;
7388 const struct hda_input_mux
*imux
;
7389 int conns
, mute
, idx
, item
;
7391 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
7392 ARRAY_SIZE(conn_list
));
7395 mux_idx
= c
>= spec
->num_mux_defs
? 0 : c
;
7396 imux
= &spec
->input_mux
[mux_idx
];
7397 for (idx
= 0; idx
< conns
; idx
++) {
7398 /* if the current connection is the selected one,
7399 * unmute it as default - otherwise mute it
7401 mute
= AMP_IN_MUTE(idx
);
7402 for (item
= 0; item
< imux
->num_items
; item
++) {
7403 if (imux
->items
[item
].index
== idx
) {
7404 if (spec
->cur_mux
[c
] == item
)
7405 mute
= AMP_IN_UNMUTE(idx
);
7409 /* check if we have a selector or mixer
7410 * we could check for the widget type instead, but
7411 * just check for Amp-In presence (in case of mixer
7412 * without amp-in there is something wrong, this
7413 * function shouldn't be used or capsrc nid is wrong)
7415 if (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)
7416 snd_hda_codec_write(codec
, nid
, 0,
7417 AC_VERB_SET_AMP_GAIN_MUTE
,
7419 else if (mute
!= AMP_IN_MUTE(idx
))
7420 snd_hda_codec_write(codec
, nid
, 0,
7421 AC_VERB_SET_CONNECT_SEL
,
7427 /* add mic boosts if needed */
7428 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
7430 struct alc_spec
*spec
= codec
->spec
;
7434 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
7435 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
7436 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
7438 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
7442 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
7443 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
7444 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
7446 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
7453 /* almost identical with ALC880 parser... */
7454 static int alc882_parse_auto_config(struct hda_codec
*codec
)
7456 struct alc_spec
*spec
= codec
->spec
;
7457 int err
= alc880_parse_auto_config(codec
);
7462 return 0; /* no config found */
7464 err
= alc_auto_add_mic_boost(codec
);
7468 /* hack - override the init verbs */
7469 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
7471 return 1; /* config found */
7474 /* additional initialization for auto-configuration model */
7475 static void alc882_auto_init(struct hda_codec
*codec
)
7477 struct alc_spec
*spec
= codec
->spec
;
7478 alc882_auto_init_multi_out(codec
);
7479 alc882_auto_init_hp_out(codec
);
7480 alc882_auto_init_analog_input(codec
);
7481 alc882_auto_init_input_src(codec
);
7482 if (spec
->unsol_event
)
7483 alc_inithook(codec
);
7486 static int patch_alc883(struct hda_codec
*codec
); /* called in patch_alc882() */
7488 static int patch_alc882(struct hda_codec
*codec
)
7490 struct alc_spec
*spec
;
7491 int err
, board_config
;
7493 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
7499 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
7503 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
7504 /* Pick up systems that don't supply PCI SSID */
7505 switch (codec
->subsystem_id
) {
7506 case 0x106b0c00: /* Mac Pro */
7507 board_config
= ALC885_MACPRO
;
7509 case 0x106b1000: /* iMac 24 */
7510 case 0x106b2800: /* AppleTV */
7511 case 0x106b3e00: /* iMac 24 Aluminium */
7512 board_config
= ALC885_IMAC24
;
7514 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7515 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7516 case 0x106b00a4: /* MacbookPro4,1 */
7517 case 0x106b2c00: /* Macbook Pro rev3 */
7518 /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */
7519 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7520 board_config
= ALC885_MBP3
;
7522 case 0x106b3f00: /* Macbook 5,1 */
7523 case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense
7524 * seems not working, so apparently
7525 * no perfect solution yet
7527 board_config
= ALC885_MB5
;
7530 /* ALC889A is handled better as ALC888-compatible */
7531 if (codec
->revision_id
== 0x100101 ||
7532 codec
->revision_id
== 0x100103) {
7534 return patch_alc883(codec
);
7536 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
7537 "trying auto-probe from BIOS...\n",
7539 board_config
= ALC882_AUTO
;
7543 alc_fix_pincfg(codec
, alc882_pinfix_tbl
, alc882_pin_fixes
);
7545 if (board_config
== ALC882_AUTO
) {
7546 /* automatic parse from the BIOS config */
7547 err
= alc882_parse_auto_config(codec
);
7553 "hda_codec: Cannot set up configuration "
7554 "from BIOS. Using base mode...\n");
7555 board_config
= ALC882_3ST_DIG
;
7559 err
= snd_hda_attach_beep_device(codec
, 0x1);
7565 if (board_config
!= ALC882_AUTO
)
7566 setup_preset(spec
, &alc882_presets
[board_config
]);
7568 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
7569 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
7570 /* FIXME: setup DAC5 */
7571 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7572 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
7574 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
7575 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
7577 if (!spec
->adc_nids
&& spec
->input_mux
) {
7578 /* check whether NID 0x07 is valid */
7579 unsigned int wcap
= get_wcaps(codec
, 0x07);
7581 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
7582 if (wcap
!= AC_WID_AUD_IN
) {
7583 spec
->adc_nids
= alc882_adc_nids_alt
;
7584 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
7585 spec
->capsrc_nids
= alc882_capsrc_nids_alt
;
7587 spec
->adc_nids
= alc882_adc_nids
;
7588 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
7589 spec
->capsrc_nids
= alc882_capsrc_nids
;
7592 set_capture_mixer(spec
);
7593 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
7595 spec
->vmaster_nid
= 0x0c;
7597 codec
->patch_ops
= alc_patch_ops
;
7598 if (board_config
== ALC882_AUTO
)
7599 spec
->init_hook
= alc882_auto_init
;
7600 #ifdef CONFIG_SND_HDA_POWER_SAVE
7601 if (!spec
->loopback
.amplist
)
7602 spec
->loopback
.amplist
= alc882_loopbacks
;
7604 codec
->proc_widget_hook
= print_realtek_coef
;
7612 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7613 * configuration. Each pin widget can choose any input DACs and a mixer.
7614 * Each ADC is connected from a mixer of all inputs. This makes possible
7615 * 6-channel independent captures.
7617 * In addition, an independent DAC for the multi-playback (not used in this
7620 #define ALC883_DIGOUT_NID 0x06
7621 #define ALC883_DIGIN_NID 0x0a
7623 #define ALC1200_DIGOUT_NID 0x10
7625 static hda_nid_t alc883_dac_nids
[4] = {
7626 /* front, rear, clfe, rear_surr */
7627 0x02, 0x03, 0x04, 0x05
7630 static hda_nid_t alc883_adc_nids
[2] = {
7635 static hda_nid_t alc883_adc_nids_alt
[1] = {
7640 static hda_nid_t alc883_adc_nids_rev
[2] = {
7645 #define alc889_adc_nids alc880_adc_nids
7647 static hda_nid_t alc883_capsrc_nids
[2] = { 0x23, 0x22 };
7649 static hda_nid_t alc883_capsrc_nids_rev
[2] = { 0x22, 0x23 };
7651 #define alc889_capsrc_nids alc882_capsrc_nids
7654 /* FIXME: should be a matrix-type input source selection */
7656 static struct hda_input_mux alc883_capture_source
= {
7660 { "Front Mic", 0x1 },
7666 static struct hda_input_mux alc883_3stack_6ch_intel
= {
7670 { "Front Mic", 0x0 },
7676 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
7684 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
7694 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
7702 static struct hda_input_mux alc883_lenovo_sky_capture_source
= {
7706 { "Front Mic", 0x1 },
7711 static struct hda_input_mux alc883_asus_eee1601_capture_source
= {
7719 static struct hda_input_mux alc889A_mb31_capture_source
= {
7723 /* Front Mic (0x01) unused */
7725 /* Line 2 (0x03) unused */
7726 /* CD (0x04) unsused? */
7733 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
7740 static struct hda_verb alc883_3ST_ch2_init
[] = {
7741 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7742 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7743 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7744 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7751 static struct hda_verb alc883_3ST_ch4_init
[] = {
7752 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7753 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7754 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7755 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7756 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7763 static struct hda_verb alc883_3ST_ch6_init
[] = {
7764 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7765 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7766 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7767 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7768 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7769 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7773 static struct hda_channel_mode alc883_3ST_6ch_modes
[3] = {
7774 { 2, alc883_3ST_ch2_init
},
7775 { 4, alc883_3ST_ch4_init
},
7776 { 6, alc883_3ST_ch6_init
},
7783 static struct hda_verb alc883_4ST_ch2_init
[] = {
7784 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7785 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7786 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7787 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7788 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7789 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7796 static struct hda_verb alc883_4ST_ch4_init
[] = {
7797 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7798 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7799 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7800 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7801 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7802 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7803 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7810 static struct hda_verb alc883_4ST_ch6_init
[] = {
7811 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7812 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
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 },
7825 static struct hda_verb alc883_4ST_ch8_init
[] = {
7826 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7827 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7828 { 0x17, AC_VERB_SET_CONNECT_SEL
, 0x03 },
7829 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7830 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7831 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7832 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7833 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7834 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7838 static struct hda_channel_mode alc883_4ST_8ch_modes
[4] = {
7839 { 2, alc883_4ST_ch2_init
},
7840 { 4, alc883_4ST_ch4_init
},
7841 { 6, alc883_4ST_ch6_init
},
7842 { 8, alc883_4ST_ch8_init
},
7849 static struct hda_verb alc883_3ST_ch2_intel_init
[] = {
7850 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7851 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7852 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7853 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7860 static struct hda_verb alc883_3ST_ch4_intel_init
[] = {
7861 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7862 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7863 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7864 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7865 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7872 static struct hda_verb alc883_3ST_ch6_intel_init
[] = {
7873 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7874 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7875 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
7876 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7877 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7878 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7882 static struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
7883 { 2, alc883_3ST_ch2_intel_init
},
7884 { 4, alc883_3ST_ch4_intel_init
},
7885 { 6, alc883_3ST_ch6_intel_init
},
7891 static struct hda_verb alc883_sixstack_ch6_init
[] = {
7892 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7893 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7894 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7895 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7902 static struct hda_verb alc883_sixstack_ch8_init
[] = {
7903 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7904 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7905 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7906 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7910 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
7911 { 6, alc883_sixstack_ch6_init
},
7912 { 8, alc883_sixstack_ch8_init
},
7915 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7916 static struct hda_verb alc889A_mb31_ch2_init
[] = {
7917 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
7918 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
7919 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
7920 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
7924 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7925 static struct hda_verb alc889A_mb31_ch4_init
[] = {
7926 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP as front */
7927 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
7928 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
7929 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
7933 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7934 static struct hda_verb alc889A_mb31_ch5_init
[] = {
7935 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as rear */
7936 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Subwoofer on */
7937 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line as input */
7938 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Line off */
7942 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7943 static struct hda_verb alc889A_mb31_ch6_init
[] = {
7944 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* HP as front */
7945 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Subwoofer off */
7946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line as output */
7947 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
}, /* Line on */
7951 static struct hda_channel_mode alc889A_mb31_6ch_modes
[4] = {
7952 { 2, alc889A_mb31_ch2_init
},
7953 { 4, alc889A_mb31_ch4_init
},
7954 { 5, alc889A_mb31_ch5_init
},
7955 { 6, alc889A_mb31_ch6_init
},
7958 static struct hda_verb alc883_medion_eapd_verbs
[] = {
7959 /* eanable EAPD on medion laptop */
7960 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7961 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
7965 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7966 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7969 static struct snd_kcontrol_new alc883_base_mixer
[] = {
7970 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7971 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7972 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7973 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7974 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7975 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7976 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7977 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7978 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
7979 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
7980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7981 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7982 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7983 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7984 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7985 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7986 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7987 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7988 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7989 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7990 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7994 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
7995 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7996 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7997 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7998 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7999 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8000 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8001 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8002 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8003 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8004 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8005 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8006 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8007 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8011 static struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
8012 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8013 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8014 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8015 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8016 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8017 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8019 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8020 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8021 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8025 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
8026 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8027 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
8028 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8029 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8031 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8032 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8033 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8034 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8035 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8039 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
8040 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8041 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8042 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8043 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8044 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8045 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8046 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8048 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8050 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8051 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8052 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8056 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
8057 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8058 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8059 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8060 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8061 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8062 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8063 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8064 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8065 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8066 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8067 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8068 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8069 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8070 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8071 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8072 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8073 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8074 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8075 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8079 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
8080 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8081 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8082 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8083 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8084 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8086 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8087 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8088 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8089 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8090 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8091 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8092 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8093 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8095 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
8096 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8097 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8098 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT
),
8099 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8103 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
8104 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8105 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8106 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8107 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8108 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8109 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8110 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8111 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8112 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8113 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8114 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8115 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8116 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8118 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8120 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8121 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8122 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8126 static struct snd_kcontrol_new alc883_targa_mixer
[] = {
8127 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8129 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8130 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8131 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
8132 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8133 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8134 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
8135 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
8136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8138 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8139 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8141 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8146 static struct snd_kcontrol_new alc883_targa_2ch_mixer
[] = {
8147 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8148 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8149 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8150 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8151 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8153 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8155 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8156 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8157 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8161 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
8162 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8163 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8164 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8165 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
8166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8168 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8173 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
8174 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8175 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
8176 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8177 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8178 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8179 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8180 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8181 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8182 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8186 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
8187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8188 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8189 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8190 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8191 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8194 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8195 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8199 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
8200 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8201 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8202 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8203 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8204 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8206 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8207 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8211 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer
[] = {
8212 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8213 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8214 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8215 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT
),
8216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8218 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8219 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8221 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8226 static struct snd_kcontrol_new alc888_lenovo_sky_mixer
[] = {
8227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8228 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8229 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
8230 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
8231 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8232 0x0d, 1, 0x0, HDA_OUTPUT
),
8233 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
8234 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
8235 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
8236 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
8237 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
8238 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8239 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8240 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8241 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8243 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8245 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8246 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8247 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8251 static struct snd_kcontrol_new alc889A_mb31_mixer
[] = {
8253 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
8254 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
8255 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
8256 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT
),
8257 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8259 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT
),
8260 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT
),
8261 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT
),
8262 /* Output switches */
8263 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT
),
8264 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT
),
8265 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT
),
8267 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
8268 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
8270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
8271 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
8272 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8273 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8277 static struct snd_kcontrol_new alc883_vaiott_mixer
[] = {
8278 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8279 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8280 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8282 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
8283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8287 static struct hda_bind_ctls alc883_bind_cap_vol
= {
8288 .ops
= &snd_hda_bind_vol
,
8290 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
8291 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
8296 static struct hda_bind_ctls alc883_bind_cap_switch
= {
8297 .ops
= &snd_hda_bind_sw
,
8299 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
8300 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
8305 static struct snd_kcontrol_new alc883_asus_eee1601_mixer
[] = {
8306 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8307 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
8308 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8309 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8310 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8312 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8313 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8317 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer
[] = {
8318 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol
),
8319 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch
),
8321 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8322 /* .name = "Capture Source", */
8323 .name
= "Input Source",
8325 .info
= alc_mux_enum_info
,
8326 .get
= alc_mux_enum_get
,
8327 .put
= alc_mux_enum_put
,
8332 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
8334 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8335 .name
= "Channel Mode",
8336 .info
= alc_ch_mode_info
,
8337 .get
= alc_ch_mode_get
,
8338 .put
= alc_ch_mode_put
,
8343 static struct hda_verb alc883_init_verbs
[] = {
8344 /* ADC1: mute amp left and right */
8345 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8346 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8347 /* ADC2: mute amp left and right */
8348 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8349 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8350 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8357 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8359 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8360 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8361 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8363 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8364 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8365 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8367 /* mute analog input loopbacks */
8368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8374 /* Front Pin: output 0 (0x0c) */
8375 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8376 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8377 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8378 /* Rear Pin: output 1 (0x0d) */
8379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8380 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8381 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8382 /* CLFE Pin: output 2 (0x0e) */
8383 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8384 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8385 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
8386 /* Side Pin: output 3 (0x0f) */
8387 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8388 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8389 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8390 /* Mic (rear) pin: input vref at 80% */
8391 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8392 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8393 /* Front Mic pin: input vref at 80% */
8394 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8395 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8396 /* Line In pin: input */
8397 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8398 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8399 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8400 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8401 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8402 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8403 /* CD pin widget for input */
8404 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8406 /* FIXME: use matrix-type input source selection */
8407 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8409 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8410 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8421 /* toggle speaker-output according to the hp-jack state */
8422 static void alc883_mitac_init_hook(struct hda_codec
*codec
)
8424 struct alc_spec
*spec
= codec
->spec
;
8426 spec
->autocfg
.hp_pins
[0] = 0x15;
8427 spec
->autocfg
.speaker_pins
[0] = 0x14;
8428 spec
->autocfg
.speaker_pins
[1] = 0x17;
8429 alc_automute_amp(codec
);
8432 /* auto-toggle front mic */
8434 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8436 unsigned int present;
8439 present = snd_hda_codec_read(codec, 0x18, 0,
8440 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8441 bits = present ? HDA_AMP_MUTE : 0;
8442 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8446 static struct hda_verb alc883_mitac_verbs
[] = {
8448 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8449 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8451 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
8452 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8454 /* enable unsolicited event */
8455 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8456 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8461 static struct hda_verb alc883_clevo_m720_verbs
[] = {
8463 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8466 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
8467 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8469 /* enable unsolicited event */
8470 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8471 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
8476 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
8478 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8481 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8482 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8484 /* enable unsolicited event */
8485 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8490 static struct hda_verb alc883_targa_verbs
[] = {
8491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8494 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8497 /* Connect Line-Out side jack (SPDIF) to Side */
8498 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8499 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8500 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
8501 /* Connect Mic jack to CLFE */
8502 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8503 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8504 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02},
8505 /* Connect Line-in jack to Surround */
8506 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8508 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
8509 /* Connect HP out jack to Front */
8510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8511 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8512 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8514 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8519 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
8520 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8521 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
8522 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
8526 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
8527 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8528 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8529 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8530 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8534 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
8535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8537 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8538 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
8539 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8543 static struct hda_verb alc883_haier_w66_verbs
[] = {
8544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8545 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8549 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8550 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8551 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8552 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8556 static struct hda_verb alc888_lenovo_sky_verbs
[] = {
8557 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8558 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8559 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8560 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8561 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8562 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8563 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
8564 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8568 static struct hda_verb alc888_6st_dell_verbs
[] = {
8569 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8573 static struct hda_verb alc883_vaiott_verbs
[] = {
8575 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8578 /* enable unsolicited event */
8579 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8584 static void alc888_3st_hp_init_hook(struct hda_codec
*codec
)
8586 struct alc_spec
*spec
= codec
->spec
;
8588 spec
->autocfg
.hp_pins
[0] = 0x1b;
8589 spec
->autocfg
.speaker_pins
[0] = 0x14;
8590 spec
->autocfg
.speaker_pins
[1] = 0x16;
8591 spec
->autocfg
.speaker_pins
[2] = 0x18;
8592 alc_automute_amp(codec
);
8595 static struct hda_verb alc888_3st_hp_verbs
[] = {
8596 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
8597 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
8598 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
8599 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8606 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
8607 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8608 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8609 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8610 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8617 static struct hda_verb alc888_3st_hp_4ch_init
[] = {
8618 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
8619 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8620 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8621 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8622 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8629 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
8630 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8631 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8632 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
8633 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8634 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8635 { 0x16, AC_VERB_SET_CONNECT_SEL
, 0x01 },
8639 static struct hda_channel_mode alc888_3st_hp_modes
[3] = {
8640 { 2, alc888_3st_hp_2ch_init
},
8641 { 4, alc888_3st_hp_4ch_init
},
8642 { 6, alc888_3st_hp_6ch_init
},
8645 /* toggle front-jack and RCA according to the hp-jack state */
8646 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
8648 unsigned int present
;
8650 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8651 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8652 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8653 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8654 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8655 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8658 /* toggle RCA according to the front-jack state */
8659 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
8661 unsigned int present
;
8663 present
= snd_hda_codec_read(codec
, 0x14, 0,
8664 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8665 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8666 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8669 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
8672 if ((res
>> 26) == ALC880_HP_EVENT
)
8673 alc888_lenovo_ms7195_front_automute(codec
);
8674 if ((res
>> 26) == ALC880_FRONT_EVENT
)
8675 alc888_lenovo_ms7195_rca_automute(codec
);
8678 static struct hda_verb alc883_medion_md2_verbs
[] = {
8679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8682 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8684 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8688 /* toggle speaker-output according to the hp-jack state */
8689 static void alc883_medion_md2_init_hook(struct hda_codec
*codec
)
8691 struct alc_spec
*spec
= codec
->spec
;
8693 spec
->autocfg
.hp_pins
[0] = 0x14;
8694 spec
->autocfg
.speaker_pins
[0] = 0x15;
8695 alc_automute_amp(codec
);
8698 /* toggle speaker-output according to the hp-jack state */
8699 #define alc883_targa_init_hook alc882_targa_init_hook
8700 #define alc883_targa_unsol_event alc882_targa_unsol_event
8702 static void alc883_clevo_m720_mic_automute(struct hda_codec
*codec
)
8704 unsigned int present
;
8706 present
= snd_hda_codec_read(codec
, 0x18, 0,
8707 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8708 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
8709 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8712 static void alc883_clevo_m720_init_hook(struct hda_codec
*codec
)
8714 struct alc_spec
*spec
= codec
->spec
;
8716 spec
->autocfg
.hp_pins
[0] = 0x15;
8717 spec
->autocfg
.speaker_pins
[0] = 0x14;
8718 alc_automute_amp(codec
);
8719 alc883_clevo_m720_mic_automute(codec
);
8722 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
8725 switch (res
>> 26) {
8726 case ALC880_MIC_EVENT
:
8727 alc883_clevo_m720_mic_automute(codec
);
8730 alc_automute_amp_unsol_event(codec
, res
);
8735 /* toggle speaker-output according to the hp-jack state */
8736 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec
*codec
)
8738 struct alc_spec
*spec
= codec
->spec
;
8740 spec
->autocfg
.hp_pins
[0] = 0x14;
8741 spec
->autocfg
.speaker_pins
[0] = 0x15;
8742 alc_automute_amp(codec
);
8745 static void alc883_haier_w66_init_hook(struct hda_codec
*codec
)
8747 struct alc_spec
*spec
= codec
->spec
;
8749 spec
->autocfg
.hp_pins
[0] = 0x1b;
8750 spec
->autocfg
.speaker_pins
[0] = 0x14;
8751 alc_automute_amp(codec
);
8754 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
8756 unsigned int present
;
8759 present
= snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_GET_PIN_SENSE
, 0)
8760 & AC_PINSENSE_PRESENCE
;
8761 bits
= present
? HDA_AMP_MUTE
: 0;
8762 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8763 HDA_AMP_MUTE
, bits
);
8766 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
8768 unsigned int present
;
8771 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8772 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8773 bits
= present
? HDA_AMP_MUTE
: 0;
8774 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8775 HDA_AMP_MUTE
, bits
);
8776 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8777 HDA_AMP_MUTE
, bits
);
8780 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
8783 if ((res
>> 26) == ALC880_HP_EVENT
)
8784 alc883_lenovo_101e_all_automute(codec
);
8785 if ((res
>> 26) == ALC880_FRONT_EVENT
)
8786 alc883_lenovo_101e_ispeaker_automute(codec
);
8789 /* toggle speaker-output according to the hp-jack state */
8790 static void alc883_acer_aspire_init_hook(struct hda_codec
*codec
)
8792 struct alc_spec
*spec
= codec
->spec
;
8794 spec
->autocfg
.hp_pins
[0] = 0x14;
8795 spec
->autocfg
.speaker_pins
[0] = 0x15;
8796 spec
->autocfg
.speaker_pins
[1] = 0x16;
8797 alc_automute_amp(codec
);
8800 static struct hda_verb alc883_acer_eapd_verbs
[] = {
8801 /* HP Pin: output 0 (0x0c) */
8802 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8803 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8804 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8805 /* Front Pin: output 0 (0x0c) */
8806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8807 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8808 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8809 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
8810 /* eanable EAPD on medion laptop */
8811 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8812 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
8813 /* enable unsolicited event */
8814 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8818 static void alc888_6st_dell_init_hook(struct hda_codec
*codec
)
8820 struct alc_spec
*spec
= codec
->spec
;
8822 spec
->autocfg
.hp_pins
[0] = 0x1b;
8823 spec
->autocfg
.speaker_pins
[0] = 0x14;
8824 spec
->autocfg
.speaker_pins
[1] = 0x15;
8825 spec
->autocfg
.speaker_pins
[2] = 0x16;
8826 spec
->autocfg
.speaker_pins
[3] = 0x17;
8827 alc_automute_amp(codec
);
8830 static void alc888_lenovo_sky_init_hook(struct hda_codec
*codec
)
8832 struct alc_spec
*spec
= codec
->spec
;
8834 spec
->autocfg
.hp_pins
[0] = 0x1b;
8835 spec
->autocfg
.speaker_pins
[0] = 0x14;
8836 spec
->autocfg
.speaker_pins
[1] = 0x15;
8837 spec
->autocfg
.speaker_pins
[2] = 0x16;
8838 spec
->autocfg
.speaker_pins
[3] = 0x17;
8839 spec
->autocfg
.speaker_pins
[4] = 0x1a;
8840 alc_automute_amp(codec
);
8843 static void alc883_vaiott_init_hook(struct hda_codec
*codec
)
8845 struct alc_spec
*spec
= codec
->spec
;
8847 spec
->autocfg
.hp_pins
[0] = 0x15;
8848 spec
->autocfg
.speaker_pins
[0] = 0x14;
8849 spec
->autocfg
.speaker_pins
[1] = 0x17;
8850 alc_automute_amp(codec
);
8854 * generic initialization of ADC, input mixers and output mixers
8856 static struct hda_verb alc883_auto_init_verbs
[] = {
8858 * Unmute ADC0-2 and set the default input to mic-in
8860 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8861 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8862 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8863 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8865 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8867 * Note: PASD motherboards uses the Line In 2 as the input for
8868 * front panel mic (mic 2)
8870 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8871 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8872 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8873 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8874 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8875 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8878 * Set up output mixers (0x0c - 0x0f)
8880 /* set vol=0 to output mixers */
8881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8882 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8883 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8884 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8885 /* set up input amps for analog loopback */
8886 /* Amp Indices: DAC = 0, mixer = 1 */
8887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8891 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8893 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8894 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8895 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8896 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8898 /* FIXME: use matrix-type input source selection */
8899 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8901 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8902 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8903 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8904 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8905 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
8907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8910 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
8916 static struct hda_verb alc888_asus_m90v_verbs
[] = {
8917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8918 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8919 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8920 /* enable unsolicited event */
8921 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8922 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
8926 static void alc883_nb_mic_automute(struct hda_codec
*codec
)
8928 unsigned int present
;
8930 present
= snd_hda_codec_read(codec
, 0x18, 0,
8931 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8932 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
8933 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
8934 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
8935 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
8938 static void alc883_M90V_init_hook(struct hda_codec
*codec
)
8940 struct alc_spec
*spec
= codec
->spec
;
8942 spec
->autocfg
.hp_pins
[0] = 0x1b;
8943 spec
->autocfg
.speaker_pins
[0] = 0x14;
8944 spec
->autocfg
.speaker_pins
[1] = 0x15;
8945 spec
->autocfg
.speaker_pins
[2] = 0x16;
8946 alc_automute_pin(codec
);
8949 static void alc883_mode2_unsol_event(struct hda_codec
*codec
,
8952 switch (res
>> 26) {
8953 case ALC880_MIC_EVENT
:
8954 alc883_nb_mic_automute(codec
);
8957 alc_sku_unsol_event(codec
, res
);
8962 static void alc883_mode2_inithook(struct hda_codec
*codec
)
8964 alc883_M90V_init_hook(codec
);
8965 alc883_nb_mic_automute(codec
);
8968 static struct hda_verb alc888_asus_eee1601_verbs
[] = {
8969 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8970 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8972 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8973 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8974 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
8975 {0x20, AC_VERB_SET_PROC_COEF
, 0x0838},
8976 /* enable unsolicited event */
8977 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8981 static void alc883_eee1601_inithook(struct hda_codec
*codec
)
8983 struct alc_spec
*spec
= codec
->spec
;
8985 spec
->autocfg
.hp_pins
[0] = 0x14;
8986 spec
->autocfg
.speaker_pins
[0] = 0x1b;
8987 alc_automute_pin(codec
);
8990 static struct hda_verb alc889A_mb31_verbs
[] = {
8991 /* Init rear pin (used as headphone output) */
8992 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4}, /* Apple Headphones */
8993 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Connect to front */
8994 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8995 /* Init line pin (used as output in 4ch and 6ch mode) */
8996 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Connect to CLFE */
8997 /* Init line 2 pin (used as headphone out by default) */
8998 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Use as input */
8999 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
}, /* Mute output */
9003 /* Mute speakers according to the headphone jack state */
9004 static void alc889A_mb31_automute(struct hda_codec
*codec
)
9006 unsigned int present
;
9008 /* Mute only in 2ch or 4ch mode */
9009 if (snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_CONNECT_SEL
, 0)
9011 present
= snd_hda_codec_read(codec
, 0x15, 0,
9012 AC_VERB_GET_PIN_SENSE
, 0) & AC_PINSENSE_PRESENCE
;
9013 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9014 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9015 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9016 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
9020 static void alc889A_mb31_unsol_event(struct hda_codec
*codec
, unsigned int res
)
9022 if ((res
>> 26) == ALC880_HP_EVENT
)
9023 alc889A_mb31_automute(codec
);
9026 #ifdef CONFIG_SND_HDA_POWER_SAVE
9027 #define alc883_loopbacks alc880_loopbacks
9030 /* pcm configuration: identical with ALC880 */
9031 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
9032 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
9033 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
9034 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
9035 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
9038 * configuration and preset
9040 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
9041 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
9042 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
9043 [ALC883_3ST_6ch
] = "3stack-6ch",
9044 [ALC883_6ST_DIG
] = "6stack-dig",
9045 [ALC883_TARGA_DIG
] = "targa-dig",
9046 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
9047 [ALC883_TARGA_8ch_DIG
] = "targa-8ch-dig",
9048 [ALC883_ACER
] = "acer",
9049 [ALC883_ACER_ASPIRE
] = "acer-aspire",
9050 [ALC888_ACER_ASPIRE_4930G
] = "acer-aspire-4930g",
9051 [ALC888_ACER_ASPIRE_6530G
] = "acer-aspire-6530g",
9052 [ALC888_ACER_ASPIRE_8930G
] = "acer-aspire-8930g",
9053 [ALC883_MEDION
] = "medion",
9054 [ALC883_MEDION_MD2
] = "medion-md2",
9055 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
9056 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
9057 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
9058 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
9059 [ALC888_LENOVO_SKY
] = "lenovo-sky",
9060 [ALC883_HAIER_W66
] = "haier-w66",
9061 [ALC888_3ST_HP
] = "3stack-hp",
9062 [ALC888_6ST_DELL
] = "6stack-dell",
9063 [ALC883_MITAC
] = "mitac",
9064 [ALC883_CLEVO_M720
] = "clevo-m720",
9065 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
9066 [ALC888_FUJITSU_XA3530
] = "fujitsu-xa3530",
9067 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
9068 [ALC1200_ASUS_P5Q
] = "asus-p5q",
9069 [ALC889A_MB31
] = "mb31",
9070 [ALC883_SONY_VAIO_TT
] = "sony-vaio-tt",
9071 [ALC883_AUTO
] = "auto",
9074 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
9075 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
9076 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
9077 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE
),
9078 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE
),
9079 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
9080 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
9081 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
9082 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9083 ALC888_ACER_ASPIRE_4930G
),
9084 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9085 ALC888_ACER_ASPIRE_4930G
),
9086 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9087 ALC888_ACER_ASPIRE_8930G
),
9088 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9089 ALC888_ACER_ASPIRE_8930G
),
9090 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO
),
9091 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO
),
9092 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9093 ALC888_ACER_ASPIRE_6530G
),
9094 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9095 ALC888_ACER_ASPIRE_6530G
),
9096 /* default Acer -- disabled as it causes more problems.
9097 * model=auto should work fine now
9099 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9100 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
9101 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
9102 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
9103 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
9104 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
9105 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP
),
9106 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP
),
9107 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V
),
9108 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
9109 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG
),
9110 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q
),
9111 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601
),
9112 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
9113 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
9114 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC
),
9115 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
9116 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
9117 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL
),
9118 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
9119 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG
),
9120 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
9121 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
9122 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
9123 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG
),
9124 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
9125 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
9126 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
9127 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
9128 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
9129 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
9130 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
9131 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
9132 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
9133 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
9134 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
9135 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG
),
9136 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
9137 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
9138 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
9139 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG
),
9140 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
9141 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
9142 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
9143 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG
),
9144 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
9145 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
9146 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
9147 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
9148 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD
),
9149 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
9150 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
9151 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9152 ALC883_FUJITSU_PI2515
),
9153 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9154 ALC888_FUJITSU_XA3530
),
9155 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
9156 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9157 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9158 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
9159 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY
),
9160 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
9161 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG
),
9162 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
9163 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
9164 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
9165 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
9166 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC
),
9167 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL
),
9168 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
9169 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT
),
9173 static hda_nid_t alc883_slave_dig_outs
[] = {
9174 ALC1200_DIGOUT_NID
, 0,
9177 static hda_nid_t alc1200_slave_dig_outs
[] = {
9178 ALC883_DIGOUT_NID
, 0,
9181 static struct alc_config_preset alc883_presets
[] = {
9182 [ALC883_3ST_2ch_DIG
] = {
9183 .mixers
= { alc883_3ST_2ch_mixer
},
9184 .init_verbs
= { alc883_init_verbs
},
9185 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9186 .dac_nids
= alc883_dac_nids
,
9187 .dig_out_nid
= ALC883_DIGOUT_NID
,
9188 .dig_in_nid
= ALC883_DIGIN_NID
,
9189 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9190 .channel_mode
= alc883_3ST_2ch_modes
,
9191 .input_mux
= &alc883_capture_source
,
9193 [ALC883_3ST_6ch_DIG
] = {
9194 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9195 .init_verbs
= { alc883_init_verbs
},
9196 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9197 .dac_nids
= alc883_dac_nids
,
9198 .dig_out_nid
= ALC883_DIGOUT_NID
,
9199 .dig_in_nid
= ALC883_DIGIN_NID
,
9200 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9201 .channel_mode
= alc883_3ST_6ch_modes
,
9203 .input_mux
= &alc883_capture_source
,
9205 [ALC883_3ST_6ch
] = {
9206 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9207 .init_verbs
= { alc883_init_verbs
},
9208 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9209 .dac_nids
= alc883_dac_nids
,
9210 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9211 .channel_mode
= alc883_3ST_6ch_modes
,
9213 .input_mux
= &alc883_capture_source
,
9215 [ALC883_3ST_6ch_INTEL
] = {
9216 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
9217 .init_verbs
= { alc883_init_verbs
},
9218 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9219 .dac_nids
= alc883_dac_nids
,
9220 .dig_out_nid
= ALC883_DIGOUT_NID
,
9221 .dig_in_nid
= ALC883_DIGIN_NID
,
9222 .slave_dig_outs
= alc883_slave_dig_outs
,
9223 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
9224 .channel_mode
= alc883_3ST_6ch_intel_modes
,
9226 .input_mux
= &alc883_3stack_6ch_intel
,
9228 [ALC883_6ST_DIG
] = {
9229 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
9230 .init_verbs
= { alc883_init_verbs
},
9231 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9232 .dac_nids
= alc883_dac_nids
,
9233 .dig_out_nid
= ALC883_DIGOUT_NID
,
9234 .dig_in_nid
= ALC883_DIGIN_NID
,
9235 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9236 .channel_mode
= alc883_sixstack_modes
,
9237 .input_mux
= &alc883_capture_source
,
9239 [ALC883_TARGA_DIG
] = {
9240 .mixers
= { alc883_targa_mixer
, alc883_chmode_mixer
},
9241 .init_verbs
= { alc883_init_verbs
, alc883_targa_verbs
},
9242 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9243 .dac_nids
= alc883_dac_nids
,
9244 .dig_out_nid
= ALC883_DIGOUT_NID
,
9245 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9246 .channel_mode
= alc883_3ST_6ch_modes
,
9248 .input_mux
= &alc883_capture_source
,
9249 .unsol_event
= alc883_targa_unsol_event
,
9250 .init_hook
= alc883_targa_init_hook
,
9252 [ALC883_TARGA_2ch_DIG
] = {
9253 .mixers
= { alc883_targa_2ch_mixer
},
9254 .init_verbs
= { alc883_init_verbs
, alc883_targa_verbs
},
9255 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9256 .dac_nids
= alc883_dac_nids
,
9257 .adc_nids
= alc883_adc_nids_alt
,
9258 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
9259 .dig_out_nid
= ALC883_DIGOUT_NID
,
9260 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9261 .channel_mode
= alc883_3ST_2ch_modes
,
9262 .input_mux
= &alc883_capture_source
,
9263 .unsol_event
= alc883_targa_unsol_event
,
9264 .init_hook
= alc883_targa_init_hook
,
9266 [ALC883_TARGA_8ch_DIG
] = {
9267 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
9268 .init_verbs
= { alc883_init_verbs
, alc880_gpio3_init_verbs
,
9269 alc883_targa_verbs
},
9270 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9271 .dac_nids
= alc883_dac_nids
,
9272 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9273 .adc_nids
= alc883_adc_nids_rev
,
9274 .capsrc_nids
= alc883_capsrc_nids_rev
,
9275 .dig_out_nid
= ALC883_DIGOUT_NID
,
9276 .dig_in_nid
= ALC883_DIGIN_NID
,
9277 .num_channel_mode
= ARRAY_SIZE(alc883_4ST_8ch_modes
),
9278 .channel_mode
= alc883_4ST_8ch_modes
,
9280 .input_mux
= &alc883_capture_source
,
9281 .unsol_event
= alc883_targa_unsol_event
,
9282 .init_hook
= alc883_targa_init_hook
,
9285 .mixers
= { alc883_base_mixer
},
9286 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9287 * and the headphone jack. Turn this on and rely on the
9288 * standard mute methods whenever the user wants to turn
9289 * these outputs off.
9291 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
9292 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9293 .dac_nids
= alc883_dac_nids
,
9294 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9295 .channel_mode
= alc883_3ST_2ch_modes
,
9296 .input_mux
= &alc883_capture_source
,
9298 [ALC883_ACER_ASPIRE
] = {
9299 .mixers
= { alc883_acer_aspire_mixer
},
9300 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
9301 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9302 .dac_nids
= alc883_dac_nids
,
9303 .dig_out_nid
= ALC883_DIGOUT_NID
,
9304 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9305 .channel_mode
= alc883_3ST_2ch_modes
,
9306 .input_mux
= &alc883_capture_source
,
9307 .unsol_event
= alc_automute_amp_unsol_event
,
9308 .init_hook
= alc883_acer_aspire_init_hook
,
9310 [ALC888_ACER_ASPIRE_4930G
] = {
9311 .mixers
= { alc888_base_mixer
,
9312 alc883_chmode_mixer
},
9313 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
9314 alc888_acer_aspire_4930g_verbs
},
9315 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9316 .dac_nids
= alc883_dac_nids
,
9317 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9318 .adc_nids
= alc883_adc_nids_rev
,
9319 .capsrc_nids
= alc883_capsrc_nids_rev
,
9320 .dig_out_nid
= ALC883_DIGOUT_NID
,
9321 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9322 .channel_mode
= alc883_3ST_6ch_modes
,
9325 ARRAY_SIZE(alc888_2_capture_sources
),
9326 .input_mux
= alc888_2_capture_sources
,
9327 .unsol_event
= alc_automute_amp_unsol_event
,
9328 .init_hook
= alc888_acer_aspire_4930g_init_hook
,
9330 [ALC888_ACER_ASPIRE_6530G
] = {
9331 .mixers
= { alc888_acer_aspire_6530_mixer
},
9332 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
9333 alc888_acer_aspire_6530g_verbs
},
9334 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9335 .dac_nids
= alc883_dac_nids
,
9336 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9337 .adc_nids
= alc883_adc_nids_rev
,
9338 .capsrc_nids
= alc883_capsrc_nids_rev
,
9339 .dig_out_nid
= ALC883_DIGOUT_NID
,
9340 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9341 .channel_mode
= alc883_3ST_2ch_modes
,
9343 ARRAY_SIZE(alc888_2_capture_sources
),
9344 .input_mux
= alc888_acer_aspire_6530_sources
,
9345 .unsol_event
= alc_automute_amp_unsol_event
,
9346 .init_hook
= alc888_acer_aspire_6530g_init_hook
,
9348 [ALC888_ACER_ASPIRE_8930G
] = {
9349 .mixers
= { alc888_base_mixer
,
9350 alc883_chmode_mixer
},
9351 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
,
9352 alc889_acer_aspire_8930g_verbs
},
9353 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9354 .dac_nids
= alc883_dac_nids
,
9355 .num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
),
9356 .adc_nids
= alc889_adc_nids
,
9357 .capsrc_nids
= alc889_capsrc_nids
,
9358 .dig_out_nid
= ALC883_DIGOUT_NID
,
9359 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9360 .channel_mode
= alc883_3ST_6ch_modes
,
9362 .const_channel_count
= 6,
9364 ARRAY_SIZE(alc889_capture_sources
),
9365 .input_mux
= alc889_capture_sources
,
9366 .unsol_event
= alc_automute_amp_unsol_event
,
9367 .init_hook
= alc889_acer_aspire_8930g_init_hook
,
9370 .mixers
= { alc883_fivestack_mixer
,
9371 alc883_chmode_mixer
},
9372 .init_verbs
= { alc883_init_verbs
,
9373 alc883_medion_eapd_verbs
},
9374 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9375 .dac_nids
= alc883_dac_nids
,
9376 .adc_nids
= alc883_adc_nids_alt
,
9377 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
9378 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9379 .channel_mode
= alc883_sixstack_modes
,
9380 .input_mux
= &alc883_capture_source
,
9382 [ALC883_MEDION_MD2
] = {
9383 .mixers
= { alc883_medion_md2_mixer
},
9384 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
9385 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9386 .dac_nids
= alc883_dac_nids
,
9387 .dig_out_nid
= ALC883_DIGOUT_NID
,
9388 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9389 .channel_mode
= alc883_3ST_2ch_modes
,
9390 .input_mux
= &alc883_capture_source
,
9391 .unsol_event
= alc_automute_amp_unsol_event
,
9392 .init_hook
= alc883_medion_md2_init_hook
,
9394 [ALC883_LAPTOP_EAPD
] = {
9395 .mixers
= { alc883_base_mixer
},
9396 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
9397 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9398 .dac_nids
= alc883_dac_nids
,
9399 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9400 .channel_mode
= alc883_3ST_2ch_modes
,
9401 .input_mux
= &alc883_capture_source
,
9403 [ALC883_CLEVO_M720
] = {
9404 .mixers
= { alc883_clevo_m720_mixer
},
9405 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
9406 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9407 .dac_nids
= alc883_dac_nids
,
9408 .dig_out_nid
= ALC883_DIGOUT_NID
,
9409 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9410 .channel_mode
= alc883_3ST_2ch_modes
,
9411 .input_mux
= &alc883_capture_source
,
9412 .unsol_event
= alc883_clevo_m720_unsol_event
,
9413 .init_hook
= alc883_clevo_m720_init_hook
,
9415 [ALC883_LENOVO_101E_2ch
] = {
9416 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
9417 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
9418 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9419 .dac_nids
= alc883_dac_nids
,
9420 .adc_nids
= alc883_adc_nids_alt
,
9421 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_alt
),
9422 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9423 .channel_mode
= alc883_3ST_2ch_modes
,
9424 .input_mux
= &alc883_lenovo_101e_capture_source
,
9425 .unsol_event
= alc883_lenovo_101e_unsol_event
,
9426 .init_hook
= alc883_lenovo_101e_all_automute
,
9428 [ALC883_LENOVO_NB0763
] = {
9429 .mixers
= { alc883_lenovo_nb0763_mixer
},
9430 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
9431 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9432 .dac_nids
= alc883_dac_nids
,
9433 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9434 .channel_mode
= alc883_3ST_2ch_modes
,
9436 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
9437 .unsol_event
= alc_automute_amp_unsol_event
,
9438 .init_hook
= alc883_medion_md2_init_hook
,
9440 [ALC888_LENOVO_MS7195_DIG
] = {
9441 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9442 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
9443 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9444 .dac_nids
= alc883_dac_nids
,
9445 .dig_out_nid
= ALC883_DIGOUT_NID
,
9446 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9447 .channel_mode
= alc883_3ST_6ch_modes
,
9449 .input_mux
= &alc883_capture_source
,
9450 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
9451 .init_hook
= alc888_lenovo_ms7195_front_automute
,
9453 [ALC883_HAIER_W66
] = {
9454 .mixers
= { alc883_targa_2ch_mixer
},
9455 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
9456 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9457 .dac_nids
= alc883_dac_nids
,
9458 .dig_out_nid
= ALC883_DIGOUT_NID
,
9459 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9460 .channel_mode
= alc883_3ST_2ch_modes
,
9461 .input_mux
= &alc883_capture_source
,
9462 .unsol_event
= alc_automute_amp_unsol_event
,
9463 .init_hook
= alc883_haier_w66_init_hook
,
9466 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9467 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
9468 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9469 .dac_nids
= alc883_dac_nids
,
9470 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
9471 .channel_mode
= alc888_3st_hp_modes
,
9473 .input_mux
= &alc883_capture_source
,
9474 .unsol_event
= alc_automute_amp_unsol_event
,
9475 .init_hook
= alc888_3st_hp_init_hook
,
9477 [ALC888_6ST_DELL
] = {
9478 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
9479 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
9480 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9481 .dac_nids
= alc883_dac_nids
,
9482 .dig_out_nid
= ALC883_DIGOUT_NID
,
9483 .dig_in_nid
= ALC883_DIGIN_NID
,
9484 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9485 .channel_mode
= alc883_sixstack_modes
,
9486 .input_mux
= &alc883_capture_source
,
9487 .unsol_event
= alc_automute_amp_unsol_event
,
9488 .init_hook
= alc888_6st_dell_init_hook
,
9491 .mixers
= { alc883_mitac_mixer
},
9492 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
9493 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9494 .dac_nids
= alc883_dac_nids
,
9495 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9496 .channel_mode
= alc883_3ST_2ch_modes
,
9497 .input_mux
= &alc883_capture_source
,
9498 .unsol_event
= alc_automute_amp_unsol_event
,
9499 .init_hook
= alc883_mitac_init_hook
,
9501 [ALC883_FUJITSU_PI2515
] = {
9502 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
9503 .init_verbs
= { alc883_init_verbs
,
9504 alc883_2ch_fujitsu_pi2515_verbs
},
9505 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9506 .dac_nids
= alc883_dac_nids
,
9507 .dig_out_nid
= ALC883_DIGOUT_NID
,
9508 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9509 .channel_mode
= alc883_3ST_2ch_modes
,
9510 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
9511 .unsol_event
= alc_automute_amp_unsol_event
,
9512 .init_hook
= alc883_2ch_fujitsu_pi2515_init_hook
,
9514 [ALC888_FUJITSU_XA3530
] = {
9515 .mixers
= { alc888_base_mixer
, alc883_chmode_mixer
},
9516 .init_verbs
= { alc883_init_verbs
,
9517 alc888_fujitsu_xa3530_verbs
},
9518 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9519 .dac_nids
= alc883_dac_nids
,
9520 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids_rev
),
9521 .adc_nids
= alc883_adc_nids_rev
,
9522 .capsrc_nids
= alc883_capsrc_nids_rev
,
9523 .dig_out_nid
= ALC883_DIGOUT_NID
,
9524 .num_channel_mode
= ARRAY_SIZE(alc888_4ST_8ch_intel_modes
),
9525 .channel_mode
= alc888_4ST_8ch_intel_modes
,
9527 ARRAY_SIZE(alc888_2_capture_sources
),
9528 .input_mux
= alc888_2_capture_sources
,
9529 .unsol_event
= alc_automute_amp_unsol_event
,
9530 .init_hook
= alc888_fujitsu_xa3530_init_hook
,
9532 [ALC888_LENOVO_SKY
] = {
9533 .mixers
= { alc888_lenovo_sky_mixer
, alc883_chmode_mixer
},
9534 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_sky_verbs
},
9535 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9536 .dac_nids
= alc883_dac_nids
,
9537 .dig_out_nid
= ALC883_DIGOUT_NID
,
9538 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9539 .channel_mode
= alc883_sixstack_modes
,
9541 .input_mux
= &alc883_lenovo_sky_capture_source
,
9542 .unsol_event
= alc_automute_amp_unsol_event
,
9543 .init_hook
= alc888_lenovo_sky_init_hook
,
9545 [ALC888_ASUS_M90V
] = {
9546 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
9547 .init_verbs
= { alc883_init_verbs
, alc888_asus_m90v_verbs
},
9548 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9549 .dac_nids
= alc883_dac_nids
,
9550 .dig_out_nid
= ALC883_DIGOUT_NID
,
9551 .dig_in_nid
= ALC883_DIGIN_NID
,
9552 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
9553 .channel_mode
= alc883_3ST_6ch_modes
,
9555 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
9556 .unsol_event
= alc883_mode2_unsol_event
,
9557 .init_hook
= alc883_mode2_inithook
,
9559 [ALC888_ASUS_EEE1601
] = {
9560 .mixers
= { alc883_asus_eee1601_mixer
},
9561 .cap_mixer
= alc883_asus_eee1601_cap_mixer
,
9562 .init_verbs
= { alc883_init_verbs
, alc888_asus_eee1601_verbs
},
9563 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9564 .dac_nids
= alc883_dac_nids
,
9565 .dig_out_nid
= ALC883_DIGOUT_NID
,
9566 .dig_in_nid
= ALC883_DIGIN_NID
,
9567 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9568 .channel_mode
= alc883_3ST_2ch_modes
,
9570 .input_mux
= &alc883_asus_eee1601_capture_source
,
9571 .unsol_event
= alc_sku_unsol_event
,
9572 .init_hook
= alc883_eee1601_inithook
,
9574 [ALC1200_ASUS_P5Q
] = {
9575 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
9576 .init_verbs
= { alc883_init_verbs
},
9577 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9578 .dac_nids
= alc883_dac_nids
,
9579 .dig_out_nid
= ALC1200_DIGOUT_NID
,
9580 .dig_in_nid
= ALC883_DIGIN_NID
,
9581 .slave_dig_outs
= alc1200_slave_dig_outs
,
9582 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
9583 .channel_mode
= alc883_sixstack_modes
,
9584 .input_mux
= &alc883_capture_source
,
9587 .mixers
= { alc889A_mb31_mixer
, alc883_chmode_mixer
},
9588 .init_verbs
= { alc883_init_verbs
, alc889A_mb31_verbs
,
9589 alc880_gpio1_init_verbs
},
9590 .adc_nids
= alc883_adc_nids
,
9591 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
9592 .dac_nids
= alc883_dac_nids
,
9593 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9594 .channel_mode
= alc889A_mb31_6ch_modes
,
9595 .num_channel_mode
= ARRAY_SIZE(alc889A_mb31_6ch_modes
),
9596 .input_mux
= &alc889A_mb31_capture_source
,
9597 .dig_out_nid
= ALC883_DIGOUT_NID
,
9598 .unsol_event
= alc889A_mb31_unsol_event
,
9599 .init_hook
= alc889A_mb31_automute
,
9601 [ALC883_SONY_VAIO_TT
] = {
9602 .mixers
= { alc883_vaiott_mixer
},
9603 .init_verbs
= { alc883_init_verbs
, alc883_vaiott_verbs
},
9604 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
9605 .dac_nids
= alc883_dac_nids
,
9606 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
9607 .channel_mode
= alc883_3ST_2ch_modes
,
9608 .input_mux
= &alc883_capture_source
,
9609 .unsol_event
= alc_automute_amp_unsol_event
,
9610 .init_hook
= alc883_vaiott_init_hook
,
9616 * BIOS auto configuration
9618 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
9619 hda_nid_t nid
, int pin_type
,
9623 struct alc_spec
*spec
= codec
->spec
;
9626 alc_set_pin_output(codec
, nid
, pin_type
);
9627 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
9630 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
9631 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
9635 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
9637 struct alc_spec
*spec
= codec
->spec
;
9640 for (i
= 0; i
<= HDA_SIDE
; i
++) {
9641 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
9642 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
9644 alc883_auto_set_output_and_unmute(codec
, nid
, pin_type
,
9649 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
9651 struct alc_spec
*spec
= codec
->spec
;
9654 pin
= spec
->autocfg
.hp_pins
[0];
9655 if (pin
) /* connect to front */
9657 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
9658 pin
= spec
->autocfg
.speaker_pins
[0];
9660 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
9663 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9664 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9666 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
9668 struct alc_spec
*spec
= codec
->spec
;
9671 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
9672 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
9673 if (alc883_is_input_pin(nid
)) {
9674 alc_set_input_pin(codec
, nid
, i
);
9675 if (nid
!= ALC883_PIN_CD_NID
&&
9676 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
9677 snd_hda_codec_write(codec
, nid
, 0,
9678 AC_VERB_SET_AMP_GAIN_MUTE
,
9684 #define alc883_auto_init_input_src alc882_auto_init_input_src
9686 /* almost identical with ALC880 parser... */
9687 static int alc883_parse_auto_config(struct hda_codec
*codec
)
9689 struct alc_spec
*spec
= codec
->spec
;
9690 int err
= alc880_parse_auto_config(codec
);
9691 struct auto_pin_cfg
*cfg
= &spec
->autocfg
;
9697 return 0; /* no config found */
9699 err
= alc_auto_add_mic_boost(codec
);
9703 /* hack - override the init verbs */
9704 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
9706 /* setup input_mux for ALC889 */
9707 if (codec
->vendor_id
== 0x10ec0889) {
9708 /* digital-mic input pin is excluded in alc880_auto_create..()
9709 * because it's under 0x18
9711 if (cfg
->input_pins
[AUTO_PIN_MIC
] == 0x12 ||
9712 cfg
->input_pins
[AUTO_PIN_FRONT_MIC
] == 0x12) {
9713 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
9714 for (i
= 1; i
< 3; i
++)
9715 memcpy(&spec
->private_imux
[i
],
9716 &spec
->private_imux
[0],
9717 sizeof(spec
->private_imux
[0]));
9718 imux
->items
[imux
->num_items
].label
= "Int DMic";
9719 imux
->items
[imux
->num_items
].index
= 0x0b;
9721 spec
->num_mux_defs
= 3;
9722 spec
->input_mux
= spec
->private_imux
;
9726 return 1; /* config found */
9729 /* additional initialization for auto-configuration model */
9730 static void alc883_auto_init(struct hda_codec
*codec
)
9732 struct alc_spec
*spec
= codec
->spec
;
9733 alc883_auto_init_multi_out(codec
);
9734 alc883_auto_init_hp_out(codec
);
9735 alc883_auto_init_analog_input(codec
);
9736 alc883_auto_init_input_src(codec
);
9737 if (spec
->unsol_event
)
9738 alc_inithook(codec
);
9741 static int patch_alc883(struct hda_codec
*codec
)
9743 struct alc_spec
*spec
;
9744 int err
, board_config
;
9746 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
9752 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
9754 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
9757 if (board_config
< 0 || board_config
>= ALC883_MODEL_LAST
) {
9758 /* Pick up systems that don't supply PCI SSID */
9759 switch (codec
->subsystem_id
) {
9760 case 0x106b3600: /* Macbook 3.1 */
9761 board_config
= ALC889A_MB31
;
9765 "hda_codec: Unknown model for %s, trying "
9766 "auto-probe from BIOS...\n", codec
->chip_name
);
9767 board_config
= ALC883_AUTO
;
9771 if (board_config
== ALC883_AUTO
) {
9772 /* automatic parse from the BIOS config */
9773 err
= alc883_parse_auto_config(codec
);
9779 "hda_codec: Cannot set up configuration "
9780 "from BIOS. Using base mode...\n");
9781 board_config
= ALC883_3ST_2ch_DIG
;
9785 err
= snd_hda_attach_beep_device(codec
, 0x1);
9791 if (board_config
!= ALC883_AUTO
)
9792 setup_preset(spec
, &alc883_presets
[board_config
]);
9794 switch (codec
->vendor_id
) {
9796 if (!spec
->num_adc_nids
) {
9797 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
9798 spec
->adc_nids
= alc883_adc_nids
;
9800 if (!spec
->capsrc_nids
)
9801 spec
->capsrc_nids
= alc883_capsrc_nids
;
9802 spec
->init_amp
= ALC_INIT_DEFAULT
; /* always initialize */
9805 if (!spec
->num_adc_nids
) {
9806 spec
->num_adc_nids
= ARRAY_SIZE(alc889_adc_nids
);
9807 spec
->adc_nids
= alc889_adc_nids
;
9809 if (!spec
->capsrc_nids
)
9810 spec
->capsrc_nids
= alc889_capsrc_nids
;
9813 if (!spec
->num_adc_nids
) {
9814 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
9815 spec
->adc_nids
= alc883_adc_nids
;
9817 if (!spec
->capsrc_nids
)
9818 spec
->capsrc_nids
= alc883_capsrc_nids
;
9822 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
9823 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
9824 spec
->stream_analog_alt_capture
= &alc883_pcm_analog_alt_capture
;
9826 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
9827 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
9829 if (!spec
->cap_mixer
)
9830 set_capture_mixer(spec
);
9831 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
9833 spec
->vmaster_nid
= 0x0c;
9835 codec
->patch_ops
= alc_patch_ops
;
9836 if (board_config
== ALC883_AUTO
)
9837 spec
->init_hook
= alc883_auto_init
;
9839 #ifdef CONFIG_SND_HDA_POWER_SAVE
9840 if (!spec
->loopback
.amplist
)
9841 spec
->loopback
.amplist
= alc883_loopbacks
;
9843 codec
->proc_widget_hook
= print_realtek_coef
;
9852 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9853 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9855 #define alc262_dac_nids alc260_dac_nids
9856 #define alc262_adc_nids alc882_adc_nids
9857 #define alc262_adc_nids_alt alc882_adc_nids_alt
9858 #define alc262_capsrc_nids alc882_capsrc_nids
9859 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9861 #define alc262_modes alc260_modes
9862 #define alc262_capture_source alc882_capture_source
9864 static hda_nid_t alc262_dmic_adc_nids
[1] = {
9869 static hda_nid_t alc262_dmic_capsrc_nids
[1] = { 0x22 };
9871 static struct snd_kcontrol_new alc262_base_mixer
[] = {
9872 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9873 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9874 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9875 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9876 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9877 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9880 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9881 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9882 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9883 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9884 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
9885 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9886 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
9887 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
9891 /* update HP, line and mono-out pins according to the master switch */
9892 static void alc262_hp_master_update(struct hda_codec
*codec
)
9894 struct alc_spec
*spec
= codec
->spec
;
9895 int val
= spec
->master_sw
;
9898 snd_hda_codec_write_cache(codec
, 0x1b, 0,
9899 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9901 snd_hda_codec_write_cache(codec
, 0x15, 0,
9902 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9904 /* mono (speaker) depending on the HP jack sense */
9905 val
= val
&& !spec
->jack_present
;
9906 snd_hda_codec_write_cache(codec
, 0x16, 0,
9907 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9911 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
9913 struct alc_spec
*spec
= codec
->spec
;
9914 unsigned int presence
;
9915 presence
= snd_hda_codec_read(codec
, 0x1b, 0,
9916 AC_VERB_GET_PIN_SENSE
, 0);
9917 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
9918 alc262_hp_master_update(codec
);
9921 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
9923 if ((res
>> 26) != ALC880_HP_EVENT
)
9925 alc262_hp_bpc_automute(codec
);
9928 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
9930 struct alc_spec
*spec
= codec
->spec
;
9931 unsigned int presence
;
9932 presence
= snd_hda_codec_read(codec
, 0x15, 0,
9933 AC_VERB_GET_PIN_SENSE
, 0);
9934 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
9935 alc262_hp_master_update(codec
);
9938 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
9941 if ((res
>> 26) != ALC880_HP_EVENT
)
9943 alc262_hp_wildwest_automute(codec
);
9946 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9948 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
9949 struct snd_ctl_elem_value
*ucontrol
)
9951 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9952 struct alc_spec
*spec
= codec
->spec
;
9953 int val
= !!*ucontrol
->value
.integer
.value
;
9955 if (val
== spec
->master_sw
)
9957 spec
->master_sw
= val
;
9958 alc262_hp_master_update(codec
);
9962 #define ALC262_HP_MASTER_SWITCH \
9964 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9965 .name = "Master Playback Switch", \
9966 .info = snd_ctl_boolean_mono_info, \
9967 .get = alc262_hp_master_sw_get, \
9968 .put = alc262_hp_master_sw_put, \
9971 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
9972 ALC262_HP_MASTER_SWITCH
,
9973 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9974 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9975 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9976 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9978 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9981 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9982 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9983 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9984 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9985 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9986 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9987 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9988 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9989 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9990 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
9991 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
9995 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
9996 ALC262_HP_MASTER_SWITCH
,
9997 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9998 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9999 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
10000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10001 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10003 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10005 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10006 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10007 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
10008 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10009 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10010 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10011 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10015 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
10016 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10017 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10018 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
10022 /* mute/unmute internal speaker according to the hp jack and mute state */
10023 static void alc262_hp_t5735_init_hook(struct hda_codec
*codec
)
10025 struct alc_spec
*spec
= codec
->spec
;
10027 spec
->autocfg
.hp_pins
[0] = 0x15;
10028 spec
->autocfg
.speaker_pins
[0] = 0x0c; /* HACK: not actually a pin */
10029 alc_automute_amp(codec
);
10032 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
10033 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10034 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10035 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
10036 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10037 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10038 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10039 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10043 static struct hda_verb alc262_hp_t5735_verbs
[] = {
10044 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10045 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10047 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10051 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
10052 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10053 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10054 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
10055 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
10056 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10057 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10061 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
10062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10063 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10064 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10065 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10066 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10067 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10068 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
10069 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
10070 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
10071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
10075 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
10082 /* bind hp and internal speaker mute (with plug check) as master switch */
10083 static void alc262_hippo_master_update(struct hda_codec
*codec
)
10085 struct alc_spec
*spec
= codec
->spec
;
10086 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
10087 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
10088 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
10092 mute
= spec
->master_sw
? 0 : HDA_AMP_MUTE
;
10093 snd_hda_codec_amp_stereo(codec
, hp_nid
, HDA_OUTPUT
, 0,
10094 HDA_AMP_MUTE
, mute
);
10095 /* mute internal speaker per jack sense */
10096 if (spec
->jack_present
)
10097 mute
= HDA_AMP_MUTE
;
10099 snd_hda_codec_amp_stereo(codec
, line_nid
, HDA_OUTPUT
, 0,
10100 HDA_AMP_MUTE
, mute
);
10101 if (speaker_nid
&& speaker_nid
!= line_nid
)
10102 snd_hda_codec_amp_stereo(codec
, speaker_nid
, HDA_OUTPUT
, 0,
10103 HDA_AMP_MUTE
, mute
);
10106 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10108 static int alc262_hippo_master_sw_put(struct snd_kcontrol
*kcontrol
,
10109 struct snd_ctl_elem_value
*ucontrol
)
10111 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10112 struct alc_spec
*spec
= codec
->spec
;
10113 int val
= !!*ucontrol
->value
.integer
.value
;
10115 if (val
== spec
->master_sw
)
10117 spec
->master_sw
= val
;
10118 alc262_hippo_master_update(codec
);
10122 #define ALC262_HIPPO_MASTER_SWITCH \
10124 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10125 .name = "Master Playback Switch", \
10126 .info = snd_ctl_boolean_mono_info, \
10127 .get = alc262_hippo_master_sw_get, \
10128 .put = alc262_hippo_master_sw_put, \
10131 static struct snd_kcontrol_new alc262_hippo_mixer
[] = {
10132 ALC262_HIPPO_MASTER_SWITCH
,
10133 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10134 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10135 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10136 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10137 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10139 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10140 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10141 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10142 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10143 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10144 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
10148 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
10149 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10150 ALC262_HIPPO_MASTER_SWITCH
,
10151 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10152 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10153 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10154 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10156 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10157 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10158 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10159 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10160 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10164 /* mute/unmute internal speaker according to the hp jack and mute state */
10165 static void alc262_hippo_automute(struct hda_codec
*codec
)
10167 struct alc_spec
*spec
= codec
->spec
;
10168 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
10169 unsigned int present
;
10171 /* need to execute and sync at first */
10172 snd_hda_codec_read(codec
, hp_nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
10173 present
= snd_hda_codec_read(codec
, hp_nid
, 0,
10174 AC_VERB_GET_PIN_SENSE
, 0);
10175 spec
->jack_present
= (present
& 0x80000000) != 0;
10176 alc262_hippo_master_update(codec
);
10179 static void alc262_hippo_unsol_event(struct hda_codec
*codec
, unsigned int res
)
10181 if ((res
>> 26) != ALC880_HP_EVENT
)
10183 alc262_hippo_automute(codec
);
10186 static void alc262_hippo_init_hook(struct hda_codec
*codec
)
10188 struct alc_spec
*spec
= codec
->spec
;
10190 spec
->autocfg
.hp_pins
[0] = 0x15;
10191 spec
->autocfg
.speaker_pins
[0] = 0x14;
10192 alc262_hippo_automute(codec
);
10195 static void alc262_hippo1_init_hook(struct hda_codec
*codec
)
10197 struct alc_spec
*spec
= codec
->spec
;
10199 spec
->autocfg
.hp_pins
[0] = 0x1b;
10200 spec
->autocfg
.speaker_pins
[0] = 0x14;
10201 alc262_hippo_automute(codec
);
10205 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
10206 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10207 ALC262_HIPPO_MASTER_SWITCH
,
10208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10209 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10210 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10211 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10215 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
10216 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10217 ALC262_HIPPO_MASTER_SWITCH
,
10218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
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("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10222 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10226 static struct snd_kcontrol_new alc262_tyan_mixer
[] = {
10227 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10228 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
10229 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT
),
10230 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT
),
10231 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10232 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10234 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10235 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10237 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10238 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10242 static struct hda_verb alc262_tyan_verbs
[] = {
10243 /* Headphone automute */
10244 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10245 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10246 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10248 /* P11 AUX_IN, white 4-pin connector */
10249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10250 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1
, 0xe1},
10251 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2
, 0x93},
10252 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3
, 0x19},
10257 /* unsolicited event for HP jack sensing */
10258 static void alc262_tyan_init_hook(struct hda_codec
*codec
)
10260 struct alc_spec
*spec
= codec
->spec
;
10262 spec
->autocfg
.hp_pins
[0] = 0x1b;
10263 spec
->autocfg
.speaker_pins
[0] = 0x15;
10264 alc_automute_amp(codec
);
10268 #define alc262_capture_mixer alc882_capture_mixer
10269 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10272 * generic initialization of ADC, input mixers and output mixers
10274 static struct hda_verb alc262_init_verbs
[] = {
10276 * Unmute ADC0-2 and set the default input to mic-in
10278 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10280 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10281 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10282 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10283 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10285 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10287 * Note: PASD motherboards uses the Line In 2 as the input for
10288 * front panel mic (mic 2)
10290 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10298 * Set up output mixers (0x0c - 0x0e)
10300 /* set vol=0 to output mixers */
10301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10302 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10303 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10304 /* set up input amps for analog loopback */
10305 /* Amp Indices: DAC = 0, mixer = 1 */
10306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10308 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10310 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
10314 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
10315 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
10316 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10317 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10318 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10320 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10321 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10322 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10323 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10324 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10326 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
10327 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
10329 /* FIXME: use matrix-type input source selection */
10330 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10331 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10337 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10338 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10339 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10342 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10350 static struct hda_verb alc262_eapd_verbs
[] = {
10351 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10352 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10356 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
10357 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10358 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10362 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
10363 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
10364 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10365 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
10367 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10368 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10372 static struct hda_verb alc262_sony_unsol_verbs
[] = {
10373 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
10374 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10375 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
10377 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10378 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10382 static struct hda_input_mux alc262_dmic_capture_source
= {
10385 { "Int DMic", 0x9 },
10390 static struct snd_kcontrol_new alc262_toshiba_s06_mixer
[] = {
10391 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10392 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10393 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10394 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10395 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10399 static struct hda_verb alc262_toshiba_s06_verbs
[] = {
10400 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10401 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10402 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10403 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10404 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x09},
10405 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10406 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
10407 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10411 static void alc262_dmic_automute(struct hda_codec
*codec
)
10413 unsigned int present
;
10415 present
= snd_hda_codec_read(codec
, 0x18, 0,
10416 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10417 snd_hda_codec_write(codec
, 0x22, 0,
10418 AC_VERB_SET_CONNECT_SEL
, present
? 0x0 : 0x09);
10422 /* unsolicited event for HP jack sensing */
10423 static void alc262_toshiba_s06_unsol_event(struct hda_codec
*codec
,
10426 if ((res
>> 26) == ALC880_MIC_EVENT
)
10427 alc262_dmic_automute(codec
);
10429 alc_sku_unsol_event(codec
, res
);
10432 static void alc262_toshiba_s06_init_hook(struct hda_codec
*codec
)
10434 struct alc_spec
*spec
= codec
->spec
;
10436 spec
->autocfg
.hp_pins
[0] = 0x15;
10437 spec
->autocfg
.speaker_pins
[0] = 0x14;
10438 alc_automute_pin(codec
);
10439 alc262_dmic_automute(codec
);
10445 * 0x16 = internal speaker
10446 * 0x18 = external mic
10449 static struct snd_kcontrol_new alc262_nec_mixer
[] = {
10450 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
10451 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
10453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10454 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10455 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10457 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
10458 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10462 static struct hda_verb alc262_nec_verbs
[] = {
10463 /* Unmute Speaker */
10464 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10467 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10470 /* External mic to headphone */
10471 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10472 /* External mic to speaker */
10473 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10479 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10480 * 0x1b = port replicator headphone out
10483 #define ALC_HP_EVENT 0x37
10485 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
10486 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
10487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10488 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
10489 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10493 static struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
10494 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
10495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10499 static struct hda_input_mux alc262_fujitsu_capture_source
= {
10503 { "Int Mic", 0x1 },
10508 static struct hda_input_mux alc262_HP_capture_source
= {
10512 { "Front Mic", 0x1 },
10519 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
10523 { "Front Mic", 0x2 },
10529 /* mute/unmute internal speaker according to the hp jacks and mute state */
10530 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
10532 struct alc_spec
*spec
= codec
->spec
;
10535 if (force
|| !spec
->sense_updated
) {
10536 unsigned int present
;
10537 /* need to execute and sync at first */
10538 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
10539 /* check laptop HP jack */
10540 present
= snd_hda_codec_read(codec
, 0x14, 0,
10541 AC_VERB_GET_PIN_SENSE
, 0);
10542 /* need to execute and sync at first */
10543 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
10544 /* check docking HP jack */
10545 present
|= snd_hda_codec_read(codec
, 0x1b, 0,
10546 AC_VERB_GET_PIN_SENSE
, 0);
10547 if (present
& AC_PINSENSE_PRESENCE
)
10548 spec
->jack_present
= 1;
10550 spec
->jack_present
= 0;
10551 spec
->sense_updated
= 1;
10553 /* unmute internal speaker only if both HPs are unplugged and
10554 * master switch is on
10556 if (spec
->jack_present
)
10557 mute
= HDA_AMP_MUTE
;
10559 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
10560 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
10561 HDA_AMP_MUTE
, mute
);
10564 /* unsolicited event for HP jack sensing */
10565 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
10568 if ((res
>> 26) != ALC_HP_EVENT
)
10570 alc262_fujitsu_automute(codec
, 1);
10573 static void alc262_fujitsu_init_hook(struct hda_codec
*codec
)
10575 alc262_fujitsu_automute(codec
, 1);
10578 /* bind volumes of both NID 0x0c and 0x0d */
10579 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
10580 .ops
= &snd_hda_bind_vol
,
10582 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
10583 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
10588 /* mute/unmute internal speaker according to the hp jack and mute state */
10589 static void alc262_lenovo_3000_automute(struct hda_codec
*codec
, int force
)
10591 struct alc_spec
*spec
= codec
->spec
;
10594 if (force
|| !spec
->sense_updated
) {
10595 unsigned int present_int_hp
;
10596 /* need to execute and sync at first */
10597 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
10598 present_int_hp
= snd_hda_codec_read(codec
, 0x1b, 0,
10599 AC_VERB_GET_PIN_SENSE
, 0);
10600 spec
->jack_present
= (present_int_hp
& 0x80000000) != 0;
10601 spec
->sense_updated
= 1;
10603 if (spec
->jack_present
) {
10604 /* mute internal speaker */
10605 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10606 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
10607 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
10608 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
10610 /* unmute internal speaker if necessary */
10611 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
10612 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10613 HDA_AMP_MUTE
, mute
);
10614 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
10615 HDA_AMP_MUTE
, mute
);
10619 /* unsolicited event for HP jack sensing */
10620 static void alc262_lenovo_3000_unsol_event(struct hda_codec
*codec
,
10623 if ((res
>> 26) != ALC_HP_EVENT
)
10625 alc262_lenovo_3000_automute(codec
, 1);
10628 /* bind hp and internal speaker mute (with plug check) */
10629 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
10630 struct snd_ctl_elem_value
*ucontrol
)
10632 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10633 long *valp
= ucontrol
->value
.integer
.value
;
10636 change
= snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10638 valp
? 0 : HDA_AMP_MUTE
);
10639 change
|= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
10641 valp
? 0 : HDA_AMP_MUTE
);
10644 alc262_fujitsu_automute(codec
, 0);
10648 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
10649 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
10651 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10652 .name
= "Master Playback Switch",
10653 .info
= snd_hda_mixer_amp_switch_info
,
10654 .get
= snd_hda_mixer_amp_switch_get
,
10655 .put
= alc262_fujitsu_master_sw_put
,
10656 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
10658 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10659 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10660 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10661 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10662 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10663 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
10664 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10665 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10669 /* bind hp and internal speaker mute (with plug check) */
10670 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol
*kcontrol
,
10671 struct snd_ctl_elem_value
*ucontrol
)
10673 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10674 long *valp
= ucontrol
->value
.integer
.value
;
10677 change
= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
10679 valp
? 0 : HDA_AMP_MUTE
);
10682 alc262_lenovo_3000_automute(codec
, 0);
10686 static struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
10687 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
10689 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10690 .name
= "Master Playback Switch",
10691 .info
= snd_hda_mixer_amp_switch_info
,
10692 .get
= snd_hda_mixer_amp_switch_get
,
10693 .put
= alc262_lenovo_3000_master_sw_put
,
10694 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
10696 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10697 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10698 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10699 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10700 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10701 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
10702 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10703 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10707 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer
[] = {
10708 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
10709 ALC262_HIPPO_MASTER_SWITCH
,
10710 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10711 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10712 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10713 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10714 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10715 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10719 /* additional init verbs for Benq laptops */
10720 static struct hda_verb alc262_EAPD_verbs
[] = {
10721 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
10722 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
10726 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
10727 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10728 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10730 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
10731 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
10735 /* Samsung Q1 Ultra Vista model setup */
10736 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
10737 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
10738 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
10739 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10740 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10741 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
10742 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT
),
10746 static struct hda_verb alc262_ultra_verbs
[] = {
10748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10749 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10750 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10752 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10753 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10755 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
10757 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10758 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10760 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10761 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10763 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10765 /* ADC, choose mic */
10766 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10767 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10768 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10770 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10771 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10772 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
10773 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
10774 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
10775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
10779 /* mute/unmute internal speaker according to the hp jack and mute state */
10780 static void alc262_ultra_automute(struct hda_codec
*codec
)
10782 struct alc_spec
*spec
= codec
->spec
;
10786 /* auto-mute only when HP is used as HP */
10787 if (!spec
->cur_mux
[0]) {
10788 unsigned int present
;
10789 /* need to execute and sync at first */
10790 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
10791 present
= snd_hda_codec_read(codec
, 0x15, 0,
10792 AC_VERB_GET_PIN_SENSE
, 0);
10793 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
10794 if (spec
->jack_present
)
10795 mute
= HDA_AMP_MUTE
;
10797 /* mute/unmute internal speaker */
10798 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10799 HDA_AMP_MUTE
, mute
);
10800 /* mute/unmute HP */
10801 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
10802 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
10805 /* unsolicited event for HP jack sensing */
10806 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
10809 if ((res
>> 26) != ALC880_HP_EVENT
)
10811 alc262_ultra_automute(codec
);
10814 static struct hda_input_mux alc262_ultra_capture_source
= {
10818 { "Headphone", 0x7 },
10822 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
10823 struct snd_ctl_elem_value
*ucontrol
)
10825 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10826 struct alc_spec
*spec
= codec
->spec
;
10829 ret
= alc_mux_enum_put(kcontrol
, ucontrol
);
10832 /* reprogram the HP pin as mic or HP according to the input source */
10833 snd_hda_codec_write_cache(codec
, 0x15, 0,
10834 AC_VERB_SET_PIN_WIDGET_CONTROL
,
10835 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
10836 alc262_ultra_automute(codec
); /* mute/unmute HP */
10840 static struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
10841 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
10842 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
10844 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10845 .name
= "Capture Source",
10846 .info
= alc_mux_enum_info
,
10847 .get
= alc_mux_enum_get
,
10848 .put
= alc262_ultra_mux_enum_put
,
10853 /* add playback controls from the parsed DAC table */
10854 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
10855 const struct auto_pin_cfg
*cfg
)
10860 spec
->multiout
.num_dacs
= 1; /* only use one dac */
10861 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
10862 spec
->multiout
.dac_nids
[0] = 2;
10864 nid
= cfg
->line_out_pins
[0];
10866 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10867 "Front Playback Volume",
10868 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
));
10871 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10872 "Front Playback Switch",
10873 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
10878 nid
= cfg
->speaker_pins
[0];
10881 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10882 "Speaker Playback Volume",
10883 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10887 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10888 "Speaker Playback Switch",
10889 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
10894 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10895 "Speaker Playback Switch",
10896 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
10902 nid
= cfg
->hp_pins
[0];
10904 /* spec->multiout.hp_nid = 2; */
10906 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10907 "Headphone Playback Volume",
10908 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10912 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10913 "Headphone Playback Switch",
10914 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
10919 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10920 "Headphone Playback Switch",
10921 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
10930 static int alc262_auto_create_analog_input_ctls(struct alc_spec
*spec
,
10931 const struct auto_pin_cfg
*cfg
)
10935 err
= alc880_auto_create_analog_input_ctls(spec
, cfg
);
10938 /* digital-mic input pin is excluded in alc880_auto_create..()
10939 * because it's under 0x18
10941 if (cfg
->input_pins
[AUTO_PIN_MIC
] == 0x12 ||
10942 cfg
->input_pins
[AUTO_PIN_FRONT_MIC
] == 0x12) {
10943 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
10944 imux
->items
[imux
->num_items
].label
= "Int Mic";
10945 imux
->items
[imux
->num_items
].index
= 0x09;
10953 * generic initialization of ADC, input mixers and output mixers
10955 static struct hda_verb alc262_volume_init_verbs
[] = {
10957 * Unmute ADC0-2 and set the default input to mic-in
10959 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10960 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10961 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10962 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10963 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10964 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10966 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10968 * Note: PASD motherboards uses the Line In 2 as the input for
10969 * front panel mic (mic 2)
10971 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10972 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10974 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10975 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10976 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10979 * Set up output mixers (0x0c - 0x0f)
10981 /* set vol=0 to output mixers */
10982 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10983 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10984 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10986 /* set up input amps for analog loopback */
10987 /* Amp Indices: DAC = 0, mixer = 1 */
10988 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10989 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10990 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10991 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10992 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10993 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10995 /* FIXME: use matrix-type input source selection */
10996 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10997 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10998 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11000 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11001 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11003 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11008 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11016 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
11018 * Unmute ADC0-2 and set the default input to mic-in
11020 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11021 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11022 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11023 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11024 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11025 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11027 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11029 * Note: PASD motherboards uses the Line In 2 as the input for
11030 * front panel mic (mic 2)
11032 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11034 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
11039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
11042 * Set up output mixers (0x0c - 0x0e)
11044 /* set vol=0 to output mixers */
11045 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11046 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11047 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11049 /* set up input amps for analog loopback */
11050 /* Amp Indices: DAC = 0, mixer = 1 */
11051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11053 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11054 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11055 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11056 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11058 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11059 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11060 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11063 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11065 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11066 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11068 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11070 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11072 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11074 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11075 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11076 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11077 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11078 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11079 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11082 /* FIXME: use matrix-type input source selection */
11083 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11084 /* Input mixer1: only unmute Mic */
11085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
11087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11088 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11089 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11090 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
11091 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
11092 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
11093 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
11095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
11097 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11098 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11099 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11100 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
11101 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
11102 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
11103 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
11105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8))},
11107 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
11108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
11109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
11110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x05 << 8))},
11111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x06 << 8))},
11112 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x07 << 8))},
11113 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x08 << 8))},
11115 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11120 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
11122 * Unmute ADC0-2 and set the default input to mic-in
11124 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
11125 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11126 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11127 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11128 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11129 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11131 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11133 * Note: PASD motherboards uses the Line In 2 as the input for front
11134 * panel mic (mic 2)
11136 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11139 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11140 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11141 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11142 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
11143 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
11144 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
11146 * Set up output mixers (0x0c - 0x0e)
11148 /* set vol=0 to output mixers */
11149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11150 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11151 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11153 /* set up input amps for analog loopback */
11154 /* Amp Indices: DAC = 0, mixer = 1 */
11155 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11156 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11157 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11158 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11159 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11160 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11163 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
11164 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
11165 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
11166 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
11167 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
11168 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
11169 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
11171 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11174 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11175 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11177 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11178 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11179 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11180 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
11181 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11182 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
11184 /* FIXME: use matrix-type input source selection */
11185 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11186 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11187 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11188 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
11189 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
11190 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
11191 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
11192 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
11195 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11196 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11197 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
11198 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
11199 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
11200 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11201 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
11203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
11204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
11205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
11206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
11207 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
11208 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11209 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
11211 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11216 static struct hda_verb alc262_toshiba_rx1_unsol_verbs
[] = {
11218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Front Speaker */
11219 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11220 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
11222 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* MIC jack */
11223 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
11224 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
11225 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
11227 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP jack */
11228 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11229 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11234 #ifdef CONFIG_SND_HDA_POWER_SAVE
11235 #define alc262_loopbacks alc880_loopbacks
11238 /* pcm configuration: identical with ALC880 */
11239 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11240 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11241 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11242 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11245 * BIOS auto configuration
11247 static int alc262_parse_auto_config(struct hda_codec
*codec
)
11249 struct alc_spec
*spec
= codec
->spec
;
11251 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
11253 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11257 if (!spec
->autocfg
.line_outs
) {
11258 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
11259 spec
->multiout
.max_channels
= 2;
11260 spec
->no_analog
= 1;
11263 return 0; /* can't find valid BIOS pin config */
11265 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11268 err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
11272 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
11275 if (spec
->autocfg
.dig_outs
) {
11276 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
11277 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
11279 if (spec
->autocfg
.dig_in_pin
)
11280 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
11282 if (spec
->kctls
.list
)
11283 add_mixer(spec
, spec
->kctls
.list
);
11285 add_verb(spec
, alc262_volume_init_verbs
);
11286 spec
->num_mux_defs
= 1;
11287 spec
->input_mux
= &spec
->private_imux
[0];
11289 err
= alc_auto_add_mic_boost(codec
);
11293 alc_ssid_check(codec
, 0x15, 0x14, 0x1b);
11298 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11299 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11300 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11301 #define alc262_auto_init_input_src alc882_auto_init_input_src
11304 /* init callback for auto-configuration model -- overriding the default init */
11305 static void alc262_auto_init(struct hda_codec
*codec
)
11307 struct alc_spec
*spec
= codec
->spec
;
11308 alc262_auto_init_multi_out(codec
);
11309 alc262_auto_init_hp_out(codec
);
11310 alc262_auto_init_analog_input(codec
);
11311 alc262_auto_init_input_src(codec
);
11312 if (spec
->unsol_event
)
11313 alc_inithook(codec
);
11317 * configuration and preset
11319 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
11320 [ALC262_BASIC
] = "basic",
11321 [ALC262_HIPPO
] = "hippo",
11322 [ALC262_HIPPO_1
] = "hippo_1",
11323 [ALC262_FUJITSU
] = "fujitsu",
11324 [ALC262_HP_BPC
] = "hp-bpc",
11325 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
11326 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
11327 [ALC262_HP_RP5700
] = "hp-rp5700",
11328 [ALC262_BENQ_ED8
] = "benq",
11329 [ALC262_BENQ_T31
] = "benq-t31",
11330 [ALC262_SONY_ASSAMD
] = "sony-assamd",
11331 [ALC262_TOSHIBA_S06
] = "toshiba-s06",
11332 [ALC262_TOSHIBA_RX1
] = "toshiba-rx1",
11333 [ALC262_ULTRA
] = "ultra",
11334 [ALC262_LENOVO_3000
] = "lenovo-3000",
11335 [ALC262_NEC
] = "nec",
11336 [ALC262_TYAN
] = "tyan",
11337 [ALC262_AUTO
] = "auto",
11340 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
11341 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
11342 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
11343 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11345 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11347 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11349 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
11350 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
11351 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
11352 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
11353 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
11354 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
11355 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
11356 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
11357 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
11358 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
11359 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
11360 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11361 ALC262_HP_TC_T5735
),
11362 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
11363 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
11364 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
11365 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
11366 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO
), /* dig-only */
11367 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06
),
11368 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11369 ALC262_SONY_ASSAMD
),
11370 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11371 ALC262_TOSHIBA_RX1
),
11372 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06
),
11373 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
11374 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
11375 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN
),
11376 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11378 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO
),
11379 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
11380 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
11381 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
11382 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
11386 static struct alc_config_preset alc262_presets
[] = {
11388 .mixers
= { alc262_base_mixer
},
11389 .init_verbs
= { alc262_init_verbs
},
11390 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11391 .dac_nids
= alc262_dac_nids
,
11393 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11394 .channel_mode
= alc262_modes
,
11395 .input_mux
= &alc262_capture_source
,
11398 .mixers
= { alc262_hippo_mixer
},
11399 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
11400 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11401 .dac_nids
= alc262_dac_nids
,
11403 .dig_out_nid
= ALC262_DIGOUT_NID
,
11404 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11405 .channel_mode
= alc262_modes
,
11406 .input_mux
= &alc262_capture_source
,
11407 .unsol_event
= alc262_hippo_unsol_event
,
11408 .init_hook
= alc262_hippo_init_hook
,
11410 [ALC262_HIPPO_1
] = {
11411 .mixers
= { alc262_hippo1_mixer
},
11412 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
11413 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11414 .dac_nids
= alc262_dac_nids
,
11416 .dig_out_nid
= ALC262_DIGOUT_NID
,
11417 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11418 .channel_mode
= alc262_modes
,
11419 .input_mux
= &alc262_capture_source
,
11420 .unsol_event
= alc262_hippo_unsol_event
,
11421 .init_hook
= alc262_hippo1_init_hook
,
11423 [ALC262_FUJITSU
] = {
11424 .mixers
= { alc262_fujitsu_mixer
},
11425 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
11426 alc262_fujitsu_unsol_verbs
},
11427 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11428 .dac_nids
= alc262_dac_nids
,
11430 .dig_out_nid
= ALC262_DIGOUT_NID
,
11431 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11432 .channel_mode
= alc262_modes
,
11433 .input_mux
= &alc262_fujitsu_capture_source
,
11434 .unsol_event
= alc262_fujitsu_unsol_event
,
11435 .init_hook
= alc262_fujitsu_init_hook
,
11437 [ALC262_HP_BPC
] = {
11438 .mixers
= { alc262_HP_BPC_mixer
},
11439 .init_verbs
= { alc262_HP_BPC_init_verbs
},
11440 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11441 .dac_nids
= alc262_dac_nids
,
11443 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11444 .channel_mode
= alc262_modes
,
11445 .input_mux
= &alc262_HP_capture_source
,
11446 .unsol_event
= alc262_hp_bpc_unsol_event
,
11447 .init_hook
= alc262_hp_bpc_automute
,
11449 [ALC262_HP_BPC_D7000_WF
] = {
11450 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
11451 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
11452 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11453 .dac_nids
= alc262_dac_nids
,
11455 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11456 .channel_mode
= alc262_modes
,
11457 .input_mux
= &alc262_HP_D7000_capture_source
,
11458 .unsol_event
= alc262_hp_wildwest_unsol_event
,
11459 .init_hook
= alc262_hp_wildwest_automute
,
11461 [ALC262_HP_BPC_D7000_WL
] = {
11462 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
11463 alc262_HP_BPC_WildWest_option_mixer
},
11464 .init_verbs
= { alc262_HP_BPC_WildWest_init_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_HP_D7000_capture_source
,
11471 .unsol_event
= alc262_hp_wildwest_unsol_event
,
11472 .init_hook
= alc262_hp_wildwest_automute
,
11474 [ALC262_HP_TC_T5735
] = {
11475 .mixers
= { alc262_hp_t5735_mixer
},
11476 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
11477 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11478 .dac_nids
= alc262_dac_nids
,
11480 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11481 .channel_mode
= alc262_modes
,
11482 .input_mux
= &alc262_capture_source
,
11483 .unsol_event
= alc_automute_amp_unsol_event
,
11484 .init_hook
= alc262_hp_t5735_init_hook
,
11486 [ALC262_HP_RP5700
] = {
11487 .mixers
= { alc262_hp_rp5700_mixer
},
11488 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
11489 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11490 .dac_nids
= alc262_dac_nids
,
11491 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11492 .channel_mode
= alc262_modes
,
11493 .input_mux
= &alc262_hp_rp5700_capture_source
,
11495 [ALC262_BENQ_ED8
] = {
11496 .mixers
= { alc262_base_mixer
},
11497 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
11498 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11499 .dac_nids
= alc262_dac_nids
,
11501 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11502 .channel_mode
= alc262_modes
,
11503 .input_mux
= &alc262_capture_source
,
11505 [ALC262_SONY_ASSAMD
] = {
11506 .mixers
= { alc262_sony_mixer
},
11507 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
11508 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11509 .dac_nids
= alc262_dac_nids
,
11511 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11512 .channel_mode
= alc262_modes
,
11513 .input_mux
= &alc262_capture_source
,
11514 .unsol_event
= alc262_hippo_unsol_event
,
11515 .init_hook
= alc262_hippo_init_hook
,
11517 [ALC262_BENQ_T31
] = {
11518 .mixers
= { alc262_benq_t31_mixer
},
11519 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
, alc262_hippo_unsol_verbs
},
11520 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11521 .dac_nids
= alc262_dac_nids
,
11523 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11524 .channel_mode
= alc262_modes
,
11525 .input_mux
= &alc262_capture_source
,
11526 .unsol_event
= alc262_hippo_unsol_event
,
11527 .init_hook
= alc262_hippo_init_hook
,
11530 .mixers
= { alc262_ultra_mixer
},
11531 .cap_mixer
= alc262_ultra_capture_mixer
,
11532 .init_verbs
= { alc262_ultra_verbs
},
11533 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11534 .dac_nids
= alc262_dac_nids
,
11535 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11536 .channel_mode
= alc262_modes
,
11537 .input_mux
= &alc262_ultra_capture_source
,
11538 .adc_nids
= alc262_adc_nids
, /* ADC0 */
11539 .capsrc_nids
= alc262_capsrc_nids
,
11540 .num_adc_nids
= 1, /* single ADC */
11541 .unsol_event
= alc262_ultra_unsol_event
,
11542 .init_hook
= alc262_ultra_automute
,
11544 [ALC262_LENOVO_3000
] = {
11545 .mixers
= { alc262_lenovo_3000_mixer
},
11546 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
11547 alc262_lenovo_3000_unsol_verbs
},
11548 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11549 .dac_nids
= alc262_dac_nids
,
11551 .dig_out_nid
= ALC262_DIGOUT_NID
,
11552 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11553 .channel_mode
= alc262_modes
,
11554 .input_mux
= &alc262_fujitsu_capture_source
,
11555 .unsol_event
= alc262_lenovo_3000_unsol_event
,
11558 .mixers
= { alc262_nec_mixer
},
11559 .init_verbs
= { alc262_nec_verbs
},
11560 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11561 .dac_nids
= alc262_dac_nids
,
11563 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11564 .channel_mode
= alc262_modes
,
11565 .input_mux
= &alc262_capture_source
,
11567 [ALC262_TOSHIBA_S06
] = {
11568 .mixers
= { alc262_toshiba_s06_mixer
},
11569 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_s06_verbs
,
11570 alc262_eapd_verbs
},
11571 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11572 .capsrc_nids
= alc262_dmic_capsrc_nids
,
11573 .dac_nids
= alc262_dac_nids
,
11574 .adc_nids
= alc262_dmic_adc_nids
, /* ADC0 */
11575 .num_adc_nids
= 1, /* single ADC */
11576 .dig_out_nid
= ALC262_DIGOUT_NID
,
11577 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11578 .channel_mode
= alc262_modes
,
11579 .input_mux
= &alc262_dmic_capture_source
,
11580 .unsol_event
= alc262_toshiba_s06_unsol_event
,
11581 .init_hook
= alc262_toshiba_s06_init_hook
,
11583 [ALC262_TOSHIBA_RX1
] = {
11584 .mixers
= { alc262_toshiba_rx1_mixer
},
11585 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_rx1_unsol_verbs
},
11586 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11587 .dac_nids
= alc262_dac_nids
,
11589 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11590 .channel_mode
= alc262_modes
,
11591 .input_mux
= &alc262_capture_source
,
11592 .unsol_event
= alc262_hippo_unsol_event
,
11593 .init_hook
= alc262_hippo_init_hook
,
11596 .mixers
= { alc262_tyan_mixer
},
11597 .init_verbs
= { alc262_init_verbs
, alc262_tyan_verbs
},
11598 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
11599 .dac_nids
= alc262_dac_nids
,
11601 .dig_out_nid
= ALC262_DIGOUT_NID
,
11602 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
11603 .channel_mode
= alc262_modes
,
11604 .input_mux
= &alc262_capture_source
,
11605 .unsol_event
= alc_automute_amp_unsol_event
,
11606 .init_hook
= alc262_tyan_init_hook
,
11610 static int patch_alc262(struct hda_codec
*codec
)
11612 struct alc_spec
*spec
;
11616 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
11620 codec
->spec
= spec
;
11622 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11627 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
11628 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
11629 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
11630 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
11634 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
11636 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
11640 if (board_config
< 0) {
11641 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
11642 "trying auto-probe from BIOS...\n", codec
->chip_name
);
11643 board_config
= ALC262_AUTO
;
11646 if (board_config
== ALC262_AUTO
) {
11647 /* automatic parse from the BIOS config */
11648 err
= alc262_parse_auto_config(codec
);
11654 "hda_codec: Cannot set up configuration "
11655 "from BIOS. Using base mode...\n");
11656 board_config
= ALC262_BASIC
;
11660 if (!spec
->no_analog
) {
11661 err
= snd_hda_attach_beep_device(codec
, 0x1);
11668 if (board_config
!= ALC262_AUTO
)
11669 setup_preset(spec
, &alc262_presets
[board_config
]);
11671 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
11672 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
11674 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
11675 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
11677 if (!spec
->adc_nids
&& spec
->input_mux
) {
11679 /* check whether the digital-mic has to be supported */
11680 for (i
= 0; i
< spec
->input_mux
->num_items
; i
++) {
11681 if (spec
->input_mux
->items
[i
].index
>= 9)
11684 if (i
< spec
->input_mux
->num_items
) {
11685 /* use only ADC0 */
11686 spec
->adc_nids
= alc262_dmic_adc_nids
;
11687 spec
->num_adc_nids
= 1;
11688 spec
->capsrc_nids
= alc262_dmic_capsrc_nids
;
11690 /* all analog inputs */
11691 /* check whether NID 0x07 is valid */
11692 unsigned int wcap
= get_wcaps(codec
, 0x07);
11695 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
11696 if (wcap
!= AC_WID_AUD_IN
) {
11697 spec
->adc_nids
= alc262_adc_nids_alt
;
11698 spec
->num_adc_nids
=
11699 ARRAY_SIZE(alc262_adc_nids_alt
);
11700 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
11702 spec
->adc_nids
= alc262_adc_nids
;
11703 spec
->num_adc_nids
=
11704 ARRAY_SIZE(alc262_adc_nids
);
11705 spec
->capsrc_nids
= alc262_capsrc_nids
;
11709 if (!spec
->cap_mixer
&& !spec
->no_analog
)
11710 set_capture_mixer(spec
);
11711 if (!spec
->no_analog
)
11712 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
11714 spec
->vmaster_nid
= 0x0c;
11716 codec
->patch_ops
= alc_patch_ops
;
11717 if (board_config
== ALC262_AUTO
)
11718 spec
->init_hook
= alc262_auto_init
;
11719 #ifdef CONFIG_SND_HDA_POWER_SAVE
11720 if (!spec
->loopback
.amplist
)
11721 spec
->loopback
.amplist
= alc262_loopbacks
;
11723 codec
->proc_widget_hook
= print_realtek_coef
;
11729 * ALC268 channel source setting (2 channel)
11731 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11732 #define alc268_modes alc260_modes
11734 static hda_nid_t alc268_dac_nids
[2] = {
11739 static hda_nid_t alc268_adc_nids
[2] = {
11744 static hda_nid_t alc268_adc_nids_alt
[1] = {
11749 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
11751 static struct snd_kcontrol_new alc268_base_mixer
[] = {
11752 /* output mixer control */
11753 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
11754 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11755 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
11756 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11757 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11758 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
11759 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
11763 static struct snd_kcontrol_new alc268_toshiba_mixer
[] = {
11764 /* output mixer control */
11765 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
11766 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
11767 ALC262_HIPPO_MASTER_SWITCH
,
11768 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11769 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
11770 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
11774 /* bind Beep switches of both NID 0x0f and 0x10 */
11775 static struct hda_bind_ctls alc268_bind_beep_sw
= {
11776 .ops
= &snd_hda_bind_sw
,
11778 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
11779 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
11784 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
11785 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
11786 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
11790 static struct hda_verb alc268_eapd_verbs
[] = {
11791 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11792 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11796 /* Toshiba specific */
11797 static struct hda_verb alc268_toshiba_verbs
[] = {
11798 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11802 static struct hda_input_mux alc268_acer_lc_capture_source
= {
11810 /* Acer specific */
11811 /* bind volumes of both NID 0x02 and 0x03 */
11812 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
11813 .ops
= &snd_hda_bind_vol
,
11815 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
11816 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
11821 /* mute/unmute internal speaker according to the hp jack and mute state */
11822 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
11824 struct alc_spec
*spec
= codec
->spec
;
11827 if (force
|| !spec
->sense_updated
) {
11828 unsigned int present
;
11829 present
= snd_hda_codec_read(codec
, 0x14, 0,
11830 AC_VERB_GET_PIN_SENSE
, 0);
11831 spec
->jack_present
= (present
& 0x80000000) != 0;
11832 spec
->sense_updated
= 1;
11834 if (spec
->jack_present
)
11835 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
11836 else /* unmute internal speaker if necessary */
11837 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
11838 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
11839 HDA_AMP_MUTE
, mute
);
11843 /* bind hp and internal speaker mute (with plug check) */
11844 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
11845 struct snd_ctl_elem_value
*ucontrol
)
11847 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11848 long *valp
= ucontrol
->value
.integer
.value
;
11851 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
11853 valp
[0] ? 0 : HDA_AMP_MUTE
);
11854 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
11856 valp
[1] ? 0 : HDA_AMP_MUTE
);
11858 alc268_acer_automute(codec
, 0);
11862 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer
[] = {
11863 /* output mixer control */
11864 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
11866 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11867 .name
= "Master Playback Switch",
11868 .info
= snd_hda_mixer_amp_switch_info
,
11869 .get
= snd_hda_mixer_amp_switch_get
,
11870 .put
= alc268_acer_master_sw_put
,
11871 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11873 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT
),
11877 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
11878 /* output mixer control */
11879 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
11881 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11882 .name
= "Master Playback Switch",
11883 .info
= snd_hda_mixer_amp_switch_info
,
11884 .get
= snd_hda_mixer_amp_switch_get
,
11885 .put
= alc268_acer_master_sw_put
,
11886 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11888 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11889 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
11890 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
11894 static struct snd_kcontrol_new alc268_acer_dmic_mixer
[] = {
11895 /* output mixer control */
11896 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
11898 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11899 .name
= "Master Playback Switch",
11900 .info
= snd_hda_mixer_amp_switch_info
,
11901 .get
= snd_hda_mixer_amp_switch_get
,
11902 .put
= alc268_acer_master_sw_put
,
11903 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11905 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11906 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
11910 static struct hda_verb alc268_acer_aspire_one_verbs
[] = {
11911 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11912 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11913 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11914 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11915 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x06},
11916 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, 0xa017},
11920 static struct hda_verb alc268_acer_verbs
[] = {
11921 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
11922 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11924 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11925 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11926 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11927 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11931 /* unsolicited event for HP jack sensing */
11932 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11933 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11935 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
11938 if ((res
>> 26) != ALC880_HP_EVENT
)
11940 alc268_acer_automute(codec
, 1);
11943 static void alc268_acer_init_hook(struct hda_codec
*codec
)
11945 alc268_acer_automute(codec
, 1);
11948 /* toggle speaker-output according to the hp-jack state */
11949 static void alc268_aspire_one_speaker_automute(struct hda_codec
*codec
)
11951 unsigned int present
;
11952 unsigned char bits
;
11954 present
= snd_hda_codec_read(codec
, 0x15, 0,
11955 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11956 bits
= present
? AMP_IN_MUTE(0) : 0;
11957 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 0,
11958 AMP_IN_MUTE(0), bits
);
11959 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 1,
11960 AMP_IN_MUTE(0), bits
);
11964 static void alc268_acer_mic_automute(struct hda_codec
*codec
)
11966 unsigned int present
;
11968 present
= snd_hda_codec_read(codec
, 0x18, 0,
11969 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11970 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_CONNECT_SEL
,
11971 present
? 0x0 : 0x6);
11974 static void alc268_acer_lc_unsol_event(struct hda_codec
*codec
,
11977 if ((res
>> 26) == ALC880_HP_EVENT
)
11978 alc268_aspire_one_speaker_automute(codec
);
11979 if ((res
>> 26) == ALC880_MIC_EVENT
)
11980 alc268_acer_mic_automute(codec
);
11983 static void alc268_acer_lc_init_hook(struct hda_codec
*codec
)
11985 alc268_aspire_one_speaker_automute(codec
);
11986 alc268_acer_mic_automute(codec
);
11989 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
11990 /* output mixer control */
11991 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11992 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11993 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
11994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11995 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11996 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
12000 static struct hda_verb alc268_dell_verbs
[] = {
12001 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12002 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12003 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12007 /* mute/unmute internal speaker according to the hp jack and mute state */
12008 static void alc268_dell_init_hook(struct hda_codec
*codec
)
12010 struct alc_spec
*spec
= codec
->spec
;
12012 spec
->autocfg
.hp_pins
[0] = 0x15;
12013 spec
->autocfg
.speaker_pins
[0] = 0x14;
12014 alc_automute_pin(codec
);
12017 static struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
12018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
12019 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12020 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
12021 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12022 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12023 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
12024 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
12025 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
12029 static struct hda_verb alc267_quanta_il1_verbs
[] = {
12030 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12031 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
12035 static void alc267_quanta_il1_mic_automute(struct hda_codec
*codec
)
12037 unsigned int present
;
12039 present
= snd_hda_codec_read(codec
, 0x18, 0,
12040 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12041 snd_hda_codec_write(codec
, 0x23, 0,
12042 AC_VERB_SET_CONNECT_SEL
,
12043 present
? 0x00 : 0x01);
12046 static void alc267_quanta_il1_init_hook(struct hda_codec
*codec
)
12048 struct alc_spec
*spec
= codec
->spec
;
12050 spec
->autocfg
.hp_pins
[0] = 0x15;
12051 spec
->autocfg
.speaker_pins
[0] = 0x14;
12052 alc_automute_pin(codec
);
12053 alc267_quanta_il1_mic_automute(codec
);
12056 static void alc267_quanta_il1_unsol_event(struct hda_codec
*codec
,
12059 switch (res
>> 26) {
12060 case ALC880_MIC_EVENT
:
12061 alc267_quanta_il1_mic_automute(codec
);
12064 alc_sku_unsol_event(codec
, res
);
12070 * generic initialization of ADC, input mixers and output mixers
12072 static struct hda_verb alc268_base_init_verbs
[] = {
12073 /* Unmute DAC0-1 and set vol = 0 */
12074 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12075 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12078 * Set up output mixers (0x0c - 0x0e)
12080 /* set vol=0 to output mixers */
12081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12082 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
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 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
12088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
12089 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
12090 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12091 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12092 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12093 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12094 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12096 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12097 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12098 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12099 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12100 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12102 /* set PCBEEP vol = 0, mute connections */
12103 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12104 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12105 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12107 /* Unmute Selector 23h,24h and set the default input to mic-in */
12109 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
12110 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12111 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
12112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12118 * generic initialization of ADC, input mixers and output mixers
12120 static struct hda_verb alc268_volume_init_verbs
[] = {
12121 /* set output DAC */
12122 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12123 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12125 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12126 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
12127 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12128 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12129 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
12131 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12132 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12133 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12135 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12136 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12138 /* set PCBEEP vol = 0, mute connections */
12139 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12140 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12141 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12146 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
12147 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12148 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
12150 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12151 /* The multiple "Capture Source" controls confuse alsamixer
12152 * So call somewhat different..
12154 /* .name = "Capture Source", */
12155 .name
= "Input Source",
12157 .info
= alc_mux_enum_info
,
12158 .get
= alc_mux_enum_get
,
12159 .put
= alc_mux_enum_put
,
12164 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
12165 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12166 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
12167 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
12168 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
12170 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12171 /* The multiple "Capture Source" controls confuse alsamixer
12172 * So call somewhat different..
12174 /* .name = "Capture Source", */
12175 .name
= "Input Source",
12177 .info
= alc_mux_enum_info
,
12178 .get
= alc_mux_enum_get
,
12179 .put
= alc_mux_enum_put
,
12184 static struct hda_input_mux alc268_capture_source
= {
12188 { "Front Mic", 0x1 },
12194 static struct hda_input_mux alc268_acer_capture_source
= {
12198 { "Internal Mic", 0x1 },
12203 static struct hda_input_mux alc268_acer_dmic_capture_source
= {
12207 { "Internal Mic", 0x6 },
12212 #ifdef CONFIG_SND_DEBUG
12213 static struct snd_kcontrol_new alc268_test_mixer
[] = {
12214 /* Volume widgets */
12215 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12216 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12217 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
12218 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
12219 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
12220 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
12221 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
12222 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
12223 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
12224 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
12225 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
12226 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
12227 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
12228 /* The below appears problematic on some hardwares */
12229 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12230 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
12231 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
12232 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
12233 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
12235 /* Modes for retasking pin widgets */
12236 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
12237 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
12238 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
12239 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
12241 /* Controls for GPIO pins, assuming they are configured as outputs */
12242 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12243 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12244 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12245 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12247 /* Switches to allow the digital SPDIF output pin to be enabled.
12248 * The ALC268 does not have an SPDIF input.
12250 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12252 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12253 * this output to turn on an external amplifier.
12255 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12256 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12262 /* create input playback/capture controls for the given pin */
12263 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
12264 const char *ctlname
, int idx
)
12269 sprintf(name
, "%s Playback Volume", ctlname
);
12271 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
12272 HDA_COMPOSE_AMP_VAL(0x02, 3, idx
,
12276 } else if (nid
== 0x15) {
12277 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
12278 HDA_COMPOSE_AMP_VAL(0x03, 3, idx
,
12284 sprintf(name
, "%s Playback Switch", ctlname
);
12285 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
12286 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
12292 /* add playback controls from the parsed DAC table */
12293 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12294 const struct auto_pin_cfg
*cfg
)
12299 spec
->multiout
.num_dacs
= 2; /* only use one dac */
12300 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
12301 spec
->multiout
.dac_nids
[0] = 2;
12302 spec
->multiout
.dac_nids
[1] = 3;
12304 nid
= cfg
->line_out_pins
[0];
12306 alc268_new_analog_output(spec
, nid
, "Front", 0);
12308 nid
= cfg
->speaker_pins
[0];
12310 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12311 "Speaker Playback Volume",
12312 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
12316 nid
= cfg
->hp_pins
[0];
12318 alc268_new_analog_output(spec
, nid
, "Headphone", 0);
12320 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
12322 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12323 "Mono Playback Switch",
12324 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_INPUT
));
12331 /* create playback/capture controls for input pins */
12332 static int alc268_auto_create_analog_input_ctls(struct alc_spec
*spec
,
12333 const struct auto_pin_cfg
*cfg
)
12335 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
12338 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12339 switch(cfg
->input_pins
[i
]) {
12341 idx1
= 0; /* Mic 1 */
12344 idx1
= 1; /* Mic 2 */
12347 idx1
= 2; /* Line In */
12354 idx1
= 6; /* digital mics */
12359 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
12360 imux
->items
[imux
->num_items
].index
= idx1
;
12366 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
12368 struct alc_spec
*spec
= codec
->spec
;
12369 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
12370 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
12371 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
12372 unsigned int dac_vol1
, dac_vol2
;
12375 snd_hda_codec_write(codec
, speaker_nid
, 0,
12376 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
12377 snd_hda_codec_write(codec
, 0x0f, 0,
12378 AC_VERB_SET_AMP_GAIN_MUTE
,
12380 snd_hda_codec_write(codec
, 0x10, 0,
12381 AC_VERB_SET_AMP_GAIN_MUTE
,
12384 snd_hda_codec_write(codec
, 0x0f, 0,
12385 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
12386 snd_hda_codec_write(codec
, 0x10, 0,
12387 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
12390 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
12391 if (line_nid
== 0x14)
12392 dac_vol2
= AMP_OUT_ZERO
;
12393 else if (line_nid
== 0x15)
12394 dac_vol1
= AMP_OUT_ZERO
;
12395 if (hp_nid
== 0x14)
12396 dac_vol2
= AMP_OUT_ZERO
;
12397 else if (hp_nid
== 0x15)
12398 dac_vol1
= AMP_OUT_ZERO
;
12399 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
12400 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
12401 spec
->autocfg
.line_out_pins
[2] != 0x16)
12402 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
12404 snd_hda_codec_write(codec
, 0x02, 0,
12405 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
12406 snd_hda_codec_write(codec
, 0x03, 0,
12407 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
12410 /* pcm configuration: identical with ALC880 */
12411 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12412 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12413 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12414 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12417 * BIOS auto configuration
12419 static int alc268_parse_auto_config(struct hda_codec
*codec
)
12421 struct alc_spec
*spec
= codec
->spec
;
12423 static hda_nid_t alc268_ignore
[] = { 0 };
12425 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12429 if (!spec
->autocfg
.line_outs
) {
12430 if (spec
->autocfg
.dig_outs
|| spec
->autocfg
.dig_in_pin
) {
12431 spec
->multiout
.max_channels
= 2;
12432 spec
->no_analog
= 1;
12435 return 0; /* can't find valid BIOS pin config */
12437 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12440 err
= alc268_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
12444 spec
->multiout
.max_channels
= 2;
12447 /* digital only support output */
12448 if (spec
->autocfg
.dig_outs
) {
12449 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
12450 spec
->dig_out_type
= spec
->autocfg
.dig_out_type
[0];
12452 if (spec
->kctls
.list
)
12453 add_mixer(spec
, spec
->kctls
.list
);
12455 if (!spec
->no_analog
&& spec
->autocfg
.speaker_pins
[0] != 0x1d)
12456 add_mixer(spec
, alc268_beep_mixer
);
12458 add_verb(spec
, alc268_volume_init_verbs
);
12459 spec
->num_mux_defs
= 1;
12460 spec
->input_mux
= &spec
->private_imux
[0];
12462 err
= alc_auto_add_mic_boost(codec
);
12466 alc_ssid_check(codec
, 0x15, 0x1b, 0x14);
12471 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12472 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12473 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12475 /* init callback for auto-configuration model -- overriding the default init */
12476 static void alc268_auto_init(struct hda_codec
*codec
)
12478 struct alc_spec
*spec
= codec
->spec
;
12479 alc268_auto_init_multi_out(codec
);
12480 alc268_auto_init_hp_out(codec
);
12481 alc268_auto_init_mono_speaker_out(codec
);
12482 alc268_auto_init_analog_input(codec
);
12483 if (spec
->unsol_event
)
12484 alc_inithook(codec
);
12488 * configuration and preset
12490 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
12491 [ALC267_QUANTA_IL1
] = "quanta-il1",
12492 [ALC268_3ST
] = "3stack",
12493 [ALC268_TOSHIBA
] = "toshiba",
12494 [ALC268_ACER
] = "acer",
12495 [ALC268_ACER_DMIC
] = "acer-dmic",
12496 [ALC268_ACER_ASPIRE_ONE
] = "acer-aspire",
12497 [ALC268_DELL
] = "dell",
12498 [ALC268_ZEPTO
] = "zepto",
12499 #ifdef CONFIG_SND_DEBUG
12500 [ALC268_TEST
] = "test",
12502 [ALC268_AUTO
] = "auto",
12505 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
12506 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
12507 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
12508 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
12509 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
12510 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
12511 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12512 ALC268_ACER_ASPIRE_ONE
),
12513 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
12514 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL
),
12515 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12517 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
12518 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
12519 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12521 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
12522 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
12523 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
12524 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL
),
12528 static struct alc_config_preset alc268_presets
[] = {
12529 [ALC267_QUANTA_IL1
] = {
12530 .mixers
= { alc267_quanta_il1_mixer
, alc268_beep_mixer
},
12531 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12532 alc267_quanta_il1_verbs
},
12533 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12534 .dac_nids
= alc268_dac_nids
,
12535 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12536 .adc_nids
= alc268_adc_nids_alt
,
12538 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12539 .channel_mode
= alc268_modes
,
12540 .input_mux
= &alc268_capture_source
,
12541 .unsol_event
= alc267_quanta_il1_unsol_event
,
12542 .init_hook
= alc267_quanta_il1_init_hook
,
12545 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
12546 alc268_beep_mixer
},
12547 .init_verbs
= { alc268_base_init_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 .dig_out_nid
= ALC268_DIGOUT_NID
,
12555 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12556 .channel_mode
= alc268_modes
,
12557 .input_mux
= &alc268_capture_source
,
12559 [ALC268_TOSHIBA
] = {
12560 .mixers
= { alc268_toshiba_mixer
, alc268_capture_alt_mixer
,
12561 alc268_beep_mixer
},
12562 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12563 alc268_toshiba_verbs
},
12564 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12565 .dac_nids
= alc268_dac_nids
,
12566 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12567 .adc_nids
= alc268_adc_nids_alt
,
12568 .capsrc_nids
= alc268_capsrc_nids
,
12570 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12571 .channel_mode
= alc268_modes
,
12572 .input_mux
= &alc268_capture_source
,
12573 .unsol_event
= alc268_toshiba_unsol_event
,
12574 .init_hook
= alc268_toshiba_init_hook
,
12577 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
12578 alc268_beep_mixer
},
12579 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12580 alc268_acer_verbs
},
12581 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12582 .dac_nids
= alc268_dac_nids
,
12583 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12584 .adc_nids
= alc268_adc_nids_alt
,
12585 .capsrc_nids
= alc268_capsrc_nids
,
12587 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12588 .channel_mode
= alc268_modes
,
12589 .input_mux
= &alc268_acer_capture_source
,
12590 .unsol_event
= alc268_acer_unsol_event
,
12591 .init_hook
= alc268_acer_init_hook
,
12593 [ALC268_ACER_DMIC
] = {
12594 .mixers
= { alc268_acer_dmic_mixer
, alc268_capture_alt_mixer
,
12595 alc268_beep_mixer
},
12596 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12597 alc268_acer_verbs
},
12598 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12599 .dac_nids
= alc268_dac_nids
,
12600 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12601 .adc_nids
= alc268_adc_nids_alt
,
12602 .capsrc_nids
= alc268_capsrc_nids
,
12604 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12605 .channel_mode
= alc268_modes
,
12606 .input_mux
= &alc268_acer_dmic_capture_source
,
12607 .unsol_event
= alc268_acer_unsol_event
,
12608 .init_hook
= alc268_acer_init_hook
,
12610 [ALC268_ACER_ASPIRE_ONE
] = {
12611 .mixers
= { alc268_acer_aspire_one_mixer
,
12613 alc268_capture_alt_mixer
},
12614 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12615 alc268_acer_aspire_one_verbs
},
12616 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12617 .dac_nids
= alc268_dac_nids
,
12618 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12619 .adc_nids
= alc268_adc_nids_alt
,
12620 .capsrc_nids
= alc268_capsrc_nids
,
12622 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12623 .channel_mode
= alc268_modes
,
12624 .input_mux
= &alc268_acer_lc_capture_source
,
12625 .unsol_event
= alc268_acer_lc_unsol_event
,
12626 .init_hook
= alc268_acer_lc_init_hook
,
12629 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
},
12630 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12631 alc268_dell_verbs
},
12632 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12633 .dac_nids
= alc268_dac_nids
,
12635 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12636 .channel_mode
= alc268_modes
,
12637 .unsol_event
= alc_sku_unsol_event
,
12638 .init_hook
= alc268_dell_init_hook
,
12639 .input_mux
= &alc268_capture_source
,
12642 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
12643 alc268_beep_mixer
},
12644 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12645 alc268_toshiba_verbs
},
12646 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12647 .dac_nids
= alc268_dac_nids
,
12648 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12649 .adc_nids
= alc268_adc_nids_alt
,
12650 .capsrc_nids
= alc268_capsrc_nids
,
12652 .dig_out_nid
= ALC268_DIGOUT_NID
,
12653 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12654 .channel_mode
= alc268_modes
,
12655 .input_mux
= &alc268_capture_source
,
12656 .unsol_event
= alc268_toshiba_unsol_event
,
12657 .init_hook
= alc268_toshiba_init_hook
12659 #ifdef CONFIG_SND_DEBUG
12661 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
12662 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
12663 alc268_volume_init_verbs
},
12664 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
12665 .dac_nids
= alc268_dac_nids
,
12666 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
12667 .adc_nids
= alc268_adc_nids_alt
,
12668 .capsrc_nids
= alc268_capsrc_nids
,
12670 .dig_out_nid
= ALC268_DIGOUT_NID
,
12671 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
12672 .channel_mode
= alc268_modes
,
12673 .input_mux
= &alc268_capture_source
,
12678 static int patch_alc268(struct hda_codec
*codec
)
12680 struct alc_spec
*spec
;
12682 int i
, has_beep
, err
;
12684 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
12688 codec
->spec
= spec
;
12690 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
12694 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
12695 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
12696 "trying auto-probe from BIOS...\n", codec
->chip_name
);
12697 board_config
= ALC268_AUTO
;
12700 if (board_config
== ALC268_AUTO
) {
12701 /* automatic parse from the BIOS config */
12702 err
= alc268_parse_auto_config(codec
);
12708 "hda_codec: Cannot set up configuration "
12709 "from BIOS. Using base mode...\n");
12710 board_config
= ALC268_3ST
;
12714 if (board_config
!= ALC268_AUTO
)
12715 setup_preset(spec
, &alc268_presets
[board_config
]);
12717 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
12718 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
12719 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
12721 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
12724 for (i
= 0; i
< spec
->num_mixers
; i
++) {
12725 if (spec
->mixers
[i
] == alc268_beep_mixer
) {
12732 err
= snd_hda_attach_beep_device(codec
, 0x1);
12737 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
12738 /* override the amp caps for beep generator */
12739 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
12740 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
12741 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
12742 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
12743 (0 << AC_AMPCAP_MUTE_SHIFT
));
12746 if (!spec
->no_analog
&& !spec
->adc_nids
&& spec
->input_mux
) {
12747 /* check whether NID 0x07 is valid */
12748 unsigned int wcap
= get_wcaps(codec
, 0x07);
12752 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
12753 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
12754 spec
->adc_nids
= alc268_adc_nids_alt
;
12755 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
12756 add_mixer(spec
, alc268_capture_alt_mixer
);
12758 spec
->adc_nids
= alc268_adc_nids
;
12759 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
12760 add_mixer(spec
, alc268_capture_mixer
);
12762 spec
->capsrc_nids
= alc268_capsrc_nids
;
12763 /* set default input source */
12764 for (i
= 0; i
< spec
->num_adc_nids
; i
++)
12765 snd_hda_codec_write_cache(codec
, alc268_capsrc_nids
[i
],
12766 0, AC_VERB_SET_CONNECT_SEL
,
12767 spec
->input_mux
->items
[0].index
);
12770 spec
->vmaster_nid
= 0x02;
12772 codec
->patch_ops
= alc_patch_ops
;
12773 if (board_config
== ALC268_AUTO
)
12774 spec
->init_hook
= alc268_auto_init
;
12776 codec
->proc_widget_hook
= print_realtek_coef
;
12782 * ALC269 channel source setting (2 channel)
12784 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12786 #define alc269_dac_nids alc260_dac_nids
12788 static hda_nid_t alc269_adc_nids
[1] = {
12793 static hda_nid_t alc269_capsrc_nids
[1] = {
12797 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12801 static struct hda_input_mux alc269_eeepc_dmic_capture_source
= {
12809 static struct hda_input_mux alc269_eeepc_amic_capture_source
= {
12817 #define alc269_modes alc260_modes
12818 #define alc269_capture_source alc880_lg_lw_capture_source
12820 static struct snd_kcontrol_new alc269_base_mixer
[] = {
12821 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12822 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12823 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
12824 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
12825 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12826 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12827 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12828 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12829 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12830 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12831 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12832 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
12836 static struct snd_kcontrol_new alc269_quanta_fl1_mixer
[] = {
12837 /* output mixer control */
12838 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12840 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12841 .name
= "Master Playback Switch",
12842 .info
= snd_hda_mixer_amp_switch_info
,
12843 .get
= snd_hda_mixer_amp_switch_get
,
12844 .put
= alc268_acer_master_sw_put
,
12845 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
12847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12849 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12850 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12851 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12852 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
12856 static struct snd_kcontrol_new alc269_lifebook_mixer
[] = {
12857 /* output mixer control */
12858 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
12860 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12861 .name
= "Master Playback Switch",
12862 .info
= snd_hda_mixer_amp_switch_info
,
12863 .get
= snd_hda_mixer_amp_switch_get
,
12864 .put
= alc268_acer_master_sw_put
,
12865 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
12867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12869 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12870 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
12871 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
12872 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
12873 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT
),
12874 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT
),
12875 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT
),
12879 static struct snd_kcontrol_new alc269_eeepc_mixer
[] = {
12880 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12881 HDA_CODEC_MUTE("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12883 HDA_CODEC_MUTE("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12887 /* capture mixer elements */
12888 static struct snd_kcontrol_new alc269_epc_capture_mixer
[] = {
12889 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12890 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12891 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12896 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12898 static struct hda_verb alc269_quanta_fl1_verbs
[] = {
12899 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12900 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12902 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12903 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12904 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12908 static struct hda_verb alc269_lifebook_verbs
[] = {
12909 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12910 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
12911 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12912 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12913 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12914 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12915 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12916 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
12917 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12918 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12922 /* toggle speaker-output according to the hp-jack state */
12923 static void alc269_quanta_fl1_speaker_automute(struct hda_codec
*codec
)
12925 unsigned int present
;
12926 unsigned char bits
;
12928 present
= snd_hda_codec_read(codec
, 0x15, 0,
12929 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12930 bits
= present
? AMP_IN_MUTE(0) : 0;
12931 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
12932 AMP_IN_MUTE(0), bits
);
12933 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
12934 AMP_IN_MUTE(0), bits
);
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
, 0x680);
12941 snd_hda_codec_write(codec
, 0x20, 0,
12942 AC_VERB_SET_COEF_INDEX
, 0x0c);
12943 snd_hda_codec_write(codec
, 0x20, 0,
12944 AC_VERB_SET_PROC_COEF
, 0x480);
12947 /* toggle speaker-output according to the hp-jacks state */
12948 static void alc269_lifebook_speaker_automute(struct hda_codec
*codec
)
12950 unsigned int present
;
12951 unsigned char bits
;
12953 /* Check laptop headphone socket */
12954 present
= snd_hda_codec_read(codec
, 0x15, 0,
12955 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12957 /* Check port replicator headphone socket */
12958 present
|= snd_hda_codec_read(codec
, 0x1a, 0,
12959 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12961 bits
= present
? AMP_IN_MUTE(0) : 0;
12962 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
12963 AMP_IN_MUTE(0), bits
);
12964 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
12965 AMP_IN_MUTE(0), bits
);
12967 snd_hda_codec_write(codec
, 0x20, 0,
12968 AC_VERB_SET_COEF_INDEX
, 0x0c);
12969 snd_hda_codec_write(codec
, 0x20, 0,
12970 AC_VERB_SET_PROC_COEF
, 0x680);
12972 snd_hda_codec_write(codec
, 0x20, 0,
12973 AC_VERB_SET_COEF_INDEX
, 0x0c);
12974 snd_hda_codec_write(codec
, 0x20, 0,
12975 AC_VERB_SET_PROC_COEF
, 0x480);
12978 static void alc269_quanta_fl1_mic_automute(struct hda_codec
*codec
)
12980 unsigned int present
;
12982 present
= snd_hda_codec_read(codec
, 0x18, 0,
12983 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12984 snd_hda_codec_write(codec
, 0x23, 0,
12985 AC_VERB_SET_CONNECT_SEL
, present
? 0x0 : 0x1);
12988 static void alc269_lifebook_mic_autoswitch(struct hda_codec
*codec
)
12990 unsigned int present_laptop
;
12991 unsigned int present_dock
;
12993 present_laptop
= snd_hda_codec_read(codec
, 0x18, 0,
12994 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12996 present_dock
= snd_hda_codec_read(codec
, 0x1b, 0,
12997 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12999 /* Laptop mic port overrides dock mic port, design decision */
13001 snd_hda_codec_write(codec
, 0x23, 0,
13002 AC_VERB_SET_CONNECT_SEL
, 0x3);
13003 if (present_laptop
)
13004 snd_hda_codec_write(codec
, 0x23, 0,
13005 AC_VERB_SET_CONNECT_SEL
, 0x0);
13006 if (!present_dock
&& !present_laptop
)
13007 snd_hda_codec_write(codec
, 0x23, 0,
13008 AC_VERB_SET_CONNECT_SEL
, 0x1);
13011 static void alc269_quanta_fl1_unsol_event(struct hda_codec
*codec
,
13014 if ((res
>> 26) == ALC880_HP_EVENT
)
13015 alc269_quanta_fl1_speaker_automute(codec
);
13016 if ((res
>> 26) == ALC880_MIC_EVENT
)
13017 alc269_quanta_fl1_mic_automute(codec
);
13020 static void alc269_lifebook_unsol_event(struct hda_codec
*codec
,
13023 if ((res
>> 26) == ALC880_HP_EVENT
)
13024 alc269_lifebook_speaker_automute(codec
);
13025 if ((res
>> 26) == ALC880_MIC_EVENT
)
13026 alc269_lifebook_mic_autoswitch(codec
);
13029 static void alc269_quanta_fl1_init_hook(struct hda_codec
*codec
)
13031 alc269_quanta_fl1_speaker_automute(codec
);
13032 alc269_quanta_fl1_mic_automute(codec
);
13035 static void alc269_lifebook_init_hook(struct hda_codec
*codec
)
13037 alc269_lifebook_speaker_automute(codec
);
13038 alc269_lifebook_mic_autoswitch(codec
);
13041 static struct hda_verb alc269_eeepc_dmic_init_verbs
[] = {
13042 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13043 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
13044 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
13045 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
13046 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13047 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13048 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13052 static struct hda_verb alc269_eeepc_amic_init_verbs
[] = {
13053 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13054 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
13055 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
13056 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
13057 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13058 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13062 /* toggle speaker-output according to the hp-jack state */
13063 static void alc269_speaker_automute(struct hda_codec
*codec
)
13065 unsigned int present
;
13066 unsigned char bits
;
13068 present
= snd_hda_codec_read(codec
, 0x15, 0,
13069 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13070 bits
= present
? AMP_IN_MUTE(0) : 0;
13071 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
13072 AMP_IN_MUTE(0), bits
);
13073 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
13074 AMP_IN_MUTE(0), bits
);
13077 static void alc269_eeepc_dmic_automute(struct hda_codec
*codec
)
13079 unsigned int present
;
13081 present
= snd_hda_codec_read(codec
, 0x18, 0,
13082 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13083 snd_hda_codec_write(codec
, 0x23, 0,
13084 AC_VERB_SET_CONNECT_SEL
, (present
? 0 : 5));
13087 static void alc269_eeepc_amic_automute(struct hda_codec
*codec
)
13089 unsigned int present
;
13091 present
= snd_hda_codec_read(codec
, 0x18, 0,
13092 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13093 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13094 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
13095 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13096 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
13099 /* unsolicited event for HP jack sensing */
13100 static void alc269_eeepc_dmic_unsol_event(struct hda_codec
*codec
,
13103 if ((res
>> 26) == ALC880_HP_EVENT
)
13104 alc269_speaker_automute(codec
);
13106 if ((res
>> 26) == ALC880_MIC_EVENT
)
13107 alc269_eeepc_dmic_automute(codec
);
13110 static void alc269_eeepc_dmic_inithook(struct hda_codec
*codec
)
13112 alc269_speaker_automute(codec
);
13113 alc269_eeepc_dmic_automute(codec
);
13116 /* unsolicited event for HP jack sensing */
13117 static void alc269_eeepc_amic_unsol_event(struct hda_codec
*codec
,
13120 if ((res
>> 26) == ALC880_HP_EVENT
)
13121 alc269_speaker_automute(codec
);
13123 if ((res
>> 26) == ALC880_MIC_EVENT
)
13124 alc269_eeepc_amic_automute(codec
);
13127 static void alc269_eeepc_amic_inithook(struct hda_codec
*codec
)
13129 alc269_speaker_automute(codec
);
13130 alc269_eeepc_amic_automute(codec
);
13134 * generic initialization of ADC, input mixers and output mixers
13136 static struct hda_verb alc269_init_verbs
[] = {
13138 * Unmute ADC0 and set the default input to mic-in
13140 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13142 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13143 * analog-loopback mixer widget
13144 * Note: PASD motherboards uses the Line In 2 as the input for
13145 * front panel mic (mic 2)
13147 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13148 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13149 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13150 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13151 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13152 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13155 * Set up output mixers (0x0c - 0x0e)
13157 /* set vol=0 to output mixers */
13158 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13159 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13161 /* set up input amps for analog loopback */
13162 /* Amp Indices: DAC = 0, mixer = 1 */
13163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13165 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13166 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13167 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13168 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13170 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13172 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13173 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13174 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13175 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13176 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13178 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13180 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13181 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13182 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13183 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13184 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13186 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
13187 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
13189 /* FIXME: use matrix-type input source selection */
13190 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13191 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13198 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13199 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13203 /* add playback controls from the parsed DAC table */
13204 static int alc269_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13205 const struct auto_pin_cfg
*cfg
)
13210 spec
->multiout
.num_dacs
= 1; /* only use one dac */
13211 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
13212 spec
->multiout
.dac_nids
[0] = 2;
13214 nid
= cfg
->line_out_pins
[0];
13216 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13217 "Front Playback Volume",
13218 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
));
13221 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13222 "Front Playback Switch",
13223 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
13228 nid
= cfg
->speaker_pins
[0];
13230 if (!cfg
->line_out_pins
[0]) {
13231 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13232 "Speaker Playback Volume",
13233 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13239 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13240 "Speaker Playback Switch",
13241 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
13246 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13247 "Speaker Playback Switch",
13248 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
13254 nid
= cfg
->hp_pins
[0];
13256 /* spec->multiout.hp_nid = 2; */
13257 if (!cfg
->line_out_pins
[0] && !cfg
->speaker_pins
[0]) {
13258 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13259 "Headphone Playback Volume",
13260 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13266 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13267 "Headphone Playback Switch",
13268 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
13273 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13274 "Headphone Playback Switch",
13275 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
13284 #define alc269_auto_create_analog_input_ctls \
13285 alc262_auto_create_analog_input_ctls
13287 #ifdef CONFIG_SND_HDA_POWER_SAVE
13288 #define alc269_loopbacks alc880_loopbacks
13291 /* pcm configuration: identical with ALC880 */
13292 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13293 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13294 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13295 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13297 static struct hda_pcm_stream alc269_44k_pcm_analog_playback
= {
13301 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
13302 /* NID is set in alc_build_pcms */
13304 .open
= alc880_playback_pcm_open
,
13305 .prepare
= alc880_playback_pcm_prepare
,
13306 .cleanup
= alc880_playback_pcm_cleanup
13310 static struct hda_pcm_stream alc269_44k_pcm_analog_capture
= {
13314 .rates
= SNDRV_PCM_RATE_44100
, /* fixed rate */
13315 /* NID is set in alc_build_pcms */
13319 * BIOS auto configuration
13321 static int alc269_parse_auto_config(struct hda_codec
*codec
)
13323 struct alc_spec
*spec
= codec
->spec
;
13325 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
13327 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13332 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13335 err
= alc269_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
13339 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
13341 if (spec
->autocfg
.dig_outs
)
13342 spec
->multiout
.dig_out_nid
= ALC269_DIGOUT_NID
;
13344 if (spec
->kctls
.list
)
13345 add_mixer(spec
, spec
->kctls
.list
);
13347 add_verb(spec
, alc269_init_verbs
);
13348 spec
->num_mux_defs
= 1;
13349 spec
->input_mux
= &spec
->private_imux
[0];
13350 /* set default input source */
13351 snd_hda_codec_write_cache(codec
, alc269_capsrc_nids
[0],
13352 0, AC_VERB_SET_CONNECT_SEL
,
13353 spec
->input_mux
->items
[0].index
);
13355 err
= alc_auto_add_mic_boost(codec
);
13359 if (!spec
->cap_mixer
&& !spec
->no_analog
)
13360 set_capture_mixer(spec
);
13362 alc_ssid_check(codec
, 0x15, 0x1b, 0x14);
13367 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13368 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13369 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13372 /* init callback for auto-configuration model -- overriding the default init */
13373 static void alc269_auto_init(struct hda_codec
*codec
)
13375 struct alc_spec
*spec
= codec
->spec
;
13376 alc269_auto_init_multi_out(codec
);
13377 alc269_auto_init_hp_out(codec
);
13378 alc269_auto_init_analog_input(codec
);
13379 if (spec
->unsol_event
)
13380 alc_inithook(codec
);
13384 * configuration and preset
13386 static const char *alc269_models
[ALC269_MODEL_LAST
] = {
13387 [ALC269_BASIC
] = "basic",
13388 [ALC269_QUANTA_FL1
] = "quanta",
13389 [ALC269_ASUS_EEEPC_P703
] = "eeepc-p703",
13390 [ALC269_ASUS_EEEPC_P901
] = "eeepc-p901",
13391 [ALC269_FUJITSU
] = "fujitsu",
13392 [ALC269_LIFEBOOK
] = "lifebook"
13395 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
13396 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1
),
13397 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13398 ALC269_ASUS_EEEPC_P703
),
13399 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703
),
13400 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703
),
13401 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703
),
13402 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703
),
13403 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703
),
13404 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703
),
13405 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13406 ALC269_ASUS_EEEPC_P901
),
13407 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13408 ALC269_ASUS_EEEPC_P901
),
13409 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901
),
13410 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU
),
13411 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK
),
13415 static struct alc_config_preset alc269_presets
[] = {
13417 .mixers
= { alc269_base_mixer
},
13418 .init_verbs
= { alc269_init_verbs
},
13419 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13420 .dac_nids
= alc269_dac_nids
,
13422 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13423 .channel_mode
= alc269_modes
,
13424 .input_mux
= &alc269_capture_source
,
13426 [ALC269_QUANTA_FL1
] = {
13427 .mixers
= { alc269_quanta_fl1_mixer
},
13428 .init_verbs
= { alc269_init_verbs
, alc269_quanta_fl1_verbs
},
13429 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13430 .dac_nids
= alc269_dac_nids
,
13432 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13433 .channel_mode
= alc269_modes
,
13434 .input_mux
= &alc269_capture_source
,
13435 .unsol_event
= alc269_quanta_fl1_unsol_event
,
13436 .init_hook
= alc269_quanta_fl1_init_hook
,
13438 [ALC269_ASUS_EEEPC_P703
] = {
13439 .mixers
= { alc269_eeepc_mixer
},
13440 .cap_mixer
= alc269_epc_capture_mixer
,
13441 .init_verbs
= { alc269_init_verbs
,
13442 alc269_eeepc_amic_init_verbs
},
13443 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13444 .dac_nids
= alc269_dac_nids
,
13446 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13447 .channel_mode
= alc269_modes
,
13448 .input_mux
= &alc269_eeepc_amic_capture_source
,
13449 .unsol_event
= alc269_eeepc_amic_unsol_event
,
13450 .init_hook
= alc269_eeepc_amic_inithook
,
13452 [ALC269_ASUS_EEEPC_P901
] = {
13453 .mixers
= { alc269_eeepc_mixer
},
13454 .cap_mixer
= alc269_epc_capture_mixer
,
13455 .init_verbs
= { alc269_init_verbs
,
13456 alc269_eeepc_dmic_init_verbs
},
13457 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13458 .dac_nids
= alc269_dac_nids
,
13460 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13461 .channel_mode
= alc269_modes
,
13462 .input_mux
= &alc269_eeepc_dmic_capture_source
,
13463 .unsol_event
= alc269_eeepc_dmic_unsol_event
,
13464 .init_hook
= alc269_eeepc_dmic_inithook
,
13466 [ALC269_FUJITSU
] = {
13467 .mixers
= { alc269_fujitsu_mixer
},
13468 .cap_mixer
= alc269_epc_capture_mixer
,
13469 .init_verbs
= { alc269_init_verbs
,
13470 alc269_eeepc_dmic_init_verbs
},
13471 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13472 .dac_nids
= alc269_dac_nids
,
13474 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13475 .channel_mode
= alc269_modes
,
13476 .input_mux
= &alc269_eeepc_dmic_capture_source
,
13477 .unsol_event
= alc269_eeepc_dmic_unsol_event
,
13478 .init_hook
= alc269_eeepc_dmic_inithook
,
13480 [ALC269_LIFEBOOK
] = {
13481 .mixers
= { alc269_lifebook_mixer
},
13482 .init_verbs
= { alc269_init_verbs
, alc269_lifebook_verbs
},
13483 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
13484 .dac_nids
= alc269_dac_nids
,
13486 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
13487 .channel_mode
= alc269_modes
,
13488 .input_mux
= &alc269_capture_source
,
13489 .unsol_event
= alc269_lifebook_unsol_event
,
13490 .init_hook
= alc269_lifebook_init_hook
,
13494 static int patch_alc269(struct hda_codec
*codec
)
13496 struct alc_spec
*spec
;
13500 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13504 codec
->spec
= spec
;
13506 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
13508 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
13512 if (board_config
< 0) {
13513 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
13514 "trying auto-probe from BIOS...\n", codec
->chip_name
);
13515 board_config
= ALC269_AUTO
;
13518 if (board_config
== ALC269_AUTO
) {
13519 /* automatic parse from the BIOS config */
13520 err
= alc269_parse_auto_config(codec
);
13526 "hda_codec: Cannot set up configuration "
13527 "from BIOS. Using base mode...\n");
13528 board_config
= ALC269_BASIC
;
13532 err
= snd_hda_attach_beep_device(codec
, 0x1);
13538 if (board_config
!= ALC269_AUTO
)
13539 setup_preset(spec
, &alc269_presets
[board_config
]);
13541 if (codec
->subsystem_id
== 0x17aa3bf8) {
13542 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13543 * fix the sample rate of analog I/O to 44.1kHz
13545 spec
->stream_analog_playback
= &alc269_44k_pcm_analog_playback
;
13546 spec
->stream_analog_capture
= &alc269_44k_pcm_analog_capture
;
13548 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
13549 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
13551 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
13552 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
13554 spec
->adc_nids
= alc269_adc_nids
;
13555 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
13556 spec
->capsrc_nids
= alc269_capsrc_nids
;
13557 if (!spec
->cap_mixer
)
13558 set_capture_mixer(spec
);
13559 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
13561 codec
->patch_ops
= alc_patch_ops
;
13562 if (board_config
== ALC269_AUTO
)
13563 spec
->init_hook
= alc269_auto_init
;
13564 #ifdef CONFIG_SND_HDA_POWER_SAVE
13565 if (!spec
->loopback
.amplist
)
13566 spec
->loopback
.amplist
= alc269_loopbacks
;
13568 codec
->proc_widget_hook
= print_realtek_coef
;
13574 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13578 * set the path ways for 2 channel output
13579 * need to set the codec line out and mic 1 pin widgets to inputs
13581 static struct hda_verb alc861_threestack_ch2_init
[] = {
13582 /* set pin widget 1Ah (line in) for input */
13583 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13584 /* set pin widget 18h (mic1/2) for input, for mic also enable
13587 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13589 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
13591 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
13592 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
13598 * need to set the codec line out and mic 1 pin widgets to outputs
13600 static struct hda_verb alc861_threestack_ch6_init
[] = {
13601 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13602 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13603 /* set pin widget 18h (mic1) for output (CLFE)*/
13604 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13606 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13607 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13609 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
13611 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
13612 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
13617 static struct hda_channel_mode alc861_threestack_modes
[2] = {
13618 { 2, alc861_threestack_ch2_init
},
13619 { 6, alc861_threestack_ch6_init
},
13621 /* Set mic1 as input and unmute the mixer */
13622 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
13623 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13624 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
13627 /* Set mic1 as output and mute mixer */
13628 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
13629 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13630 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
13634 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
13635 { 2, alc861_uniwill_m31_ch2_init
},
13636 { 4, alc861_uniwill_m31_ch4_init
},
13639 /* Set mic1 and line-in as input and unmute the mixer */
13640 static struct hda_verb alc861_asus_ch2_init
[] = {
13641 /* set pin widget 1Ah (line in) for input */
13642 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13643 /* set pin widget 18h (mic1/2) for input, for mic also enable
13646 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13648 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
13650 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
13651 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
13655 /* Set mic1 nad line-in as output and mute mixer */
13656 static struct hda_verb alc861_asus_ch6_init
[] = {
13657 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13658 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13659 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13660 /* set pin widget 18h (mic1) for output (CLFE)*/
13661 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13662 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13663 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13664 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13666 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
13668 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
13669 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
13674 static struct hda_channel_mode alc861_asus_modes
[2] = {
13675 { 2, alc861_asus_ch2_init
},
13676 { 6, alc861_asus_ch6_init
},
13681 static struct snd_kcontrol_new alc861_base_mixer
[] = {
13682 /* output mixer control */
13683 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13684 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
13685 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
13686 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
13687 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
13689 /*Input mixer control */
13690 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13691 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13692 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
13693 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
13694 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
13695 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
13696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
13697 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
13698 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
13699 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
13704 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
13705 /* output mixer control */
13706 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13707 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
13708 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
13709 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
13710 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13712 /* Input mixer control */
13713 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13714 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13715 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
13716 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
13717 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
13718 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
13719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
13720 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
13721 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
13722 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
13725 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13726 .name
= "Channel Mode",
13727 .info
= alc_ch_mode_info
,
13728 .get
= alc_ch_mode_get
,
13729 .put
= alc_ch_mode_put
,
13730 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
13735 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
13736 /* output mixer control */
13737 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
13739 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
13744 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
13745 /* output mixer control */
13746 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13747 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
13748 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
13749 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
13750 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13752 /* Input mixer control */
13753 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13754 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13755 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
13756 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
13757 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
13758 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
13759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
13760 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
13761 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
13762 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
13765 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13766 .name
= "Channel Mode",
13767 .info
= alc_ch_mode_info
,
13768 .get
= alc_ch_mode_get
,
13769 .put
= alc_ch_mode_put
,
13770 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
13775 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
13776 /* output mixer control */
13777 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13778 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
13779 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
13780 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
13781 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
13783 /* Input mixer control */
13784 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
13785 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13786 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
13787 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
13788 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
13789 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
13790 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
13791 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
13792 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
13793 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
13796 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13797 .name
= "Channel Mode",
13798 .info
= alc_ch_mode_info
,
13799 .get
= alc_ch_mode_get
,
13800 .put
= alc_ch_mode_put
,
13801 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
13806 /* additional mixer */
13807 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
13808 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
13809 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
13814 * generic initialization of ADC, input mixers and output mixers
13816 static struct hda_verb alc861_base_init_verbs
[] = {
13818 * Unmute ADC0 and set the default input to mic-in
13820 /* port-A for surround (rear panel) */
13821 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13822 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13823 /* port-B for mic-in (rear panel) with vref */
13824 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13825 /* port-C for line-in (rear panel) */
13826 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13827 /* port-D for Front */
13828 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13829 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13830 /* port-E for HP out (front panel) */
13831 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
13832 /* route front PCM to HP */
13833 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13834 /* port-F for mic-in (front panel) with vref */
13835 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13836 /* port-G for CLFE (rear panel) */
13837 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13838 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13839 /* port-H for side (rear panel) */
13840 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13841 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13843 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13844 /* route front mic to ADC1*/
13845 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
13846 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13848 /* Unmute DAC0~3 & spdif out*/
13849 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13850 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13851 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13852 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13855 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13856 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13857 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13858 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13859 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13861 /* Unmute Stereo Mixer 15 */
13862 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13863 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
13867 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13868 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13869 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13870 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13871 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13872 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13873 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13874 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13875 /* hp used DAC 3 (Front) */
13876 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13877 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13882 static struct hda_verb alc861_threestack_init_verbs
[] = {
13884 * Unmute ADC0 and set the default input to mic-in
13886 /* port-A for surround (rear panel) */
13887 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13888 /* port-B for mic-in (rear panel) with vref */
13889 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13890 /* port-C for line-in (rear panel) */
13891 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13892 /* port-D for Front */
13893 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13894 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13895 /* port-E for HP out (front panel) */
13896 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
13897 /* route front PCM to HP */
13898 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13899 /* port-F for mic-in (front panel) with vref */
13900 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13901 /* port-G for CLFE (rear panel) */
13902 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13903 /* port-H for side (rear panel) */
13904 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13906 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13907 /* route front mic to ADC1*/
13908 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
13909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13910 /* Unmute DAC0~3 & spdif out*/
13911 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13912 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13913 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13914 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13917 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13918 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13919 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13920 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13921 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13923 /* Unmute Stereo Mixer 15 */
13924 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13925 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13926 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
13929 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13930 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13931 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13932 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13933 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13934 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13935 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13936 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13937 /* hp used DAC 3 (Front) */
13938 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
13939 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13943 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
13945 * Unmute ADC0 and set the default input to mic-in
13947 /* port-A for surround (rear panel) */
13948 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13949 /* port-B for mic-in (rear panel) with vref */
13950 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13951 /* port-C for line-in (rear panel) */
13952 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13953 /* port-D for Front */
13954 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
13955 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13956 /* port-E for HP out (front panel) */
13957 /* this has to be set to VREF80 */
13958 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13959 /* route front PCM to HP */
13960 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
13961 /* port-F for mic-in (front panel) with vref */
13962 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
13963 /* port-G for CLFE (rear panel) */
13964 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13965 /* port-H for side (rear panel) */
13966 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13968 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
13969 /* route front mic to ADC1*/
13970 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
13971 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13972 /* Unmute DAC0~3 & spdif out*/
13973 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13974 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13975 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13976 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13979 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13980 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13981 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13982 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13983 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13985 /* Unmute Stereo Mixer 15 */
13986 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13987 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13988 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13989 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
13991 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13992 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13993 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13994 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13995 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13996 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13997 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13998 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13999 /* hp used DAC 3 (Front) */
14000 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
14001 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14005 static struct hda_verb alc861_asus_init_verbs
[] = {
14007 * Unmute ADC0 and set the default input to mic-in
14009 /* port-A for surround (rear panel)
14010 * according to codec#0 this is the HP jack
14012 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
14013 /* route front PCM to HP */
14014 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
14015 /* port-B for mic-in (rear panel) with vref */
14016 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14017 /* port-C for line-in (rear panel) */
14018 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14019 /* port-D for Front */
14020 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14021 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14022 /* port-E for HP out (front panel) */
14023 /* this has to be set to VREF80 */
14024 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14025 /* route front PCM to HP */
14026 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
14027 /* port-F for mic-in (front panel) with vref */
14028 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
14029 /* port-G for CLFE (rear panel) */
14030 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14031 /* port-H for side (rear panel) */
14032 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
14034 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
14035 /* route front mic to ADC1*/
14036 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
14037 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14038 /* Unmute DAC0~3 & spdif out*/
14039 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14040 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14041 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14042 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14043 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14044 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14045 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14046 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14047 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14048 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14050 /* Unmute Stereo Mixer 15 */
14051 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14054 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
14056 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14057 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14058 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14059 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14060 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14061 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14062 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14063 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14064 /* hp used DAC 3 (Front) */
14065 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
14066 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14070 /* additional init verbs for ASUS laptops */
14071 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
14072 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
14073 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
14078 * generic initialization of ADC, input mixers and output mixers
14080 static struct hda_verb alc861_auto_init_verbs
[] = {
14082 * Unmute ADC0 and set the default input to mic-in
14084 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14085 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14087 /* Unmute DAC0~3 & spdif out*/
14088 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14089 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14090 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14091 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14092 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14094 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14095 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14096 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14097 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14098 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14100 /* Unmute Stereo Mixer 15 */
14101 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14102 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14103 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14104 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
14106 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14107 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14108 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14109 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14110 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14111 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14112 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14113 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14115 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14116 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14117 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14118 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
14119 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14120 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14121 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14122 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
14124 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
14129 static struct hda_verb alc861_toshiba_init_verbs
[] = {
14130 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14135 /* toggle speaker-output according to the hp-jack state */
14136 static void alc861_toshiba_automute(struct hda_codec
*codec
)
14138 unsigned int present
;
14140 present
= snd_hda_codec_read(codec
, 0x0f, 0,
14141 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14142 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
14143 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
14144 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
14145 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
14148 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
14151 if ((res
>> 26) == ALC880_HP_EVENT
)
14152 alc861_toshiba_automute(codec
);
14155 /* pcm configuration: identical with ALC880 */
14156 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14157 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14158 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14159 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14162 #define ALC861_DIGOUT_NID 0x07
14164 static struct hda_channel_mode alc861_8ch_modes
[1] = {
14168 static hda_nid_t alc861_dac_nids
[4] = {
14169 /* front, surround, clfe, side */
14170 0x03, 0x06, 0x05, 0x04
14173 static hda_nid_t alc660_dac_nids
[3] = {
14174 /* front, clfe, surround */
14178 static hda_nid_t alc861_adc_nids
[1] = {
14183 static struct hda_input_mux alc861_capture_source
= {
14187 { "Front Mic", 0x3 },
14194 /* fill in the dac_nids table from the parsed pin configuration */
14195 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
,
14196 const struct auto_pin_cfg
*cfg
)
14201 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
14202 for (i
= 0; i
< cfg
->line_outs
; i
++) {
14203 nid
= cfg
->line_out_pins
[i
];
14205 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
14207 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
14210 spec
->multiout
.num_dacs
= cfg
->line_outs
;
14214 /* add playback controls from the parsed DAC table */
14215 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
14216 const struct auto_pin_cfg
*cfg
)
14219 static const char *chname
[4] = {
14220 "Front", "Surround", NULL
/*CLFE*/, "Side"
14225 for (i
= 0; i
< cfg
->line_outs
; i
++) {
14226 nid
= spec
->multiout
.dac_nids
[i
];
14231 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14232 "Center Playback Switch",
14233 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
14237 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14238 "LFE Playback Switch",
14239 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
14244 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1;
14246 if (nid
== alc861_dac_nids
[idx
])
14248 sprintf(name
, "%s Playback Switch", chname
[idx
]);
14249 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14250 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
14259 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
14267 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
14269 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
14270 "Headphone Playback Switch",
14271 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
14274 spec
->multiout
.hp_nid
= nid
;
14279 /* create playback/capture controls for input pins */
14280 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
,
14281 const struct auto_pin_cfg
*cfg
)
14283 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
14284 int i
, err
, idx
, idx1
;
14286 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14287 switch (cfg
->input_pins
[i
]) {
14290 idx
= 2; /* Line In */
14294 idx
= 2; /* Line In */
14298 idx
= 1; /* Mic In */
14302 idx
= 1; /* Mic In */
14312 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
14313 auto_pin_cfg_labels
[i
], idx
, 0x15);
14317 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
14318 imux
->items
[imux
->num_items
].index
= idx1
;
14324 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
14326 int pin_type
, int dac_idx
)
14328 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
14330 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14334 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
14336 struct alc_spec
*spec
= codec
->spec
;
14339 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
14340 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
14341 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
14343 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
14344 spec
->multiout
.dac_nids
[i
]);
14348 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
14350 struct alc_spec
*spec
= codec
->spec
;
14353 pin
= spec
->autocfg
.hp_pins
[0];
14354 if (pin
) /* connect to front */
14355 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
14356 spec
->multiout
.dac_nids
[0]);
14357 pin
= spec
->autocfg
.speaker_pins
[0];
14359 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
14362 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
14364 struct alc_spec
*spec
= codec
->spec
;
14367 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14368 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
14369 if (nid
>= 0x0c && nid
<= 0x11)
14370 alc_set_input_pin(codec
, nid
, i
);
14374 /* parse the BIOS configuration and set up the alc_spec */
14375 /* return 1 if successful, 0 if the proper config is not found,
14376 * or a negative error code
14378 static int alc861_parse_auto_config(struct hda_codec
*codec
)
14380 struct alc_spec
*spec
= codec
->spec
;
14382 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
14384 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14388 if (!spec
->autocfg
.line_outs
)
14389 return 0; /* can't find valid BIOS pin config */
14391 err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
);
14394 err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14397 err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0]);
14400 err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
14404 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14406 if (spec
->autocfg
.dig_outs
)
14407 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
14409 if (spec
->kctls
.list
)
14410 add_mixer(spec
, spec
->kctls
.list
);
14412 add_verb(spec
, alc861_auto_init_verbs
);
14414 spec
->num_mux_defs
= 1;
14415 spec
->input_mux
= &spec
->private_imux
[0];
14417 spec
->adc_nids
= alc861_adc_nids
;
14418 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
14419 set_capture_mixer(spec
);
14421 alc_ssid_check(codec
, 0x0e, 0x0f, 0x0b);
14426 /* additional initialization for auto-configuration model */
14427 static void alc861_auto_init(struct hda_codec
*codec
)
14429 struct alc_spec
*spec
= codec
->spec
;
14430 alc861_auto_init_multi_out(codec
);
14431 alc861_auto_init_hp_out(codec
);
14432 alc861_auto_init_analog_input(codec
);
14433 if (spec
->unsol_event
)
14434 alc_inithook(codec
);
14437 #ifdef CONFIG_SND_HDA_POWER_SAVE
14438 static struct hda_amp_list alc861_loopbacks
[] = {
14439 { 0x15, HDA_INPUT
, 0 },
14440 { 0x15, HDA_INPUT
, 1 },
14441 { 0x15, HDA_INPUT
, 2 },
14442 { 0x15, HDA_INPUT
, 3 },
14449 * configuration and preset
14451 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
14452 [ALC861_3ST
] = "3stack",
14453 [ALC660_3ST
] = "3stack-660",
14454 [ALC861_3ST_DIG
] = "3stack-dig",
14455 [ALC861_6ST_DIG
] = "6stack-dig",
14456 [ALC861_UNIWILL_M31
] = "uniwill-m31",
14457 [ALC861_TOSHIBA
] = "toshiba",
14458 [ALC861_ASUS
] = "asus",
14459 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
14460 [ALC861_AUTO
] = "auto",
14463 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
14464 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
14465 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
14466 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
14467 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
14468 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
14469 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
14470 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
14471 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14472 * Any other models that need this preset?
14474 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14475 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
14476 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
14477 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
14478 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
14479 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
14480 /* FIXME: the below seems conflict */
14481 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14482 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
14483 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
14487 static struct alc_config_preset alc861_presets
[] = {
14489 .mixers
= { alc861_3ST_mixer
},
14490 .init_verbs
= { alc861_threestack_init_verbs
},
14491 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14492 .dac_nids
= alc861_dac_nids
,
14493 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
14494 .channel_mode
= alc861_threestack_modes
,
14496 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14497 .adc_nids
= alc861_adc_nids
,
14498 .input_mux
= &alc861_capture_source
,
14500 [ALC861_3ST_DIG
] = {
14501 .mixers
= { alc861_base_mixer
},
14502 .init_verbs
= { alc861_threestack_init_verbs
},
14503 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14504 .dac_nids
= alc861_dac_nids
,
14505 .dig_out_nid
= ALC861_DIGOUT_NID
,
14506 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
14507 .channel_mode
= alc861_threestack_modes
,
14509 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14510 .adc_nids
= alc861_adc_nids
,
14511 .input_mux
= &alc861_capture_source
,
14513 [ALC861_6ST_DIG
] = {
14514 .mixers
= { alc861_base_mixer
},
14515 .init_verbs
= { alc861_base_init_verbs
},
14516 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14517 .dac_nids
= alc861_dac_nids
,
14518 .dig_out_nid
= ALC861_DIGOUT_NID
,
14519 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
14520 .channel_mode
= alc861_8ch_modes
,
14521 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14522 .adc_nids
= alc861_adc_nids
,
14523 .input_mux
= &alc861_capture_source
,
14526 .mixers
= { alc861_3ST_mixer
},
14527 .init_verbs
= { alc861_threestack_init_verbs
},
14528 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
14529 .dac_nids
= alc660_dac_nids
,
14530 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
14531 .channel_mode
= alc861_threestack_modes
,
14533 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14534 .adc_nids
= alc861_adc_nids
,
14535 .input_mux
= &alc861_capture_source
,
14537 [ALC861_UNIWILL_M31
] = {
14538 .mixers
= { alc861_uniwill_m31_mixer
},
14539 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
14540 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14541 .dac_nids
= alc861_dac_nids
,
14542 .dig_out_nid
= ALC861_DIGOUT_NID
,
14543 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
14544 .channel_mode
= alc861_uniwill_m31_modes
,
14546 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14547 .adc_nids
= alc861_adc_nids
,
14548 .input_mux
= &alc861_capture_source
,
14550 [ALC861_TOSHIBA
] = {
14551 .mixers
= { alc861_toshiba_mixer
},
14552 .init_verbs
= { alc861_base_init_verbs
,
14553 alc861_toshiba_init_verbs
},
14554 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14555 .dac_nids
= alc861_dac_nids
,
14556 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
14557 .channel_mode
= alc883_3ST_2ch_modes
,
14558 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14559 .adc_nids
= alc861_adc_nids
,
14560 .input_mux
= &alc861_capture_source
,
14561 .unsol_event
= alc861_toshiba_unsol_event
,
14562 .init_hook
= alc861_toshiba_automute
,
14565 .mixers
= { alc861_asus_mixer
},
14566 .init_verbs
= { alc861_asus_init_verbs
},
14567 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14568 .dac_nids
= alc861_dac_nids
,
14569 .dig_out_nid
= ALC861_DIGOUT_NID
,
14570 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
14571 .channel_mode
= alc861_asus_modes
,
14574 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14575 .adc_nids
= alc861_adc_nids
,
14576 .input_mux
= &alc861_capture_source
,
14578 [ALC861_ASUS_LAPTOP
] = {
14579 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
14580 .init_verbs
= { alc861_asus_init_verbs
,
14581 alc861_asus_laptop_init_verbs
},
14582 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
14583 .dac_nids
= alc861_dac_nids
,
14584 .dig_out_nid
= ALC861_DIGOUT_NID
,
14585 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
14586 .channel_mode
= alc883_3ST_2ch_modes
,
14588 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
14589 .adc_nids
= alc861_adc_nids
,
14590 .input_mux
= &alc861_capture_source
,
14595 static int patch_alc861(struct hda_codec
*codec
)
14597 struct alc_spec
*spec
;
14601 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14605 codec
->spec
= spec
;
14607 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
14611 if (board_config
< 0) {
14612 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
14613 "trying auto-probe from BIOS...\n", codec
->chip_name
);
14614 board_config
= ALC861_AUTO
;
14617 if (board_config
== ALC861_AUTO
) {
14618 /* automatic parse from the BIOS config */
14619 err
= alc861_parse_auto_config(codec
);
14625 "hda_codec: Cannot set up configuration "
14626 "from BIOS. Using base mode...\n");
14627 board_config
= ALC861_3ST_DIG
;
14631 err
= snd_hda_attach_beep_device(codec
, 0x23);
14637 if (board_config
!= ALC861_AUTO
)
14638 setup_preset(spec
, &alc861_presets
[board_config
]);
14640 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
14641 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
14643 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
14644 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
14646 set_beep_amp(spec
, 0x23, 0, HDA_OUTPUT
);
14648 spec
->vmaster_nid
= 0x03;
14650 codec
->patch_ops
= alc_patch_ops
;
14651 if (board_config
== ALC861_AUTO
)
14652 spec
->init_hook
= alc861_auto_init
;
14653 #ifdef CONFIG_SND_HDA_POWER_SAVE
14654 if (!spec
->loopback
.amplist
)
14655 spec
->loopback
.amplist
= alc861_loopbacks
;
14657 codec
->proc_widget_hook
= print_realtek_coef
;
14663 * ALC861-VD support
14667 * In addition, an independent DAC
14669 #define ALC861VD_DIGOUT_NID 0x06
14671 static hda_nid_t alc861vd_dac_nids
[4] = {
14672 /* front, surr, clfe, side surr */
14673 0x02, 0x03, 0x04, 0x05
14676 /* dac_nids for ALC660vd are in a different order - according to
14677 * Realtek's driver.
14678 * This should probably result in a different mixer for 6stack models
14679 * of ALC660vd codecs, but for now there is only 3stack mixer
14680 * - and it is the same as in 861vd.
14681 * adc_nids in ALC660vd are (is) the same as in 861vd
14683 static hda_nid_t alc660vd_dac_nids
[3] = {
14684 /* front, rear, clfe, rear_surr */
14688 static hda_nid_t alc861vd_adc_nids
[1] = {
14693 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
14696 /* FIXME: should be a matrix-type input source selection */
14697 static struct hda_input_mux alc861vd_capture_source
= {
14701 { "Front Mic", 0x1 },
14707 static struct hda_input_mux alc861vd_dallas_capture_source
= {
14710 { "Ext Mic", 0x0 },
14711 { "Int Mic", 0x1 },
14715 static struct hda_input_mux alc861vd_hp_capture_source
= {
14718 { "Front Mic", 0x0 },
14719 { "ATAPI Mic", 0x1 },
14726 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
14733 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
14734 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14735 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14736 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14737 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14744 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
14745 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14746 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14747 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14748 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14752 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
14753 { 6, alc861vd_6stack_ch6_init
},
14754 { 8, alc861vd_6stack_ch8_init
},
14757 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
14759 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14760 .name
= "Channel Mode",
14761 .info
= alc_ch_mode_info
,
14762 .get
= alc_ch_mode_get
,
14763 .put
= alc_ch_mode_put
,
14768 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14769 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14771 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
14772 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14773 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
14775 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14776 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
14778 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14780 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14782 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
14783 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
14785 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
14786 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
14788 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14790 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
14791 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14792 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14794 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
14795 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14796 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14798 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14799 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14801 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
14802 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14807 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
14808 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14809 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
14811 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14813 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
14814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14817 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
14818 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14819 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14821 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14822 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14824 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
14825 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14830 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
14831 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14832 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14833 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14835 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14837 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
14838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14839 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14841 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
14842 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14843 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14845 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
14846 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14851 /* Pin assignment: Speaker=0x14, HP = 0x15,
14852 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14854 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
14855 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14856 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
14857 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14858 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
14859 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
14860 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14861 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14862 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
14863 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14864 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14868 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14869 * Front Mic=0x18, ATAPI Mic = 0x19,
14871 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
14872 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14873 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
14874 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14875 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
14876 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14877 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14878 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14879 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14885 * generic initialization of ADC, input mixers and output mixers
14887 static struct hda_verb alc861vd_volume_init_verbs
[] = {
14889 * Unmute ADC0 and set the default input to mic-in
14891 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
14892 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14894 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14895 * the analog-loopback mixer widget
14897 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14898 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14899 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14900 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
14901 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
14902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
14904 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14905 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
14911 * Set up output mixers (0x02 - 0x05)
14913 /* set vol=0 to output mixers */
14914 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14915 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14916 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14917 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14919 /* set up input amps for analog loopback */
14920 /* Amp Indices: DAC = 0, mixer = 1 */
14921 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14922 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14923 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14924 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14925 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14926 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14927 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14928 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14934 * 3-stack pin configuration:
14935 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14937 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
14939 * Set pin mode and muting
14941 /* set front pin widgets 0x14 for output */
14942 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14943 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14944 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
14946 /* Mic (rear) pin: input vref at 80% */
14947 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14948 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14949 /* Front Mic pin: input vref at 80% */
14950 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14951 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14952 /* Line In pin: input */
14953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14954 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14955 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14956 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14957 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14958 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
14959 /* CD pin widget for input */
14960 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14966 * 6-stack pin configuration:
14968 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
14970 * Set pin mode and muting
14972 /* set front pin widgets 0x14 for output */
14973 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14974 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14975 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
14977 /* Rear Pin: output 1 (0x0d) */
14978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14979 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14980 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
14981 /* CLFE Pin: output 2 (0x0e) */
14982 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14983 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14984 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
14985 /* Side Pin: output 3 (0x0f) */
14986 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14987 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14988 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
14990 /* Mic (rear) pin: input vref at 80% */
14991 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14992 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14993 /* Front Mic pin: input vref at 80% */
14994 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14995 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14996 /* Line In pin: input */
14997 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14998 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14999 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15000 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15001 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15002 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
15003 /* CD pin widget for input */
15004 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15009 static struct hda_verb alc861vd_eapd_verbs
[] = {
15010 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
15014 static struct hda_verb alc660vd_eapd_verbs
[] = {
15015 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
15016 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
15020 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
15021 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
15024 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15025 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15029 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
15031 unsigned int present
;
15032 unsigned char bits
;
15034 present
= snd_hda_codec_read(codec
, 0x18, 0,
15035 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
15036 bits
= present
? HDA_AMP_MUTE
: 0;
15037 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
15038 HDA_AMP_MUTE
, bits
);
15041 static void alc861vd_lenovo_init_hook(struct hda_codec
*codec
)
15043 struct alc_spec
*spec
= codec
->spec
;
15045 spec
->autocfg
.hp_pins
[0] = 0x1b;
15046 spec
->autocfg
.speaker_pins
[0] = 0x14;
15047 alc_automute_amp(codec
);
15048 alc861vd_lenovo_mic_automute(codec
);
15051 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
15054 switch (res
>> 26) {
15055 case ALC880_MIC_EVENT
:
15056 alc861vd_lenovo_mic_automute(codec
);
15059 alc_automute_amp_unsol_event(codec
, res
);
15064 static struct hda_verb alc861vd_dallas_verbs
[] = {
15065 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15066 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15067 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15068 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15071 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15072 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15073 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15076 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15077 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15079 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15080 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15081 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15082 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15083 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15084 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15085 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15086 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15088 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
15089 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15090 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
15091 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15092 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15093 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15094 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15095 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
15102 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15103 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
15104 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15109 /* toggle speaker-output according to the hp-jack state */
15110 static void alc861vd_dallas_init_hook(struct hda_codec
*codec
)
15112 struct alc_spec
*spec
= codec
->spec
;
15114 spec
->autocfg
.hp_pins
[0] = 0x15;
15115 spec
->autocfg
.speaker_pins
[0] = 0x14;
15116 alc_automute_amp(codec
);
15119 #ifdef CONFIG_SND_HDA_POWER_SAVE
15120 #define alc861vd_loopbacks alc880_loopbacks
15123 /* pcm configuration: identical with ALC880 */
15124 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15125 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15126 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15127 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15130 * configuration and preset
15132 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
15133 [ALC660VD_3ST
] = "3stack-660",
15134 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
15135 [ALC660VD_ASUS_V1S
] = "asus-v1s",
15136 [ALC861VD_3ST
] = "3stack",
15137 [ALC861VD_3ST_DIG
] = "3stack-digout",
15138 [ALC861VD_6ST_DIG
] = "6stack-digout",
15139 [ALC861VD_LENOVO
] = "lenovo",
15140 [ALC861VD_DALLAS
] = "dallas",
15141 [ALC861VD_HP
] = "hp",
15142 [ALC861VD_AUTO
] = "auto",
15145 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
15146 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
15147 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
15148 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
15149 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST
),
15150 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S
),
15151 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
15152 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
15153 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
15154 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15155 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS
),
15156 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
15157 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
15158 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
15159 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO
),
15160 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
15164 static struct alc_config_preset alc861vd_presets
[] = {
15166 .mixers
= { alc861vd_3st_mixer
},
15167 .init_verbs
= { alc861vd_volume_init_verbs
,
15168 alc861vd_3stack_init_verbs
},
15169 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
15170 .dac_nids
= alc660vd_dac_nids
,
15171 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15172 .channel_mode
= alc861vd_3stack_2ch_modes
,
15173 .input_mux
= &alc861vd_capture_source
,
15175 [ALC660VD_3ST_DIG
] = {
15176 .mixers
= { alc861vd_3st_mixer
},
15177 .init_verbs
= { alc861vd_volume_init_verbs
,
15178 alc861vd_3stack_init_verbs
},
15179 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
15180 .dac_nids
= alc660vd_dac_nids
,
15181 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
15182 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15183 .channel_mode
= alc861vd_3stack_2ch_modes
,
15184 .input_mux
= &alc861vd_capture_source
,
15187 .mixers
= { alc861vd_3st_mixer
},
15188 .init_verbs
= { alc861vd_volume_init_verbs
,
15189 alc861vd_3stack_init_verbs
},
15190 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
15191 .dac_nids
= alc861vd_dac_nids
,
15192 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15193 .channel_mode
= alc861vd_3stack_2ch_modes
,
15194 .input_mux
= &alc861vd_capture_source
,
15196 [ALC861VD_3ST_DIG
] = {
15197 .mixers
= { alc861vd_3st_mixer
},
15198 .init_verbs
= { alc861vd_volume_init_verbs
,
15199 alc861vd_3stack_init_verbs
},
15200 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
15201 .dac_nids
= alc861vd_dac_nids
,
15202 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
15203 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15204 .channel_mode
= alc861vd_3stack_2ch_modes
,
15205 .input_mux
= &alc861vd_capture_source
,
15207 [ALC861VD_6ST_DIG
] = {
15208 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
15209 .init_verbs
= { alc861vd_volume_init_verbs
,
15210 alc861vd_6stack_init_verbs
},
15211 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
15212 .dac_nids
= alc861vd_dac_nids
,
15213 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
15214 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
15215 .channel_mode
= alc861vd_6stack_modes
,
15216 .input_mux
= &alc861vd_capture_source
,
15218 [ALC861VD_LENOVO
] = {
15219 .mixers
= { alc861vd_lenovo_mixer
},
15220 .init_verbs
= { alc861vd_volume_init_verbs
,
15221 alc861vd_3stack_init_verbs
,
15222 alc861vd_eapd_verbs
,
15223 alc861vd_lenovo_unsol_verbs
},
15224 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
15225 .dac_nids
= alc660vd_dac_nids
,
15226 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15227 .channel_mode
= alc861vd_3stack_2ch_modes
,
15228 .input_mux
= &alc861vd_capture_source
,
15229 .unsol_event
= alc861vd_lenovo_unsol_event
,
15230 .init_hook
= alc861vd_lenovo_init_hook
,
15232 [ALC861VD_DALLAS
] = {
15233 .mixers
= { alc861vd_dallas_mixer
},
15234 .init_verbs
= { alc861vd_dallas_verbs
},
15235 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
15236 .dac_nids
= alc861vd_dac_nids
,
15237 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15238 .channel_mode
= alc861vd_3stack_2ch_modes
,
15239 .input_mux
= &alc861vd_dallas_capture_source
,
15240 .unsol_event
= alc_automute_amp_unsol_event
,
15241 .init_hook
= alc861vd_dallas_init_hook
,
15244 .mixers
= { alc861vd_hp_mixer
},
15245 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
15246 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
15247 .dac_nids
= alc861vd_dac_nids
,
15248 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
15249 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15250 .channel_mode
= alc861vd_3stack_2ch_modes
,
15251 .input_mux
= &alc861vd_hp_capture_source
,
15252 .unsol_event
= alc_automute_amp_unsol_event
,
15253 .init_hook
= alc861vd_dallas_init_hook
,
15255 [ALC660VD_ASUS_V1S
] = {
15256 .mixers
= { alc861vd_lenovo_mixer
},
15257 .init_verbs
= { alc861vd_volume_init_verbs
,
15258 alc861vd_3stack_init_verbs
,
15259 alc861vd_eapd_verbs
,
15260 alc861vd_lenovo_unsol_verbs
},
15261 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
15262 .dac_nids
= alc660vd_dac_nids
,
15263 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
15264 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
15265 .channel_mode
= alc861vd_3stack_2ch_modes
,
15266 .input_mux
= &alc861vd_capture_source
,
15267 .unsol_event
= alc861vd_lenovo_unsol_event
,
15268 .init_hook
= alc861vd_lenovo_init_hook
,
15273 * BIOS auto configuration
15275 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
15276 hda_nid_t nid
, int pin_type
, int dac_idx
)
15278 alc_set_pin_output(codec
, nid
, pin_type
);
15281 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
15283 struct alc_spec
*spec
= codec
->spec
;
15286 for (i
= 0; i
<= HDA_SIDE
; i
++) {
15287 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
15288 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
15290 alc861vd_auto_set_output_and_unmute(codec
, nid
,
15296 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
15298 struct alc_spec
*spec
= codec
->spec
;
15301 pin
= spec
->autocfg
.hp_pins
[0];
15302 if (pin
) /* connect to front and use dac 0 */
15303 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
15304 pin
= spec
->autocfg
.speaker_pins
[0];
15306 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
15309 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15310 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15312 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
15314 struct alc_spec
*spec
= codec
->spec
;
15317 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
15318 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
15319 if (alc861vd_is_input_pin(nid
)) {
15320 alc_set_input_pin(codec
, nid
, i
);
15321 if (nid
!= ALC861VD_PIN_CD_NID
&&
15322 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
15323 snd_hda_codec_write(codec
, nid
, 0,
15324 AC_VERB_SET_AMP_GAIN_MUTE
,
15330 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15332 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15333 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15335 /* add playback controls from the parsed DAC table */
15336 /* Based on ALC880 version. But ALC861VD has separate,
15337 * different NIDs for mute/unmute switch and volume control */
15338 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
15339 const struct auto_pin_cfg
*cfg
)
15342 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
15343 hda_nid_t nid_v
, nid_s
;
15346 for (i
= 0; i
< cfg
->line_outs
; i
++) {
15347 if (!spec
->multiout
.dac_nids
[i
])
15349 nid_v
= alc861vd_idx_to_mixer_vol(
15351 spec
->multiout
.dac_nids
[i
]));
15352 nid_s
= alc861vd_idx_to_mixer_switch(
15354 spec
->multiout
.dac_nids
[i
]));
15358 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
15359 "Center Playback Volume",
15360 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
15364 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
15365 "LFE Playback Volume",
15366 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
15370 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
15371 "Center Playback Switch",
15372 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
15376 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
15377 "LFE Playback Switch",
15378 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
15383 sprintf(name
, "%s Playback Volume", chname
[i
]);
15384 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
15385 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
15389 sprintf(name
, "%s Playback Switch", chname
[i
]);
15390 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
15391 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
15400 /* add playback controls for speaker and HP outputs */
15401 /* Based on ALC880 version. But ALC861VD has separate,
15402 * different NIDs for mute/unmute switch and volume control */
15403 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
15404 hda_nid_t pin
, const char *pfx
)
15406 hda_nid_t nid_v
, nid_s
;
15413 if (alc880_is_fixed_pin(pin
)) {
15414 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
15415 /* specify the DAC as the extra output */
15416 if (!spec
->multiout
.hp_nid
)
15417 spec
->multiout
.hp_nid
= nid_v
;
15419 spec
->multiout
.extra_out_nid
[0] = nid_v
;
15420 /* control HP volume/switch on the output mixer amp */
15421 nid_v
= alc861vd_idx_to_mixer_vol(
15422 alc880_fixed_pin_idx(pin
));
15423 nid_s
= alc861vd_idx_to_mixer_switch(
15424 alc880_fixed_pin_idx(pin
));
15426 sprintf(name
, "%s Playback Volume", pfx
);
15427 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
15428 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
15431 sprintf(name
, "%s Playback Switch", pfx
);
15432 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
15433 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
15436 } else if (alc880_is_multi_pin(pin
)) {
15437 /* set manual connection */
15438 /* we have only a switch on HP-out PIN */
15439 sprintf(name
, "%s Playback Switch", pfx
);
15440 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
15441 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
15448 /* parse the BIOS configuration and set up the alc_spec
15449 * return 1 if successful, 0 if the proper config is not found,
15450 * or a negative error code
15451 * Based on ALC880 version - had to change it to override
15452 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15453 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
15455 struct alc_spec
*spec
= codec
->spec
;
15457 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
15459 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
15463 if (!spec
->autocfg
.line_outs
)
15464 return 0; /* can't find valid BIOS pin config */
15466 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
15469 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
15472 err
= alc861vd_auto_create_extra_out(spec
,
15473 spec
->autocfg
.speaker_pins
[0],
15477 err
= alc861vd_auto_create_extra_out(spec
,
15478 spec
->autocfg
.hp_pins
[0],
15482 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
15486 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
15488 if (spec
->autocfg
.dig_outs
)
15489 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
15491 if (spec
->kctls
.list
)
15492 add_mixer(spec
, spec
->kctls
.list
);
15494 add_verb(spec
, alc861vd_volume_init_verbs
);
15496 spec
->num_mux_defs
= 1;
15497 spec
->input_mux
= &spec
->private_imux
[0];
15499 err
= alc_auto_add_mic_boost(codec
);
15503 alc_ssid_check(codec
, 0x15, 0x1b, 0x14);
15508 /* additional initialization for auto-configuration model */
15509 static void alc861vd_auto_init(struct hda_codec
*codec
)
15511 struct alc_spec
*spec
= codec
->spec
;
15512 alc861vd_auto_init_multi_out(codec
);
15513 alc861vd_auto_init_hp_out(codec
);
15514 alc861vd_auto_init_analog_input(codec
);
15515 alc861vd_auto_init_input_src(codec
);
15516 if (spec
->unsol_event
)
15517 alc_inithook(codec
);
15520 static int patch_alc861vd(struct hda_codec
*codec
)
15522 struct alc_spec
*spec
;
15523 int err
, board_config
;
15525 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
15529 codec
->spec
= spec
;
15531 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
15535 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
15536 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
15537 "trying auto-probe from BIOS...\n", codec
->chip_name
);
15538 board_config
= ALC861VD_AUTO
;
15541 if (board_config
== ALC861VD_AUTO
) {
15542 /* automatic parse from the BIOS config */
15543 err
= alc861vd_parse_auto_config(codec
);
15549 "hda_codec: Cannot set up configuration "
15550 "from BIOS. Using base mode...\n");
15551 board_config
= ALC861VD_3ST
;
15555 err
= snd_hda_attach_beep_device(codec
, 0x23);
15561 if (board_config
!= ALC861VD_AUTO
)
15562 setup_preset(spec
, &alc861vd_presets
[board_config
]);
15564 if (codec
->vendor_id
== 0x10ec0660) {
15565 /* always turn on EAPD */
15566 add_verb(spec
, alc660vd_eapd_verbs
);
15569 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
15570 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
15572 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
15573 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
15575 spec
->adc_nids
= alc861vd_adc_nids
;
15576 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
15577 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
15579 set_capture_mixer(spec
);
15580 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
15582 spec
->vmaster_nid
= 0x02;
15584 codec
->patch_ops
= alc_patch_ops
;
15586 if (board_config
== ALC861VD_AUTO
)
15587 spec
->init_hook
= alc861vd_auto_init
;
15588 #ifdef CONFIG_SND_HDA_POWER_SAVE
15589 if (!spec
->loopback
.amplist
)
15590 spec
->loopback
.amplist
= alc861vd_loopbacks
;
15592 codec
->proc_widget_hook
= print_realtek_coef
;
15600 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15601 * configuration. Each pin widget can choose any input DACs and a mixer.
15602 * Each ADC is connected from a mixer of all inputs. This makes possible
15603 * 6-channel independent captures.
15605 * In addition, an independent DAC for the multi-playback (not used in this
15608 #define ALC662_DIGOUT_NID 0x06
15609 #define ALC662_DIGIN_NID 0x0a
15611 static hda_nid_t alc662_dac_nids
[4] = {
15612 /* front, rear, clfe, rear_surr */
15616 static hda_nid_t alc272_dac_nids
[2] = {
15620 static hda_nid_t alc662_adc_nids
[1] = {
15625 static hda_nid_t alc272_adc_nids
[1] = {
15630 static hda_nid_t alc662_capsrc_nids
[1] = { 0x22 };
15631 static hda_nid_t alc272_capsrc_nids
[1] = { 0x23 };
15635 /* FIXME: should be a matrix-type input source selection */
15636 static struct hda_input_mux alc662_capture_source
= {
15640 { "Front Mic", 0x1 },
15646 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
15654 static struct hda_input_mux alc662_eeepc_capture_source
= {
15662 static struct hda_input_mux alc663_capture_source
= {
15666 { "Front Mic", 0x1 },
15671 static struct hda_input_mux alc663_m51va_capture_source
= {
15674 { "Ext-Mic", 0x0 },
15679 #if 1 /* set to 0 for testing other input sources below */
15680 static struct hda_input_mux alc272_nc10_capture_source
= {
15683 { "Autoselect Mic", 0x0 },
15684 { "Internal Mic", 0x1 },
15688 static struct hda_input_mux alc272_nc10_capture_source
= {
15691 { "Autoselect Mic", 0x0 },
15692 { "Internal Mic", 0x1 },
15693 { "In-0x02", 0x2 },
15694 { "In-0x03", 0x3 },
15695 { "In-0x04", 0x4 },
15696 { "In-0x05", 0x5 },
15697 { "In-0x06", 0x6 },
15698 { "In-0x07", 0x7 },
15699 { "In-0x08", 0x8 },
15700 { "In-0x09", 0x9 },
15701 { "In-0x0a", 0x0a },
15702 { "In-0x0b", 0x0b },
15703 { "In-0x0c", 0x0c },
15704 { "In-0x0d", 0x0d },
15705 { "In-0x0e", 0x0e },
15706 { "In-0x0f", 0x0f },
15714 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
15721 static struct hda_verb alc662_3ST_ch2_init
[] = {
15722 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
15723 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15724 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15725 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
15732 static struct hda_verb alc662_3ST_ch6_init
[] = {
15733 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15734 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15735 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
15736 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15737 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15738 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
15742 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
15743 { 2, alc662_3ST_ch2_init
},
15744 { 6, alc662_3ST_ch6_init
},
15750 static struct hda_verb alc662_sixstack_ch6_init
[] = {
15751 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15752 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
15753 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15760 static struct hda_verb alc662_sixstack_ch8_init
[] = {
15761 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15762 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15763 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15767 static struct hda_channel_mode alc662_5stack_modes
[2] = {
15768 { 2, alc662_sixstack_ch6_init
},
15769 { 6, alc662_sixstack_ch8_init
},
15772 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15773 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15776 static struct snd_kcontrol_new alc662_base_mixer
[] = {
15777 /* output mixer control */
15778 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
15779 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
15780 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
15781 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
15782 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
15783 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
15784 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
15785 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
15786 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15788 /*Input mixer control */
15789 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
15790 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
15791 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
15792 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
15793 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
15794 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
15795 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
15796 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
15800 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
15801 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15802 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
15803 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15804 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
15805 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
15806 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15807 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15810 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15811 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15815 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
15816 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15817 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
15818 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15819 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
15820 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
15821 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
15822 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
15823 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
15824 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15825 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
15826 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
15827 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15828 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15830 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15831 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15832 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15836 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
15837 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15838 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
15839 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15840 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
15841 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15842 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15843 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15844 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15849 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
15850 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15851 ALC262_HIPPO_MASTER_SWITCH
,
15853 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
15854 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15855 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15857 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
15858 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15859 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15863 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
15864 ALC262_HIPPO_MASTER_SWITCH
,
15865 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15866 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15867 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
15868 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
15869 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
15870 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
15871 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
15872 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15873 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15877 static struct hda_bind_ctls alc663_asus_bind_master_vol
= {
15878 .ops
= &snd_hda_bind_vol
,
15880 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
15881 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
15886 static struct hda_bind_ctls alc663_asus_one_bind_switch
= {
15887 .ops
= &snd_hda_bind_sw
,
15889 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15890 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
15895 static struct snd_kcontrol_new alc663_m51va_mixer
[] = {
15896 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15897 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch
),
15898 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15899 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15903 static struct hda_bind_ctls alc663_asus_tree_bind_switch
= {
15904 .ops
= &snd_hda_bind_sw
,
15906 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15907 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
15908 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
15913 static struct snd_kcontrol_new alc663_two_hp_m1_mixer
[] = {
15914 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15915 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch
),
15916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15917 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15918 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15919 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15924 static struct hda_bind_ctls alc663_asus_four_bind_switch
= {
15925 .ops
= &snd_hda_bind_sw
,
15927 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15928 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
15929 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
15934 static struct snd_kcontrol_new alc663_two_hp_m2_mixer
[] = {
15935 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15936 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch
),
15937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15939 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15940 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15944 static struct snd_kcontrol_new alc662_1bjd_mixer
[] = {
15945 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15946 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
15947 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
15948 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15950 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15951 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15955 static struct hda_bind_ctls alc663_asus_two_bind_master_vol
= {
15956 .ops
= &snd_hda_bind_vol
,
15958 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
15959 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT
),
15964 static struct hda_bind_ctls alc663_asus_two_bind_switch
= {
15965 .ops
= &snd_hda_bind_sw
,
15967 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
15968 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT
),
15973 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer
[] = {
15974 HDA_BIND_VOL("Master Playback Volume",
15975 &alc663_asus_two_bind_master_vol
),
15976 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
15977 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15978 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
15979 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15980 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15984 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer
[] = {
15985 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
15986 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
15987 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15994 static struct snd_kcontrol_new alc663_g71v_mixer
[] = {
15995 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15996 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
15997 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
15998 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
15999 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
16001 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16003 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16004 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16008 static struct snd_kcontrol_new alc663_g50v_mixer
[] = {
16009 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16010 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
16011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
16013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16015 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16016 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16017 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
16018 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
16022 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
16024 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
16025 .name
= "Channel Mode",
16026 .info
= alc_ch_mode_info
,
16027 .get
= alc_ch_mode_get
,
16028 .put
= alc_ch_mode_put
,
16033 static struct hda_verb alc662_init_verbs
[] = {
16034 /* ADC: mute amp left and right */
16035 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16036 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16037 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16045 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16047 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16049 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16050 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16052 /* Front Pin: output 0 (0x0c) */
16053 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16054 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16056 /* Rear Pin: output 1 (0x0d) */
16057 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16060 /* CLFE Pin: output 2 (0x0e) */
16061 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16062 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16064 /* Mic (rear) pin: input vref at 80% */
16065 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16066 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16067 /* Front Mic pin: input vref at 80% */
16068 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
16069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16070 /* Line In pin: input */
16071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
16073 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16074 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16075 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16076 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
16077 /* CD pin widget for input */
16078 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16080 /* FIXME: use matrix-type input source selection */
16081 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16084 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16086 /* always trun on EAPD */
16087 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16088 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
16093 static struct hda_verb alc662_sue_init_verbs
[] = {
16094 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
16095 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
16099 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
16100 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16101 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16105 /* Set Unsolicited Event*/
16106 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
16107 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
16108 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16113 * generic initialization of ADC, input mixers and output mixers
16115 static struct hda_verb alc662_auto_init_verbs
[] = {
16117 * Unmute ADC and set the default input to mic-in
16119 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
16120 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16122 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16124 * Note: PASD motherboards uses the Line In 2 as the input for front
16125 * panel mic (mic 2)
16127 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
16130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
16131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
16132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
16135 * Set up output mixers (0x0c - 0x0f)
16137 /* set vol=0 to output mixers */
16138 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16139 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16140 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
16142 /* set up input amps for analog loopback */
16143 /* Amp Indices: DAC = 0, mixer = 1 */
16144 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16145 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16146 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16147 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16148 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16149 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16152 /* FIXME: use matrix-type input source selection */
16153 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16156 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16160 /* additional verbs for ALC663 */
16161 static struct hda_verb alc663_auto_init_verbs
[] = {
16162 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
16163 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16167 static struct hda_verb alc663_m51va_init_verbs
[] = {
16168 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16169 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16170 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16171 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16172 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16173 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16174 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
16175 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16176 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16180 static struct hda_verb alc663_21jd_amic_init_verbs
[] = {
16181 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16182 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16183 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16184 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16186 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16187 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16191 static struct hda_verb alc662_1bjd_amic_init_verbs
[] = {
16192 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16193 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16194 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16195 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
16196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16198 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16199 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16203 static struct hda_verb alc663_15jd_amic_init_verbs
[] = {
16204 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16205 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16206 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16207 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16208 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16209 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16210 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16214 static struct hda_verb alc663_two_hp_amic_m1_init_verbs
[] = {
16215 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16216 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16217 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16218 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
16219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16221 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
16222 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16223 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16224 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16225 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16226 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16230 static struct hda_verb alc663_two_hp_amic_m2_init_verbs
[] = {
16231 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16232 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16233 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16234 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16236 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16237 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16238 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16239 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
16240 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16241 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16242 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16246 static struct hda_verb alc663_g71v_init_verbs
[] = {
16247 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16248 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16249 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16251 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16252 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16253 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
16255 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
16256 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
16257 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
16261 static struct hda_verb alc663_g50v_init_verbs
[] = {
16262 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16263 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16264 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
16266 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16267 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16271 static struct hda_verb alc662_ecs_init_verbs
[] = {
16272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
16273 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16274 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16275 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16279 static struct hda_verb alc272_dell_zm1_init_verbs
[] = {
16280 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16281 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16283 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16284 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16285 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16286 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
16289 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16290 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16294 static struct hda_verb alc272_dell_init_verbs
[] = {
16295 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16296 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16297 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16298 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
16299 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
16300 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
16301 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
16302 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
16303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
16304 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
16305 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
16309 static struct snd_kcontrol_new alc662_auto_capture_mixer
[] = {
16310 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
16311 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
16315 static struct snd_kcontrol_new alc272_auto_capture_mixer
[] = {
16316 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
16317 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
16321 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
16323 unsigned int present
;
16324 unsigned char bits
;
16326 present
= snd_hda_codec_read(codec
, 0x14, 0,
16327 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
16328 bits
= present
? HDA_AMP_MUTE
: 0;
16329 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
16330 HDA_AMP_MUTE
, bits
);
16333 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
16335 unsigned int present
;
16336 unsigned char bits
;
16338 present
= snd_hda_codec_read(codec
, 0x1b, 0,
16339 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
16340 bits
= present
? HDA_AMP_MUTE
: 0;
16341 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
16342 HDA_AMP_MUTE
, bits
);
16343 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
16344 HDA_AMP_MUTE
, bits
);
16347 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
16350 if ((res
>> 26) == ALC880_HP_EVENT
)
16351 alc662_lenovo_101e_all_automute(codec
);
16352 if ((res
>> 26) == ALC880_FRONT_EVENT
)
16353 alc662_lenovo_101e_ispeaker_automute(codec
);
16356 static void alc662_eeepc_mic_automute(struct hda_codec
*codec
)
16358 unsigned int present
;
16360 present
= snd_hda_codec_read(codec
, 0x18, 0,
16361 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
16362 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16363 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
16364 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16365 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
16366 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16367 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
16368 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16369 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
16372 /* unsolicited event for HP jack sensing */
16373 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
16376 if ((res
>> 26) == ALC880_MIC_EVENT
)
16377 alc662_eeepc_mic_automute(codec
);
16379 alc262_hippo_unsol_event(codec
, res
);
16382 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
16384 alc262_hippo1_init_hook(codec
);
16385 alc662_eeepc_mic_automute(codec
);
16388 static void alc662_eeepc_ep20_inithook(struct hda_codec
*codec
)
16390 struct alc_spec
*spec
= codec
->spec
;
16392 spec
->autocfg
.hp_pins
[0] = 0x14;
16393 spec
->autocfg
.speaker_pins
[0] = 0x1b;
16394 alc262_hippo_master_update(codec
);
16397 static void alc663_m51va_speaker_automute(struct hda_codec
*codec
)
16399 unsigned int present
;
16400 unsigned char bits
;
16402 present
= snd_hda_codec_read(codec
, 0x21, 0,
16403 AC_VERB_GET_PIN_SENSE
, 0)
16404 & AC_PINSENSE_PRESENCE
;
16405 bits
= present
? HDA_AMP_MUTE
: 0;
16406 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
16407 AMP_IN_MUTE(0), bits
);
16408 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
16409 AMP_IN_MUTE(0), bits
);
16412 static void alc663_21jd_two_speaker_automute(struct hda_codec
*codec
)
16414 unsigned int present
;
16415 unsigned char bits
;
16417 present
= snd_hda_codec_read(codec
, 0x21, 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 alc663_15jd_two_speaker_automute(struct hda_codec
*codec
)
16433 unsigned int present
;
16434 unsigned char bits
;
16436 present
= snd_hda_codec_read(codec
, 0x15, 0,
16437 AC_VERB_GET_PIN_SENSE
, 0)
16438 & AC_PINSENSE_PRESENCE
;
16439 bits
= present
? HDA_AMP_MUTE
: 0;
16440 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
16441 AMP_IN_MUTE(0), bits
);
16442 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
16443 AMP_IN_MUTE(0), bits
);
16444 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
16445 AMP_IN_MUTE(0), bits
);
16446 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
16447 AMP_IN_MUTE(0), bits
);
16450 static void alc662_f5z_speaker_automute(struct hda_codec
*codec
)
16452 unsigned int present
;
16453 unsigned char bits
;
16455 present
= snd_hda_codec_read(codec
, 0x1b, 0,
16456 AC_VERB_GET_PIN_SENSE
, 0)
16457 & AC_PINSENSE_PRESENCE
;
16458 bits
= present
? 0 : PIN_OUT
;
16459 snd_hda_codec_write(codec
, 0x14, 0,
16460 AC_VERB_SET_PIN_WIDGET_CONTROL
, bits
);
16463 static void alc663_two_hp_m1_speaker_automute(struct hda_codec
*codec
)
16465 unsigned int present1
, present2
;
16467 present1
= snd_hda_codec_read(codec
, 0x21, 0,
16468 AC_VERB_GET_PIN_SENSE
, 0)
16469 & AC_PINSENSE_PRESENCE
;
16470 present2
= snd_hda_codec_read(codec
, 0x15, 0,
16471 AC_VERB_GET_PIN_SENSE
, 0)
16472 & AC_PINSENSE_PRESENCE
;
16474 if (present1
|| present2
) {
16475 snd_hda_codec_write_cache(codec
, 0x14, 0,
16476 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
16478 snd_hda_codec_write_cache(codec
, 0x14, 0,
16479 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
16483 static void alc663_two_hp_m2_speaker_automute(struct hda_codec
*codec
)
16485 unsigned int present1
, present2
;
16487 present1
= snd_hda_codec_read(codec
, 0x1b, 0,
16488 AC_VERB_GET_PIN_SENSE
, 0)
16489 & AC_PINSENSE_PRESENCE
;
16490 present2
= snd_hda_codec_read(codec
, 0x15, 0,
16491 AC_VERB_GET_PIN_SENSE
, 0)
16492 & AC_PINSENSE_PRESENCE
;
16494 if (present1
|| present2
) {
16495 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
16496 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16497 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
16498 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16500 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
16501 AMP_IN_MUTE(0), 0);
16502 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
16503 AMP_IN_MUTE(0), 0);
16507 static void alc663_m51va_mic_automute(struct hda_codec
*codec
)
16509 unsigned int present
;
16511 present
= snd_hda_codec_read(codec
, 0x18, 0,
16512 AC_VERB_GET_PIN_SENSE
, 0)
16513 & AC_PINSENSE_PRESENCE
;
16514 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16515 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
16516 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16517 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
16518 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16519 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
16520 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
16521 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
16524 static void alc663_m51va_unsol_event(struct hda_codec
*codec
,
16527 switch (res
>> 26) {
16528 case ALC880_HP_EVENT
:
16529 alc663_m51va_speaker_automute(codec
);
16531 case ALC880_MIC_EVENT
:
16532 alc663_m51va_mic_automute(codec
);
16537 static void alc663_m51va_inithook(struct hda_codec
*codec
)
16539 alc663_m51va_speaker_automute(codec
);
16540 alc663_m51va_mic_automute(codec
);
16543 /* ***************** Mode1 ******************************/
16544 static void alc663_mode1_unsol_event(struct hda_codec
*codec
,
16547 switch (res
>> 26) {
16548 case ALC880_HP_EVENT
:
16549 alc663_m51va_speaker_automute(codec
);
16551 case ALC880_MIC_EVENT
:
16552 alc662_eeepc_mic_automute(codec
);
16557 static void alc663_mode1_inithook(struct hda_codec
*codec
)
16559 alc663_m51va_speaker_automute(codec
);
16560 alc662_eeepc_mic_automute(codec
);
16562 /* ***************** Mode2 ******************************/
16563 static void alc662_mode2_unsol_event(struct hda_codec
*codec
,
16566 switch (res
>> 26) {
16567 case ALC880_HP_EVENT
:
16568 alc662_f5z_speaker_automute(codec
);
16570 case ALC880_MIC_EVENT
:
16571 alc662_eeepc_mic_automute(codec
);
16576 static void alc662_mode2_inithook(struct hda_codec
*codec
)
16578 alc662_f5z_speaker_automute(codec
);
16579 alc662_eeepc_mic_automute(codec
);
16581 /* ***************** Mode3 ******************************/
16582 static void alc663_mode3_unsol_event(struct hda_codec
*codec
,
16585 switch (res
>> 26) {
16586 case ALC880_HP_EVENT
:
16587 alc663_two_hp_m1_speaker_automute(codec
);
16589 case ALC880_MIC_EVENT
:
16590 alc662_eeepc_mic_automute(codec
);
16595 static void alc663_mode3_inithook(struct hda_codec
*codec
)
16597 alc663_two_hp_m1_speaker_automute(codec
);
16598 alc662_eeepc_mic_automute(codec
);
16600 /* ***************** Mode4 ******************************/
16601 static void alc663_mode4_unsol_event(struct hda_codec
*codec
,
16604 switch (res
>> 26) {
16605 case ALC880_HP_EVENT
:
16606 alc663_21jd_two_speaker_automute(codec
);
16608 case ALC880_MIC_EVENT
:
16609 alc662_eeepc_mic_automute(codec
);
16614 static void alc663_mode4_inithook(struct hda_codec
*codec
)
16616 alc663_21jd_two_speaker_automute(codec
);
16617 alc662_eeepc_mic_automute(codec
);
16619 /* ***************** Mode5 ******************************/
16620 static void alc663_mode5_unsol_event(struct hda_codec
*codec
,
16623 switch (res
>> 26) {
16624 case ALC880_HP_EVENT
:
16625 alc663_15jd_two_speaker_automute(codec
);
16627 case ALC880_MIC_EVENT
:
16628 alc662_eeepc_mic_automute(codec
);
16633 static void alc663_mode5_inithook(struct hda_codec
*codec
)
16635 alc663_15jd_two_speaker_automute(codec
);
16636 alc662_eeepc_mic_automute(codec
);
16638 /* ***************** Mode6 ******************************/
16639 static void alc663_mode6_unsol_event(struct hda_codec
*codec
,
16642 switch (res
>> 26) {
16643 case ALC880_HP_EVENT
:
16644 alc663_two_hp_m2_speaker_automute(codec
);
16646 case ALC880_MIC_EVENT
:
16647 alc662_eeepc_mic_automute(codec
);
16652 static void alc663_mode6_inithook(struct hda_codec
*codec
)
16654 alc663_two_hp_m2_speaker_automute(codec
);
16655 alc662_eeepc_mic_automute(codec
);
16658 static void alc663_g71v_hp_automute(struct hda_codec
*codec
)
16660 unsigned int present
;
16661 unsigned char bits
;
16663 present
= snd_hda_codec_read(codec
, 0x21, 0,
16664 AC_VERB_GET_PIN_SENSE
, 0)
16665 & AC_PINSENSE_PRESENCE
;
16666 bits
= present
? HDA_AMP_MUTE
: 0;
16667 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
16668 HDA_AMP_MUTE
, bits
);
16669 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
16670 HDA_AMP_MUTE
, bits
);
16673 static void alc663_g71v_front_automute(struct hda_codec
*codec
)
16675 unsigned int present
;
16676 unsigned char bits
;
16678 present
= snd_hda_codec_read(codec
, 0x15, 0,
16679 AC_VERB_GET_PIN_SENSE
, 0)
16680 & AC_PINSENSE_PRESENCE
;
16681 bits
= present
? HDA_AMP_MUTE
: 0;
16682 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
16683 HDA_AMP_MUTE
, bits
);
16686 static void alc663_g71v_unsol_event(struct hda_codec
*codec
,
16689 switch (res
>> 26) {
16690 case ALC880_HP_EVENT
:
16691 alc663_g71v_hp_automute(codec
);
16693 case ALC880_FRONT_EVENT
:
16694 alc663_g71v_front_automute(codec
);
16696 case ALC880_MIC_EVENT
:
16697 alc662_eeepc_mic_automute(codec
);
16702 static void alc663_g71v_inithook(struct hda_codec
*codec
)
16704 alc663_g71v_front_automute(codec
);
16705 alc663_g71v_hp_automute(codec
);
16706 alc662_eeepc_mic_automute(codec
);
16709 static void alc663_g50v_unsol_event(struct hda_codec
*codec
,
16712 switch (res
>> 26) {
16713 case ALC880_HP_EVENT
:
16714 alc663_m51va_speaker_automute(codec
);
16716 case ALC880_MIC_EVENT
:
16717 alc662_eeepc_mic_automute(codec
);
16722 static void alc663_g50v_inithook(struct hda_codec
*codec
)
16724 alc663_m51va_speaker_automute(codec
);
16725 alc662_eeepc_mic_automute(codec
);
16728 static struct snd_kcontrol_new alc662_ecs_mixer
[] = {
16729 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16730 ALC262_HIPPO_MASTER_SWITCH
,
16732 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT
),
16733 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16734 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16736 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
16737 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16738 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16742 static struct snd_kcontrol_new alc272_nc10_mixer
[] = {
16743 /* Master Playback automatically created from Speaker and Headphone */
16744 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
16745 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
16746 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
16747 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
16749 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
16750 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
16751 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
16753 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
16754 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
16755 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
16759 #ifdef CONFIG_SND_HDA_POWER_SAVE
16760 #define alc662_loopbacks alc880_loopbacks
16764 /* pcm configuration: identical with ALC880 */
16765 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16766 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16767 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16768 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16771 * configuration and preset
16773 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
16774 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
16775 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
16776 [ALC662_3ST_6ch
] = "3stack-6ch",
16777 [ALC662_5ST_DIG
] = "6stack-dig",
16778 [ALC662_LENOVO_101E
] = "lenovo-101e",
16779 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
16780 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
16781 [ALC662_ECS
] = "ecs",
16782 [ALC663_ASUS_M51VA
] = "m51va",
16783 [ALC663_ASUS_G71V
] = "g71v",
16784 [ALC663_ASUS_H13
] = "h13",
16785 [ALC663_ASUS_G50V
] = "g50v",
16786 [ALC663_ASUS_MODE1
] = "asus-mode1",
16787 [ALC662_ASUS_MODE2
] = "asus-mode2",
16788 [ALC663_ASUS_MODE3
] = "asus-mode3",
16789 [ALC663_ASUS_MODE4
] = "asus-mode4",
16790 [ALC663_ASUS_MODE5
] = "asus-mode5",
16791 [ALC663_ASUS_MODE6
] = "asus-mode6",
16792 [ALC272_DELL
] = "dell",
16793 [ALC272_DELL_ZM1
] = "dell-zm1",
16794 [ALC272_SAMSUNG_NC10
] = "samsung-nc10",
16795 [ALC662_AUTO
] = "auto",
16798 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
16799 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS
),
16800 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL
),
16801 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1
),
16802 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1
),
16803 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3
),
16804 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3
),
16805 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1
),
16806 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2
),
16807 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1
),
16808 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2
),
16809 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2
),
16810 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2
),
16811 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6
),
16812 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6
),
16813 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2
),
16814 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3
),
16815 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA
),
16816 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2
),
16817 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2
),
16818 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5
),
16819 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6
),
16820 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2
),
16821 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1
),
16822 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2
),
16823 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2
),
16824 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
16825 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16826 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3
),
16827 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3
),
16828 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1
),
16829 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1
),
16830 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1
),
16831 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1
),
16832 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2
),
16833 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2
),
16834 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1
),
16835 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1
),
16836 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3
),
16837 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1
),
16838 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1
),
16839 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V
),
16840 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16841 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1
),
16842 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2
),
16843 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA
),
16844 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1
),
16845 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4
),
16846 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
16847 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
16848 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
16849 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS
),
16850 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16851 ALC662_3ST_6ch_DIG
),
16852 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10
),
16853 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16854 ALC662_3ST_6ch_DIG
),
16855 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG
),
16856 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA
),
16857 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
16858 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16859 ALC662_3ST_6ch_DIG
),
16860 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16865 static struct alc_config_preset alc662_presets
[] = {
16866 [ALC662_3ST_2ch_DIG
] = {
16867 .mixers
= { alc662_3ST_2ch_mixer
},
16868 .init_verbs
= { alc662_init_verbs
},
16869 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16870 .dac_nids
= alc662_dac_nids
,
16871 .dig_out_nid
= ALC662_DIGOUT_NID
,
16872 .dig_in_nid
= ALC662_DIGIN_NID
,
16873 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16874 .channel_mode
= alc662_3ST_2ch_modes
,
16875 .input_mux
= &alc662_capture_source
,
16877 [ALC662_3ST_6ch_DIG
] = {
16878 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
16879 .init_verbs
= { alc662_init_verbs
},
16880 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16881 .dac_nids
= alc662_dac_nids
,
16882 .dig_out_nid
= ALC662_DIGOUT_NID
,
16883 .dig_in_nid
= ALC662_DIGIN_NID
,
16884 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16885 .channel_mode
= alc662_3ST_6ch_modes
,
16887 .input_mux
= &alc662_capture_source
,
16889 [ALC662_3ST_6ch
] = {
16890 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
},
16891 .init_verbs
= { alc662_init_verbs
},
16892 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16893 .dac_nids
= alc662_dac_nids
,
16894 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16895 .channel_mode
= alc662_3ST_6ch_modes
,
16897 .input_mux
= &alc662_capture_source
,
16899 [ALC662_5ST_DIG
] = {
16900 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
},
16901 .init_verbs
= { alc662_init_verbs
},
16902 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16903 .dac_nids
= alc662_dac_nids
,
16904 .dig_out_nid
= ALC662_DIGOUT_NID
,
16905 .dig_in_nid
= ALC662_DIGIN_NID
,
16906 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
16907 .channel_mode
= alc662_5stack_modes
,
16908 .input_mux
= &alc662_capture_source
,
16910 [ALC662_LENOVO_101E
] = {
16911 .mixers
= { alc662_lenovo_101e_mixer
},
16912 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
16913 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16914 .dac_nids
= alc662_dac_nids
,
16915 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16916 .channel_mode
= alc662_3ST_2ch_modes
,
16917 .input_mux
= &alc662_lenovo_101e_capture_source
,
16918 .unsol_event
= alc662_lenovo_101e_unsol_event
,
16919 .init_hook
= alc662_lenovo_101e_all_automute
,
16921 [ALC662_ASUS_EEEPC_P701
] = {
16922 .mixers
= { alc662_eeepc_p701_mixer
},
16923 .init_verbs
= { alc662_init_verbs
,
16924 alc662_eeepc_sue_init_verbs
},
16925 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16926 .dac_nids
= alc662_dac_nids
,
16927 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16928 .channel_mode
= alc662_3ST_2ch_modes
,
16929 .input_mux
= &alc662_eeepc_capture_source
,
16930 .unsol_event
= alc662_eeepc_unsol_event
,
16931 .init_hook
= alc662_eeepc_inithook
,
16933 [ALC662_ASUS_EEEPC_EP20
] = {
16934 .mixers
= { alc662_eeepc_ep20_mixer
,
16935 alc662_chmode_mixer
},
16936 .init_verbs
= { alc662_init_verbs
,
16937 alc662_eeepc_ep20_sue_init_verbs
},
16938 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16939 .dac_nids
= alc662_dac_nids
,
16940 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
16941 .channel_mode
= alc662_3ST_6ch_modes
,
16942 .input_mux
= &alc662_lenovo_101e_capture_source
,
16943 .unsol_event
= alc662_eeepc_unsol_event
,
16944 .init_hook
= alc662_eeepc_ep20_inithook
,
16947 .mixers
= { alc662_ecs_mixer
},
16948 .init_verbs
= { alc662_init_verbs
,
16949 alc662_ecs_init_verbs
},
16950 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16951 .dac_nids
= alc662_dac_nids
,
16952 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16953 .channel_mode
= alc662_3ST_2ch_modes
,
16954 .input_mux
= &alc662_eeepc_capture_source
,
16955 .unsol_event
= alc662_eeepc_unsol_event
,
16956 .init_hook
= alc662_eeepc_inithook
,
16958 [ALC663_ASUS_M51VA
] = {
16959 .mixers
= { alc663_m51va_mixer
},
16960 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
16961 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16962 .dac_nids
= alc662_dac_nids
,
16963 .dig_out_nid
= ALC662_DIGOUT_NID
,
16964 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16965 .channel_mode
= alc662_3ST_2ch_modes
,
16966 .input_mux
= &alc663_m51va_capture_source
,
16967 .unsol_event
= alc663_m51va_unsol_event
,
16968 .init_hook
= alc663_m51va_inithook
,
16970 [ALC663_ASUS_G71V
] = {
16971 .mixers
= { alc663_g71v_mixer
},
16972 .init_verbs
= { alc662_init_verbs
, alc663_g71v_init_verbs
},
16973 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16974 .dac_nids
= alc662_dac_nids
,
16975 .dig_out_nid
= ALC662_DIGOUT_NID
,
16976 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16977 .channel_mode
= alc662_3ST_2ch_modes
,
16978 .input_mux
= &alc662_eeepc_capture_source
,
16979 .unsol_event
= alc663_g71v_unsol_event
,
16980 .init_hook
= alc663_g71v_inithook
,
16982 [ALC663_ASUS_H13
] = {
16983 .mixers
= { alc663_m51va_mixer
},
16984 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
16985 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16986 .dac_nids
= alc662_dac_nids
,
16987 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
16988 .channel_mode
= alc662_3ST_2ch_modes
,
16989 .input_mux
= &alc663_m51va_capture_source
,
16990 .unsol_event
= alc663_m51va_unsol_event
,
16991 .init_hook
= alc663_m51va_inithook
,
16993 [ALC663_ASUS_G50V
] = {
16994 .mixers
= { alc663_g50v_mixer
},
16995 .init_verbs
= { alc662_init_verbs
, alc663_g50v_init_verbs
},
16996 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
16997 .dac_nids
= alc662_dac_nids
,
16998 .dig_out_nid
= ALC662_DIGOUT_NID
,
16999 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
17000 .channel_mode
= alc662_3ST_6ch_modes
,
17001 .input_mux
= &alc663_capture_source
,
17002 .unsol_event
= alc663_g50v_unsol_event
,
17003 .init_hook
= alc663_g50v_inithook
,
17005 [ALC663_ASUS_MODE1
] = {
17006 .mixers
= { alc663_m51va_mixer
},
17007 .cap_mixer
= alc662_auto_capture_mixer
,
17008 .init_verbs
= { alc662_init_verbs
,
17009 alc663_21jd_amic_init_verbs
},
17010 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17012 .dac_nids
= alc662_dac_nids
,
17013 .dig_out_nid
= ALC662_DIGOUT_NID
,
17014 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17015 .channel_mode
= alc662_3ST_2ch_modes
,
17016 .input_mux
= &alc662_eeepc_capture_source
,
17017 .unsol_event
= alc663_mode1_unsol_event
,
17018 .init_hook
= alc663_mode1_inithook
,
17020 [ALC662_ASUS_MODE2
] = {
17021 .mixers
= { alc662_1bjd_mixer
},
17022 .cap_mixer
= alc662_auto_capture_mixer
,
17023 .init_verbs
= { alc662_init_verbs
,
17024 alc662_1bjd_amic_init_verbs
},
17025 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17026 .dac_nids
= alc662_dac_nids
,
17027 .dig_out_nid
= ALC662_DIGOUT_NID
,
17028 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17029 .channel_mode
= alc662_3ST_2ch_modes
,
17030 .input_mux
= &alc662_eeepc_capture_source
,
17031 .unsol_event
= alc662_mode2_unsol_event
,
17032 .init_hook
= alc662_mode2_inithook
,
17034 [ALC663_ASUS_MODE3
] = {
17035 .mixers
= { alc663_two_hp_m1_mixer
},
17036 .cap_mixer
= alc662_auto_capture_mixer
,
17037 .init_verbs
= { alc662_init_verbs
,
17038 alc663_two_hp_amic_m1_init_verbs
},
17039 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17041 .dac_nids
= alc662_dac_nids
,
17042 .dig_out_nid
= ALC662_DIGOUT_NID
,
17043 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17044 .channel_mode
= alc662_3ST_2ch_modes
,
17045 .input_mux
= &alc662_eeepc_capture_source
,
17046 .unsol_event
= alc663_mode3_unsol_event
,
17047 .init_hook
= alc663_mode3_inithook
,
17049 [ALC663_ASUS_MODE4
] = {
17050 .mixers
= { alc663_asus_21jd_clfe_mixer
},
17051 .cap_mixer
= alc662_auto_capture_mixer
,
17052 .init_verbs
= { alc662_init_verbs
,
17053 alc663_21jd_amic_init_verbs
},
17054 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17056 .dac_nids
= alc662_dac_nids
,
17057 .dig_out_nid
= ALC662_DIGOUT_NID
,
17058 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17059 .channel_mode
= alc662_3ST_2ch_modes
,
17060 .input_mux
= &alc662_eeepc_capture_source
,
17061 .unsol_event
= alc663_mode4_unsol_event
,
17062 .init_hook
= alc663_mode4_inithook
,
17064 [ALC663_ASUS_MODE5
] = {
17065 .mixers
= { alc663_asus_15jd_clfe_mixer
},
17066 .cap_mixer
= alc662_auto_capture_mixer
,
17067 .init_verbs
= { alc662_init_verbs
,
17068 alc663_15jd_amic_init_verbs
},
17069 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17071 .dac_nids
= alc662_dac_nids
,
17072 .dig_out_nid
= ALC662_DIGOUT_NID
,
17073 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17074 .channel_mode
= alc662_3ST_2ch_modes
,
17075 .input_mux
= &alc662_eeepc_capture_source
,
17076 .unsol_event
= alc663_mode5_unsol_event
,
17077 .init_hook
= alc663_mode5_inithook
,
17079 [ALC663_ASUS_MODE6
] = {
17080 .mixers
= { alc663_two_hp_m2_mixer
},
17081 .cap_mixer
= alc662_auto_capture_mixer
,
17082 .init_verbs
= { alc662_init_verbs
,
17083 alc663_two_hp_amic_m2_init_verbs
},
17084 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
17086 .dac_nids
= alc662_dac_nids
,
17087 .dig_out_nid
= ALC662_DIGOUT_NID
,
17088 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17089 .channel_mode
= alc662_3ST_2ch_modes
,
17090 .input_mux
= &alc662_eeepc_capture_source
,
17091 .unsol_event
= alc663_mode6_unsol_event
,
17092 .init_hook
= alc663_mode6_inithook
,
17095 .mixers
= { alc663_m51va_mixer
},
17096 .cap_mixer
= alc272_auto_capture_mixer
,
17097 .init_verbs
= { alc662_init_verbs
, alc272_dell_init_verbs
},
17098 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
17099 .dac_nids
= alc662_dac_nids
,
17100 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17101 .adc_nids
= alc272_adc_nids
,
17102 .num_adc_nids
= ARRAY_SIZE(alc272_adc_nids
),
17103 .capsrc_nids
= alc272_capsrc_nids
,
17104 .channel_mode
= alc662_3ST_2ch_modes
,
17105 .input_mux
= &alc663_m51va_capture_source
,
17106 .unsol_event
= alc663_m51va_unsol_event
,
17107 .init_hook
= alc663_m51va_inithook
,
17109 [ALC272_DELL_ZM1
] = {
17110 .mixers
= { alc663_m51va_mixer
},
17111 .cap_mixer
= alc662_auto_capture_mixer
,
17112 .init_verbs
= { alc662_init_verbs
, alc272_dell_zm1_init_verbs
},
17113 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
17114 .dac_nids
= alc662_dac_nids
,
17115 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17116 .adc_nids
= alc662_adc_nids
,
17117 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
17118 .capsrc_nids
= alc662_capsrc_nids
,
17119 .channel_mode
= alc662_3ST_2ch_modes
,
17120 .input_mux
= &alc663_m51va_capture_source
,
17121 .unsol_event
= alc663_m51va_unsol_event
,
17122 .init_hook
= alc663_m51va_inithook
,
17124 [ALC272_SAMSUNG_NC10
] = {
17125 .mixers
= { alc272_nc10_mixer
},
17126 .init_verbs
= { alc662_init_verbs
,
17127 alc663_21jd_amic_init_verbs
},
17128 .num_dacs
= ARRAY_SIZE(alc272_dac_nids
),
17129 .dac_nids
= alc272_dac_nids
,
17130 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
17131 .channel_mode
= alc662_3ST_2ch_modes
,
17132 .input_mux
= &alc272_nc10_capture_source
,
17133 .unsol_event
= alc663_mode4_unsol_event
,
17134 .init_hook
= alc663_mode4_inithook
,
17140 * BIOS auto configuration
17143 /* add playback controls from the parsed DAC table */
17144 static int alc662_auto_create_multi_out_ctls(struct alc_spec
*spec
,
17145 const struct auto_pin_cfg
*cfg
)
17148 static const char *chname
[4] = {
17149 "Front", "Surround", NULL
/*CLFE*/, "Side"
17154 for (i
= 0; i
< cfg
->line_outs
; i
++) {
17155 if (!spec
->multiout
.dac_nids
[i
])
17157 nid
= alc880_idx_to_dac(i
);
17160 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
17161 "Center Playback Volume",
17162 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
17166 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
17167 "LFE Playback Volume",
17168 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
17172 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
17173 "Center Playback Switch",
17174 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17178 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
17179 "LFE Playback Switch",
17180 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17185 sprintf(name
, "%s Playback Volume", chname
[i
]);
17186 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
17187 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
17191 sprintf(name
, "%s Playback Switch", chname
[i
]);
17192 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
17193 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i
),
17202 /* add playback controls for speaker and HP outputs */
17203 static int alc662_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
17214 /* ALC663 has a mono output pin on 0x17 */
17215 sprintf(name
, "%s Playback Switch", pfx
);
17216 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
17217 HDA_COMPOSE_AMP_VAL(pin
, 2, 0, HDA_OUTPUT
));
17221 if (alc880_is_fixed_pin(pin
)) {
17222 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
17223 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17224 /* specify the DAC as the extra output */
17225 if (!spec
->multiout
.hp_nid
)
17226 spec
->multiout
.hp_nid
= nid
;
17228 spec
->multiout
.extra_out_nid
[0] = nid
;
17229 /* control HP volume/switch on the output mixer amp */
17230 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
17231 sprintf(name
, "%s Playback Volume", pfx
);
17232 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
17233 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
17236 sprintf(name
, "%s Playback Switch", pfx
);
17237 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
17238 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
17241 } else if (alc880_is_multi_pin(pin
)) {
17242 /* set manual connection */
17243 /* we have only a switch on HP-out PIN */
17244 sprintf(name
, "%s Playback Switch", pfx
);
17245 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
17246 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
17253 /* return the index of the src widget from the connection list of the nid.
17254 * return -1 if not found
17256 static int alc662_input_pin_idx(struct hda_codec
*codec
, hda_nid_t nid
,
17259 hda_nid_t conn_list
[HDA_MAX_CONNECTIONS
];
17262 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
17263 ARRAY_SIZE(conn_list
));
17266 for (i
= 0; i
< conns
; i
++)
17267 if (conn_list
[i
] == src
)
17272 static int alc662_is_input_pin(struct hda_codec
*codec
, hda_nid_t nid
)
17274 unsigned int pincap
= snd_hda_query_pin_caps(codec
, nid
);
17275 return (pincap
& AC_PINCAP_IN
) != 0;
17278 /* create playback/capture controls for input pins */
17279 static int alc662_auto_create_analog_input_ctls(struct hda_codec
*codec
,
17280 const struct auto_pin_cfg
*cfg
)
17282 struct alc_spec
*spec
= codec
->spec
;
17283 struct hda_input_mux
*imux
= &spec
->private_imux
[0];
17286 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
17287 if (alc662_is_input_pin(codec
, cfg
->input_pins
[i
])) {
17288 idx
= alc662_input_pin_idx(codec
, 0x0b,
17289 cfg
->input_pins
[i
]);
17291 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
17292 auto_pin_cfg_labels
[i
],
17297 idx
= alc662_input_pin_idx(codec
, 0x22,
17298 cfg
->input_pins
[i
]);
17300 imux
->items
[imux
->num_items
].label
=
17301 auto_pin_cfg_labels
[i
];
17302 imux
->items
[imux
->num_items
].index
= idx
;
17310 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
17311 hda_nid_t nid
, int pin_type
,
17314 alc_set_pin_output(codec
, nid
, pin_type
);
17315 /* need the manual connection? */
17316 if (alc880_is_multi_pin(nid
)) {
17317 struct alc_spec
*spec
= codec
->spec
;
17318 int idx
= alc880_multi_pin_idx(nid
);
17319 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
17320 AC_VERB_SET_CONNECT_SEL
,
17321 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
17325 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
17327 struct alc_spec
*spec
= codec
->spec
;
17330 for (i
= 0; i
<= HDA_SIDE
; i
++) {
17331 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
17332 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
17334 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
17339 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
17341 struct alc_spec
*spec
= codec
->spec
;
17344 pin
= spec
->autocfg
.hp_pins
[0];
17345 if (pin
) /* connect to front */
17347 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
17348 pin
= spec
->autocfg
.speaker_pins
[0];
17350 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
17353 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17355 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
17357 struct alc_spec
*spec
= codec
->spec
;
17360 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
17361 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
17362 if (alc662_is_input_pin(codec
, nid
)) {
17363 alc_set_input_pin(codec
, nid
, i
);
17364 if (nid
!= ALC662_PIN_CD_NID
&&
17365 (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
))
17366 snd_hda_codec_write(codec
, nid
, 0,
17367 AC_VERB_SET_AMP_GAIN_MUTE
,
17373 #define alc662_auto_init_input_src alc882_auto_init_input_src
17375 static int alc662_parse_auto_config(struct hda_codec
*codec
)
17377 struct alc_spec
*spec
= codec
->spec
;
17379 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
17381 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
17385 if (!spec
->autocfg
.line_outs
)
17386 return 0; /* can't find valid BIOS pin config */
17388 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
17391 err
= alc662_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
17394 err
= alc662_auto_create_extra_out(spec
,
17395 spec
->autocfg
.speaker_pins
[0],
17399 err
= alc662_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
17403 err
= alc662_auto_create_analog_input_ctls(codec
, &spec
->autocfg
);
17407 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
17409 if (spec
->autocfg
.dig_outs
)
17410 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
17412 if (spec
->kctls
.list
)
17413 add_mixer(spec
, spec
->kctls
.list
);
17415 spec
->num_mux_defs
= 1;
17416 spec
->input_mux
= &spec
->private_imux
[0];
17418 add_verb(spec
, alc662_auto_init_verbs
);
17419 if (codec
->vendor_id
== 0x10ec0663)
17420 add_verb(spec
, alc663_auto_init_verbs
);
17422 err
= alc_auto_add_mic_boost(codec
);
17426 alc_ssid_check(codec
, 0x15, 0x1b, 0x14);
17431 /* additional initialization for auto-configuration model */
17432 static void alc662_auto_init(struct hda_codec
*codec
)
17434 struct alc_spec
*spec
= codec
->spec
;
17435 alc662_auto_init_multi_out(codec
);
17436 alc662_auto_init_hp_out(codec
);
17437 alc662_auto_init_analog_input(codec
);
17438 alc662_auto_init_input_src(codec
);
17439 if (spec
->unsol_event
)
17440 alc_inithook(codec
);
17443 static int patch_alc662(struct hda_codec
*codec
)
17445 struct alc_spec
*spec
;
17446 int err
, board_config
;
17448 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
17452 codec
->spec
= spec
;
17454 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
17456 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
17459 if (board_config
< 0) {
17460 printk(KERN_INFO
"hda_codec: Unknown model for %s, "
17461 "trying auto-probe from BIOS...\n", codec
->chip_name
);
17462 board_config
= ALC662_AUTO
;
17465 if (board_config
== ALC662_AUTO
) {
17466 /* automatic parse from the BIOS config */
17467 err
= alc662_parse_auto_config(codec
);
17473 "hda_codec: Cannot set up configuration "
17474 "from BIOS. Using base mode...\n");
17475 board_config
= ALC662_3ST_2ch_DIG
;
17479 err
= snd_hda_attach_beep_device(codec
, 0x1);
17485 if (board_config
!= ALC662_AUTO
)
17486 setup_preset(spec
, &alc662_presets
[board_config
]);
17488 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
17489 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
17491 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
17492 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
17494 spec
->adc_nids
= alc662_adc_nids
;
17495 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
17496 spec
->capsrc_nids
= alc662_capsrc_nids
;
17498 if (!spec
->cap_mixer
)
17499 set_capture_mixer(spec
);
17500 if (codec
->vendor_id
== 0x10ec0662)
17501 set_beep_amp(spec
, 0x0b, 0x05, HDA_INPUT
);
17503 set_beep_amp(spec
, 0x0b, 0x04, HDA_INPUT
);
17505 spec
->vmaster_nid
= 0x02;
17507 codec
->patch_ops
= alc_patch_ops
;
17508 if (board_config
== ALC662_AUTO
)
17509 spec
->init_hook
= alc662_auto_init
;
17510 #ifdef CONFIG_SND_HDA_POWER_SAVE
17511 if (!spec
->loopback
.amplist
)
17512 spec
->loopback
.amplist
= alc662_loopbacks
;
17514 codec
->proc_widget_hook
= print_realtek_coef
;
17522 static struct hda_codec_preset snd_hda_preset_realtek
[] = {
17523 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
17524 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
17525 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
17526 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
17527 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
17528 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
17529 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
17530 .patch
= patch_alc861
},
17531 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
17532 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
17533 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
17534 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
17535 .patch
= patch_alc883
},
17536 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
17537 .patch
= patch_alc662
},
17538 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
17539 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
17540 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
17541 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
17542 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
17543 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
17544 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
17545 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
17546 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
17547 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc883
},
17548 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
17549 .patch
= patch_alc883
},
17550 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
17551 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc883
},
17552 {} /* terminator */
17555 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17557 MODULE_LICENSE("GPL");
17558 MODULE_DESCRIPTION("Realtek HD-audio codec");
17560 static struct hda_codec_preset_list realtek_list
= {
17561 .preset
= snd_hda_preset_realtek
,
17562 .owner
= THIS_MODULE
,
17565 static int __init
patch_realtek_init(void)
17567 return snd_hda_add_codec_preset(&realtek_list
);
17570 static void __exit
patch_realtek_exit(void)
17572 snd_hda_delete_codec_preset(&realtek_list
);
17575 module_init(patch_realtek_init
)
17576 module_exit(patch_realtek_exit
)