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,
216 ALC883_TARGA_2ch_DIG,
217 ALC883_TARGA_8ch_DIG,
220 ALC888_ACER_ASPIRE_4930G,
221 ALC888_ACER_ASPIRE_6530G,
222 ALC888_ACER_ASPIRE_8930G,
223 ALC888_ACER_ASPIRE_7730G,
227 ALC883_LENOVO_101E_2ch,
228 ALC883_LENOVO_NB0763,
229 ALC888_LENOVO_MS7195_DIG,
237 ALC883_FUJITSU_PI2515,
238 ALC888_FUJITSU_XA3530,
239 ALC883_3ST_6ch_INTEL,
252 #define GPIO_MASK 0x03
254 /* extra amp-initialization sequence types */
263 struct alc_mic_route {
265 unsigned char mux_idx;
266 unsigned char amix_idx;
269 #define MUX_IDX_UNDEF ((unsigned char)-1)
272 /* codec parameterization */
273 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
274 unsigned int num_mixers;
275 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
276 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
278 const struct hda_verb *init_verbs[5]; /* initialization verbs
282 unsigned int num_init_verbs;
284 char stream_name_analog[32]; /* analog PCM stream */
285 struct hda_pcm_stream *stream_analog_playback;
286 struct hda_pcm_stream *stream_analog_capture;
287 struct hda_pcm_stream *stream_analog_alt_playback;
288 struct hda_pcm_stream *stream_analog_alt_capture;
290 char stream_name_digital[32]; /* digital PCM stream */
291 struct hda_pcm_stream *stream_digital_playback;
292 struct hda_pcm_stream *stream_digital_capture;
295 struct hda_multi_out multiout; /* playback set-up
296 * max_channels, dacs must be set
297 * dig_out_nid and hp_nid are optional
299 hda_nid_t alt_dac_nid;
300 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
304 unsigned int num_adc_nids;
306 hda_nid_t *capsrc_nids;
307 hda_nid_t dig_in_nid; /* digital-in NID; optional */
310 unsigned int num_mux_defs;
311 const struct hda_input_mux *input_mux;
312 unsigned int cur_mux[3];
313 struct alc_mic_route ext_mic;
314 struct alc_mic_route int_mic;
317 const struct hda_channel_mode *channel_mode;
318 int num_channel_mode;
320 int const_channel_count;
321 int ext_channel_count;
323 /* PCM information */
324 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
326 /* dynamic controls, init_verbs and input_mux */
327 struct auto_pin_cfg autocfg;
328 struct snd_array kctls;
329 struct hda_input_mux private_imux[3];
330 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
331 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
332 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
335 void (*init_hook)(struct hda_codec *codec);
336 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
338 /* for pin sensing */
339 unsigned int sense_updated: 1;
340 unsigned int jack_present: 1;
341 unsigned int master_sw: 1;
342 unsigned int auto_mic:1;
345 unsigned int no_analog :1; /* digital I/O only */
348 /* for virtual master */
349 hda_nid_t vmaster_nid;
350 #ifdef CONFIG_SND_HDA_POWER_SAVE
351 struct hda_loopback_check loopback;
356 unsigned int pll_coef_idx, pll_coef_bit;
360 * configuration template - to be copied to the spec instance
362 struct alc_config_preset {
363 struct snd_kcontrol_new *mixers[5]; /* should be identical size
366 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
367 const struct hda_verb *init_verbs[5];
368 unsigned int num_dacs;
370 hda_nid_t dig_out_nid; /* optional */
371 hda_nid_t hp_nid; /* optional */
372 hda_nid_t *slave_dig_outs;
373 unsigned int num_adc_nids;
375 hda_nid_t *capsrc_nids;
376 hda_nid_t dig_in_nid;
377 unsigned int num_channel_mode;
378 const struct hda_channel_mode *channel_mode;
380 int const_channel_count;
381 unsigned int num_mux_defs;
382 const struct hda_input_mux *input_mux;
383 void (*unsol_event)(struct hda_codec *, unsigned int);
384 void (*setup)(struct hda_codec *);
385 void (*init_hook)(struct hda_codec *);
386 #ifdef CONFIG_SND_HDA_POWER_SAVE
387 struct hda_amp_list *loopbacks;
395 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
396 struct snd_ctl_elem_info *uinfo)
398 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
399 struct alc_spec *spec = codec->spec;
400 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
401 if (mux_idx >= spec->num_mux_defs)
403 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
406 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
407 struct snd_ctl_elem_value *ucontrol)
409 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
410 struct alc_spec *spec = codec->spec;
411 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
413 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
417 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
418 struct snd_ctl_elem_value *ucontrol)
420 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
421 struct alc_spec *spec = codec->spec;
422 const struct hda_input_mux *imux;
423 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
424 unsigned int mux_idx;
425 hda_nid_t nid = spec->capsrc_nids ?
426 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
429 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
430 imux = &spec->input_mux[mux_idx];
432 type = get_wcaps_type(get_wcaps(codec, nid));
433 if (type == AC_WID_AUD_MIX) {
434 /* Matrix-mixer style (e.g. ALC882) */
435 unsigned int *cur_val = &spec->cur_mux[adc_idx];
438 idx = ucontrol->value.enumerated.item[0];
439 if (idx >= imux->num_items)
440 idx = imux->num_items - 1;
443 for (i = 0; i < imux->num_items; i++) {
444 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
445 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
446 imux->items[i].index,
452 /* MUX style (e.g. ALC880) */
453 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
454 &spec->cur_mux[adc_idx]);
459 * channel mode setting
461 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
462 struct snd_ctl_elem_info *uinfo)
464 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
465 struct alc_spec *spec = codec->spec;
466 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
467 spec->num_channel_mode);
470 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
471 struct snd_ctl_elem_value *ucontrol)
473 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
474 struct alc_spec *spec = codec->spec;
475 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
476 spec->num_channel_mode,
477 spec->ext_channel_count);
480 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
481 struct snd_ctl_elem_value *ucontrol)
483 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
484 struct alc_spec *spec = codec->spec;
485 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
486 spec->num_channel_mode,
487 &spec->ext_channel_count);
488 if (err >= 0 && !spec->const_channel_count) {
489 spec->multiout.max_channels = spec->ext_channel_count;
490 if (spec->need_dac_fix)
491 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
497 * Control the mode of pin widget settings via the mixer. "pc" is used
498 * instead of "%" to avoid consequences of accidently treating the % as
499 * being part of a format specifier. Maximum allowed length of a value is
500 * 63 characters plus NULL terminator.
502 * Note: some retasking pin complexes seem to ignore requests for input
503 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
504 * are requested. Therefore order this list so that this behaviour will not
505 * cause problems when mixer clients move through the enum sequentially.
506 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
509 static char *alc_pin_mode_names[] = {
510 "Mic 50pc bias", "Mic 80pc bias",
511 "Line in", "Line out", "Headphone out",
513 static unsigned char alc_pin_mode_values[] = {
514 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
516 /* The control can present all 5 options, or it can limit the options based
517 * in the pin being assumed to be exclusively an input or an output pin. In
518 * addition, "input" pins may or may not process the mic bias option
519 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
520 * accept requests for bias as of chip versions up to March 2006) and/or
521 * wiring in the computer.
523 #define ALC_PIN_DIR_IN 0x00
524 #define ALC_PIN_DIR_OUT 0x01
525 #define ALC_PIN_DIR_INOUT 0x02
526 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
527 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
529 /* Info about the pin modes supported by the different pin direction modes.
530 * For each direction the minimum and maximum values are given.
532 static signed char alc_pin_mode_dir_info[5][2] = {
533 { 0, 2 }, /* ALC_PIN_DIR_IN */
534 { 3, 4 }, /* ALC_PIN_DIR_OUT */
535 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
536 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
537 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
539 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
540 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
541 #define alc_pin_mode_n_items(_dir) \
542 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
544 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
545 struct snd_ctl_elem_info *uinfo)
547 unsigned int item_num = uinfo->value.enumerated.item;
548 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
550 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
552 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
554 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
555 item_num = alc_pin_mode_min(dir);
556 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
560 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
561 struct snd_ctl_elem_value *ucontrol)
564 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
565 hda_nid_t nid = kcontrol->private_value & 0xffff;
566 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
567 long *valp = ucontrol->value.integer.value;
568 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
569 AC_VERB_GET_PIN_WIDGET_CONTROL,
572 /* Find enumerated value for current pinctl setting */
573 i = alc_pin_mode_min(dir);
574 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
576 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
580 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
581 struct snd_ctl_elem_value *ucontrol)
584 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
585 hda_nid_t nid = kcontrol->private_value & 0xffff;
586 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
587 long val = *ucontrol->value.integer.value;
588 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
589 AC_VERB_GET_PIN_WIDGET_CONTROL,
592 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
593 val = alc_pin_mode_min(dir);
595 change = pinctl != alc_pin_mode_values[val];
597 /* Set pin mode to that requested */
598 snd_hda_codec_write_cache(codec, nid, 0,
599 AC_VERB_SET_PIN_WIDGET_CONTROL,
600 alc_pin_mode_values[val]);
602 /* Also enable the retasking pin's input/output as required
603 * for the requested pin mode. Enum values of 2 or less are
606 * Dynamically switching the input/output buffers probably
607 * reduces noise slightly (particularly on input) so we'll
608 * do it. However, having both input and output buffers
609 * enabled simultaneously doesn't seem to be problematic if
610 * this turns out to be necessary in the future.
613 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
614 HDA_AMP_MUTE, HDA_AMP_MUTE);
615 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
618 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
619 HDA_AMP_MUTE, HDA_AMP_MUTE);
620 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
627 #define ALC_PIN_MODE(xname, nid, dir) \
628 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
629 .info = alc_pin_mode_info, \
630 .get = alc_pin_mode_get, \
631 .put = alc_pin_mode_put, \
632 .private_value = nid | (dir<<16) }
634 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
635 * together using a mask with more than one bit set. This control is
636 * currently used only by the ALC260 test model. At this stage they are not
637 * needed for any "production" models.
639 #ifdef CONFIG_SND_DEBUG
640 #define alc_gpio_data_info snd_ctl_boolean_mono_info
642 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
643 struct snd_ctl_elem_value *ucontrol)
645 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
646 hda_nid_t nid = kcontrol->private_value & 0xffff;
647 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
648 long *valp = ucontrol->value.integer.value;
649 unsigned int val = snd_hda_codec_read(codec, nid, 0,
650 AC_VERB_GET_GPIO_DATA, 0x00);
652 *valp = (val & mask) != 0;
655 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
656 struct snd_ctl_elem_value *ucontrol)
659 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
660 hda_nid_t nid = kcontrol->private_value & 0xffff;
661 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
662 long val = *ucontrol->value.integer.value;
663 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
664 AC_VERB_GET_GPIO_DATA,
667 /* Set/unset the masked GPIO bit(s) as needed */
668 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
673 snd_hda_codec_write_cache(codec, nid, 0,
674 AC_VERB_SET_GPIO_DATA, gpio_data);
678 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
679 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
680 .info = alc_gpio_data_info, \
681 .get = alc_gpio_data_get, \
682 .put = alc_gpio_data_put, \
683 .private_value = nid | (mask<<16) }
684 #endif /* CONFIG_SND_DEBUG */
686 /* A switch control to allow the enabling of the digital IO pins on the
687 * ALC260. This is incredibly simplistic; the intention of this control is
688 * to provide something in the test model allowing digital outputs to be
689 * identified if present. If models are found which can utilise these
690 * outputs a more complete mixer control can be devised for those models if
693 #ifdef CONFIG_SND_DEBUG
694 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
696 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
697 struct snd_ctl_elem_value *ucontrol)
699 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
700 hda_nid_t nid = kcontrol->private_value & 0xffff;
701 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
702 long *valp = ucontrol->value.integer.value;
703 unsigned int val = snd_hda_codec_read(codec, nid, 0,
704 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
706 *valp = (val & mask) != 0;
709 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
710 struct snd_ctl_elem_value *ucontrol)
713 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
714 hda_nid_t nid = kcontrol->private_value & 0xffff;
715 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
716 long val = *ucontrol->value.integer.value;
717 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
718 AC_VERB_GET_DIGI_CONVERT_1,
721 /* Set/unset the masked control bit(s) as needed */
722 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
727 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
732 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
733 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
734 .info = alc_spdif_ctrl_info, \
735 .get = alc_spdif_ctrl_get, \
736 .put = alc_spdif_ctrl_put, \
737 .private_value = nid | (mask<<16) }
738 #endif /* CONFIG_SND_DEBUG */
740 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
741 * Again, this is only used in the ALC26x test models to help identify when
742 * the EAPD line must be asserted for features to work.
744 #ifdef CONFIG_SND_DEBUG
745 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
747 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
748 struct snd_ctl_elem_value *ucontrol)
750 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
751 hda_nid_t nid = kcontrol->private_value & 0xffff;
752 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
753 long *valp = ucontrol->value.integer.value;
754 unsigned int val = snd_hda_codec_read(codec, nid, 0,
755 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
757 *valp = (val & mask) != 0;
761 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
762 struct snd_ctl_elem_value *ucontrol)
765 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
766 hda_nid_t nid = kcontrol->private_value & 0xffff;
767 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
768 long val = *ucontrol->value.integer.value;
769 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
770 AC_VERB_GET_EAPD_BTLENABLE,
773 /* Set/unset the masked control bit(s) as needed */
774 change = (!val ? 0 : mask) != (ctrl_data & mask);
779 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
785 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
786 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
787 .info = alc_eapd_ctrl_info, \
788 .get = alc_eapd_ctrl_get, \
789 .put = alc_eapd_ctrl_put, \
790 .private_value = nid | (mask<<16) }
791 #endif /* CONFIG_SND_DEBUG */
794 * set up the input pin config (depending on the given auto-pin type)
796 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
799 unsigned int val = PIN_IN;
801 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
803 pincap = snd_hda_query_pin_caps(codec, nid);
804 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
805 if (pincap & AC_PINCAP_VREF_80)
807 else if (pincap & AC_PINCAP_VREF_50)
809 else if (pincap & AC_PINCAP_VREF_100)
811 else if (pincap & AC_PINCAP_VREF_GRD)
814 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
819 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
821 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
823 spec->mixers[spec->num_mixers++] = mix;
826 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
828 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
830 spec->init_verbs[spec->num_init_verbs++] = verb;
833 #ifdef CONFIG_PROC_FS
837 static void print_realtek_coef(struct snd_info_buffer *buffer,
838 struct hda_codec *codec, hda_nid_t nid)
844 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
845 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
846 coeff = snd_hda_codec_read(codec, nid, 0,
847 AC_VERB_GET_COEF_INDEX, 0);
848 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
851 #define print_realtek_coef NULL
855 * set up from the preset table
857 static void setup_preset(struct hda_codec *codec,
858 const struct alc_config_preset *preset)
860 struct alc_spec *spec = codec->spec;
863 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
864 add_mixer(spec, preset->mixers[i]);
865 spec->cap_mixer = preset->cap_mixer;
866 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
868 add_verb(spec, preset->init_verbs[i]);
870 spec->channel_mode = preset->channel_mode;
871 spec->num_channel_mode = preset->num_channel_mode;
872 spec->need_dac_fix = preset->need_dac_fix;
873 spec->const_channel_count = preset->const_channel_count;
875 if (preset->const_channel_count)
876 spec->multiout.max_channels = preset->const_channel_count;
878 spec->multiout.max_channels = spec->channel_mode[0].channels;
879 spec->ext_channel_count = spec->channel_mode[0].channels;
881 spec->multiout.num_dacs = preset->num_dacs;
882 spec->multiout.dac_nids = preset->dac_nids;
883 spec->multiout.dig_out_nid = preset->dig_out_nid;
884 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
885 spec->multiout.hp_nid = preset->hp_nid;
887 spec->num_mux_defs = preset->num_mux_defs;
888 if (!spec->num_mux_defs)
889 spec->num_mux_defs = 1;
890 spec->input_mux = preset->input_mux;
892 spec->num_adc_nids = preset->num_adc_nids;
893 spec->adc_nids = preset->adc_nids;
894 spec->capsrc_nids = preset->capsrc_nids;
895 spec->dig_in_nid = preset->dig_in_nid;
897 spec->unsol_event = preset->unsol_event;
898 spec->init_hook = preset->init_hook;
899 #ifdef CONFIG_SND_HDA_POWER_SAVE
900 spec->loopback.amplist = preset->loopbacks;
904 preset->setup(codec);
907 /* Enable GPIO mask and set output */
908 static struct hda_verb alc_gpio1_init_verbs[] = {
909 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
910 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
911 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
915 static struct hda_verb alc_gpio2_init_verbs[] = {
916 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
917 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
918 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
922 static struct hda_verb alc_gpio3_init_verbs[] = {
923 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
924 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
925 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
930 * Fix hardware PLL issue
931 * On some codecs, the analog PLL gating control must be off while
932 * the default value is 1.
934 static void alc_fix_pll(struct hda_codec *codec)
936 struct alc_spec *spec = codec->spec;
941 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
943 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
944 AC_VERB_GET_PROC_COEF, 0);
945 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
947 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
948 val & ~(1 << spec->pll_coef_bit));
951 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
952 unsigned int coef_idx, unsigned int coef_bit)
954 struct alc_spec *spec = codec->spec;
956 spec->pll_coef_idx = coef_idx;
957 spec->pll_coef_bit = coef_bit;
961 static void alc_automute_pin(struct hda_codec *codec)
963 struct alc_spec *spec = codec->spec;
964 unsigned int present, pincap;
965 unsigned int nid = spec->autocfg.hp_pins[0];
968 pincap = snd_hda_query_pin_caps(codec, nid);
969 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
970 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
971 present = snd_hda_codec_read(codec, nid, 0,
972 AC_VERB_GET_PIN_SENSE, 0);
973 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
974 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
975 nid = spec->autocfg.speaker_pins[i];
978 snd_hda_codec_write(codec, nid, 0,
979 AC_VERB_SET_PIN_WIDGET_CONTROL,
980 spec->jack_present ? 0 : PIN_OUT);
984 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
987 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
990 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
991 for (i = 0; i < nums; i++)
997 static void alc_mic_automute(struct hda_codec *codec)
999 struct alc_spec *spec = codec->spec;
1000 struct alc_mic_route *dead, *alive;
1001 unsigned int present, type;
1004 if (!spec->auto_mic)
1006 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1008 if (snd_BUG_ON(!spec->adc_nids))
1011 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1013 present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0,
1014 AC_VERB_GET_PIN_SENSE, 0);
1015 present &= AC_PINSENSE_PRESENCE;
1017 alive = &spec->ext_mic;
1018 dead = &spec->int_mic;
1020 alive = &spec->int_mic;
1021 dead = &spec->ext_mic;
1024 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1025 if (type == AC_WID_AUD_MIX) {
1026 /* Matrix-mixer style (e.g. ALC882) */
1027 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1030 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1032 HDA_AMP_MUTE, HDA_AMP_MUTE);
1034 /* MUX style (e.g. ALC880) */
1035 snd_hda_codec_write_cache(codec, cap_nid, 0,
1036 AC_VERB_SET_CONNECT_SEL,
1040 /* FIXME: analog mixer */
1043 /* unsolicited event for HP jack sensing */
1044 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1046 if (codec->vendor_id == 0x10ec0880)
1051 case ALC880_HP_EVENT:
1052 alc_automute_pin(codec);
1054 case ALC880_MIC_EVENT:
1055 alc_mic_automute(codec);
1060 static void alc_inithook(struct hda_codec *codec)
1062 alc_automute_pin(codec);
1063 alc_mic_automute(codec);
1066 /* additional initialization for ALC888 variants */
1067 static void alc888_coef_init(struct hda_codec *codec)
1071 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1072 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1073 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1074 if ((tmp & 0xf0) == 0x20)
1076 snd_hda_codec_read(codec, 0x20, 0,
1077 AC_VERB_SET_PROC_COEF, 0x830);
1080 snd_hda_codec_read(codec, 0x20, 0,
1081 AC_VERB_SET_PROC_COEF, 0x3030);
1084 static void alc889_coef_init(struct hda_codec *codec)
1088 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1089 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1090 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1091 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1094 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1099 case ALC_INIT_GPIO1:
1100 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1102 case ALC_INIT_GPIO2:
1103 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1105 case ALC_INIT_GPIO3:
1106 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1108 case ALC_INIT_DEFAULT:
1109 switch (codec->vendor_id) {
1111 snd_hda_codec_write(codec, 0x0f, 0,
1112 AC_VERB_SET_EAPD_BTLENABLE, 2);
1113 snd_hda_codec_write(codec, 0x10, 0,
1114 AC_VERB_SET_EAPD_BTLENABLE, 2);
1126 snd_hda_codec_write(codec, 0x14, 0,
1127 AC_VERB_SET_EAPD_BTLENABLE, 2);
1128 snd_hda_codec_write(codec, 0x15, 0,
1129 AC_VERB_SET_EAPD_BTLENABLE, 2);
1132 switch (codec->vendor_id) {
1134 snd_hda_codec_write(codec, 0x1a, 0,
1135 AC_VERB_SET_COEF_INDEX, 7);
1136 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1137 AC_VERB_GET_PROC_COEF, 0);
1138 snd_hda_codec_write(codec, 0x1a, 0,
1139 AC_VERB_SET_COEF_INDEX, 7);
1140 snd_hda_codec_write(codec, 0x1a, 0,
1141 AC_VERB_SET_PROC_COEF,
1151 alc889_coef_init(codec);
1154 alc888_coef_init(codec);
1158 snd_hda_codec_write(codec, 0x20, 0,
1159 AC_VERB_SET_COEF_INDEX, 7);
1160 tmp = snd_hda_codec_read(codec, 0x20, 0,
1161 AC_VERB_GET_PROC_COEF, 0);
1162 snd_hda_codec_write(codec, 0x20, 0,
1163 AC_VERB_SET_COEF_INDEX, 7);
1164 snd_hda_codec_write(codec, 0x20, 0,
1165 AC_VERB_SET_PROC_COEF,
1173 static void alc_init_auto_hp(struct hda_codec *codec)
1175 struct alc_spec *spec = codec->spec;
1177 if (!spec->autocfg.hp_pins[0])
1180 if (!spec->autocfg.speaker_pins[0]) {
1181 if (spec->autocfg.line_out_pins[0] &&
1182 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1183 spec->autocfg.speaker_pins[0] =
1184 spec->autocfg.line_out_pins[0];
1189 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1190 spec->autocfg.hp_pins[0]);
1191 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1192 AC_VERB_SET_UNSOLICITED_ENABLE,
1193 AC_USRSP_EN | ALC880_HP_EVENT);
1194 spec->unsol_event = alc_sku_unsol_event;
1197 static void alc_init_auto_mic(struct hda_codec *codec)
1199 struct alc_spec *spec = codec->spec;
1200 struct auto_pin_cfg *cfg = &spec->autocfg;
1201 hda_nid_t fixed, ext;
1204 /* there must be only two mic inputs exclusively */
1205 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1206 if (cfg->input_pins[i])
1210 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1211 hda_nid_t nid = cfg->input_pins[i];
1212 unsigned int defcfg;
1215 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1216 switch (get_defcfg_connect(defcfg)) {
1217 case AC_JACK_PORT_FIXED:
1219 return; /* already occupied */
1222 case AC_JACK_PORT_COMPLEX:
1224 return; /* already occupied */
1228 return; /* invalid entry */
1231 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1232 return; /* no unsol support */
1233 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1235 spec->ext_mic.pin = ext;
1236 spec->int_mic.pin = fixed;
1237 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1238 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1240 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1241 AC_VERB_SET_UNSOLICITED_ENABLE,
1242 AC_USRSP_EN | ALC880_MIC_EVENT);
1243 spec->unsol_event = alc_sku_unsol_event;
1246 /* check subsystem ID and set up device-specific initialization;
1247 * return 1 if initialized, 0 if invalid SSID
1249 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1250 * 31 ~ 16 : Manufacture ID
1252 * 7 ~ 0 : Assembly ID
1253 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1255 static int alc_subsystem_id(struct hda_codec *codec,
1256 hda_nid_t porta, hda_nid_t porte,
1259 unsigned int ass, tmp, i;
1261 struct alc_spec *spec = codec->spec;
1263 ass = codec->subsystem_id & 0xffff;
1264 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1267 /* invalid SSID, check the special NID pin defcfg instead */
1269 * 31~30 : port connectivity
1272 * 19~16 : Check sum (15:1)
1277 if (codec->vendor_id == 0x10ec0260)
1279 ass = snd_hda_codec_get_pincfg(codec, nid);
1280 snd_printd("realtek: No valid SSID, "
1281 "checking pincfg 0x%08x for NID 0x%x\n",
1283 if (!(ass & 1) && !(ass & 0x100000))
1285 if ((ass >> 30) != 1) /* no physical connection */
1290 for (i = 1; i < 16; i++) {
1294 if (((ass >> 16) & 0xf) != tmp)
1297 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1298 ass & 0xffff, codec->vendor_id);
1302 * 2 : 0 --> Desktop, 1 --> Laptop
1303 * 3~5 : External Amplifier control
1306 tmp = (ass & 0x38) >> 3; /* external Amp control */
1309 spec->init_amp = ALC_INIT_GPIO1;
1312 spec->init_amp = ALC_INIT_GPIO2;
1315 spec->init_amp = ALC_INIT_GPIO3;
1318 spec->init_amp = ALC_INIT_DEFAULT;
1322 /* is laptop or Desktop and enable the function "Mute internal speaker
1323 * when the external headphone out jack is plugged"
1325 if (!(ass & 0x8000))
1328 * 10~8 : Jack location
1329 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1331 * 15 : 1 --> enable the function "Mute internal speaker
1332 * when the external headphone out jack is plugged"
1334 if (!spec->autocfg.hp_pins[0]) {
1335 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1337 spec->autocfg.hp_pins[0] = porta;
1339 spec->autocfg.hp_pins[0] = porte;
1341 spec->autocfg.hp_pins[0] = portd;
1346 alc_init_auto_hp(codec);
1347 alc_init_auto_mic(codec);
1351 static void alc_ssid_check(struct hda_codec *codec,
1352 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1354 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1355 struct alc_spec *spec = codec->spec;
1356 snd_printd("realtek: "
1357 "Enable default setup for auto mode as fallback\n");
1358 spec->init_amp = ALC_INIT_DEFAULT;
1359 alc_init_auto_hp(codec);
1360 alc_init_auto_mic(codec);
1365 * Fix-up pin default configurations
1373 static void alc_fix_pincfg(struct hda_codec *codec,
1374 const struct snd_pci_quirk *quirk,
1375 const struct alc_pincfg **pinfix)
1377 const struct alc_pincfg *cfg;
1379 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1383 cfg = pinfix[quirk->value];
1384 for (; cfg->nid; cfg++)
1385 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1395 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1396 /* Mic-in jack as mic in */
1397 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1398 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1399 /* Line-in jack as Line in */
1400 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1401 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1402 /* Line-Out as Front */
1403 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1410 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1411 /* Mic-in jack as mic in */
1412 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1413 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1414 /* Line-in jack as Surround */
1415 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1416 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1417 /* Line-Out as Front */
1418 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1425 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1426 /* Mic-in jack as CLFE */
1427 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1428 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1429 /* Line-in jack as Surround */
1430 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1431 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1432 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1433 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1440 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1441 /* Mic-in jack as CLFE */
1442 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1443 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1444 /* Line-in jack as Surround */
1445 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1446 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1447 /* Line-Out as Side */
1448 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1452 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1453 { 2, alc888_4ST_ch2_intel_init },
1454 { 4, alc888_4ST_ch4_intel_init },
1455 { 6, alc888_4ST_ch6_intel_init },
1456 { 8, alc888_4ST_ch8_intel_init },
1460 * ALC888 Fujitsu Siemens Amillo xa3530
1463 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1464 /* Front Mic: set to PIN_IN (empty by default) */
1465 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1466 /* Connect Internal HP to Front */
1467 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1468 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1469 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1470 /* Connect Bass HP to Front */
1471 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1472 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1473 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1474 /* Connect Line-Out side jack (SPDIF) to Side */
1475 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1476 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1477 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1478 /* Connect Mic jack to CLFE */
1479 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1480 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1481 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1482 /* Connect Line-in jack to Surround */
1483 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1484 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1485 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1486 /* Connect HP out jack to Front */
1487 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1488 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1489 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1490 /* Enable unsolicited event for HP jack and Line-out jack */
1491 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1492 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1496 static void alc_automute_amp(struct hda_codec *codec)
1498 struct alc_spec *spec = codec->spec;
1499 unsigned int val, mute, pincap;
1503 spec->jack_present = 0;
1504 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1505 nid = spec->autocfg.hp_pins[i];
1508 pincap = snd_hda_query_pin_caps(codec, nid);
1509 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1510 snd_hda_codec_read(codec, nid, 0,
1511 AC_VERB_SET_PIN_SENSE, 0);
1512 val = snd_hda_codec_read(codec, nid, 0,
1513 AC_VERB_GET_PIN_SENSE, 0);
1514 if (val & AC_PINSENSE_PRESENCE) {
1515 spec->jack_present = 1;
1520 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1521 /* Toggle internal speakers muting */
1522 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1523 nid = spec->autocfg.speaker_pins[i];
1526 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1527 HDA_AMP_MUTE, mute);
1531 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1534 if (codec->vendor_id == 0x10ec0880)
1538 if (res == ALC880_HP_EVENT)
1539 alc_automute_amp(codec);
1542 static void alc889_automute_setup(struct hda_codec *codec)
1544 struct alc_spec *spec = codec->spec;
1546 spec->autocfg.hp_pins[0] = 0x15;
1547 spec->autocfg.speaker_pins[0] = 0x14;
1548 spec->autocfg.speaker_pins[1] = 0x16;
1549 spec->autocfg.speaker_pins[2] = 0x17;
1550 spec->autocfg.speaker_pins[3] = 0x19;
1551 spec->autocfg.speaker_pins[4] = 0x1a;
1554 static void alc889_intel_init_hook(struct hda_codec *codec)
1556 alc889_coef_init(codec);
1557 alc_automute_amp(codec);
1560 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1562 struct alc_spec *spec = codec->spec;
1564 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1565 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1566 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1567 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1571 * ALC888 Acer Aspire 4930G model
1574 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1575 /* Front Mic: set to PIN_IN (empty by default) */
1576 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1577 /* Unselect Front Mic by default in input mixer 3 */
1578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1579 /* Enable unsolicited event for HP jack */
1580 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1581 /* Connect Internal HP to front */
1582 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1583 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1584 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1585 /* Connect HP out to front */
1586 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1587 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1588 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1593 * ALC888 Acer Aspire 6530G model
1596 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1597 /* Bias voltage on for external mic port */
1598 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1599 /* Front Mic: set to PIN_IN (empty by default) */
1600 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1601 /* Unselect Front Mic by default in input mixer 3 */
1602 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1603 /* Enable unsolicited event for HP jack */
1604 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1605 /* Enable speaker output */
1606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1607 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1608 /* Enable headphone output */
1609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1611 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1616 * ALC889 Acer Aspire 8930G model
1619 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1620 /* Front Mic: set to PIN_IN (empty by default) */
1621 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1622 /* Unselect Front Mic by default in input mixer 3 */
1623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1624 /* Enable unsolicited event for HP jack */
1625 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1626 /* Connect Internal Front to Front */
1627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1628 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1629 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1630 /* Connect Internal Rear to Rear */
1631 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1632 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1633 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1634 /* Connect Internal CLFE to CLFE */
1635 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1636 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1637 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1638 /* Connect HP out to Front */
1639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1642 /* Enable all DACs */
1643 /* DAC DISABLE/MUTE 1? */
1644 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1645 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1646 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1647 /* DAC DISABLE/MUTE 2? */
1648 /* some bit here disables the other DACs. Init=0x4900 */
1649 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1650 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1651 /* Enable amplifiers */
1652 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1653 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1655 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1656 * which makes the stereo useless. However, either the mic or the ALC889
1657 * makes the signal become a difference/sum signal instead of standard
1658 * stereo, which is annoying. So instead we flip this bit which makes the
1659 * codec replicate the sum signal to both channels, turning it into a
1662 /* DMIC_CONTROL? Init value = 0x0001 */
1663 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1664 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1668 static struct hda_input_mux alc888_2_capture_sources[2] = {
1669 /* Front mic only available on one ADC */
1676 { "Front Mic", 0xb },
1689 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1690 /* Interal mic only available on one ADC */
1697 { "Input Mix", 0xa },
1707 { "Input Mix", 0xa },
1712 static struct hda_input_mux alc889_capture_sources[3] = {
1713 /* Digital mic only available on first "ADC" */
1720 { "Front Mic", 0xb },
1721 { "Input Mix", 0xa },
1730 { "Input Mix", 0xa },
1739 { "Input Mix", 0xa },
1744 static struct snd_kcontrol_new alc888_base_mixer[] = {
1745 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1746 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1747 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1748 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1749 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
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("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1755 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1756 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1757 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1758 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1759 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1761 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1762 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1766 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1768 struct alc_spec *spec = codec->spec;
1770 spec->autocfg.hp_pins[0] = 0x15;
1771 spec->autocfg.speaker_pins[0] = 0x14;
1774 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1776 struct alc_spec *spec = codec->spec;
1778 spec->autocfg.hp_pins[0] = 0x15;
1779 spec->autocfg.speaker_pins[0] = 0x14;
1780 spec->autocfg.speaker_pins[1] = 0x16;
1781 spec->autocfg.speaker_pins[2] = 0x17;
1784 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1786 struct alc_spec *spec = codec->spec;
1788 spec->autocfg.hp_pins[0] = 0x15;
1789 spec->autocfg.speaker_pins[0] = 0x14;
1790 spec->autocfg.speaker_pins[1] = 0x16;
1791 spec->autocfg.speaker_pins[2] = 0x1b;
1795 * ALC880 3-stack model
1797 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1798 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1799 * F-Mic = 0x1b, HP = 0x19
1802 static hda_nid_t alc880_dac_nids[4] = {
1803 /* front, rear, clfe, rear_surr */
1804 0x02, 0x05, 0x04, 0x03
1807 static hda_nid_t alc880_adc_nids[3] = {
1812 /* The datasheet says the node 0x07 is connected from inputs,
1813 * but it shows zero connection in the real implementation on some devices.
1814 * Note: this is a 915GAV bug, fixed on 915GLV
1816 static hda_nid_t alc880_adc_nids_alt[2] = {
1821 #define ALC880_DIGOUT_NID 0x06
1822 #define ALC880_DIGIN_NID 0x0a
1824 static struct hda_input_mux alc880_capture_source = {
1828 { "Front Mic", 0x3 },
1834 /* channel source setting (2/6 channel selection for 3-stack) */
1836 static struct hda_verb alc880_threestack_ch2_init[] = {
1837 /* set line-in to input, mute it */
1838 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1839 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1840 /* set mic-in to input vref 80%, mute it */
1841 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1842 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1847 static struct hda_verb alc880_threestack_ch6_init[] = {
1848 /* set line-in to output, unmute it */
1849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1850 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1851 /* set mic-in to output, unmute it */
1852 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1853 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1857 static struct hda_channel_mode alc880_threestack_modes[2] = {
1858 { 2, alc880_threestack_ch2_init },
1859 { 6, alc880_threestack_ch6_init },
1862 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1863 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1864 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1865 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1866 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1867 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1868 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1869 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1870 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1871 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1872 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1873 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1874 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1875 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1876 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1877 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1878 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1879 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1881 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1882 .name = "Channel Mode",
1883 .info = alc_ch_mode_info,
1884 .get = alc_ch_mode_get,
1885 .put = alc_ch_mode_put,
1890 /* capture mixer elements */
1891 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1892 struct snd_ctl_elem_info *uinfo)
1894 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1895 struct alc_spec *spec = codec->spec;
1898 mutex_lock(&codec->control_mutex);
1899 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1901 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1902 mutex_unlock(&codec->control_mutex);
1906 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1907 unsigned int size, unsigned int __user *tlv)
1909 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1910 struct alc_spec *spec = codec->spec;
1913 mutex_lock(&codec->control_mutex);
1914 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1916 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1917 mutex_unlock(&codec->control_mutex);
1921 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1922 struct snd_ctl_elem_value *ucontrol);
1924 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1925 struct snd_ctl_elem_value *ucontrol,
1928 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1929 struct alc_spec *spec = codec->spec;
1930 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1933 mutex_lock(&codec->control_mutex);
1934 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1936 err = func(kcontrol, ucontrol);
1937 mutex_unlock(&codec->control_mutex);
1941 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1942 struct snd_ctl_elem_value *ucontrol)
1944 return alc_cap_getput_caller(kcontrol, ucontrol,
1945 snd_hda_mixer_amp_volume_get);
1948 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1949 struct snd_ctl_elem_value *ucontrol)
1951 return alc_cap_getput_caller(kcontrol, ucontrol,
1952 snd_hda_mixer_amp_volume_put);
1955 /* capture mixer elements */
1956 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1958 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1959 struct snd_ctl_elem_value *ucontrol)
1961 return alc_cap_getput_caller(kcontrol, ucontrol,
1962 snd_hda_mixer_amp_switch_get);
1965 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1966 struct snd_ctl_elem_value *ucontrol)
1968 return alc_cap_getput_caller(kcontrol, ucontrol,
1969 snd_hda_mixer_amp_switch_put);
1972 #define _DEFINE_CAPMIX(num) \
1974 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1975 .name = "Capture Switch", \
1976 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1978 .info = alc_cap_sw_info, \
1979 .get = alc_cap_sw_get, \
1980 .put = alc_cap_sw_put, \
1983 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1984 .name = "Capture Volume", \
1985 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1986 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1987 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1989 .info = alc_cap_vol_info, \
1990 .get = alc_cap_vol_get, \
1991 .put = alc_cap_vol_put, \
1992 .tlv = { .c = alc_cap_vol_tlv }, \
1995 #define _DEFINE_CAPSRC(num) \
1997 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1998 /* .name = "Capture Source", */ \
1999 .name = "Input Source", \
2001 .info = alc_mux_enum_info, \
2002 .get = alc_mux_enum_get, \
2003 .put = alc_mux_enum_put, \
2006 #define DEFINE_CAPMIX(num) \
2007 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2008 _DEFINE_CAPMIX(num), \
2009 _DEFINE_CAPSRC(num), \
2013 #define DEFINE_CAPMIX_NOSRC(num) \
2014 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2015 _DEFINE_CAPMIX(num), \
2019 /* up to three ADCs */
2023 DEFINE_CAPMIX_NOSRC(1);
2024 DEFINE_CAPMIX_NOSRC(2);
2025 DEFINE_CAPMIX_NOSRC(3);
2028 * ALC880 5-stack model
2030 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2032 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2033 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2036 /* additional mixers to alc880_three_stack_mixer */
2037 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2038 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2039 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2043 /* channel source setting (6/8 channel selection for 5-stack) */
2045 static struct hda_verb alc880_fivestack_ch6_init[] = {
2046 /* set line-in to input, mute it */
2047 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2048 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2053 static struct hda_verb alc880_fivestack_ch8_init[] = {
2054 /* set line-in to output, unmute it */
2055 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2056 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2060 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2061 { 6, alc880_fivestack_ch6_init },
2062 { 8, alc880_fivestack_ch8_init },
2067 * ALC880 6-stack model
2069 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2070 * Side = 0x05 (0x0f)
2071 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2072 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2075 static hda_nid_t alc880_6st_dac_nids[4] = {
2076 /* front, rear, clfe, rear_surr */
2077 0x02, 0x03, 0x04, 0x05
2080 static struct hda_input_mux alc880_6stack_capture_source = {
2084 { "Front Mic", 0x1 },
2090 /* fixed 8-channels */
2091 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2095 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2096 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2097 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2098 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2099 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2100 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2101 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2102 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2103 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2104 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2105 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2112 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2113 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2115 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2116 .name = "Channel Mode",
2117 .info = alc_ch_mode_info,
2118 .get = alc_ch_mode_get,
2119 .put = alc_ch_mode_put,
2128 * W810 has rear IO for:
2131 * Center/LFE (DAC 04)
2134 * The system also has a pair of internal speakers, and a headphone jack.
2135 * These are both connected to Line2 on the codec, hence to DAC 02.
2137 * There is a variable resistor to control the speaker or headphone
2138 * volume. This is a hardware-only device without a software API.
2140 * Plugging headphones in will disable the internal speakers. This is
2141 * implemented in hardware, not via the driver using jack sense. In
2142 * a similar fashion, plugging into the rear socket marked "front" will
2143 * disable both the speakers and headphones.
2145 * For input, there's a microphone jack, and an "audio in" jack.
2146 * These may not do anything useful with this driver yet, because I
2147 * haven't setup any initialization verbs for these yet...
2150 static hda_nid_t alc880_w810_dac_nids[3] = {
2151 /* front, rear/surround, clfe */
2155 /* fixed 6 channels */
2156 static struct hda_channel_mode alc880_w810_modes[1] = {
2160 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2161 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2162 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2163 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2164 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2165 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2166 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2167 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2168 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2169 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2170 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2178 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2179 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2183 static hda_nid_t alc880_z71v_dac_nids[1] = {
2186 #define ALC880_Z71V_HP_DAC 0x03
2188 /* fixed 2 channels */
2189 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2193 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2194 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2195 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2196 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2197 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2198 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2199 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2207 * ALC880 F1734 model
2209 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2210 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2213 static hda_nid_t alc880_f1734_dac_nids[1] = {
2216 #define ALC880_F1734_HP_DAC 0x02
2218 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2219 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2220 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2221 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2222 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2223 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2224 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2226 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2230 static struct hda_input_mux alc880_f1734_capture_source = {
2242 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2243 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2244 * Mic = 0x18, Line = 0x1a
2247 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2248 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2250 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2251 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2252 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2253 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2254 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2255 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2256 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2257 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2258 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2259 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2260 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2261 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2262 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2264 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2266 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2267 .name = "Channel Mode",
2268 .info = alc_ch_mode_info,
2269 .get = alc_ch_mode_get,
2270 .put = alc_ch_mode_put,
2276 * ALC880 ASUS W1V model
2278 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2279 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2280 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2283 /* additional mixers to alc880_asus_mixer */
2284 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2285 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2286 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2291 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2292 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2293 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2294 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2295 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2296 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2299 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2300 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2305 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2306 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2307 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2308 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2309 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2310 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2311 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2312 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2313 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2314 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2315 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2317 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2320 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2321 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2323 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2324 .name = "Channel Mode",
2325 .info = alc_ch_mode_info,
2326 .get = alc_ch_mode_get,
2327 .put = alc_ch_mode_put,
2332 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2333 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2334 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2335 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2336 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2337 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2338 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2340 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2341 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2342 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2346 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2347 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2348 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2349 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2350 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2357 * virtual master controls
2361 * slave controls for virtual master
2363 static const char *alc_slave_vols[] = {
2364 "Front Playback Volume",
2365 "Surround Playback Volume",
2366 "Center Playback Volume",
2367 "LFE Playback Volume",
2368 "Side Playback Volume",
2369 "Headphone Playback Volume",
2370 "Speaker Playback Volume",
2371 "Mono Playback Volume",
2372 "Line-Out Playback Volume",
2373 "PCM Playback Volume",
2377 static const char *alc_slave_sws[] = {
2378 "Front Playback Switch",
2379 "Surround Playback Switch",
2380 "Center Playback Switch",
2381 "LFE Playback Switch",
2382 "Side Playback Switch",
2383 "Headphone Playback Switch",
2384 "Speaker Playback Switch",
2385 "Mono Playback Switch",
2386 "IEC958 Playback Switch",
2391 * build control elements
2394 static void alc_free_kctls(struct hda_codec *codec);
2396 /* additional beep mixers; the actual parameters are overwritten at build */
2397 static struct snd_kcontrol_new alc_beep_mixer[] = {
2398 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2399 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2403 static int alc_build_controls(struct hda_codec *codec)
2405 struct alc_spec *spec = codec->spec;
2409 for (i = 0; i < spec->num_mixers; i++) {
2410 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2414 if (spec->cap_mixer) {
2415 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2419 if (spec->multiout.dig_out_nid) {
2420 err = snd_hda_create_spdif_out_ctls(codec,
2421 spec->multiout.dig_out_nid);
2424 if (!spec->no_analog) {
2425 err = snd_hda_create_spdif_share_sw(codec,
2429 spec->multiout.share_spdif = 1;
2432 if (spec->dig_in_nid) {
2433 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2438 /* create beep controls if needed */
2439 if (spec->beep_amp) {
2440 struct snd_kcontrol_new *knew;
2441 for (knew = alc_beep_mixer; knew->name; knew++) {
2442 struct snd_kcontrol *kctl;
2443 kctl = snd_ctl_new1(knew, codec);
2446 kctl->private_value = spec->beep_amp;
2447 err = snd_hda_ctl_add(codec, kctl);
2453 /* if we have no master control, let's create it */
2454 if (!spec->no_analog &&
2455 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2456 unsigned int vmaster_tlv[4];
2457 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2458 HDA_OUTPUT, vmaster_tlv);
2459 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2460 vmaster_tlv, alc_slave_vols);
2464 if (!spec->no_analog &&
2465 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2466 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2467 NULL, alc_slave_sws);
2472 alc_free_kctls(codec); /* no longer needed */
2478 * initialize the codec volumes, etc
2482 * generic initialization of ADC, input mixers and output mixers
2484 static struct hda_verb alc880_volume_init_verbs[] = {
2486 * Unmute ADC0-2 and set the default input to mic-in
2488 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2490 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2491 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2492 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2495 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2497 * Note: PASD motherboards uses the Line In 2 as the input for front
2500 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2510 * Set up output mixers (0x0c - 0x0f)
2512 /* set vol=0 to output mixers */
2513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2514 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2516 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2517 /* set up input amps for analog loopback */
2518 /* Amp Indices: DAC = 0, mixer = 1 */
2519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2522 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2523 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2524 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2525 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2526 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2532 * 3-stack pin configuration:
2533 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2535 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2537 * preset connection lists of input pins
2538 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2540 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2541 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2542 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2545 * Set pin mode and muting
2547 /* set front pin widgets 0x14 for output */
2548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2549 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2550 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2551 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2552 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2553 /* Mic2 (as headphone out) for HP output */
2554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2555 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2556 /* Line In pin widget for input */
2557 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2558 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2559 /* Line2 (as front mic) pin widget for input and vref at 80% */
2560 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2561 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2562 /* CD pin widget for input */
2563 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2569 * 5-stack pin configuration:
2570 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2571 * line-in/side = 0x1a, f-mic = 0x1b
2573 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2575 * preset connection lists of input pins
2576 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2578 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2579 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2582 * Set pin mode and muting
2584 /* set pin widgets 0x14-0x17 for output */
2585 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2586 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2587 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2588 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2589 /* unmute pins for output (no gain on this amp) */
2590 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2591 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2592 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2593 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2595 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2596 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2597 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2598 /* Mic2 (as headphone out) for HP output */
2599 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2600 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2601 /* Line In pin widget for input */
2602 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2603 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2604 /* Line2 (as front mic) pin widget for input and vref at 80% */
2605 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2606 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2607 /* CD pin widget for input */
2608 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2614 * W810 pin configuration:
2615 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2617 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2618 /* hphone/speaker input selector: front DAC */
2619 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2621 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2622 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2623 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2624 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2625 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2626 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2628 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2629 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2635 * Z71V pin configuration:
2636 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2638 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2639 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2640 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2641 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2642 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2644 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2645 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2646 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2647 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2653 * 6-stack pin configuration:
2654 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2655 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2657 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2658 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2660 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2661 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2662 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2663 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2664 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2665 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2666 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2667 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2669 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2670 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2671 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2672 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2673 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2674 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2675 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2676 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2677 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2683 * Uniwill pin configuration:
2684 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2687 static struct hda_verb alc880_uniwill_init_verbs[] = {
2688 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2691 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2693 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2694 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2695 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2696 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2697 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2698 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2699 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2700 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2701 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2702 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2703 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2705 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2706 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2707 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2708 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2709 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2710 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2711 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2712 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2713 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2715 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2716 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2723 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2725 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2726 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2729 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2730 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2733 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2734 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2735 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2737 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2738 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2739 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2741 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2742 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2743 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2744 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2745 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2746 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2748 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2749 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2754 static struct hda_verb alc880_beep_init_verbs[] = {
2755 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2759 /* auto-toggle front mic */
2760 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2762 unsigned int present;
2765 present = snd_hda_codec_read(codec, 0x18, 0,
2766 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2767 bits = present ? HDA_AMP_MUTE : 0;
2768 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2771 static void alc880_uniwill_setup(struct hda_codec *codec)
2773 struct alc_spec *spec = codec->spec;
2775 spec->autocfg.hp_pins[0] = 0x14;
2776 spec->autocfg.speaker_pins[0] = 0x15;
2777 spec->autocfg.speaker_pins[0] = 0x16;
2780 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2782 alc_automute_amp(codec);
2783 alc880_uniwill_mic_automute(codec);
2786 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2789 /* Looks like the unsol event is incompatible with the standard
2790 * definition. 4bit tag is placed at 28 bit!
2792 switch (res >> 28) {
2793 case ALC880_MIC_EVENT:
2794 alc880_uniwill_mic_automute(codec);
2797 alc_automute_amp_unsol_event(codec, res);
2802 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2804 struct alc_spec *spec = codec->spec;
2806 spec->autocfg.hp_pins[0] = 0x14;
2807 spec->autocfg.speaker_pins[0] = 0x15;
2810 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2812 unsigned int present;
2814 present = snd_hda_codec_read(codec, 0x21, 0,
2815 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2816 present &= HDA_AMP_VOLMASK;
2817 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2818 HDA_AMP_VOLMASK, present);
2819 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2820 HDA_AMP_VOLMASK, present);
2823 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2826 /* Looks like the unsol event is incompatible with the standard
2827 * definition. 4bit tag is placed at 28 bit!
2829 if ((res >> 28) == ALC880_DCVOL_EVENT)
2830 alc880_uniwill_p53_dcvol_automute(codec);
2832 alc_automute_amp_unsol_event(codec, res);
2836 * F1734 pin configuration:
2837 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2839 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2840 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2841 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2842 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2843 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2844 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2847 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2848 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2849 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2851 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2852 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2853 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2854 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2855 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2856 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2857 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2858 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2859 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2861 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2862 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2868 * ASUS pin configuration:
2869 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2871 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2872 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2873 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2874 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2875 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2877 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2878 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2879 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2881 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2883 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2884 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2886 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2887 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2888 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2889 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2890 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2891 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2892 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2893 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2894 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2899 /* Enable GPIO mask and set output */
2900 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2901 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2902 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2904 /* Clevo m520g init */
2905 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2906 /* headphone output */
2907 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2909 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2912 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2913 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2916 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2917 /* Mic1 (rear panel) */
2918 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2919 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2920 /* Mic2 (front panel) */
2921 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2922 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2924 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2925 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2926 /* change to EAPD mode */
2927 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2928 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2933 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2934 /* change to EAPD mode */
2935 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2936 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2938 /* Headphone output */
2939 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2941 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2942 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2944 /* Line In pin widget for input */
2945 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2946 /* CD pin widget for input */
2947 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2948 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2949 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2951 /* change to EAPD mode */
2952 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2953 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2959 * LG m1 express dual
2962 * Rear Line-In/Out (blue): 0x14
2963 * Build-in Mic-In: 0x15
2965 * HP-Out (green): 0x1b
2966 * Mic-In/Out (red): 0x19
2970 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2971 static hda_nid_t alc880_lg_dac_nids[3] = {
2975 /* seems analog CD is not working */
2976 static struct hda_input_mux alc880_lg_capture_source = {
2981 { "Internal Mic", 0x6 },
2985 /* 2,4,6 channel modes */
2986 static struct hda_verb alc880_lg_ch2_init[] = {
2987 /* set line-in and mic-in to input */
2988 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2989 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2993 static struct hda_verb alc880_lg_ch4_init[] = {
2994 /* set line-in to out and mic-in to input */
2995 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2996 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3000 static struct hda_verb alc880_lg_ch6_init[] = {
3001 /* set line-in and mic-in to output */
3002 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3003 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3007 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3008 { 2, alc880_lg_ch2_init },
3009 { 4, alc880_lg_ch4_init },
3010 { 6, alc880_lg_ch6_init },
3013 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3014 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3015 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3016 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3017 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3018 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3019 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3020 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3021 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3022 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3023 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3024 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3025 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3026 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3027 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3029 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3030 .name = "Channel Mode",
3031 .info = alc_ch_mode_info,
3032 .get = alc_ch_mode_get,
3033 .put = alc_ch_mode_put,
3038 static struct hda_verb alc880_lg_init_verbs[] = {
3039 /* set capture source to mic-in */
3040 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3041 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3042 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3043 /* mute all amp mixer inputs */
3044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3047 /* line-in to input */
3048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3051 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3054 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3055 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 /* mic-in to input */
3057 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3058 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3059 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3061 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3062 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3063 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3065 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3069 /* toggle speaker-output according to the hp-jack state */
3070 static void alc880_lg_setup(struct hda_codec *codec)
3072 struct alc_spec *spec = codec->spec;
3074 spec->autocfg.hp_pins[0] = 0x1b;
3075 spec->autocfg.speaker_pins[0] = 0x17;
3084 * Built-in Mic-In: 0x19
3090 static struct hda_input_mux alc880_lg_lw_capture_source = {
3094 { "Internal Mic", 0x1 },
3099 #define alc880_lg_lw_modes alc880_threestack_modes
3101 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3102 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3103 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3104 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3105 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3106 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3107 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3108 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3109 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3110 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3111 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3113 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3114 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3115 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3117 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3118 .name = "Channel Mode",
3119 .info = alc_ch_mode_info,
3120 .get = alc_ch_mode_get,
3121 .put = alc_ch_mode_put,
3126 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3127 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3128 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3129 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3131 /* set capture source to mic-in */
3132 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3133 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3134 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3137 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3138 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3140 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3141 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3142 /* mic-in to input */
3143 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3144 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3146 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3147 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3149 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3153 /* toggle speaker-output according to the hp-jack state */
3154 static void alc880_lg_lw_setup(struct hda_codec *codec)
3156 struct alc_spec *spec = codec->spec;
3158 spec->autocfg.hp_pins[0] = 0x1b;
3159 spec->autocfg.speaker_pins[0] = 0x14;
3162 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3163 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3164 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3167 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3168 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3172 static struct hda_input_mux alc880_medion_rim_capture_source = {
3176 { "Internal Mic", 0x1 },
3180 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3181 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3183 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3184 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3186 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3187 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3188 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3189 /* Mic2 (as headphone out) for HP output */
3190 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3191 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3192 /* Internal Speaker */
3193 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3194 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3196 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3197 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3199 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3203 /* toggle speaker-output according to the hp-jack state */
3204 static void alc880_medion_rim_automute(struct hda_codec *codec)
3206 struct alc_spec *spec = codec->spec;
3207 alc_automute_amp(codec);
3209 if (spec->jack_present)
3210 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3212 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3215 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3218 /* Looks like the unsol event is incompatible with the standard
3219 * definition. 4bit tag is placed at 28 bit!
3221 if ((res >> 28) == ALC880_HP_EVENT)
3222 alc880_medion_rim_automute(codec);
3225 static void alc880_medion_rim_setup(struct hda_codec *codec)
3227 struct alc_spec *spec = codec->spec;
3229 spec->autocfg.hp_pins[0] = 0x14;
3230 spec->autocfg.speaker_pins[0] = 0x1b;
3233 #ifdef CONFIG_SND_HDA_POWER_SAVE
3234 static struct hda_amp_list alc880_loopbacks[] = {
3235 { 0x0b, HDA_INPUT, 0 },
3236 { 0x0b, HDA_INPUT, 1 },
3237 { 0x0b, HDA_INPUT, 2 },
3238 { 0x0b, HDA_INPUT, 3 },
3239 { 0x0b, HDA_INPUT, 4 },
3243 static struct hda_amp_list alc880_lg_loopbacks[] = {
3244 { 0x0b, HDA_INPUT, 1 },
3245 { 0x0b, HDA_INPUT, 6 },
3246 { 0x0b, HDA_INPUT, 7 },
3255 static int alc_init(struct hda_codec *codec)
3257 struct alc_spec *spec = codec->spec;
3261 alc_auto_init_amp(codec, spec->init_amp);
3263 for (i = 0; i < spec->num_init_verbs; i++)
3264 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3266 if (spec->init_hook)
3267 spec->init_hook(codec);
3272 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3274 struct alc_spec *spec = codec->spec;
3276 if (spec->unsol_event)
3277 spec->unsol_event(codec, res);
3280 #ifdef CONFIG_SND_HDA_POWER_SAVE
3281 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3283 struct alc_spec *spec = codec->spec;
3284 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3289 * Analog playback callbacks
3291 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3292 struct hda_codec *codec,
3293 struct snd_pcm_substream *substream)
3295 struct alc_spec *spec = codec->spec;
3296 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3300 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3301 struct hda_codec *codec,
3302 unsigned int stream_tag,
3303 unsigned int format,
3304 struct snd_pcm_substream *substream)
3306 struct alc_spec *spec = codec->spec;
3307 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3308 stream_tag, format, substream);
3311 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3312 struct hda_codec *codec,
3313 struct snd_pcm_substream *substream)
3315 struct alc_spec *spec = codec->spec;
3316 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3322 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3323 struct hda_codec *codec,
3324 struct snd_pcm_substream *substream)
3326 struct alc_spec *spec = codec->spec;
3327 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3330 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3331 struct hda_codec *codec,
3332 unsigned int stream_tag,
3333 unsigned int format,
3334 struct snd_pcm_substream *substream)
3336 struct alc_spec *spec = codec->spec;
3337 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3338 stream_tag, format, substream);
3341 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3342 struct hda_codec *codec,
3343 struct snd_pcm_substream *substream)
3345 struct alc_spec *spec = codec->spec;
3346 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3349 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3350 struct hda_codec *codec,
3351 struct snd_pcm_substream *substream)
3353 struct alc_spec *spec = codec->spec;
3354 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3360 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3361 struct hda_codec *codec,
3362 unsigned int stream_tag,
3363 unsigned int format,
3364 struct snd_pcm_substream *substream)
3366 struct alc_spec *spec = codec->spec;
3368 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3369 stream_tag, 0, format);
3373 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3374 struct hda_codec *codec,
3375 struct snd_pcm_substream *substream)
3377 struct alc_spec *spec = codec->spec;
3379 snd_hda_codec_cleanup_stream(codec,
3380 spec->adc_nids[substream->number + 1]);
3387 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3391 /* NID is set in alc_build_pcms */
3393 .open = alc880_playback_pcm_open,
3394 .prepare = alc880_playback_pcm_prepare,
3395 .cleanup = alc880_playback_pcm_cleanup
3399 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3403 /* NID is set in alc_build_pcms */
3406 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3410 /* NID is set in alc_build_pcms */
3413 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3414 .substreams = 2, /* can be overridden */
3417 /* NID is set in alc_build_pcms */
3419 .prepare = alc880_alt_capture_pcm_prepare,
3420 .cleanup = alc880_alt_capture_pcm_cleanup
3424 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3428 /* NID is set in alc_build_pcms */
3430 .open = alc880_dig_playback_pcm_open,
3431 .close = alc880_dig_playback_pcm_close,
3432 .prepare = alc880_dig_playback_pcm_prepare,
3433 .cleanup = alc880_dig_playback_pcm_cleanup
3437 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3441 /* NID is set in alc_build_pcms */
3444 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3445 static struct hda_pcm_stream alc_pcm_null_stream = {
3451 static int alc_build_pcms(struct hda_codec *codec)
3453 struct alc_spec *spec = codec->spec;
3454 struct hda_pcm *info = spec->pcm_rec;
3457 codec->num_pcms = 1;
3458 codec->pcm_info = info;
3460 if (spec->no_analog)
3463 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3464 "%s Analog", codec->chip_name);
3465 info->name = spec->stream_name_analog;
3467 if (spec->stream_analog_playback) {
3468 if (snd_BUG_ON(!spec->multiout.dac_nids))
3470 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3471 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3473 if (spec->stream_analog_capture) {
3474 if (snd_BUG_ON(!spec->adc_nids))
3476 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3477 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3480 if (spec->channel_mode) {
3481 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3482 for (i = 0; i < spec->num_channel_mode; i++) {
3483 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3484 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3490 /* SPDIF for stream index #1 */
3491 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3492 snprintf(spec->stream_name_digital,
3493 sizeof(spec->stream_name_digital),
3494 "%s Digital", codec->chip_name);
3495 codec->num_pcms = 2;
3496 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3497 info = spec->pcm_rec + 1;
3498 info->name = spec->stream_name_digital;
3499 if (spec->dig_out_type)
3500 info->pcm_type = spec->dig_out_type;
3502 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3503 if (spec->multiout.dig_out_nid &&
3504 spec->stream_digital_playback) {
3505 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3506 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3508 if (spec->dig_in_nid &&
3509 spec->stream_digital_capture) {
3510 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3511 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3513 /* FIXME: do we need this for all Realtek codec models? */
3514 codec->spdif_status_reset = 1;
3517 if (spec->no_analog)
3520 /* If the use of more than one ADC is requested for the current
3521 * model, configure a second analog capture-only PCM.
3523 /* Additional Analaog capture for index #2 */
3524 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3525 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3526 codec->num_pcms = 3;
3527 info = spec->pcm_rec + 2;
3528 info->name = spec->stream_name_analog;
3529 if (spec->alt_dac_nid) {
3530 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3531 *spec->stream_analog_alt_playback;
3532 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3535 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3536 alc_pcm_null_stream;
3537 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3539 if (spec->num_adc_nids > 1) {
3540 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3541 *spec->stream_analog_alt_capture;
3542 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3544 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3545 spec->num_adc_nids - 1;
3547 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3548 alc_pcm_null_stream;
3549 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3556 static void alc_free_kctls(struct hda_codec *codec)
3558 struct alc_spec *spec = codec->spec;
3560 if (spec->kctls.list) {
3561 struct snd_kcontrol_new *kctl = spec->kctls.list;
3563 for (i = 0; i < spec->kctls.used; i++)
3564 kfree(kctl[i].name);
3566 snd_array_free(&spec->kctls);
3569 static void alc_free(struct hda_codec *codec)
3571 struct alc_spec *spec = codec->spec;
3576 alc_free_kctls(codec);
3578 snd_hda_detach_beep_device(codec);
3581 #ifdef SND_HDA_NEEDS_RESUME
3582 static int alc_resume(struct hda_codec *codec)
3584 codec->patch_ops.init(codec);
3585 snd_hda_codec_resume_amp(codec);
3586 snd_hda_codec_resume_cache(codec);
3593 static struct hda_codec_ops alc_patch_ops = {
3594 .build_controls = alc_build_controls,
3595 .build_pcms = alc_build_pcms,
3598 .unsol_event = alc_unsol_event,
3599 #ifdef SND_HDA_NEEDS_RESUME
3600 .resume = alc_resume,
3602 #ifdef CONFIG_SND_HDA_POWER_SAVE
3603 .check_power_status = alc_check_power_status,
3609 * Test configuration for debugging
3611 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3614 #ifdef CONFIG_SND_DEBUG
3615 static hda_nid_t alc880_test_dac_nids[4] = {
3616 0x02, 0x03, 0x04, 0x05
3619 static struct hda_input_mux alc880_test_capture_source = {
3628 { "Surround", 0x6 },
3632 static struct hda_channel_mode alc880_test_modes[4] = {
3639 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3640 struct snd_ctl_elem_info *uinfo)
3642 static char *texts[] = {
3643 "N/A", "Line Out", "HP Out",
3644 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3646 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3648 uinfo->value.enumerated.items = 8;
3649 if (uinfo->value.enumerated.item >= 8)
3650 uinfo->value.enumerated.item = 7;
3651 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3655 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3656 struct snd_ctl_elem_value *ucontrol)
3658 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3659 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3660 unsigned int pin_ctl, item = 0;
3662 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3663 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3664 if (pin_ctl & AC_PINCTL_OUT_EN) {
3665 if (pin_ctl & AC_PINCTL_HP_EN)
3669 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3670 switch (pin_ctl & AC_PINCTL_VREFEN) {
3671 case AC_PINCTL_VREF_HIZ: item = 3; break;
3672 case AC_PINCTL_VREF_50: item = 4; break;
3673 case AC_PINCTL_VREF_GRD: item = 5; break;
3674 case AC_PINCTL_VREF_80: item = 6; break;
3675 case AC_PINCTL_VREF_100: item = 7; break;
3678 ucontrol->value.enumerated.item[0] = item;
3682 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3683 struct snd_ctl_elem_value *ucontrol)
3685 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3686 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3687 static unsigned int ctls[] = {
3688 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3689 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3690 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3691 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3692 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3693 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3695 unsigned int old_ctl, new_ctl;
3697 old_ctl = snd_hda_codec_read(codec, nid, 0,
3698 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3699 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3700 if (old_ctl != new_ctl) {
3702 snd_hda_codec_write_cache(codec, nid, 0,
3703 AC_VERB_SET_PIN_WIDGET_CONTROL,
3705 val = ucontrol->value.enumerated.item[0] >= 3 ?
3707 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3714 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3715 struct snd_ctl_elem_info *uinfo)
3717 static char *texts[] = {
3718 "Front", "Surround", "CLFE", "Side"
3720 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3722 uinfo->value.enumerated.items = 4;
3723 if (uinfo->value.enumerated.item >= 4)
3724 uinfo->value.enumerated.item = 3;
3725 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3729 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3730 struct snd_ctl_elem_value *ucontrol)
3732 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3733 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3736 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3737 ucontrol->value.enumerated.item[0] = sel & 3;
3741 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3742 struct snd_ctl_elem_value *ucontrol)
3744 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3745 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3748 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3749 if (ucontrol->value.enumerated.item[0] != sel) {
3750 sel = ucontrol->value.enumerated.item[0] & 3;
3751 snd_hda_codec_write_cache(codec, nid, 0,
3752 AC_VERB_SET_CONNECT_SEL, sel);
3758 #define PIN_CTL_TEST(xname,nid) { \
3759 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3761 .info = alc_test_pin_ctl_info, \
3762 .get = alc_test_pin_ctl_get, \
3763 .put = alc_test_pin_ctl_put, \
3764 .private_value = nid \
3767 #define PIN_SRC_TEST(xname,nid) { \
3768 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3770 .info = alc_test_pin_src_info, \
3771 .get = alc_test_pin_src_get, \
3772 .put = alc_test_pin_src_put, \
3773 .private_value = nid \
3776 static struct snd_kcontrol_new alc880_test_mixer[] = {
3777 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3778 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3779 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3780 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3781 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3782 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3783 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3784 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3785 PIN_CTL_TEST("Front Pin Mode", 0x14),
3786 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3787 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3788 PIN_CTL_TEST("Side Pin Mode", 0x17),
3789 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3790 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3791 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3792 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3793 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3794 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3795 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3796 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3797 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3798 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3799 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3800 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3801 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3802 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3803 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3804 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3805 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3806 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3808 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3809 .name = "Channel Mode",
3810 .info = alc_ch_mode_info,
3811 .get = alc_ch_mode_get,
3812 .put = alc_ch_mode_put,
3817 static struct hda_verb alc880_test_init_verbs[] = {
3818 /* Unmute inputs of 0x0c - 0x0f */
3819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3821 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3822 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3823 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3824 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3825 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3826 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3827 /* Vol output for 0x0c-0x0f */
3828 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3829 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3830 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3831 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3832 /* Set output pins 0x14-0x17 */
3833 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3834 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3835 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3836 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3837 /* Unmute output pins 0x14-0x17 */
3838 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3839 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3840 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3841 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3842 /* Set input pins 0x18-0x1c */
3843 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3844 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3845 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3846 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3847 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3848 /* Mute input pins 0x18-0x1b */
3849 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3850 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3851 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3852 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3855 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3856 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3857 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3858 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3859 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3860 /* Analog input/passthru */
3861 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3862 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3863 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3864 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3865 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3873 static const char *alc880_models[ALC880_MODEL_LAST] = {
3874 [ALC880_3ST] = "3stack",
3875 [ALC880_TCL_S700] = "tcl",
3876 [ALC880_3ST_DIG] = "3stack-digout",
3877 [ALC880_CLEVO] = "clevo",
3878 [ALC880_5ST] = "5stack",
3879 [ALC880_5ST_DIG] = "5stack-digout",
3880 [ALC880_W810] = "w810",
3881 [ALC880_Z71V] = "z71v",
3882 [ALC880_6ST] = "6stack",
3883 [ALC880_6ST_DIG] = "6stack-digout",
3884 [ALC880_ASUS] = "asus",
3885 [ALC880_ASUS_W1V] = "asus-w1v",
3886 [ALC880_ASUS_DIG] = "asus-dig",
3887 [ALC880_ASUS_DIG2] = "asus-dig2",
3888 [ALC880_UNIWILL_DIG] = "uniwill",
3889 [ALC880_UNIWILL_P53] = "uniwill-p53",
3890 [ALC880_FUJITSU] = "fujitsu",
3891 [ALC880_F1734] = "F1734",
3893 [ALC880_LG_LW] = "lg-lw",
3894 [ALC880_MEDION_RIM] = "medion",
3895 #ifdef CONFIG_SND_DEBUG
3896 [ALC880_TEST] = "test",
3898 [ALC880_AUTO] = "auto",
3901 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3902 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3903 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3904 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3905 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3906 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3907 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3908 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3909 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3910 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3911 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3912 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3913 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3914 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3915 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3916 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3917 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3918 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3919 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3920 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3921 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3922 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3923 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3924 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3925 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3926 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3927 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3928 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3929 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3930 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3931 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3932 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3933 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3934 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3935 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3936 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3937 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3938 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3939 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3940 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3941 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3942 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3943 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3944 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3945 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3946 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3947 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3948 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3949 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3950 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3951 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3952 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3953 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3954 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3955 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3956 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3957 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3958 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3959 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3960 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3961 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3962 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3963 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3964 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3965 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3966 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3967 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3968 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3969 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3971 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3972 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3973 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3978 * ALC880 codec presets
3980 static struct alc_config_preset alc880_presets[] = {
3982 .mixers = { alc880_three_stack_mixer },
3983 .init_verbs = { alc880_volume_init_verbs,
3984 alc880_pin_3stack_init_verbs },
3985 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3986 .dac_nids = alc880_dac_nids,
3987 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3988 .channel_mode = alc880_threestack_modes,
3990 .input_mux = &alc880_capture_source,
3992 [ALC880_3ST_DIG] = {
3993 .mixers = { alc880_three_stack_mixer },
3994 .init_verbs = { alc880_volume_init_verbs,
3995 alc880_pin_3stack_init_verbs },
3996 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3997 .dac_nids = alc880_dac_nids,
3998 .dig_out_nid = ALC880_DIGOUT_NID,
3999 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4000 .channel_mode = alc880_threestack_modes,
4002 .input_mux = &alc880_capture_source,
4004 [ALC880_TCL_S700] = {
4005 .mixers = { alc880_tcl_s700_mixer },
4006 .init_verbs = { alc880_volume_init_verbs,
4007 alc880_pin_tcl_S700_init_verbs,
4008 alc880_gpio2_init_verbs },
4009 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4010 .dac_nids = alc880_dac_nids,
4011 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4012 .num_adc_nids = 1, /* single ADC */
4014 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4015 .channel_mode = alc880_2_jack_modes,
4016 .input_mux = &alc880_capture_source,
4019 .mixers = { alc880_three_stack_mixer,
4020 alc880_five_stack_mixer},
4021 .init_verbs = { alc880_volume_init_verbs,
4022 alc880_pin_5stack_init_verbs },
4023 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4024 .dac_nids = alc880_dac_nids,
4025 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4026 .channel_mode = alc880_fivestack_modes,
4027 .input_mux = &alc880_capture_source,
4029 [ALC880_5ST_DIG] = {
4030 .mixers = { alc880_three_stack_mixer,
4031 alc880_five_stack_mixer },
4032 .init_verbs = { alc880_volume_init_verbs,
4033 alc880_pin_5stack_init_verbs },
4034 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4035 .dac_nids = alc880_dac_nids,
4036 .dig_out_nid = ALC880_DIGOUT_NID,
4037 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4038 .channel_mode = alc880_fivestack_modes,
4039 .input_mux = &alc880_capture_source,
4042 .mixers = { alc880_six_stack_mixer },
4043 .init_verbs = { alc880_volume_init_verbs,
4044 alc880_pin_6stack_init_verbs },
4045 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4046 .dac_nids = alc880_6st_dac_nids,
4047 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4048 .channel_mode = alc880_sixstack_modes,
4049 .input_mux = &alc880_6stack_capture_source,
4051 [ALC880_6ST_DIG] = {
4052 .mixers = { alc880_six_stack_mixer },
4053 .init_verbs = { alc880_volume_init_verbs,
4054 alc880_pin_6stack_init_verbs },
4055 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4056 .dac_nids = alc880_6st_dac_nids,
4057 .dig_out_nid = ALC880_DIGOUT_NID,
4058 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4059 .channel_mode = alc880_sixstack_modes,
4060 .input_mux = &alc880_6stack_capture_source,
4063 .mixers = { alc880_w810_base_mixer },
4064 .init_verbs = { alc880_volume_init_verbs,
4065 alc880_pin_w810_init_verbs,
4066 alc880_gpio2_init_verbs },
4067 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4068 .dac_nids = alc880_w810_dac_nids,
4069 .dig_out_nid = ALC880_DIGOUT_NID,
4070 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4071 .channel_mode = alc880_w810_modes,
4072 .input_mux = &alc880_capture_source,
4075 .mixers = { alc880_z71v_mixer },
4076 .init_verbs = { alc880_volume_init_verbs,
4077 alc880_pin_z71v_init_verbs },
4078 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4079 .dac_nids = alc880_z71v_dac_nids,
4080 .dig_out_nid = ALC880_DIGOUT_NID,
4082 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4083 .channel_mode = alc880_2_jack_modes,
4084 .input_mux = &alc880_capture_source,
4087 .mixers = { alc880_f1734_mixer },
4088 .init_verbs = { alc880_volume_init_verbs,
4089 alc880_pin_f1734_init_verbs },
4090 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4091 .dac_nids = alc880_f1734_dac_nids,
4093 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4094 .channel_mode = alc880_2_jack_modes,
4095 .input_mux = &alc880_f1734_capture_source,
4096 .unsol_event = alc880_uniwill_p53_unsol_event,
4097 .setup = alc880_uniwill_p53_setup,
4098 .init_hook = alc_automute_amp,
4101 .mixers = { alc880_asus_mixer },
4102 .init_verbs = { alc880_volume_init_verbs,
4103 alc880_pin_asus_init_verbs,
4104 alc880_gpio1_init_verbs },
4105 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4106 .dac_nids = alc880_asus_dac_nids,
4107 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4108 .channel_mode = alc880_asus_modes,
4110 .input_mux = &alc880_capture_source,
4112 [ALC880_ASUS_DIG] = {
4113 .mixers = { alc880_asus_mixer },
4114 .init_verbs = { alc880_volume_init_verbs,
4115 alc880_pin_asus_init_verbs,
4116 alc880_gpio1_init_verbs },
4117 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4118 .dac_nids = alc880_asus_dac_nids,
4119 .dig_out_nid = ALC880_DIGOUT_NID,
4120 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4121 .channel_mode = alc880_asus_modes,
4123 .input_mux = &alc880_capture_source,
4125 [ALC880_ASUS_DIG2] = {
4126 .mixers = { alc880_asus_mixer },
4127 .init_verbs = { alc880_volume_init_verbs,
4128 alc880_pin_asus_init_verbs,
4129 alc880_gpio2_init_verbs }, /* use GPIO2 */
4130 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4131 .dac_nids = alc880_asus_dac_nids,
4132 .dig_out_nid = ALC880_DIGOUT_NID,
4133 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4134 .channel_mode = alc880_asus_modes,
4136 .input_mux = &alc880_capture_source,
4138 [ALC880_ASUS_W1V] = {
4139 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4140 .init_verbs = { alc880_volume_init_verbs,
4141 alc880_pin_asus_init_verbs,
4142 alc880_gpio1_init_verbs },
4143 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4144 .dac_nids = alc880_asus_dac_nids,
4145 .dig_out_nid = ALC880_DIGOUT_NID,
4146 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4147 .channel_mode = alc880_asus_modes,
4149 .input_mux = &alc880_capture_source,
4151 [ALC880_UNIWILL_DIG] = {
4152 .mixers = { alc880_asus_mixer },
4153 .init_verbs = { alc880_volume_init_verbs,
4154 alc880_pin_asus_init_verbs },
4155 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4156 .dac_nids = alc880_asus_dac_nids,
4157 .dig_out_nid = ALC880_DIGOUT_NID,
4158 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4159 .channel_mode = alc880_asus_modes,
4161 .input_mux = &alc880_capture_source,
4163 [ALC880_UNIWILL] = {
4164 .mixers = { alc880_uniwill_mixer },
4165 .init_verbs = { alc880_volume_init_verbs,
4166 alc880_uniwill_init_verbs },
4167 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4168 .dac_nids = alc880_asus_dac_nids,
4169 .dig_out_nid = ALC880_DIGOUT_NID,
4170 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4171 .channel_mode = alc880_threestack_modes,
4173 .input_mux = &alc880_capture_source,
4174 .unsol_event = alc880_uniwill_unsol_event,
4175 .setup = alc880_uniwill_setup,
4176 .init_hook = alc880_uniwill_init_hook,
4178 [ALC880_UNIWILL_P53] = {
4179 .mixers = { alc880_uniwill_p53_mixer },
4180 .init_verbs = { alc880_volume_init_verbs,
4181 alc880_uniwill_p53_init_verbs },
4182 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4183 .dac_nids = alc880_asus_dac_nids,
4184 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4185 .channel_mode = alc880_threestack_modes,
4186 .input_mux = &alc880_capture_source,
4187 .unsol_event = alc880_uniwill_p53_unsol_event,
4188 .setup = alc880_uniwill_p53_setup,
4189 .init_hook = alc_automute_amp,
4191 [ALC880_FUJITSU] = {
4192 .mixers = { alc880_fujitsu_mixer },
4193 .init_verbs = { alc880_volume_init_verbs,
4194 alc880_uniwill_p53_init_verbs,
4195 alc880_beep_init_verbs },
4196 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4197 .dac_nids = alc880_dac_nids,
4198 .dig_out_nid = ALC880_DIGOUT_NID,
4199 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4200 .channel_mode = alc880_2_jack_modes,
4201 .input_mux = &alc880_capture_source,
4202 .unsol_event = alc880_uniwill_p53_unsol_event,
4203 .setup = alc880_uniwill_p53_setup,
4204 .init_hook = alc_automute_amp,
4207 .mixers = { alc880_three_stack_mixer },
4208 .init_verbs = { alc880_volume_init_verbs,
4209 alc880_pin_clevo_init_verbs },
4210 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4211 .dac_nids = alc880_dac_nids,
4213 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4214 .channel_mode = alc880_threestack_modes,
4216 .input_mux = &alc880_capture_source,
4219 .mixers = { alc880_lg_mixer },
4220 .init_verbs = { alc880_volume_init_verbs,
4221 alc880_lg_init_verbs },
4222 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4223 .dac_nids = alc880_lg_dac_nids,
4224 .dig_out_nid = ALC880_DIGOUT_NID,
4225 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4226 .channel_mode = alc880_lg_ch_modes,
4228 .input_mux = &alc880_lg_capture_source,
4229 .unsol_event = alc_automute_amp_unsol_event,
4230 .setup = alc880_lg_setup,
4231 .init_hook = alc_automute_amp,
4232 #ifdef CONFIG_SND_HDA_POWER_SAVE
4233 .loopbacks = alc880_lg_loopbacks,
4237 .mixers = { alc880_lg_lw_mixer },
4238 .init_verbs = { alc880_volume_init_verbs,
4239 alc880_lg_lw_init_verbs },
4240 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4241 .dac_nids = alc880_dac_nids,
4242 .dig_out_nid = ALC880_DIGOUT_NID,
4243 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4244 .channel_mode = alc880_lg_lw_modes,
4245 .input_mux = &alc880_lg_lw_capture_source,
4246 .unsol_event = alc_automute_amp_unsol_event,
4247 .setup = alc880_lg_lw_setup,
4248 .init_hook = alc_automute_amp,
4250 [ALC880_MEDION_RIM] = {
4251 .mixers = { alc880_medion_rim_mixer },
4252 .init_verbs = { alc880_volume_init_verbs,
4253 alc880_medion_rim_init_verbs,
4254 alc_gpio2_init_verbs },
4255 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4256 .dac_nids = alc880_dac_nids,
4257 .dig_out_nid = ALC880_DIGOUT_NID,
4258 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4259 .channel_mode = alc880_2_jack_modes,
4260 .input_mux = &alc880_medion_rim_capture_source,
4261 .unsol_event = alc880_medion_rim_unsol_event,
4262 .setup = alc880_medion_rim_setup,
4263 .init_hook = alc880_medion_rim_automute,
4265 #ifdef CONFIG_SND_DEBUG
4267 .mixers = { alc880_test_mixer },
4268 .init_verbs = { alc880_test_init_verbs },
4269 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4270 .dac_nids = alc880_test_dac_nids,
4271 .dig_out_nid = ALC880_DIGOUT_NID,
4272 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4273 .channel_mode = alc880_test_modes,
4274 .input_mux = &alc880_test_capture_source,
4280 * Automatic parse of I/O pins from the BIOS configuration
4285 ALC_CTL_WIDGET_MUTE,
4288 static struct snd_kcontrol_new alc880_control_templates[] = {
4289 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4290 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4291 HDA_BIND_MUTE(NULL, 0, 0, 0),
4294 /* add dynamic controls */
4295 static int add_control(struct alc_spec *spec, int type, const char *name,
4298 struct snd_kcontrol_new *knew;
4300 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4301 knew = snd_array_new(&spec->kctls);
4304 *knew = alc880_control_templates[type];
4305 knew->name = kstrdup(name, GFP_KERNEL);
4308 knew->private_value = val;
4312 static int add_control_with_pfx(struct alc_spec *spec, int type,
4313 const char *pfx, const char *dir,
4314 const char *sfx, unsigned long val)
4317 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4318 return add_control(spec, type, name, val);
4321 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4322 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4323 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4324 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4326 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4327 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4328 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4329 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4330 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4331 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4332 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4333 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4334 #define ALC880_PIN_CD_NID 0x1c
4336 /* fill in the dac_nids table from the parsed pin configuration */
4337 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4338 const struct auto_pin_cfg *cfg)
4344 memset(assigned, 0, sizeof(assigned));
4345 spec->multiout.dac_nids = spec->private_dac_nids;
4347 /* check the pins hardwired to audio widget */
4348 for (i = 0; i < cfg->line_outs; i++) {
4349 nid = cfg->line_out_pins[i];
4350 if (alc880_is_fixed_pin(nid)) {
4351 int idx = alc880_fixed_pin_idx(nid);
4352 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4356 /* left pins can be connect to any audio widget */
4357 for (i = 0; i < cfg->line_outs; i++) {
4358 nid = cfg->line_out_pins[i];
4359 if (alc880_is_fixed_pin(nid))
4361 /* search for an empty channel */
4362 for (j = 0; j < cfg->line_outs; j++) {
4364 spec->multiout.dac_nids[i] =
4365 alc880_idx_to_dac(j);
4371 spec->multiout.num_dacs = cfg->line_outs;
4375 /* add playback controls from the parsed DAC table */
4376 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4377 const struct auto_pin_cfg *cfg)
4379 static const char *chname[4] = {
4380 "Front", "Surround", NULL /*CLFE*/, "Side"
4385 for (i = 0; i < cfg->line_outs; i++) {
4386 if (!spec->multiout.dac_nids[i])
4388 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4391 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4393 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4397 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4399 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4403 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4405 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4409 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4411 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4417 if (cfg->line_outs == 1 &&
4418 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4422 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4423 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4427 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4428 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4437 /* add playback controls for speaker and HP outputs */
4438 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4447 if (alc880_is_fixed_pin(pin)) {
4448 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4449 /* specify the DAC as the extra output */
4450 if (!spec->multiout.hp_nid)
4451 spec->multiout.hp_nid = nid;
4453 spec->multiout.extra_out_nid[0] = nid;
4454 /* control HP volume/switch on the output mixer amp */
4455 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4456 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4457 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4460 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4461 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4464 } else if (alc880_is_multi_pin(pin)) {
4465 /* set manual connection */
4466 /* we have only a switch on HP-out PIN */
4467 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4468 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4475 /* create input playback/capture controls for the given pin */
4476 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4477 const char *ctlname,
4478 int idx, hda_nid_t mix_nid)
4482 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4483 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4486 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4487 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4493 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4495 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4496 return (pincap & AC_PINCAP_IN) != 0;
4499 /* create playback/capture controls for input pins */
4500 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4501 const struct auto_pin_cfg *cfg,
4503 hda_nid_t cap1, hda_nid_t cap2)
4505 struct alc_spec *spec = codec->spec;
4506 struct hda_input_mux *imux = &spec->private_imux[0];
4509 for (i = 0; i < AUTO_PIN_LAST; i++) {
4512 pin = cfg->input_pins[i];
4513 if (!alc_is_input_pin(codec, pin))
4517 idx = get_connection_index(codec, mixer, pin);
4519 err = new_analog_input(spec, pin,
4520 auto_pin_cfg_labels[i],
4529 idx = get_connection_index(codec, cap1, pin);
4530 if (idx < 0 && cap2)
4531 idx = get_connection_index(codec, cap2, pin);
4533 imux->items[imux->num_items].label =
4534 auto_pin_cfg_labels[i];
4535 imux->items[imux->num_items].index = idx;
4542 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4543 const struct auto_pin_cfg *cfg)
4545 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4548 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4549 unsigned int pin_type)
4551 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4554 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4558 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4559 hda_nid_t nid, int pin_type,
4562 alc_set_pin_output(codec, nid, pin_type);
4563 /* need the manual connection? */
4564 if (alc880_is_multi_pin(nid)) {
4565 struct alc_spec *spec = codec->spec;
4566 int idx = alc880_multi_pin_idx(nid);
4567 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4568 AC_VERB_SET_CONNECT_SEL,
4569 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4573 static int get_pin_type(int line_out_type)
4575 if (line_out_type == AUTO_PIN_HP_OUT)
4581 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4583 struct alc_spec *spec = codec->spec;
4586 for (i = 0; i < spec->autocfg.line_outs; i++) {
4587 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4588 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4589 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4593 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4595 struct alc_spec *spec = codec->spec;
4598 pin = spec->autocfg.speaker_pins[0];
4599 if (pin) /* connect to front */
4600 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4601 pin = spec->autocfg.hp_pins[0];
4602 if (pin) /* connect to front */
4603 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4606 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4608 struct alc_spec *spec = codec->spec;
4611 for (i = 0; i < AUTO_PIN_LAST; i++) {
4612 hda_nid_t nid = spec->autocfg.input_pins[i];
4613 if (alc_is_input_pin(codec, nid)) {
4614 alc_set_input_pin(codec, nid, i);
4615 if (nid != ALC880_PIN_CD_NID &&
4616 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4617 snd_hda_codec_write(codec, nid, 0,
4618 AC_VERB_SET_AMP_GAIN_MUTE,
4624 /* parse the BIOS configuration and set up the alc_spec */
4625 /* return 1 if successful, 0 if the proper config is not found,
4626 * or a negative error code
4628 static int alc880_parse_auto_config(struct hda_codec *codec)
4630 struct alc_spec *spec = codec->spec;
4632 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4634 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4638 if (!spec->autocfg.line_outs)
4639 return 0; /* can't find valid BIOS pin config */
4641 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4644 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4647 err = alc880_auto_create_extra_out(spec,
4648 spec->autocfg.speaker_pins[0],
4652 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4656 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4660 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4662 /* check multiple SPDIF-out (for recent codecs) */
4663 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4665 err = snd_hda_get_connections(codec,
4666 spec->autocfg.dig_out_pins[i],
4671 spec->multiout.dig_out_nid = dig_nid;
4673 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4674 spec->slave_dig_outs[i - 1] = dig_nid;
4675 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4679 if (spec->autocfg.dig_in_pin)
4680 spec->dig_in_nid = ALC880_DIGIN_NID;
4682 if (spec->kctls.list)
4683 add_mixer(spec, spec->kctls.list);
4685 add_verb(spec, alc880_volume_init_verbs);
4687 spec->num_mux_defs = 1;
4688 spec->input_mux = &spec->private_imux[0];
4690 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4695 /* additional initialization for auto-configuration model */
4696 static void alc880_auto_init(struct hda_codec *codec)
4698 struct alc_spec *spec = codec->spec;
4699 alc880_auto_init_multi_out(codec);
4700 alc880_auto_init_extra_out(codec);
4701 alc880_auto_init_analog_input(codec);
4702 if (spec->unsol_event)
4703 alc_inithook(codec);
4706 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4707 * one of two digital mic pins, e.g. on ALC272
4709 static void fixup_automic_adc(struct hda_codec *codec)
4711 struct alc_spec *spec = codec->spec;
4714 for (i = 0; i < spec->num_adc_nids; i++) {
4715 hda_nid_t cap = spec->capsrc_nids ?
4716 spec->capsrc_nids[i] : spec->adc_nids[i];
4719 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4722 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4725 spec->int_mic.mux_idx = iidx;
4726 spec->ext_mic.mux_idx = eidx;
4727 if (spec->capsrc_nids)
4728 spec->capsrc_nids += i;
4729 spec->adc_nids += i;
4730 spec->num_adc_nids = 1;
4733 snd_printd(KERN_INFO "hda_codec: %s: "
4734 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4735 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4736 spec->auto_mic = 0; /* disable auto-mic to be sure */
4739 static void set_capture_mixer(struct hda_codec *codec)
4741 struct alc_spec *spec = codec->spec;
4742 static struct snd_kcontrol_new *caps[2][3] = {
4743 { alc_capture_mixer_nosrc1,
4744 alc_capture_mixer_nosrc2,
4745 alc_capture_mixer_nosrc3 },
4746 { alc_capture_mixer1,
4748 alc_capture_mixer3 },
4750 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4752 if (spec->auto_mic) {
4754 fixup_automic_adc(codec);
4755 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4759 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4763 #define set_beep_amp(spec, nid, idx, dir) \
4764 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4767 * OK, here we have finally the patch for ALC880
4770 static int patch_alc880(struct hda_codec *codec)
4772 struct alc_spec *spec;
4776 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4782 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4785 if (board_config < 0) {
4786 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4788 board_config = ALC880_AUTO;
4791 if (board_config == ALC880_AUTO) {
4792 /* automatic parse from the BIOS config */
4793 err = alc880_parse_auto_config(codec);
4799 "hda_codec: Cannot set up configuration "
4800 "from BIOS. Using 3-stack mode...\n");
4801 board_config = ALC880_3ST;
4805 err = snd_hda_attach_beep_device(codec, 0x1);
4811 if (board_config != ALC880_AUTO)
4812 setup_preset(codec, &alc880_presets[board_config]);
4814 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4815 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4816 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4818 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4819 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4821 if (!spec->adc_nids && spec->input_mux) {
4822 /* check whether NID 0x07 is valid */
4823 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4825 wcap = get_wcaps_type(wcap);
4826 if (wcap != AC_WID_AUD_IN) {
4827 spec->adc_nids = alc880_adc_nids_alt;
4828 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4830 spec->adc_nids = alc880_adc_nids;
4831 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4834 set_capture_mixer(codec);
4835 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4837 spec->vmaster_nid = 0x0c;
4839 codec->patch_ops = alc_patch_ops;
4840 if (board_config == ALC880_AUTO)
4841 spec->init_hook = alc880_auto_init;
4842 #ifdef CONFIG_SND_HDA_POWER_SAVE
4843 if (!spec->loopback.amplist)
4844 spec->loopback.amplist = alc880_loopbacks;
4846 codec->proc_widget_hook = print_realtek_coef;
4856 static hda_nid_t alc260_dac_nids[1] = {
4861 static hda_nid_t alc260_adc_nids[1] = {
4866 static hda_nid_t alc260_adc_nids_alt[1] = {
4871 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4872 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4874 static hda_nid_t alc260_dual_adc_nids[2] = {
4879 #define ALC260_DIGOUT_NID 0x03
4880 #define ALC260_DIGIN_NID 0x06
4882 static struct hda_input_mux alc260_capture_source = {
4886 { "Front Mic", 0x1 },
4892 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4893 * headphone jack and the internal CD lines since these are the only pins at
4894 * which audio can appear. For flexibility, also allow the option of
4895 * recording the mixer output on the second ADC (ADC0 doesn't have a
4896 * connection to the mixer output).
4898 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4902 { "Mic/Line", 0x0 },
4904 { "Headphone", 0x2 },
4910 { "Mic/Line", 0x0 },
4912 { "Headphone", 0x2 },
4919 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4920 * the Fujitsu S702x, but jacks are marked differently.
4922 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4929 { "Headphone", 0x5 },
4938 { "Headphone", 0x6 },
4944 /* Maxdata Favorit 100XS */
4945 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4949 { "Line/Mic", 0x0 },
4956 { "Line/Mic", 0x0 },
4964 * This is just place-holder, so there's something for alc_build_pcms to look
4965 * at when it calculates the maximum number of channels. ALC260 has no mixer
4966 * element which allows changing the channel mode, so the verb list is
4969 static struct hda_channel_mode alc260_modes[1] = {
4974 /* Mixer combinations
4976 * basic: base_output + input + pc_beep + capture
4977 * HP: base_output + input + capture_alt
4978 * HP_3013: hp_3013 + input + capture
4979 * fujitsu: fujitsu + capture
4980 * acer: acer + capture
4983 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4984 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4985 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4986 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4987 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4988 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4989 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4993 static struct snd_kcontrol_new alc260_input_mixer[] = {
4994 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4995 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4996 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4997 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4999 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5000 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5001 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5005 /* update HP, line and mono out pins according to the master switch */
5006 static void alc260_hp_master_update(struct hda_codec *codec,
5007 hda_nid_t hp, hda_nid_t line,
5010 struct alc_spec *spec = codec->spec;
5011 unsigned int val = spec->master_sw ? PIN_HP : 0;
5012 /* change HP and line-out pins */
5013 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5015 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5017 /* mono (speaker) depending on the HP jack sense */
5018 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5019 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5023 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5024 struct snd_ctl_elem_value *ucontrol)
5026 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5027 struct alc_spec *spec = codec->spec;
5028 *ucontrol->value.integer.value = spec->master_sw;
5032 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5033 struct snd_ctl_elem_value *ucontrol)
5035 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5036 struct alc_spec *spec = codec->spec;
5037 int val = !!*ucontrol->value.integer.value;
5038 hda_nid_t hp, line, mono;
5040 if (val == spec->master_sw)
5042 spec->master_sw = val;
5043 hp = (kcontrol->private_value >> 16) & 0xff;
5044 line = (kcontrol->private_value >> 8) & 0xff;
5045 mono = kcontrol->private_value & 0xff;
5046 alc260_hp_master_update(codec, hp, line, mono);
5050 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5052 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5053 .name = "Master Playback Switch",
5054 .info = snd_ctl_boolean_mono_info,
5055 .get = alc260_hp_master_sw_get,
5056 .put = alc260_hp_master_sw_put,
5057 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5059 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5060 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5061 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5062 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5063 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5065 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5069 static struct hda_verb alc260_hp_unsol_verbs[] = {
5070 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5074 static void alc260_hp_automute(struct hda_codec *codec)
5076 struct alc_spec *spec = codec->spec;
5077 unsigned int present;
5079 present = snd_hda_codec_read(codec, 0x10, 0,
5080 AC_VERB_GET_PIN_SENSE, 0);
5081 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5082 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5085 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5087 if ((res >> 26) == ALC880_HP_EVENT)
5088 alc260_hp_automute(codec);
5091 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5093 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5094 .name = "Master Playback Switch",
5095 .info = snd_ctl_boolean_mono_info,
5096 .get = alc260_hp_master_sw_get,
5097 .put = alc260_hp_master_sw_put,
5098 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5100 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5101 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5102 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5103 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5104 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5105 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5106 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5107 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5111 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5112 .ops = &snd_hda_bind_vol,
5114 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5115 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5116 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5121 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5122 .ops = &snd_hda_bind_sw,
5124 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5125 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5130 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5131 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5132 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5133 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5134 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5138 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5139 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5143 static void alc260_hp_3013_automute(struct hda_codec *codec)
5145 struct alc_spec *spec = codec->spec;
5146 unsigned int present;
5148 present = snd_hda_codec_read(codec, 0x15, 0,
5149 AC_VERB_GET_PIN_SENSE, 0);
5150 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5151 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5154 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5157 if ((res >> 26) == ALC880_HP_EVENT)
5158 alc260_hp_3013_automute(codec);
5161 static void alc260_hp_3012_automute(struct hda_codec *codec)
5163 unsigned int present, bits;
5165 present = snd_hda_codec_read(codec, 0x10, 0,
5166 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5168 bits = present ? 0 : PIN_OUT;
5169 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5171 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5173 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5177 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5180 if ((res >> 26) == ALC880_HP_EVENT)
5181 alc260_hp_3012_automute(codec);
5184 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5185 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5187 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5188 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5189 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5190 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5191 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5192 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5193 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5194 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5195 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5196 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5197 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5201 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5202 * versions of the ALC260 don't act on requests to enable mic bias from NID
5203 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5204 * datasheet doesn't mention this restriction. At this stage it's not clear
5205 * whether this behaviour is intentional or is a hardware bug in chip
5206 * revisions available in early 2006. Therefore for now allow the
5207 * "Headphone Jack Mode" control to span all choices, but if it turns out
5208 * that the lack of mic bias for this NID is intentional we could change the
5209 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5211 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5212 * don't appear to make the mic bias available from the "line" jack, even
5213 * though the NID used for this jack (0x14) can supply it. The theory is
5214 * that perhaps Acer have included blocking capacitors between the ALC260
5215 * and the output jack. If this turns out to be the case for all such
5216 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5217 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5219 * The C20x Tablet series have a mono internal speaker which is controlled
5220 * via the chip's Mono sum widget and pin complex, so include the necessary
5221 * controls for such models. On models without a "mono speaker" the control
5222 * won't do anything.
5224 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5225 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5226 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5227 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5228 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5230 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5232 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5233 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5235 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5236 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5237 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5238 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5239 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5243 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5245 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5246 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5247 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5248 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5249 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5250 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5251 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5255 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5256 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5258 static struct snd_kcontrol_new alc260_will_mixer[] = {
5259 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5260 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5262 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5263 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5264 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5265 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5266 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5267 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5268 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5272 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5273 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5275 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5276 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5277 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5278 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5279 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5280 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5281 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5282 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5283 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5284 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5285 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5290 * initialization verbs
5292 static struct hda_verb alc260_init_verbs[] = {
5293 /* Line In pin widget for input */
5294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5295 /* CD pin widget for input */
5296 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5297 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5298 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5299 /* Mic2 (front panel) pin widget for input and vref at 80% */
5300 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5301 /* LINE-2 is used for line-out in rear */
5302 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5303 /* select line-out */
5304 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5306 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5308 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5310 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5311 /* mute capture amp left and right */
5312 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5313 /* set connection select to line in (default select for this ADC) */
5314 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5315 /* mute capture amp left and right */
5316 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5317 /* set connection select to line in (default select for this ADC) */
5318 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5319 /* set vol=0 Line-Out mixer amp left and right */
5320 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5321 /* unmute pin widget amp left and right (no gain on this amp) */
5322 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5323 /* set vol=0 HP mixer amp left and right */
5324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5325 /* unmute pin widget amp left and right (no gain on this amp) */
5326 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5327 /* set vol=0 Mono mixer amp left and right */
5328 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5329 /* unmute pin widget amp left and right (no gain on this amp) */
5330 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5331 /* unmute LINE-2 out pin */
5332 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5333 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5336 /* mute analog inputs */
5337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5342 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5343 /* mute Front out path */
5344 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5345 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5346 /* mute Headphone out path */
5347 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5348 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5349 /* mute Mono out path */
5350 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5351 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5355 #if 0 /* should be identical with alc260_init_verbs? */
5356 static struct hda_verb alc260_hp_init_verbs[] = {
5357 /* Headphone and output */
5358 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5360 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5361 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5362 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5363 /* Mic2 (front panel) pin widget for input and vref at 80% */
5364 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5365 /* Line In pin widget for input */
5366 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5367 /* Line-2 pin widget for output */
5368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5369 /* CD pin widget for input */
5370 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5371 /* unmute amp left and right */
5372 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5373 /* set connection select to line in (default select for this ADC) */
5374 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5375 /* unmute Line-Out mixer amp left and right (volume = 0) */
5376 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5377 /* mute pin widget amp left and right (no gain on this amp) */
5378 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5379 /* unmute HP mixer amp left and right (volume = 0) */
5380 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5381 /* mute pin widget amp left and right (no gain on this amp) */
5382 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5383 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5386 /* mute analog inputs */
5387 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5388 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5389 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5390 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5392 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5393 /* Unmute Front out path */
5394 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5395 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5396 /* Unmute Headphone out path */
5397 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5398 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5399 /* Unmute Mono out path */
5400 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5401 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5406 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5407 /* Line out and output */
5408 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5410 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5411 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5412 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5413 /* Mic2 (front panel) pin widget for input and vref at 80% */
5414 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5415 /* Line In pin widget for input */
5416 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5417 /* Headphone pin widget for output */
5418 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5419 /* CD pin widget for input */
5420 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5421 /* unmute amp left and right */
5422 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5423 /* set connection select to line in (default select for this ADC) */
5424 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5425 /* unmute Line-Out mixer amp left and right (volume = 0) */
5426 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5427 /* mute pin widget amp left and right (no gain on this amp) */
5428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5429 /* unmute HP mixer amp left and right (volume = 0) */
5430 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5431 /* mute pin widget amp left and right (no gain on this amp) */
5432 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5433 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5436 /* mute analog inputs */
5437 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5438 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5441 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5442 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5443 /* Unmute Front out path */
5444 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5446 /* Unmute Headphone out path */
5447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5449 /* Unmute Mono out path */
5450 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5451 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5455 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5456 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5457 * audio = 0x16, internal speaker = 0x10.
5459 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5460 /* Disable all GPIOs */
5461 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5462 /* Internal speaker is connected to headphone pin */
5463 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5464 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5466 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5467 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5468 /* Ensure all other unused pins are disabled and muted. */
5469 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5470 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5471 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5472 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5473 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5474 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5476 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5478 /* Disable digital (SPDIF) pins */
5479 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5480 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5482 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5483 * when acting as an output.
5485 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5487 /* Start with output sum widgets muted and their output gains at min */
5488 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5489 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5491 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5494 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5495 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5496 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5498 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5499 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5500 /* Unmute Line1 pin widget output buffer since it starts as an output.
5501 * If the pin mode is changed by the user the pin mode control will
5502 * take care of enabling the pin's input/output buffers as needed.
5503 * Therefore there's no need to enable the input buffer at this
5506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5507 /* Unmute input buffer of pin widget used for Line-in (no equiv
5510 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5512 /* Mute capture amp left and right */
5513 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5514 /* Set ADC connection select to match default mixer setting - line
5517 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5519 /* Do the same for the second ADC: mute capture input amp and
5520 * set ADC connection to line in (on mic1 pin)
5522 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5523 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5525 /* Mute all inputs to mixer widget (even unconnected ones) */
5526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5538 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5539 * similar laptops (adapted from Fujitsu init verbs).
5541 static struct hda_verb alc260_acer_init_verbs[] = {
5542 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5543 * the headphone jack. Turn this on and rely on the standard mute
5544 * methods whenever the user wants to turn these outputs off.
5546 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5547 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5548 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5549 /* Internal speaker/Headphone jack is connected to Line-out pin */
5550 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5551 /* Internal microphone/Mic jack is connected to Mic1 pin */
5552 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5553 /* Line In jack is connected to Line1 pin */
5554 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5555 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5556 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5557 /* Ensure all other unused pins are disabled and muted. */
5558 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5559 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5560 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5561 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5562 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5564 /* Disable digital (SPDIF) pins */
5565 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5566 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5568 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5569 * bus when acting as outputs.
5571 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5572 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5574 /* Start with output sum widgets muted and their output gains at min */
5575 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5576 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5577 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5578 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5579 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5580 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5581 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5582 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5583 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5585 /* Unmute Line-out pin widget amp left and right
5586 * (no equiv mixer ctrl)
5588 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5589 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5590 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5591 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5592 * inputs. If the pin mode is changed by the user the pin mode control
5593 * will take care of enabling the pin's input/output buffers as needed.
5594 * Therefore there's no need to enable the input buffer at this
5597 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5598 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5600 /* Mute capture amp left and right */
5601 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5602 /* Set ADC connection select to match default mixer setting - mic
5605 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5607 /* Do similar with the second ADC: mute capture input amp and
5608 * set ADC connection to mic to match ALSA's default state.
5610 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5611 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5613 /* Mute all inputs to mixer widget (even unconnected ones) */
5614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5619 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5626 /* Initialisation sequence for Maxdata Favorit 100XS
5627 * (adapted from Acer init verbs).
5629 static struct hda_verb alc260_favorit100_init_verbs[] = {
5630 /* GPIO 0 enables the output jack.
5631 * Turn this on and rely on the standard mute
5632 * methods whenever the user wants to turn these outputs off.
5634 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5635 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5636 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5637 /* Line/Mic input jack is connected to Mic1 pin */
5638 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5639 /* Ensure all other unused pins are disabled and muted. */
5640 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5641 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5642 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5643 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5644 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5645 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5646 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5648 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5649 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5650 /* Disable digital (SPDIF) pins */
5651 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5652 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5654 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5655 * bus when acting as outputs.
5657 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5658 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5660 /* Start with output sum widgets muted and their output gains at min */
5661 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5662 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5663 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5664 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5665 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5666 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5667 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5668 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5669 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5671 /* Unmute Line-out pin widget amp left and right
5672 * (no equiv mixer ctrl)
5674 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5675 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5676 * inputs. If the pin mode is changed by the user the pin mode control
5677 * will take care of enabling the pin's input/output buffers as needed.
5678 * Therefore there's no need to enable the input buffer at this
5681 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5683 /* Mute capture amp left and right */
5684 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5685 /* Set ADC connection select to match default mixer setting - mic
5688 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5690 /* Do similar with the second ADC: mute capture input amp and
5691 * set ADC connection to mic to match ALSA's default state.
5693 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5694 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5696 /* Mute all inputs to mixer widget (even unconnected ones) */
5697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5704 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5709 static struct hda_verb alc260_will_verbs[] = {
5710 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5711 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5712 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5713 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5714 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5715 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5719 static struct hda_verb alc260_replacer_672v_verbs[] = {
5720 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5721 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5722 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5724 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5725 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5726 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5728 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5732 /* toggle speaker-output according to the hp-jack state */
5733 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5735 unsigned int present;
5737 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5738 present = snd_hda_codec_read(codec, 0x0f, 0,
5739 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5741 snd_hda_codec_write_cache(codec, 0x01, 0,
5742 AC_VERB_SET_GPIO_DATA, 1);
5743 snd_hda_codec_write_cache(codec, 0x0f, 0,
5744 AC_VERB_SET_PIN_WIDGET_CONTROL,
5747 snd_hda_codec_write_cache(codec, 0x01, 0,
5748 AC_VERB_SET_GPIO_DATA, 0);
5749 snd_hda_codec_write_cache(codec, 0x0f, 0,
5750 AC_VERB_SET_PIN_WIDGET_CONTROL,
5755 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5758 if ((res >> 26) == ALC880_HP_EVENT)
5759 alc260_replacer_672v_automute(codec);
5762 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5763 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5764 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5765 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5766 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5767 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5768 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5769 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5770 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5771 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5772 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5776 /* Test configuration for debugging, modelled after the ALC880 test
5779 #ifdef CONFIG_SND_DEBUG
5780 static hda_nid_t alc260_test_dac_nids[1] = {
5783 static hda_nid_t alc260_test_adc_nids[2] = {
5786 /* For testing the ALC260, each input MUX needs its own definition since
5787 * the signal assignments are different. This assumes that the first ADC
5790 static struct hda_input_mux alc260_test_capture_sources[2] = {
5794 { "MIC1 pin", 0x0 },
5795 { "MIC2 pin", 0x1 },
5796 { "LINE1 pin", 0x2 },
5797 { "LINE2 pin", 0x3 },
5799 { "LINE-OUT pin", 0x5 },
5800 { "HP-OUT pin", 0x6 },
5806 { "MIC1 pin", 0x0 },
5807 { "MIC2 pin", 0x1 },
5808 { "LINE1 pin", 0x2 },
5809 { "LINE2 pin", 0x3 },
5812 { "LINE-OUT pin", 0x6 },
5813 { "HP-OUT pin", 0x7 },
5817 static struct snd_kcontrol_new alc260_test_mixer[] = {
5818 /* Output driver widgets */
5819 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5820 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5821 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5822 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5823 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5824 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5826 /* Modes for retasking pin widgets
5827 * Note: the ALC260 doesn't seem to act on requests to enable mic
5828 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5829 * mention this restriction. At this stage it's not clear whether
5830 * this behaviour is intentional or is a hardware bug in chip
5831 * revisions available at least up until early 2006. Therefore for
5832 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5833 * choices, but if it turns out that the lack of mic bias for these
5834 * NIDs is intentional we could change their modes from
5835 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5837 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5838 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5839 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5840 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5841 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5842 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5844 /* Loopback mixer controls */
5845 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5846 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5847 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5848 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5849 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5850 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5851 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5852 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5853 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5854 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5855 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5856 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5857 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5858 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5860 /* Controls for GPIO pins, assuming they are configured as outputs */
5861 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5862 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5863 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5864 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5866 /* Switches to allow the digital IO pins to be enabled. The datasheet
5867 * is ambigious as to which NID is which; testing on laptops which
5868 * make this output available should provide clarification.
5870 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5871 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5873 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5874 * this output to turn on an external amplifier.
5876 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5877 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5881 static struct hda_verb alc260_test_init_verbs[] = {
5882 /* Enable all GPIOs as outputs with an initial value of 0 */
5883 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5884 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5885 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5887 /* Enable retasking pins as output, initially without power amp */
5888 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5889 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5890 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5891 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5892 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5893 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5895 /* Disable digital (SPDIF) pins initially, but users can enable
5896 * them via a mixer switch. In the case of SPDIF-out, this initverb
5897 * payload also sets the generation to 0, output to be in "consumer"
5898 * PCM format, copyright asserted, no pre-emphasis and no validity
5901 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5902 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5904 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5905 * OUT1 sum bus when acting as an output.
5907 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5908 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5909 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5910 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5912 /* Start with output sum widgets muted and their output gains at min */
5913 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5914 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5915 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5916 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5917 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5918 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5919 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5920 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5921 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5923 /* Unmute retasking pin widget output buffers since the default
5924 * state appears to be output. As the pin mode is changed by the
5925 * user the pin mode control will take care of enabling the pin's
5926 * input/output buffers as needed.
5928 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5929 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5931 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5932 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5933 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5934 /* Also unmute the mono-out pin widget */
5935 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5937 /* Mute capture amp left and right */
5938 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5939 /* Set ADC connection select to match default mixer setting (mic1
5942 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5944 /* Do the same for the second ADC: mute capture input amp and
5945 * set ADC connection to mic1 pin
5947 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5948 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5950 /* Mute all inputs to mixer widget (even unconnected ones) */
5951 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5952 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5954 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5955 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5957 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5958 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5964 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5965 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5967 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5968 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5971 * for BIOS auto-configuration
5974 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5975 const char *pfx, int *vol_bits)
5978 unsigned long vol_val, sw_val;
5981 if (nid >= 0x0f && nid < 0x11) {
5982 nid_vol = nid - 0x7;
5983 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5984 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5985 } else if (nid == 0x11) {
5986 nid_vol = nid - 0x7;
5987 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5988 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5989 } else if (nid >= 0x12 && nid <= 0x15) {
5991 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5992 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5996 if (!(*vol_bits & (1 << nid_vol))) {
5997 /* first control for the volume widget */
5998 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6001 *vol_bits |= (1 << nid_vol);
6003 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6009 /* add playback controls from the parsed DAC table */
6010 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6011 const struct auto_pin_cfg *cfg)
6017 spec->multiout.num_dacs = 1;
6018 spec->multiout.dac_nids = spec->private_dac_nids;
6019 spec->multiout.dac_nids[0] = 0x02;
6021 nid = cfg->line_out_pins[0];
6024 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6026 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6030 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6035 nid = cfg->speaker_pins[0];
6037 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6042 nid = cfg->hp_pins[0];
6044 err = alc260_add_playback_controls(spec, nid, "Headphone",
6052 /* create playback/capture controls for input pins */
6053 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6054 const struct auto_pin_cfg *cfg)
6056 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6059 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6060 hda_nid_t nid, int pin_type,
6063 alc_set_pin_output(codec, nid, pin_type);
6064 /* need the manual connection? */
6066 int idx = nid - 0x12;
6067 snd_hda_codec_write(codec, idx + 0x0b, 0,
6068 AC_VERB_SET_CONNECT_SEL, sel_idx);
6072 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6074 struct alc_spec *spec = codec->spec;
6077 nid = spec->autocfg.line_out_pins[0];
6079 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6080 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6083 nid = spec->autocfg.speaker_pins[0];
6085 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6087 nid = spec->autocfg.hp_pins[0];
6089 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6092 #define ALC260_PIN_CD_NID 0x16
6093 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6095 struct alc_spec *spec = codec->spec;
6098 for (i = 0; i < AUTO_PIN_LAST; i++) {
6099 hda_nid_t nid = spec->autocfg.input_pins[i];
6101 alc_set_input_pin(codec, nid, i);
6102 if (nid != ALC260_PIN_CD_NID &&
6103 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6104 snd_hda_codec_write(codec, nid, 0,
6105 AC_VERB_SET_AMP_GAIN_MUTE,
6112 * generic initialization of ADC, input mixers and output mixers
6114 static struct hda_verb alc260_volume_init_verbs[] = {
6116 * Unmute ADC0-1 and set the default input to mic-in
6118 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6119 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6120 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6121 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6123 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6125 * Note: PASD motherboards uses the Line In 2 as the input for
6126 * front panel mic (mic 2)
6128 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6129 /* mute analog inputs */
6130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6132 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6133 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6134 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6137 * Set up output mixers (0x08 - 0x0a)
6139 /* set vol=0 to output mixers */
6140 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6141 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6142 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6143 /* set up input amps for analog loopback */
6144 /* Amp Indices: DAC = 0, mixer = 1 */
6145 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6146 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6147 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6148 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6149 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6150 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6155 static int alc260_parse_auto_config(struct hda_codec *codec)
6157 struct alc_spec *spec = codec->spec;
6159 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6161 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6165 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6168 if (!spec->kctls.list)
6169 return 0; /* can't find valid BIOS pin config */
6170 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6174 spec->multiout.max_channels = 2;
6176 if (spec->autocfg.dig_outs)
6177 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6178 if (spec->kctls.list)
6179 add_mixer(spec, spec->kctls.list);
6181 add_verb(spec, alc260_volume_init_verbs);
6183 spec->num_mux_defs = 1;
6184 spec->input_mux = &spec->private_imux[0];
6186 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6191 /* additional initialization for auto-configuration model */
6192 static void alc260_auto_init(struct hda_codec *codec)
6194 struct alc_spec *spec = codec->spec;
6195 alc260_auto_init_multi_out(codec);
6196 alc260_auto_init_analog_input(codec);
6197 if (spec->unsol_event)
6198 alc_inithook(codec);
6201 #ifdef CONFIG_SND_HDA_POWER_SAVE
6202 static struct hda_amp_list alc260_loopbacks[] = {
6203 { 0x07, HDA_INPUT, 0 },
6204 { 0x07, HDA_INPUT, 1 },
6205 { 0x07, HDA_INPUT, 2 },
6206 { 0x07, HDA_INPUT, 3 },
6207 { 0x07, HDA_INPUT, 4 },
6213 * ALC260 configurations
6215 static const char *alc260_models[ALC260_MODEL_LAST] = {
6216 [ALC260_BASIC] = "basic",
6218 [ALC260_HP_3013] = "hp-3013",
6219 [ALC260_HP_DC7600] = "hp-dc7600",
6220 [ALC260_FUJITSU_S702X] = "fujitsu",
6221 [ALC260_ACER] = "acer",
6222 [ALC260_WILL] = "will",
6223 [ALC260_REPLACER_672V] = "replacer",
6224 [ALC260_FAVORIT100] = "favorit100",
6225 #ifdef CONFIG_SND_DEBUG
6226 [ALC260_TEST] = "test",
6228 [ALC260_AUTO] = "auto",
6231 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6232 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6233 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6234 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6235 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6236 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6237 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6238 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6239 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6240 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6241 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6242 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6243 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6244 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6245 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6246 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6247 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6248 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6249 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6250 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6254 static struct alc_config_preset alc260_presets[] = {
6256 .mixers = { alc260_base_output_mixer,
6257 alc260_input_mixer },
6258 .init_verbs = { alc260_init_verbs },
6259 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6260 .dac_nids = alc260_dac_nids,
6261 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6262 .adc_nids = alc260_adc_nids,
6263 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6264 .channel_mode = alc260_modes,
6265 .input_mux = &alc260_capture_source,
6268 .mixers = { alc260_hp_output_mixer,
6269 alc260_input_mixer },
6270 .init_verbs = { alc260_init_verbs,
6271 alc260_hp_unsol_verbs },
6272 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6273 .dac_nids = alc260_dac_nids,
6274 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6275 .adc_nids = alc260_adc_nids_alt,
6276 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6277 .channel_mode = alc260_modes,
6278 .input_mux = &alc260_capture_source,
6279 .unsol_event = alc260_hp_unsol_event,
6280 .init_hook = alc260_hp_automute,
6282 [ALC260_HP_DC7600] = {
6283 .mixers = { alc260_hp_dc7600_mixer,
6284 alc260_input_mixer },
6285 .init_verbs = { alc260_init_verbs,
6286 alc260_hp_dc7600_verbs },
6287 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6288 .dac_nids = alc260_dac_nids,
6289 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6290 .adc_nids = alc260_adc_nids_alt,
6291 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6292 .channel_mode = alc260_modes,
6293 .input_mux = &alc260_capture_source,
6294 .unsol_event = alc260_hp_3012_unsol_event,
6295 .init_hook = alc260_hp_3012_automute,
6297 [ALC260_HP_3013] = {
6298 .mixers = { alc260_hp_3013_mixer,
6299 alc260_input_mixer },
6300 .init_verbs = { alc260_hp_3013_init_verbs,
6301 alc260_hp_3013_unsol_verbs },
6302 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6303 .dac_nids = alc260_dac_nids,
6304 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6305 .adc_nids = alc260_adc_nids_alt,
6306 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6307 .channel_mode = alc260_modes,
6308 .input_mux = &alc260_capture_source,
6309 .unsol_event = alc260_hp_3013_unsol_event,
6310 .init_hook = alc260_hp_3013_automute,
6312 [ALC260_FUJITSU_S702X] = {
6313 .mixers = { alc260_fujitsu_mixer },
6314 .init_verbs = { alc260_fujitsu_init_verbs },
6315 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6316 .dac_nids = alc260_dac_nids,
6317 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6318 .adc_nids = alc260_dual_adc_nids,
6319 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6320 .channel_mode = alc260_modes,
6321 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6322 .input_mux = alc260_fujitsu_capture_sources,
6325 .mixers = { alc260_acer_mixer },
6326 .init_verbs = { alc260_acer_init_verbs },
6327 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6328 .dac_nids = alc260_dac_nids,
6329 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6330 .adc_nids = alc260_dual_adc_nids,
6331 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6332 .channel_mode = alc260_modes,
6333 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6334 .input_mux = alc260_acer_capture_sources,
6336 [ALC260_FAVORIT100] = {
6337 .mixers = { alc260_favorit100_mixer },
6338 .init_verbs = { alc260_favorit100_init_verbs },
6339 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6340 .dac_nids = alc260_dac_nids,
6341 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6342 .adc_nids = alc260_dual_adc_nids,
6343 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6344 .channel_mode = alc260_modes,
6345 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6346 .input_mux = alc260_favorit100_capture_sources,
6349 .mixers = { alc260_will_mixer },
6350 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6351 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6352 .dac_nids = alc260_dac_nids,
6353 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6354 .adc_nids = alc260_adc_nids,
6355 .dig_out_nid = ALC260_DIGOUT_NID,
6356 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6357 .channel_mode = alc260_modes,
6358 .input_mux = &alc260_capture_source,
6360 [ALC260_REPLACER_672V] = {
6361 .mixers = { alc260_replacer_672v_mixer },
6362 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6363 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6364 .dac_nids = alc260_dac_nids,
6365 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6366 .adc_nids = alc260_adc_nids,
6367 .dig_out_nid = ALC260_DIGOUT_NID,
6368 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6369 .channel_mode = alc260_modes,
6370 .input_mux = &alc260_capture_source,
6371 .unsol_event = alc260_replacer_672v_unsol_event,
6372 .init_hook = alc260_replacer_672v_automute,
6374 #ifdef CONFIG_SND_DEBUG
6376 .mixers = { alc260_test_mixer },
6377 .init_verbs = { alc260_test_init_verbs },
6378 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6379 .dac_nids = alc260_test_dac_nids,
6380 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6381 .adc_nids = alc260_test_adc_nids,
6382 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6383 .channel_mode = alc260_modes,
6384 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6385 .input_mux = alc260_test_capture_sources,
6390 static int patch_alc260(struct hda_codec *codec)
6392 struct alc_spec *spec;
6393 int err, board_config;
6395 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6401 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6404 if (board_config < 0) {
6405 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6407 board_config = ALC260_AUTO;
6410 if (board_config == ALC260_AUTO) {
6411 /* automatic parse from the BIOS config */
6412 err = alc260_parse_auto_config(codec);
6418 "hda_codec: Cannot set up configuration "
6419 "from BIOS. Using base mode...\n");
6420 board_config = ALC260_BASIC;
6424 err = snd_hda_attach_beep_device(codec, 0x1);
6430 if (board_config != ALC260_AUTO)
6431 setup_preset(codec, &alc260_presets[board_config]);
6433 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6434 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6436 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6437 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6439 if (!spec->adc_nids && spec->input_mux) {
6440 /* check whether NID 0x04 is valid */
6441 unsigned int wcap = get_wcaps(codec, 0x04);
6442 wcap = get_wcaps_type(wcap);
6444 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6445 spec->adc_nids = alc260_adc_nids_alt;
6446 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6448 spec->adc_nids = alc260_adc_nids;
6449 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6452 set_capture_mixer(codec);
6453 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6455 spec->vmaster_nid = 0x08;
6457 codec->patch_ops = alc_patch_ops;
6458 if (board_config == ALC260_AUTO)
6459 spec->init_hook = alc260_auto_init;
6460 #ifdef CONFIG_SND_HDA_POWER_SAVE
6461 if (!spec->loopback.amplist)
6462 spec->loopback.amplist = alc260_loopbacks;
6464 codec->proc_widget_hook = print_realtek_coef;
6471 * ALC882/883/885/888/889 support
6473 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6474 * configuration. Each pin widget can choose any input DACs and a mixer.
6475 * Each ADC is connected from a mixer of all inputs. This makes possible
6476 * 6-channel independent captures.
6478 * In addition, an independent DAC for the multi-playback (not used in this
6481 #define ALC882_DIGOUT_NID 0x06
6482 #define ALC882_DIGIN_NID 0x0a
6483 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6484 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6485 #define ALC1200_DIGOUT_NID 0x10
6488 static struct hda_channel_mode alc882_ch_modes[1] = {
6493 static hda_nid_t alc882_dac_nids[4] = {
6494 /* front, rear, clfe, rear_surr */
6495 0x02, 0x03, 0x04, 0x05
6497 #define alc883_dac_nids alc882_dac_nids
6500 #define alc882_adc_nids alc880_adc_nids
6501 #define alc882_adc_nids_alt alc880_adc_nids_alt
6502 #define alc883_adc_nids alc882_adc_nids_alt
6503 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6504 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6505 #define alc889_adc_nids alc880_adc_nids
6507 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6508 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6509 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6510 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6511 #define alc889_capsrc_nids alc882_capsrc_nids
6514 /* FIXME: should be a matrix-type input source selection */
6516 static struct hda_input_mux alc882_capture_source = {
6520 { "Front Mic", 0x1 },
6526 #define alc883_capture_source alc882_capture_source
6528 static struct hda_input_mux alc889_capture_source = {
6531 { "Front Mic", 0x0 },
6537 static struct hda_input_mux mb5_capture_source = {
6546 static struct hda_input_mux alc883_3stack_6ch_intel = {
6550 { "Front Mic", 0x0 },
6556 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6564 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6574 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6582 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6586 { "Front Mic", 0x1 },
6591 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6599 static struct hda_input_mux alc889A_mb31_capture_source = {
6603 /* Front Mic (0x01) unused */
6605 /* Line 2 (0x03) unused */
6606 /* CD (0x04) unsused? */
6613 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6620 static struct hda_verb alc882_3ST_ch2_init[] = {
6621 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6622 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6623 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6624 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6631 static struct hda_verb alc882_3ST_ch4_init[] = {
6632 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6633 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6634 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6635 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6636 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6643 static struct hda_verb alc882_3ST_ch6_init[] = {
6644 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6645 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6646 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6647 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6648 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6649 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6653 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6654 { 2, alc882_3ST_ch2_init },
6655 { 4, alc882_3ST_ch4_init },
6656 { 6, alc882_3ST_ch6_init },
6659 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6664 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6665 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6666 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6667 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6668 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6669 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6676 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6677 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6678 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6679 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6680 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6681 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6682 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6689 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6690 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6691 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6692 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6693 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6694 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6695 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6696 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6700 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6701 { 2, alc883_3ST_ch2_clevo_init },
6702 { 4, alc883_3ST_ch4_clevo_init },
6703 { 6, alc883_3ST_ch6_clevo_init },
6710 static struct hda_verb alc882_sixstack_ch6_init[] = {
6711 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6712 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6713 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6714 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6721 static struct hda_verb alc882_sixstack_ch8_init[] = {
6722 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6723 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6724 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6725 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6729 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6730 { 6, alc882_sixstack_ch6_init },
6731 { 8, alc882_sixstack_ch8_init },
6735 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6741 static struct hda_verb alc885_mbp_ch2_init[] = {
6742 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6743 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6744 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6751 static struct hda_verb alc885_mbp_ch4_init[] = {
6752 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6753 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6754 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6755 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6756 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6760 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6761 { 2, alc885_mbp_ch2_init },
6762 { 4, alc885_mbp_ch4_init },
6767 * Speakers/Woofer/HP = Front
6770 static struct hda_verb alc885_mb5_ch2_init[] = {
6771 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6772 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6778 * Speakers/HP = Front
6782 static struct hda_verb alc885_mb5_ch6_init[] = {
6783 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6784 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6785 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6789 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6790 { 2, alc885_mb5_ch2_init },
6791 { 6, alc885_mb5_ch6_init },
6798 static struct hda_verb alc883_4ST_ch2_init[] = {
6799 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6800 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6801 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6802 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6803 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6804 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6811 static struct hda_verb alc883_4ST_ch4_init[] = {
6812 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6813 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6814 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6815 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6816 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6817 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6818 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6825 static struct hda_verb alc883_4ST_ch6_init[] = {
6826 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6827 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6828 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6829 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6830 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6831 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6832 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6833 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6840 static struct hda_verb alc883_4ST_ch8_init[] = {
6841 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6842 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6843 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6844 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6845 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6846 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6849 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6853 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6854 { 2, alc883_4ST_ch2_init },
6855 { 4, alc883_4ST_ch4_init },
6856 { 6, alc883_4ST_ch6_init },
6857 { 8, alc883_4ST_ch8_init },
6864 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6865 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6866 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6867 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6868 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6875 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6876 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6877 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6878 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6879 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6880 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6887 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6888 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6889 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6890 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6891 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6892 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6893 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6897 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6898 { 2, alc883_3ST_ch2_intel_init },
6899 { 4, alc883_3ST_ch4_intel_init },
6900 { 6, alc883_3ST_ch6_intel_init },
6906 static struct hda_verb alc889_ch2_intel_init[] = {
6907 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6908 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6909 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6910 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6911 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6912 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6919 static struct hda_verb alc889_ch6_intel_init[] = {
6920 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6921 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6922 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6923 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6924 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6925 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6932 static struct hda_verb alc889_ch8_intel_init[] = {
6933 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6934 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6935 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6936 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6937 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6938 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6939 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6943 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6944 { 2, alc889_ch2_intel_init },
6945 { 6, alc889_ch6_intel_init },
6946 { 8, alc889_ch8_intel_init },
6952 static struct hda_verb alc883_sixstack_ch6_init[] = {
6953 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6954 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6955 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6956 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6963 static struct hda_verb alc883_sixstack_ch8_init[] = {
6964 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6965 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6966 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6967 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6971 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6972 { 6, alc883_sixstack_ch6_init },
6973 { 8, alc883_sixstack_ch8_init },
6977 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6978 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6980 static struct snd_kcontrol_new alc882_base_mixer[] = {
6981 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6982 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6983 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6984 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6985 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6986 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6987 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6988 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6989 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6990 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6991 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6992 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6993 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6994 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6995 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6997 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6999 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7000 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7001 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7005 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7006 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7007 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7008 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7009 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7010 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7011 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7012 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7014 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7015 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7016 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7020 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7021 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7022 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7023 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7024 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7025 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7026 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7027 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7028 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7029 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7030 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7032 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7034 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7038 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7039 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7040 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7041 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7042 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7043 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7044 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7046 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7047 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7051 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7052 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7053 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7054 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7055 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7056 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7057 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7058 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7060 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7061 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7062 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7063 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7064 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7068 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7069 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7071 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7072 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7073 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7074 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7075 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7076 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7077 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7078 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7079 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7080 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7081 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7084 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7088 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7090 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7091 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7093 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7094 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7095 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7102 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7104 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7105 .name = "Channel Mode",
7106 .info = alc_ch_mode_info,
7107 .get = alc_ch_mode_get,
7108 .put = alc_ch_mode_put,
7113 static struct hda_verb alc882_base_init_verbs[] = {
7114 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7119 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7120 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7121 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7123 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7124 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7125 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7127 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7128 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7129 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7131 /* mute analog input loopbacks */
7132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7138 /* Front Pin: output 0 (0x0c) */
7139 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7140 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7141 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7142 /* Rear Pin: output 1 (0x0d) */
7143 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7144 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7145 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7146 /* CLFE Pin: output 2 (0x0e) */
7147 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7148 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7149 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7150 /* Side Pin: output 3 (0x0f) */
7151 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7152 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7153 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7154 /* Mic (rear) pin: input vref at 80% */
7155 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7156 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7157 /* Front Mic pin: input vref at 80% */
7158 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7159 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7160 /* Line In pin: input */
7161 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7162 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7163 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7164 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7165 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7166 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7167 /* CD pin widget for input */
7168 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7170 /* FIXME: use matrix-type input source selection */
7171 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7173 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7175 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7176 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7180 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7181 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7182 /* ADC2: mute amp left and right */
7183 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7184 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7185 /* ADC3: mute amp left and right */
7186 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7187 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7192 static struct hda_verb alc882_adc1_init_verbs[] = {
7193 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7198 /* ADC1: mute amp left and right */
7199 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7200 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7204 static struct hda_verb alc882_eapd_verbs[] = {
7205 /* change to EAPD mode */
7206 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7207 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7211 static struct hda_verb alc889_eapd_verbs[] = {
7212 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7213 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7217 static struct hda_verb alc_hp15_unsol_verbs[] = {
7218 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7223 static struct hda_verb alc885_init_verbs[] = {
7224 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7225 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7226 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7227 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7229 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7230 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7231 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7233 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7234 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7235 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7237 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7238 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7239 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7241 /* mute analog input loopbacks */
7242 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7243 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7244 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7246 /* Front HP Pin: output 0 (0x0c) */
7247 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7248 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7249 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7250 /* Front Pin: output 0 (0x0c) */
7251 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7252 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7253 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7254 /* Rear Pin: output 1 (0x0d) */
7255 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7256 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7257 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7258 /* CLFE Pin: output 2 (0x0e) */
7259 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7260 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7261 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7262 /* Side Pin: output 3 (0x0f) */
7263 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7264 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7265 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7266 /* Mic (rear) pin: input vref at 80% */
7267 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7268 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7269 /* Front Mic pin: input vref at 80% */
7270 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7271 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7272 /* Line In pin: input */
7273 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7274 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7276 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7289 /* ADC2: mute amp left and right */
7290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7291 /* ADC3: mute amp left and right */
7292 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7297 static struct hda_verb alc885_init_input_verbs[] = {
7298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7305 /* Unmute Selector 24h and set the default input to front mic */
7306 static struct hda_verb alc889_init_input_verbs[] = {
7307 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7308 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7313 #define alc883_init_verbs alc882_base_init_verbs
7316 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7317 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7318 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7319 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7320 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7321 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7322 /* FIXME: this looks suspicious...
7323 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7324 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7329 static struct hda_verb alc882_macpro_init_verbs[] = {
7330 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7334 /* Front Pin: output 0 (0x0c) */
7335 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7336 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7337 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7338 /* Front Mic pin: input vref at 80% */
7339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7341 /* Speaker: output */
7342 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7343 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7344 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7345 /* Headphone output (output 0 - 0x0c) */
7346 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7347 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7348 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7350 /* FIXME: use matrix-type input source selection */
7351 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7352 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7355 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7356 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7360 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7361 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7367 /* ADC1: mute amp left and right */
7368 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7369 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7370 /* ADC2: mute amp left and right */
7371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7372 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7373 /* ADC3: mute amp left and right */
7374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7375 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7381 static struct hda_verb alc885_mb5_init_verbs[] = {
7383 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7384 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7385 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7386 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7388 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7389 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7391 /* Surround mixer */
7392 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7393 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7396 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7397 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7398 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7400 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7401 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7402 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7403 /* Front Pin (0x0c) */
7404 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7405 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7406 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7407 /* LFE Pin (0x0e) */
7408 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7409 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7410 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7413 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7414 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7415 /* Front Mic pin: input vref at 80% */
7416 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7417 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7420 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7422 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7423 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7424 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7425 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7429 /* Macbook Pro rev3 */
7430 static struct hda_verb alc885_mbp3_init_verbs[] = {
7431 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7432 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7433 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7434 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7436 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7437 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7438 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7440 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7441 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7442 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7443 /* Front Pin: output 0 (0x0c) */
7444 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7446 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7447 /* HP Pin: output 0 (0x0e) */
7448 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7449 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7450 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7451 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7452 /* Mic (rear) pin: input vref at 80% */
7453 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7454 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7455 /* Front Mic pin: input vref at 80% */
7456 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7457 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7458 /* Line In pin: use output 1 when in LineOut mode */
7459 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7460 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7461 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7463 /* FIXME: use matrix-type input source selection */
7464 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7465 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7466 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7467 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7468 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7469 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7471 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7472 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7473 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7476 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7480 /* ADC1: mute amp left and right */
7481 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7482 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7483 /* ADC2: mute amp left and right */
7484 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7485 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7486 /* ADC3: mute amp left and right */
7487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7488 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7493 /* iMac 24 mixer. */
7494 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7495 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7496 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7500 /* iMac 24 init verbs. */
7501 static struct hda_verb alc885_imac24_init_verbs[] = {
7502 /* Internal speakers: output 0 (0x0c) */
7503 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7504 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7505 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7506 /* Internal speakers: output 0 (0x0c) */
7507 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7509 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7510 /* Headphone: output 0 (0x0c) */
7511 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7513 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7514 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7515 /* Front Mic: input vref at 80% */
7516 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7517 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7521 /* Toggle speaker-output according to the hp-jack state */
7522 static void alc885_imac24_setup(struct hda_codec *codec)
7524 struct alc_spec *spec = codec->spec;
7526 spec->autocfg.hp_pins[0] = 0x14;
7527 spec->autocfg.speaker_pins[0] = 0x18;
7528 spec->autocfg.speaker_pins[1] = 0x1a;
7531 static void alc885_mbp3_setup(struct hda_codec *codec)
7533 struct alc_spec *spec = codec->spec;
7535 spec->autocfg.hp_pins[0] = 0x15;
7536 spec->autocfg.speaker_pins[0] = 0x14;
7540 static struct hda_verb alc882_targa_verbs[] = {
7541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7544 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7545 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7547 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7548 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7549 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7551 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7555 /* toggle speaker-output according to the hp-jack state */
7556 static void alc882_targa_automute(struct hda_codec *codec)
7558 struct alc_spec *spec = codec->spec;
7559 alc_automute_amp(codec);
7560 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7561 spec->jack_present ? 1 : 3);
7564 static void alc882_targa_setup(struct hda_codec *codec)
7566 struct alc_spec *spec = codec->spec;
7568 spec->autocfg.hp_pins[0] = 0x14;
7569 spec->autocfg.speaker_pins[0] = 0x1b;
7572 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7574 if ((res >> 26) == ALC880_HP_EVENT)
7575 alc882_targa_automute(codec);
7578 static struct hda_verb alc882_asus_a7j_verbs[] = {
7579 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7583 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7584 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7586 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7587 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7588 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7590 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7591 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7592 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7596 static struct hda_verb alc882_asus_a7m_verbs[] = {
7597 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7602 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7604 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7605 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7606 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7608 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7609 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7610 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7614 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7616 unsigned int gpiostate, gpiomask, gpiodir;
7618 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7619 AC_VERB_GET_GPIO_DATA, 0);
7622 gpiostate |= (1 << pin);
7624 gpiostate &= ~(1 << pin);
7626 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7627 AC_VERB_GET_GPIO_MASK, 0);
7628 gpiomask |= (1 << pin);
7630 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7631 AC_VERB_GET_GPIO_DIRECTION, 0);
7632 gpiodir |= (1 << pin);
7635 snd_hda_codec_write(codec, codec->afg, 0,
7636 AC_VERB_SET_GPIO_MASK, gpiomask);
7637 snd_hda_codec_write(codec, codec->afg, 0,
7638 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7642 snd_hda_codec_write(codec, codec->afg, 0,
7643 AC_VERB_SET_GPIO_DATA, gpiostate);
7646 /* set up GPIO at initialization */
7647 static void alc885_macpro_init_hook(struct hda_codec *codec)
7649 alc882_gpio_mute(codec, 0, 0);
7650 alc882_gpio_mute(codec, 1, 0);
7653 /* set up GPIO and update auto-muting at initialization */
7654 static void alc885_imac24_init_hook(struct hda_codec *codec)
7656 alc885_macpro_init_hook(codec);
7657 alc_automute_amp(codec);
7661 * generic initialization of ADC, input mixers and output mixers
7663 static struct hda_verb alc883_auto_init_verbs[] = {
7665 * Unmute ADC0-2 and set the default input to mic-in
7667 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7668 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7669 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7670 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7672 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7674 * Note: PASD motherboards uses the Line In 2 as the input for
7675 * front panel mic (mic 2)
7677 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7678 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7679 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7680 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7681 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7682 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7685 * Set up output mixers (0x0c - 0x0f)
7687 /* set vol=0 to output mixers */
7688 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7689 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7690 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7691 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7692 /* set up input amps for analog loopback */
7693 /* Amp Indices: DAC = 0, mixer = 1 */
7694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7695 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7696 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7697 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7698 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7699 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7700 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7701 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7702 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7703 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7705 /* FIXME: use matrix-type input source selection */
7706 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7708 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7709 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7710 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7711 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7714 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7715 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7721 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7722 static struct hda_verb alc889A_mb31_ch2_init[] = {
7723 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7724 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7725 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7726 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7730 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7731 static struct hda_verb alc889A_mb31_ch4_init[] = {
7732 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7733 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7734 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7735 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7739 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7740 static struct hda_verb alc889A_mb31_ch5_init[] = {
7741 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7742 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7743 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7744 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7748 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7749 static struct hda_verb alc889A_mb31_ch6_init[] = {
7750 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7751 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7757 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7758 { 2, alc889A_mb31_ch2_init },
7759 { 4, alc889A_mb31_ch4_init },
7760 { 5, alc889A_mb31_ch5_init },
7761 { 6, alc889A_mb31_ch6_init },
7764 static struct hda_verb alc883_medion_eapd_verbs[] = {
7765 /* eanable EAPD on medion laptop */
7766 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7767 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7771 #define alc883_base_mixer alc882_base_mixer
7773 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7774 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7775 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7776 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7777 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7778 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7779 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7780 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7781 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7782 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7783 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7784 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7785 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7786 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7790 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7791 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7792 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7793 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7794 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7796 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7798 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7799 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7800 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7804 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7805 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7806 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7807 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7808 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7809 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7810 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7811 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7812 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7813 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7814 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7818 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7819 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7820 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7821 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7822 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7823 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7824 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7825 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7826 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7827 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7828 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7829 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7830 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7831 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7835 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7836 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7837 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7838 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7839 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7840 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7841 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7842 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7843 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7845 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7846 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7847 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7848 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7849 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7850 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7851 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7852 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7853 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7854 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7858 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7859 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7860 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7861 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7862 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7863 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7865 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7866 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7867 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7868 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7869 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7870 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7871 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7872 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7874 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7876 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7877 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7878 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7882 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7883 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7884 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7885 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7886 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7887 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7890 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7891 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7892 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7893 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7894 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7895 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7896 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7898 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7899 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7900 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7901 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7902 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7906 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7907 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7908 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7909 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7910 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7911 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7912 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7913 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7914 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7916 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7917 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7918 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7919 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7923 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7924 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7929 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7930 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7931 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7932 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7933 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7934 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7935 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7936 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7937 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7938 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7939 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7940 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7941 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7943 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7944 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7945 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7946 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7950 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7951 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7952 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7953 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7954 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7955 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7956 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7957 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7958 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7959 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7960 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7961 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7962 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7966 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
7967 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7968 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7970 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7971 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7975 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7976 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7977 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7979 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7987 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7988 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7989 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7990 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7995 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7996 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8000 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8001 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8002 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8003 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8004 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8005 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8007 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8009 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8013 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8014 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8015 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8016 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8017 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8018 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8020 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8025 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8026 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8027 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8028 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8029 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8030 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8031 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8032 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8033 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8034 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8040 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8041 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8042 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8043 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8044 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8045 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8046 0x0d, 1, 0x0, HDA_OUTPUT),
8047 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8048 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8049 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8050 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8051 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8052 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8053 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8054 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8055 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8056 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8057 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8058 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8059 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8061 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8065 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8067 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8068 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8069 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8070 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8071 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8073 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8074 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8075 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8076 /* Output switches */
8077 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8078 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8079 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8082 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8085 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8086 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8087 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8091 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8092 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8093 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8095 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8096 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8097 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8101 static struct hda_bind_ctls alc883_bind_cap_vol = {
8102 .ops = &snd_hda_bind_vol,
8104 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8105 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8110 static struct hda_bind_ctls alc883_bind_cap_switch = {
8111 .ops = &snd_hda_bind_sw,
8113 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8114 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8119 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8120 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8121 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8122 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8123 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8124 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8125 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8126 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8131 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8132 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8133 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8135 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8136 /* .name = "Capture Source", */
8137 .name = "Input Source",
8139 .info = alc_mux_enum_info,
8140 .get = alc_mux_enum_get,
8141 .put = alc_mux_enum_put,
8146 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8148 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8149 .name = "Channel Mode",
8150 .info = alc_ch_mode_info,
8151 .get = alc_ch_mode_get,
8152 .put = alc_ch_mode_put,
8157 /* toggle speaker-output according to the hp-jack state */
8158 static void alc883_mitac_setup(struct hda_codec *codec)
8160 struct alc_spec *spec = codec->spec;
8162 spec->autocfg.hp_pins[0] = 0x15;
8163 spec->autocfg.speaker_pins[0] = 0x14;
8164 spec->autocfg.speaker_pins[1] = 0x17;
8167 /* auto-toggle front mic */
8169 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8171 unsigned int present;
8174 present = snd_hda_codec_read(codec, 0x18, 0,
8175 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8176 bits = present ? HDA_AMP_MUTE : 0;
8177 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8181 static struct hda_verb alc883_mitac_verbs[] = {
8183 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8184 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8186 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8187 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8189 /* enable unsolicited event */
8190 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8191 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8196 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8198 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8201 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8203 /* enable unsolicited event */
8205 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8206 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8212 static struct hda_verb alc883_clevo_m720_verbs[] = {
8214 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8215 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8217 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8220 /* enable unsolicited event */
8221 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8222 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8227 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8229 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8230 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8232 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8233 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8235 /* enable unsolicited event */
8236 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8241 static struct hda_verb alc883_targa_verbs[] = {
8242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8243 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8245 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8246 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8248 /* Connect Line-Out side jack (SPDIF) to Side */
8249 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8250 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8251 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8252 /* Connect Mic jack to CLFE */
8253 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8254 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8255 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8256 /* Connect Line-in jack to Surround */
8257 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8258 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8259 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8260 /* Connect HP out jack to Front */
8261 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8262 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8263 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8265 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8270 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8271 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8272 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8273 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8277 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8278 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8279 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8280 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8285 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8286 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8288 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8289 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8290 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8294 static struct hda_verb alc883_haier_w66_verbs[] = {
8295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8298 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8300 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8301 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8302 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8303 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8307 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8312 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8313 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8314 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8315 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8319 static struct hda_verb alc888_6st_dell_verbs[] = {
8320 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8324 static struct hda_verb alc883_vaiott_verbs[] = {
8326 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8327 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8329 /* enable unsolicited event */
8330 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8335 static void alc888_3st_hp_setup(struct hda_codec *codec)
8337 struct alc_spec *spec = codec->spec;
8339 spec->autocfg.hp_pins[0] = 0x1b;
8340 spec->autocfg.speaker_pins[0] = 0x14;
8341 spec->autocfg.speaker_pins[1] = 0x16;
8342 spec->autocfg.speaker_pins[2] = 0x18;
8345 static struct hda_verb alc888_3st_hp_verbs[] = {
8346 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8347 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8348 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8349 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8356 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8357 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8358 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8359 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8360 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8367 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8368 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8369 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8370 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8371 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8372 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8379 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8380 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8381 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8382 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
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, 0x01 },
8389 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8390 { 2, alc888_3st_hp_2ch_init },
8391 { 4, alc888_3st_hp_4ch_init },
8392 { 6, alc888_3st_hp_6ch_init },
8395 /* toggle front-jack and RCA according to the hp-jack state */
8396 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8398 unsigned int present;
8400 present = snd_hda_codec_read(codec, 0x1b, 0,
8401 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8402 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8403 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8404 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8405 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8408 /* toggle RCA according to the front-jack state */
8409 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8411 unsigned int present;
8413 present = snd_hda_codec_read(codec, 0x14, 0,
8414 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8415 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8416 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8419 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8422 if ((res >> 26) == ALC880_HP_EVENT)
8423 alc888_lenovo_ms7195_front_automute(codec);
8424 if ((res >> 26) == ALC880_FRONT_EVENT)
8425 alc888_lenovo_ms7195_rca_automute(codec);
8428 static struct hda_verb alc883_medion_md2_verbs[] = {
8429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8432 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8434 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8438 /* toggle speaker-output according to the hp-jack state */
8439 static void alc883_medion_md2_setup(struct hda_codec *codec)
8441 struct alc_spec *spec = codec->spec;
8443 spec->autocfg.hp_pins[0] = 0x14;
8444 spec->autocfg.speaker_pins[0] = 0x15;
8447 /* toggle speaker-output according to the hp-jack state */
8448 #define alc883_targa_init_hook alc882_targa_init_hook
8449 #define alc883_targa_unsol_event alc882_targa_unsol_event
8451 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8453 unsigned int present;
8455 present = snd_hda_codec_read(codec, 0x18, 0,
8456 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8457 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8458 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8461 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8463 struct alc_spec *spec = codec->spec;
8465 spec->autocfg.hp_pins[0] = 0x15;
8466 spec->autocfg.speaker_pins[0] = 0x14;
8469 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8471 alc_automute_amp(codec);
8472 alc883_clevo_m720_mic_automute(codec);
8475 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8478 switch (res >> 26) {
8479 case ALC880_MIC_EVENT:
8480 alc883_clevo_m720_mic_automute(codec);
8483 alc_automute_amp_unsol_event(codec, res);
8488 /* toggle speaker-output according to the hp-jack state */
8489 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8491 struct alc_spec *spec = codec->spec;
8493 spec->autocfg.hp_pins[0] = 0x14;
8494 spec->autocfg.speaker_pins[0] = 0x15;
8497 static void alc883_haier_w66_setup(struct hda_codec *codec)
8499 struct alc_spec *spec = codec->spec;
8501 spec->autocfg.hp_pins[0] = 0x1b;
8502 spec->autocfg.speaker_pins[0] = 0x14;
8505 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8507 unsigned int present;
8510 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8511 & AC_PINSENSE_PRESENCE;
8512 bits = present ? HDA_AMP_MUTE : 0;
8513 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8514 HDA_AMP_MUTE, bits);
8517 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8519 unsigned int present;
8522 present = snd_hda_codec_read(codec, 0x1b, 0,
8523 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8524 bits = present ? HDA_AMP_MUTE : 0;
8525 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8526 HDA_AMP_MUTE, bits);
8527 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8528 HDA_AMP_MUTE, bits);
8531 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8534 if ((res >> 26) == ALC880_HP_EVENT)
8535 alc883_lenovo_101e_all_automute(codec);
8536 if ((res >> 26) == ALC880_FRONT_EVENT)
8537 alc883_lenovo_101e_ispeaker_automute(codec);
8540 /* toggle speaker-output according to the hp-jack state */
8541 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8543 struct alc_spec *spec = codec->spec;
8545 spec->autocfg.hp_pins[0] = 0x14;
8546 spec->autocfg.speaker_pins[0] = 0x15;
8547 spec->autocfg.speaker_pins[1] = 0x16;
8550 static struct hda_verb alc883_acer_eapd_verbs[] = {
8551 /* HP Pin: output 0 (0x0c) */
8552 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8553 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8554 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8555 /* Front Pin: output 0 (0x0c) */
8556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8557 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8558 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8559 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8560 /* eanable EAPD on medion laptop */
8561 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8562 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8563 /* enable unsolicited event */
8564 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8568 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8569 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8570 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8571 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8575 static void alc888_6st_dell_setup(struct hda_codec *codec)
8577 struct alc_spec *spec = codec->spec;
8579 spec->autocfg.hp_pins[0] = 0x1b;
8580 spec->autocfg.speaker_pins[0] = 0x14;
8581 spec->autocfg.speaker_pins[1] = 0x15;
8582 spec->autocfg.speaker_pins[2] = 0x16;
8583 spec->autocfg.speaker_pins[3] = 0x17;
8586 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8588 struct alc_spec *spec = codec->spec;
8590 spec->autocfg.hp_pins[0] = 0x1b;
8591 spec->autocfg.speaker_pins[0] = 0x14;
8592 spec->autocfg.speaker_pins[1] = 0x15;
8593 spec->autocfg.speaker_pins[2] = 0x16;
8594 spec->autocfg.speaker_pins[3] = 0x17;
8595 spec->autocfg.speaker_pins[4] = 0x1a;
8598 static void alc883_vaiott_setup(struct hda_codec *codec)
8600 struct alc_spec *spec = codec->spec;
8602 spec->autocfg.hp_pins[0] = 0x15;
8603 spec->autocfg.speaker_pins[0] = 0x14;
8604 spec->autocfg.speaker_pins[1] = 0x17;
8607 static struct hda_verb alc888_asus_m90v_verbs[] = {
8608 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8609 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8610 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8611 /* enable unsolicited event */
8612 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8613 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8617 static void alc883_mode2_setup(struct hda_codec *codec)
8619 struct alc_spec *spec = codec->spec;
8621 spec->autocfg.hp_pins[0] = 0x1b;
8622 spec->autocfg.speaker_pins[0] = 0x14;
8623 spec->autocfg.speaker_pins[1] = 0x15;
8624 spec->autocfg.speaker_pins[2] = 0x16;
8625 spec->ext_mic.pin = 0x18;
8626 spec->int_mic.pin = 0x19;
8627 spec->ext_mic.mux_idx = 0;
8628 spec->int_mic.mux_idx = 1;
8632 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8634 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8635 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8636 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8637 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8638 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8639 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8640 /* enable unsolicited event */
8641 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8645 static void alc883_eee1601_inithook(struct hda_codec *codec)
8647 struct alc_spec *spec = codec->spec;
8649 spec->autocfg.hp_pins[0] = 0x14;
8650 spec->autocfg.speaker_pins[0] = 0x1b;
8651 alc_automute_pin(codec);
8654 static struct hda_verb alc889A_mb31_verbs[] = {
8655 /* Init rear pin (used as headphone output) */
8656 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8657 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8658 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8659 /* Init line pin (used as output in 4ch and 6ch mode) */
8660 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8661 /* Init line 2 pin (used as headphone out by default) */
8662 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8663 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8667 /* Mute speakers according to the headphone jack state */
8668 static void alc889A_mb31_automute(struct hda_codec *codec)
8670 unsigned int present;
8672 /* Mute only in 2ch or 4ch mode */
8673 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8675 present = snd_hda_codec_read(codec, 0x15, 0,
8676 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8677 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8678 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8679 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8680 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8684 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8686 if ((res >> 26) == ALC880_HP_EVENT)
8687 alc889A_mb31_automute(codec);
8691 #ifdef CONFIG_SND_HDA_POWER_SAVE
8692 #define alc882_loopbacks alc880_loopbacks
8695 /* pcm configuration: identical with ALC880 */
8696 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8697 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8698 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8699 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8701 static hda_nid_t alc883_slave_dig_outs[] = {
8702 ALC1200_DIGOUT_NID, 0,
8705 static hda_nid_t alc1200_slave_dig_outs[] = {
8706 ALC883_DIGOUT_NID, 0,
8710 * configuration and preset
8712 static const char *alc882_models[ALC882_MODEL_LAST] = {
8713 [ALC882_3ST_DIG] = "3stack-dig",
8714 [ALC882_6ST_DIG] = "6stack-dig",
8715 [ALC882_ARIMA] = "arima",
8716 [ALC882_W2JC] = "w2jc",
8717 [ALC882_TARGA] = "targa",
8718 [ALC882_ASUS_A7J] = "asus-a7j",
8719 [ALC882_ASUS_A7M] = "asus-a7m",
8720 [ALC885_MACPRO] = "macpro",
8721 [ALC885_MB5] = "mb5",
8722 [ALC885_MBP3] = "mbp3",
8723 [ALC885_IMAC24] = "imac24",
8724 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8725 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8726 [ALC883_3ST_6ch] = "3stack-6ch",
8727 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8728 [ALC883_TARGA_DIG] = "targa-dig",
8729 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8730 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8731 [ALC883_ACER] = "acer",
8732 [ALC883_ACER_ASPIRE] = "acer-aspire",
8733 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8734 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8735 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8736 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8737 [ALC883_MEDION] = "medion",
8738 [ALC883_MEDION_MD2] = "medion-md2",
8739 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8740 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8741 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8742 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8743 [ALC888_LENOVO_SKY] = "lenovo-sky",
8744 [ALC883_HAIER_W66] = "haier-w66",
8745 [ALC888_3ST_HP] = "3stack-hp",
8746 [ALC888_6ST_DELL] = "6stack-dell",
8747 [ALC883_MITAC] = "mitac",
8748 [ALC883_CLEVO_M540R] = "clevo-m540r",
8749 [ALC883_CLEVO_M720] = "clevo-m720",
8750 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8751 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8752 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8753 [ALC889A_INTEL] = "intel-alc889a",
8754 [ALC889_INTEL] = "intel-x58",
8755 [ALC1200_ASUS_P5Q] = "asus-p5q",
8756 [ALC889A_MB31] = "mb31",
8757 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8758 [ALC882_AUTO] = "auto",
8761 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8762 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8764 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8765 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8766 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8767 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8768 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8769 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8770 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8771 ALC888_ACER_ASPIRE_4930G),
8772 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8773 ALC888_ACER_ASPIRE_4930G),
8774 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8775 ALC888_ACER_ASPIRE_8930G),
8776 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8777 ALC888_ACER_ASPIRE_8930G),
8778 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8779 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8780 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8781 ALC888_ACER_ASPIRE_6530G),
8782 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8783 ALC888_ACER_ASPIRE_6530G),
8784 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8785 ALC888_ACER_ASPIRE_7730G),
8786 /* default Acer -- disabled as it causes more problems.
8787 * model=auto should work fine now
8789 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8791 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8793 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8794 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8795 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8796 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8797 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8798 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8800 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8801 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8802 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8803 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8804 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8805 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8806 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8807 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8808 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8809 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8810 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8812 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8813 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8814 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8815 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8816 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8817 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8818 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8819 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8820 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8822 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8823 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8824 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8825 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8826 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8827 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8828 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8829 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8830 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8831 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8832 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8833 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8834 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8835 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8836 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8837 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8838 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8839 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8840 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8841 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8842 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8843 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8844 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8845 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8846 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8847 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8848 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8849 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8850 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8852 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8853 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8854 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8855 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
8856 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8857 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8858 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8859 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8860 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8861 ALC883_FUJITSU_PI2515),
8862 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8863 ALC888_FUJITSU_XA3530),
8864 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8865 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8866 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8867 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8868 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8869 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8870 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8871 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8872 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8874 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8875 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8876 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8877 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8878 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8879 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8880 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8885 /* codec SSID table for Intel Mac */
8886 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8887 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8888 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8889 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8890 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8891 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8892 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8893 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8894 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8895 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8896 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8897 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8898 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8899 * no perfect solution yet
8901 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8905 static struct alc_config_preset alc882_presets[] = {
8906 [ALC882_3ST_DIG] = {
8907 .mixers = { alc882_base_mixer },
8908 .init_verbs = { alc882_base_init_verbs,
8909 alc882_adc1_init_verbs },
8910 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8911 .dac_nids = alc882_dac_nids,
8912 .dig_out_nid = ALC882_DIGOUT_NID,
8913 .dig_in_nid = ALC882_DIGIN_NID,
8914 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8915 .channel_mode = alc882_ch_modes,
8917 .input_mux = &alc882_capture_source,
8919 [ALC882_6ST_DIG] = {
8920 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8921 .init_verbs = { alc882_base_init_verbs,
8922 alc882_adc1_init_verbs },
8923 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8924 .dac_nids = alc882_dac_nids,
8925 .dig_out_nid = ALC882_DIGOUT_NID,
8926 .dig_in_nid = ALC882_DIGIN_NID,
8927 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8928 .channel_mode = alc882_sixstack_modes,
8929 .input_mux = &alc882_capture_source,
8932 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8933 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8934 alc882_eapd_verbs },
8935 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8936 .dac_nids = alc882_dac_nids,
8937 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8938 .channel_mode = alc882_sixstack_modes,
8939 .input_mux = &alc882_capture_source,
8942 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8943 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8944 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8945 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8946 .dac_nids = alc882_dac_nids,
8947 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8948 .channel_mode = alc880_threestack_modes,
8950 .input_mux = &alc882_capture_source,
8951 .dig_out_nid = ALC882_DIGOUT_NID,
8954 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8955 .init_verbs = { alc885_mbp3_init_verbs,
8956 alc880_gpio1_init_verbs },
8958 .dac_nids = alc882_dac_nids,
8960 .channel_mode = alc885_mbp_4ch_modes,
8961 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
8962 .input_mux = &alc882_capture_source,
8963 .dig_out_nid = ALC882_DIGOUT_NID,
8964 .dig_in_nid = ALC882_DIGIN_NID,
8965 .unsol_event = alc_automute_amp_unsol_event,
8966 .setup = alc885_mbp3_setup,
8967 .init_hook = alc_automute_amp,
8970 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8971 .init_verbs = { alc885_mb5_init_verbs,
8972 alc880_gpio1_init_verbs },
8973 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8974 .dac_nids = alc882_dac_nids,
8975 .channel_mode = alc885_mb5_6ch_modes,
8976 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8977 .input_mux = &mb5_capture_source,
8978 .dig_out_nid = ALC882_DIGOUT_NID,
8979 .dig_in_nid = ALC882_DIGIN_NID,
8982 .mixers = { alc882_macpro_mixer },
8983 .init_verbs = { alc882_macpro_init_verbs },
8984 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8985 .dac_nids = alc882_dac_nids,
8986 .dig_out_nid = ALC882_DIGOUT_NID,
8987 .dig_in_nid = ALC882_DIGIN_NID,
8988 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8989 .channel_mode = alc882_ch_modes,
8990 .input_mux = &alc882_capture_source,
8991 .init_hook = alc885_macpro_init_hook,
8994 .mixers = { alc885_imac24_mixer },
8995 .init_verbs = { alc885_imac24_init_verbs },
8996 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8997 .dac_nids = alc882_dac_nids,
8998 .dig_out_nid = ALC882_DIGOUT_NID,
8999 .dig_in_nid = ALC882_DIGIN_NID,
9000 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9001 .channel_mode = alc882_ch_modes,
9002 .input_mux = &alc882_capture_source,
9003 .unsol_event = alc_automute_amp_unsol_event,
9004 .setup = alc885_imac24_setup,
9005 .init_hook = alc885_imac24_init_hook,
9008 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9009 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9010 alc880_gpio3_init_verbs, alc882_targa_verbs},
9011 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9012 .dac_nids = alc882_dac_nids,
9013 .dig_out_nid = ALC882_DIGOUT_NID,
9014 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9015 .adc_nids = alc882_adc_nids,
9016 .capsrc_nids = alc882_capsrc_nids,
9017 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9018 .channel_mode = alc882_3ST_6ch_modes,
9020 .input_mux = &alc882_capture_source,
9021 .unsol_event = alc882_targa_unsol_event,
9022 .setup = alc882_targa_setup,
9023 .init_hook = alc882_targa_automute,
9025 [ALC882_ASUS_A7J] = {
9026 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9027 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9028 alc882_asus_a7j_verbs},
9029 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9030 .dac_nids = alc882_dac_nids,
9031 .dig_out_nid = ALC882_DIGOUT_NID,
9032 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9033 .adc_nids = alc882_adc_nids,
9034 .capsrc_nids = alc882_capsrc_nids,
9035 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9036 .channel_mode = alc882_3ST_6ch_modes,
9038 .input_mux = &alc882_capture_source,
9040 [ALC882_ASUS_A7M] = {
9041 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9042 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9043 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9044 alc882_asus_a7m_verbs },
9045 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9046 .dac_nids = alc882_dac_nids,
9047 .dig_out_nid = ALC882_DIGOUT_NID,
9048 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9049 .channel_mode = alc880_threestack_modes,
9051 .input_mux = &alc882_capture_source,
9053 [ALC883_3ST_2ch_DIG] = {
9054 .mixers = { alc883_3ST_2ch_mixer },
9055 .init_verbs = { alc883_init_verbs },
9056 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9057 .dac_nids = alc883_dac_nids,
9058 .dig_out_nid = ALC883_DIGOUT_NID,
9059 .dig_in_nid = ALC883_DIGIN_NID,
9060 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9061 .channel_mode = alc883_3ST_2ch_modes,
9062 .input_mux = &alc883_capture_source,
9064 [ALC883_3ST_6ch_DIG] = {
9065 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9066 .init_verbs = { alc883_init_verbs },
9067 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9068 .dac_nids = alc883_dac_nids,
9069 .dig_out_nid = ALC883_DIGOUT_NID,
9070 .dig_in_nid = ALC883_DIGIN_NID,
9071 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9072 .channel_mode = alc883_3ST_6ch_modes,
9074 .input_mux = &alc883_capture_source,
9076 [ALC883_3ST_6ch] = {
9077 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9078 .init_verbs = { alc883_init_verbs },
9079 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9080 .dac_nids = alc883_dac_nids,
9081 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9082 .channel_mode = alc883_3ST_6ch_modes,
9084 .input_mux = &alc883_capture_source,
9086 [ALC883_3ST_6ch_INTEL] = {
9087 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9088 .init_verbs = { alc883_init_verbs },
9089 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9090 .dac_nids = alc883_dac_nids,
9091 .dig_out_nid = ALC883_DIGOUT_NID,
9092 .dig_in_nid = ALC883_DIGIN_NID,
9093 .slave_dig_outs = alc883_slave_dig_outs,
9094 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9095 .channel_mode = alc883_3ST_6ch_intel_modes,
9097 .input_mux = &alc883_3stack_6ch_intel,
9100 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9101 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9102 alc_hp15_unsol_verbs },
9103 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9104 .dac_nids = alc883_dac_nids,
9105 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9106 .adc_nids = alc889_adc_nids,
9107 .dig_out_nid = ALC883_DIGOUT_NID,
9108 .dig_in_nid = ALC883_DIGIN_NID,
9109 .slave_dig_outs = alc883_slave_dig_outs,
9110 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9111 .channel_mode = alc889_8ch_intel_modes,
9112 .capsrc_nids = alc889_capsrc_nids,
9113 .input_mux = &alc889_capture_source,
9114 .setup = alc889_automute_setup,
9115 .init_hook = alc_automute_amp,
9116 .unsol_event = alc_automute_amp_unsol_event,
9120 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9121 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9122 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9123 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9124 .dac_nids = alc883_dac_nids,
9125 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9126 .adc_nids = alc889_adc_nids,
9127 .dig_out_nid = ALC883_DIGOUT_NID,
9128 .dig_in_nid = ALC883_DIGIN_NID,
9129 .slave_dig_outs = alc883_slave_dig_outs,
9130 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9131 .channel_mode = alc889_8ch_intel_modes,
9132 .capsrc_nids = alc889_capsrc_nids,
9133 .input_mux = &alc889_capture_source,
9134 .setup = alc889_automute_setup,
9135 .init_hook = alc889_intel_init_hook,
9136 .unsol_event = alc_automute_amp_unsol_event,
9139 [ALC883_6ST_DIG] = {
9140 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9141 .init_verbs = { alc883_init_verbs },
9142 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9143 .dac_nids = alc883_dac_nids,
9144 .dig_out_nid = ALC883_DIGOUT_NID,
9145 .dig_in_nid = ALC883_DIGIN_NID,
9146 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9147 .channel_mode = alc883_sixstack_modes,
9148 .input_mux = &alc883_capture_source,
9150 [ALC883_TARGA_DIG] = {
9151 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9152 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9153 alc883_targa_verbs},
9154 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9155 .dac_nids = alc883_dac_nids,
9156 .dig_out_nid = ALC883_DIGOUT_NID,
9157 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9158 .channel_mode = alc883_3ST_6ch_modes,
9160 .input_mux = &alc883_capture_source,
9161 .unsol_event = alc883_targa_unsol_event,
9162 .setup = alc882_targa_setup,
9163 .init_hook = alc882_targa_automute,
9165 [ALC883_TARGA_2ch_DIG] = {
9166 .mixers = { alc883_targa_2ch_mixer},
9167 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9168 alc883_targa_verbs},
9169 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9170 .dac_nids = alc883_dac_nids,
9171 .adc_nids = alc883_adc_nids_alt,
9172 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9173 .dig_out_nid = ALC883_DIGOUT_NID,
9174 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9175 .channel_mode = alc883_3ST_2ch_modes,
9176 .input_mux = &alc883_capture_source,
9177 .unsol_event = alc883_targa_unsol_event,
9178 .setup = alc882_targa_setup,
9179 .init_hook = alc882_targa_automute,
9181 [ALC883_TARGA_8ch_DIG] = {
9182 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9183 alc883_chmode_mixer },
9184 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9185 alc883_targa_verbs },
9186 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9187 .dac_nids = alc883_dac_nids,
9188 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9189 .adc_nids = alc883_adc_nids_rev,
9190 .capsrc_nids = alc883_capsrc_nids_rev,
9191 .dig_out_nid = ALC883_DIGOUT_NID,
9192 .dig_in_nid = ALC883_DIGIN_NID,
9193 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9194 .channel_mode = alc883_4ST_8ch_modes,
9196 .input_mux = &alc883_capture_source,
9197 .unsol_event = alc883_targa_unsol_event,
9198 .setup = alc882_targa_setup,
9199 .init_hook = alc882_targa_automute,
9202 .mixers = { alc883_base_mixer },
9203 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9204 * and the headphone jack. Turn this on and rely on the
9205 * standard mute methods whenever the user wants to turn
9206 * these outputs off.
9208 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9209 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9210 .dac_nids = alc883_dac_nids,
9211 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9212 .channel_mode = alc883_3ST_2ch_modes,
9213 .input_mux = &alc883_capture_source,
9215 [ALC883_ACER_ASPIRE] = {
9216 .mixers = { alc883_acer_aspire_mixer },
9217 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9218 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9219 .dac_nids = alc883_dac_nids,
9220 .dig_out_nid = ALC883_DIGOUT_NID,
9221 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9222 .channel_mode = alc883_3ST_2ch_modes,
9223 .input_mux = &alc883_capture_source,
9224 .unsol_event = alc_automute_amp_unsol_event,
9225 .setup = alc883_acer_aspire_setup,
9226 .init_hook = alc_automute_amp,
9228 [ALC888_ACER_ASPIRE_4930G] = {
9229 .mixers = { alc888_base_mixer,
9230 alc883_chmode_mixer },
9231 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9232 alc888_acer_aspire_4930g_verbs },
9233 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9234 .dac_nids = alc883_dac_nids,
9235 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9236 .adc_nids = alc883_adc_nids_rev,
9237 .capsrc_nids = alc883_capsrc_nids_rev,
9238 .dig_out_nid = ALC883_DIGOUT_NID,
9239 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9240 .channel_mode = alc883_3ST_6ch_modes,
9243 ARRAY_SIZE(alc888_2_capture_sources),
9244 .input_mux = alc888_2_capture_sources,
9245 .unsol_event = alc_automute_amp_unsol_event,
9246 .setup = alc888_acer_aspire_4930g_setup,
9247 .init_hook = alc_automute_amp,
9249 [ALC888_ACER_ASPIRE_6530G] = {
9250 .mixers = { alc888_acer_aspire_6530_mixer },
9251 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9252 alc888_acer_aspire_6530g_verbs },
9253 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9254 .dac_nids = alc883_dac_nids,
9255 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9256 .adc_nids = alc883_adc_nids_rev,
9257 .capsrc_nids = alc883_capsrc_nids_rev,
9258 .dig_out_nid = ALC883_DIGOUT_NID,
9259 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9260 .channel_mode = alc883_3ST_2ch_modes,
9262 ARRAY_SIZE(alc888_2_capture_sources),
9263 .input_mux = alc888_acer_aspire_6530_sources,
9264 .unsol_event = alc_automute_amp_unsol_event,
9265 .setup = alc888_acer_aspire_6530g_setup,
9266 .init_hook = alc_automute_amp,
9268 [ALC888_ACER_ASPIRE_8930G] = {
9269 .mixers = { alc888_base_mixer,
9270 alc883_chmode_mixer },
9271 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9272 alc889_acer_aspire_8930g_verbs },
9273 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9274 .dac_nids = alc883_dac_nids,
9275 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9276 .adc_nids = alc889_adc_nids,
9277 .capsrc_nids = alc889_capsrc_nids,
9278 .dig_out_nid = ALC883_DIGOUT_NID,
9279 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9280 .channel_mode = alc883_3ST_6ch_modes,
9282 .const_channel_count = 6,
9284 ARRAY_SIZE(alc889_capture_sources),
9285 .input_mux = alc889_capture_sources,
9286 .unsol_event = alc_automute_amp_unsol_event,
9287 .setup = alc889_acer_aspire_8930g_setup,
9288 .init_hook = alc_automute_amp,
9290 [ALC888_ACER_ASPIRE_7730G] = {
9291 .mixers = { alc883_3ST_6ch_mixer,
9292 alc883_chmode_mixer },
9293 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9294 alc888_acer_aspire_7730G_verbs },
9295 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9296 .dac_nids = alc883_dac_nids,
9297 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9298 .adc_nids = alc883_adc_nids_rev,
9299 .capsrc_nids = alc883_capsrc_nids_rev,
9300 .dig_out_nid = ALC883_DIGOUT_NID,
9301 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9302 .channel_mode = alc883_3ST_6ch_modes,
9304 .const_channel_count = 6,
9305 .input_mux = &alc883_capture_source,
9306 .unsol_event = alc_automute_amp_unsol_event,
9307 .setup = alc888_acer_aspire_6530g_setup,
9308 .init_hook = alc_automute_amp,
9311 .mixers = { alc883_fivestack_mixer,
9312 alc883_chmode_mixer },
9313 .init_verbs = { alc883_init_verbs,
9314 alc883_medion_eapd_verbs },
9315 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9316 .dac_nids = alc883_dac_nids,
9317 .adc_nids = alc883_adc_nids_alt,
9318 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9319 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9320 .channel_mode = alc883_sixstack_modes,
9321 .input_mux = &alc883_capture_source,
9323 [ALC883_MEDION_MD2] = {
9324 .mixers = { alc883_medion_md2_mixer},
9325 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9326 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9327 .dac_nids = alc883_dac_nids,
9328 .dig_out_nid = ALC883_DIGOUT_NID,
9329 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9330 .channel_mode = alc883_3ST_2ch_modes,
9331 .input_mux = &alc883_capture_source,
9332 .unsol_event = alc_automute_amp_unsol_event,
9333 .setup = alc883_medion_md2_setup,
9334 .init_hook = alc_automute_amp,
9336 [ALC883_LAPTOP_EAPD] = {
9337 .mixers = { alc883_base_mixer },
9338 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9339 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9340 .dac_nids = alc883_dac_nids,
9341 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9342 .channel_mode = alc883_3ST_2ch_modes,
9343 .input_mux = &alc883_capture_source,
9345 [ALC883_CLEVO_M540R] = {
9346 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9347 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9348 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9349 .dac_nids = alc883_dac_nids,
9350 .dig_out_nid = ALC883_DIGOUT_NID,
9351 .dig_in_nid = ALC883_DIGIN_NID,
9352 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9353 .channel_mode = alc883_3ST_6ch_clevo_modes,
9355 .input_mux = &alc883_capture_source,
9356 /* This machine has the hardware HP auto-muting, thus
9357 * we need no software mute via unsol event
9360 [ALC883_CLEVO_M720] = {
9361 .mixers = { alc883_clevo_m720_mixer },
9362 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9363 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9364 .dac_nids = alc883_dac_nids,
9365 .dig_out_nid = ALC883_DIGOUT_NID,
9366 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9367 .channel_mode = alc883_3ST_2ch_modes,
9368 .input_mux = &alc883_capture_source,
9369 .unsol_event = alc883_clevo_m720_unsol_event,
9370 .setup = alc883_clevo_m720_setup,
9371 .init_hook = alc883_clevo_m720_init_hook,
9373 [ALC883_LENOVO_101E_2ch] = {
9374 .mixers = { alc883_lenovo_101e_2ch_mixer},
9375 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9376 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9377 .dac_nids = alc883_dac_nids,
9378 .adc_nids = alc883_adc_nids_alt,
9379 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9380 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9381 .channel_mode = alc883_3ST_2ch_modes,
9382 .input_mux = &alc883_lenovo_101e_capture_source,
9383 .unsol_event = alc883_lenovo_101e_unsol_event,
9384 .init_hook = alc883_lenovo_101e_all_automute,
9386 [ALC883_LENOVO_NB0763] = {
9387 .mixers = { alc883_lenovo_nb0763_mixer },
9388 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9389 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9390 .dac_nids = alc883_dac_nids,
9391 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9392 .channel_mode = alc883_3ST_2ch_modes,
9394 .input_mux = &alc883_lenovo_nb0763_capture_source,
9395 .unsol_event = alc_automute_amp_unsol_event,
9396 .setup = alc883_medion_md2_setup,
9397 .init_hook = alc_automute_amp,
9399 [ALC888_LENOVO_MS7195_DIG] = {
9400 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9401 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9402 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9403 .dac_nids = alc883_dac_nids,
9404 .dig_out_nid = ALC883_DIGOUT_NID,
9405 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9406 .channel_mode = alc883_3ST_6ch_modes,
9408 .input_mux = &alc883_capture_source,
9409 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9410 .init_hook = alc888_lenovo_ms7195_front_automute,
9412 [ALC883_HAIER_W66] = {
9413 .mixers = { alc883_targa_2ch_mixer},
9414 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9415 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9416 .dac_nids = alc883_dac_nids,
9417 .dig_out_nid = ALC883_DIGOUT_NID,
9418 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9419 .channel_mode = alc883_3ST_2ch_modes,
9420 .input_mux = &alc883_capture_source,
9421 .unsol_event = alc_automute_amp_unsol_event,
9422 .setup = alc883_haier_w66_setup,
9423 .init_hook = alc_automute_amp,
9426 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9427 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9428 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9429 .dac_nids = alc883_dac_nids,
9430 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9431 .channel_mode = alc888_3st_hp_modes,
9433 .input_mux = &alc883_capture_source,
9434 .unsol_event = alc_automute_amp_unsol_event,
9435 .setup = alc888_3st_hp_setup,
9436 .init_hook = alc_automute_amp,
9438 [ALC888_6ST_DELL] = {
9439 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9440 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9441 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9442 .dac_nids = alc883_dac_nids,
9443 .dig_out_nid = ALC883_DIGOUT_NID,
9444 .dig_in_nid = ALC883_DIGIN_NID,
9445 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9446 .channel_mode = alc883_sixstack_modes,
9447 .input_mux = &alc883_capture_source,
9448 .unsol_event = alc_automute_amp_unsol_event,
9449 .setup = alc888_6st_dell_setup,
9450 .init_hook = alc_automute_amp,
9453 .mixers = { alc883_mitac_mixer },
9454 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9455 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9456 .dac_nids = alc883_dac_nids,
9457 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9458 .channel_mode = alc883_3ST_2ch_modes,
9459 .input_mux = &alc883_capture_source,
9460 .unsol_event = alc_automute_amp_unsol_event,
9461 .setup = alc883_mitac_setup,
9462 .init_hook = alc_automute_amp,
9464 [ALC883_FUJITSU_PI2515] = {
9465 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9466 .init_verbs = { alc883_init_verbs,
9467 alc883_2ch_fujitsu_pi2515_verbs},
9468 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9469 .dac_nids = alc883_dac_nids,
9470 .dig_out_nid = ALC883_DIGOUT_NID,
9471 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9472 .channel_mode = alc883_3ST_2ch_modes,
9473 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9474 .unsol_event = alc_automute_amp_unsol_event,
9475 .setup = alc883_2ch_fujitsu_pi2515_setup,
9476 .init_hook = alc_automute_amp,
9478 [ALC888_FUJITSU_XA3530] = {
9479 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9480 .init_verbs = { alc883_init_verbs,
9481 alc888_fujitsu_xa3530_verbs },
9482 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9483 .dac_nids = alc883_dac_nids,
9484 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9485 .adc_nids = alc883_adc_nids_rev,
9486 .capsrc_nids = alc883_capsrc_nids_rev,
9487 .dig_out_nid = ALC883_DIGOUT_NID,
9488 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9489 .channel_mode = alc888_4ST_8ch_intel_modes,
9491 ARRAY_SIZE(alc888_2_capture_sources),
9492 .input_mux = alc888_2_capture_sources,
9493 .unsol_event = alc_automute_amp_unsol_event,
9494 .setup = alc888_fujitsu_xa3530_setup,
9495 .init_hook = alc_automute_amp,
9497 [ALC888_LENOVO_SKY] = {
9498 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9499 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9500 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9501 .dac_nids = alc883_dac_nids,
9502 .dig_out_nid = ALC883_DIGOUT_NID,
9503 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9504 .channel_mode = alc883_sixstack_modes,
9506 .input_mux = &alc883_lenovo_sky_capture_source,
9507 .unsol_event = alc_automute_amp_unsol_event,
9508 .setup = alc888_lenovo_sky_setup,
9509 .init_hook = alc_automute_amp,
9511 [ALC888_ASUS_M90V] = {
9512 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9513 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9514 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9515 .dac_nids = alc883_dac_nids,
9516 .dig_out_nid = ALC883_DIGOUT_NID,
9517 .dig_in_nid = ALC883_DIGIN_NID,
9518 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9519 .channel_mode = alc883_3ST_6ch_modes,
9521 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9522 .unsol_event = alc_sku_unsol_event,
9523 .setup = alc883_mode2_setup,
9524 .init_hook = alc_inithook,
9526 [ALC888_ASUS_EEE1601] = {
9527 .mixers = { alc883_asus_eee1601_mixer },
9528 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9529 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9530 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9531 .dac_nids = alc883_dac_nids,
9532 .dig_out_nid = ALC883_DIGOUT_NID,
9533 .dig_in_nid = ALC883_DIGIN_NID,
9534 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9535 .channel_mode = alc883_3ST_2ch_modes,
9537 .input_mux = &alc883_asus_eee1601_capture_source,
9538 .unsol_event = alc_sku_unsol_event,
9539 .init_hook = alc883_eee1601_inithook,
9541 [ALC1200_ASUS_P5Q] = {
9542 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9543 .init_verbs = { alc883_init_verbs },
9544 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9545 .dac_nids = alc883_dac_nids,
9546 .dig_out_nid = ALC1200_DIGOUT_NID,
9547 .dig_in_nid = ALC883_DIGIN_NID,
9548 .slave_dig_outs = alc1200_slave_dig_outs,
9549 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9550 .channel_mode = alc883_sixstack_modes,
9551 .input_mux = &alc883_capture_source,
9554 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9555 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9556 alc880_gpio1_init_verbs },
9557 .adc_nids = alc883_adc_nids,
9558 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9559 .dac_nids = alc883_dac_nids,
9560 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9561 .channel_mode = alc889A_mb31_6ch_modes,
9562 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9563 .input_mux = &alc889A_mb31_capture_source,
9564 .dig_out_nid = ALC883_DIGOUT_NID,
9565 .unsol_event = alc889A_mb31_unsol_event,
9566 .init_hook = alc889A_mb31_automute,
9568 [ALC883_SONY_VAIO_TT] = {
9569 .mixers = { alc883_vaiott_mixer },
9570 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9571 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9572 .dac_nids = alc883_dac_nids,
9573 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9574 .channel_mode = alc883_3ST_2ch_modes,
9575 .input_mux = &alc883_capture_source,
9576 .unsol_event = alc_automute_amp_unsol_event,
9577 .setup = alc883_vaiott_setup,
9578 .init_hook = alc_automute_amp,
9587 PINFIX_ABIT_AW9D_MAX
9590 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9591 { 0x15, 0x01080104 }, /* side */
9592 { 0x16, 0x01011012 }, /* rear */
9593 { 0x17, 0x01016011 }, /* clfe */
9597 static const struct alc_pincfg *alc882_pin_fixes[] = {
9598 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9601 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9602 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9607 * BIOS auto configuration
9609 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9610 const struct auto_pin_cfg *cfg)
9612 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9615 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9616 hda_nid_t nid, int pin_type,
9620 struct alc_spec *spec = codec->spec;
9623 alc_set_pin_output(codec, nid, pin_type);
9624 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9627 idx = spec->multiout.dac_nids[dac_idx] - 2;
9628 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9632 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9634 struct alc_spec *spec = codec->spec;
9637 for (i = 0; i <= HDA_SIDE; i++) {
9638 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9639 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9641 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9646 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9648 struct alc_spec *spec = codec->spec;
9651 pin = spec->autocfg.hp_pins[0];
9652 if (pin) /* connect to front */
9654 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9655 pin = spec->autocfg.speaker_pins[0];
9657 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9660 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9662 struct alc_spec *spec = codec->spec;
9665 for (i = 0; i < AUTO_PIN_LAST; i++) {
9666 hda_nid_t nid = spec->autocfg.input_pins[i];
9669 alc_set_input_pin(codec, nid, i);
9670 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9671 snd_hda_codec_write(codec, nid, 0,
9672 AC_VERB_SET_AMP_GAIN_MUTE,
9677 static void alc882_auto_init_input_src(struct hda_codec *codec)
9679 struct alc_spec *spec = codec->spec;
9682 for (c = 0; c < spec->num_adc_nids; c++) {
9683 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9684 hda_nid_t nid = spec->capsrc_nids[c];
9685 unsigned int mux_idx;
9686 const struct hda_input_mux *imux;
9687 int conns, mute, idx, item;
9689 conns = snd_hda_get_connections(codec, nid, conn_list,
9690 ARRAY_SIZE(conn_list));
9693 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9694 imux = &spec->input_mux[mux_idx];
9695 for (idx = 0; idx < conns; idx++) {
9696 /* if the current connection is the selected one,
9697 * unmute it as default - otherwise mute it
9699 mute = AMP_IN_MUTE(idx);
9700 for (item = 0; item < imux->num_items; item++) {
9701 if (imux->items[item].index == idx) {
9702 if (spec->cur_mux[c] == item)
9703 mute = AMP_IN_UNMUTE(idx);
9707 /* check if we have a selector or mixer
9708 * we could check for the widget type instead, but
9709 * just check for Amp-In presence (in case of mixer
9710 * without amp-in there is something wrong, this
9711 * function shouldn't be used or capsrc nid is wrong)
9713 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9714 snd_hda_codec_write(codec, nid, 0,
9715 AC_VERB_SET_AMP_GAIN_MUTE,
9717 else if (mute != AMP_IN_MUTE(idx))
9718 snd_hda_codec_write(codec, nid, 0,
9719 AC_VERB_SET_CONNECT_SEL,
9725 /* add mic boosts if needed */
9726 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9728 struct alc_spec *spec = codec->spec;
9732 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9733 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9734 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9736 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9740 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9741 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9742 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9744 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9751 /* almost identical with ALC880 parser... */
9752 static int alc882_parse_auto_config(struct hda_codec *codec)
9754 struct alc_spec *spec = codec->spec;
9755 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9758 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9762 if (!spec->autocfg.line_outs)
9763 return 0; /* can't find valid BIOS pin config */
9765 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9768 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9771 err = alc880_auto_create_extra_out(spec,
9772 spec->autocfg.speaker_pins[0],
9776 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9780 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9784 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9786 /* check multiple SPDIF-out (for recent codecs) */
9787 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9789 err = snd_hda_get_connections(codec,
9790 spec->autocfg.dig_out_pins[i],
9795 spec->multiout.dig_out_nid = dig_nid;
9797 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9798 spec->slave_dig_outs[i - 1] = dig_nid;
9799 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
9803 if (spec->autocfg.dig_in_pin)
9804 spec->dig_in_nid = ALC880_DIGIN_NID;
9806 if (spec->kctls.list)
9807 add_mixer(spec, spec->kctls.list);
9809 add_verb(spec, alc883_auto_init_verbs);
9810 /* if ADC 0x07 is available, initialize it, too */
9811 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9812 add_verb(spec, alc882_adc1_init_verbs);
9814 spec->num_mux_defs = 1;
9815 spec->input_mux = &spec->private_imux[0];
9817 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9819 err = alc_auto_add_mic_boost(codec);
9823 return 1; /* config found */
9826 /* additional initialization for auto-configuration model */
9827 static void alc882_auto_init(struct hda_codec *codec)
9829 struct alc_spec *spec = codec->spec;
9830 alc882_auto_init_multi_out(codec);
9831 alc882_auto_init_hp_out(codec);
9832 alc882_auto_init_analog_input(codec);
9833 alc882_auto_init_input_src(codec);
9834 if (spec->unsol_event)
9835 alc_inithook(codec);
9838 static int patch_alc882(struct hda_codec *codec)
9840 struct alc_spec *spec;
9841 int err, board_config;
9843 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9849 switch (codec->vendor_id) {
9854 /* ALC883 and variants */
9855 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9859 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9863 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9864 board_config = snd_hda_check_board_codec_sid_config(codec,
9865 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9867 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9868 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9870 board_config = ALC882_AUTO;
9873 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9875 if (board_config == ALC882_AUTO) {
9876 /* automatic parse from the BIOS config */
9877 err = alc882_parse_auto_config(codec);
9883 "hda_codec: Cannot set up configuration "
9884 "from BIOS. Using base mode...\n");
9885 board_config = ALC882_3ST_DIG;
9889 err = snd_hda_attach_beep_device(codec, 0x1);
9895 if (board_config != ALC882_AUTO)
9896 setup_preset(codec, &alc882_presets[board_config]);
9898 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9899 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9900 /* FIXME: setup DAC5 */
9901 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9902 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9904 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9905 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9907 if (codec->vendor_id == 0x10ec0888)
9908 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9910 if (!spec->adc_nids && spec->input_mux) {
9912 spec->num_adc_nids = 0;
9913 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9915 hda_nid_t nid = alc882_adc_nids[i];
9916 unsigned int wcap = get_wcaps(codec, nid);
9918 wcap = get_wcaps_type(wcap);
9919 if (wcap != AC_WID_AUD_IN)
9921 spec->private_adc_nids[spec->num_adc_nids] = nid;
9922 err = snd_hda_get_connections(codec, nid, &cap, 1);
9925 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9926 spec->num_adc_nids++;
9928 spec->adc_nids = spec->private_adc_nids;
9929 spec->capsrc_nids = spec->private_capsrc_nids;
9932 set_capture_mixer(codec);
9933 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9935 spec->vmaster_nid = 0x0c;
9937 codec->patch_ops = alc_patch_ops;
9938 if (board_config == ALC882_AUTO)
9939 spec->init_hook = alc882_auto_init;
9940 #ifdef CONFIG_SND_HDA_POWER_SAVE
9941 if (!spec->loopback.amplist)
9942 spec->loopback.amplist = alc882_loopbacks;
9944 codec->proc_widget_hook = print_realtek_coef;
9954 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9955 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9957 #define alc262_dac_nids alc260_dac_nids
9958 #define alc262_adc_nids alc882_adc_nids
9959 #define alc262_adc_nids_alt alc882_adc_nids_alt
9960 #define alc262_capsrc_nids alc882_capsrc_nids
9961 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9963 #define alc262_modes alc260_modes
9964 #define alc262_capture_source alc882_capture_source
9966 static hda_nid_t alc262_dmic_adc_nids[1] = {
9971 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9973 static struct snd_kcontrol_new alc262_base_mixer[] = {
9974 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9975 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9976 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9977 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9978 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9979 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
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("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9988 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9989 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9993 /* update HP, line and mono-out pins according to the master switch */
9994 static void alc262_hp_master_update(struct hda_codec *codec)
9996 struct alc_spec *spec = codec->spec;
9997 int val = spec->master_sw;
10000 snd_hda_codec_write_cache(codec, 0x1b, 0,
10001 AC_VERB_SET_PIN_WIDGET_CONTROL,
10003 snd_hda_codec_write_cache(codec, 0x15, 0,
10004 AC_VERB_SET_PIN_WIDGET_CONTROL,
10006 /* mono (speaker) depending on the HP jack sense */
10007 val = val && !spec->jack_present;
10008 snd_hda_codec_write_cache(codec, 0x16, 0,
10009 AC_VERB_SET_PIN_WIDGET_CONTROL,
10010 val ? PIN_OUT : 0);
10013 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10015 struct alc_spec *spec = codec->spec;
10016 unsigned int presence;
10017 presence = snd_hda_codec_read(codec, 0x1b, 0,
10018 AC_VERB_GET_PIN_SENSE, 0);
10019 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
10020 alc262_hp_master_update(codec);
10023 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10025 if ((res >> 26) != ALC880_HP_EVENT)
10027 alc262_hp_bpc_automute(codec);
10030 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10032 struct alc_spec *spec = codec->spec;
10033 unsigned int presence;
10034 presence = snd_hda_codec_read(codec, 0x15, 0,
10035 AC_VERB_GET_PIN_SENSE, 0);
10036 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
10037 alc262_hp_master_update(codec);
10040 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10043 if ((res >> 26) != ALC880_HP_EVENT)
10045 alc262_hp_wildwest_automute(codec);
10048 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10050 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10051 struct snd_ctl_elem_value *ucontrol)
10053 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10054 struct alc_spec *spec = codec->spec;
10055 int val = !!*ucontrol->value.integer.value;
10057 if (val == spec->master_sw)
10059 spec->master_sw = val;
10060 alc262_hp_master_update(codec);
10064 #define ALC262_HP_MASTER_SWITCH \
10066 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10067 .name = "Master Playback Switch", \
10068 .info = snd_ctl_boolean_mono_info, \
10069 .get = alc262_hp_master_sw_get, \
10070 .put = alc262_hp_master_sw_put, \
10073 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10074 ALC262_HP_MASTER_SWITCH,
10075 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10076 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10077 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10078 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10080 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10084 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10085 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10086 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10087 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10088 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10089 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10090 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10091 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10092 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10093 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10097 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10098 ALC262_HP_MASTER_SWITCH,
10099 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10100 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10101 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10102 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10103 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10105 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10107 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10108 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10109 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10110 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10111 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10112 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10113 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10117 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10118 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10119 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10120 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10124 /* mute/unmute internal speaker according to the hp jack and mute state */
10125 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10127 struct alc_spec *spec = codec->spec;
10129 spec->autocfg.hp_pins[0] = 0x15;
10130 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10133 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10134 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10135 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10136 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
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),
10144 static struct hda_verb alc262_hp_t5735_verbs[] = {
10145 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10146 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10148 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10152 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10153 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10155 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10156 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10157 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10158 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10162 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10163 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10164 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10165 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10166 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10167 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10168 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10169 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10170 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10171 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10172 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10176 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10183 /* bind hp and internal speaker mute (with plug check) as master switch */
10184 static void alc262_hippo_master_update(struct hda_codec *codec)
10186 struct alc_spec *spec = codec->spec;
10187 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10188 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10189 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10193 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10194 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10195 HDA_AMP_MUTE, mute);
10196 /* mute internal speaker per jack sense */
10197 if (spec->jack_present)
10198 mute = HDA_AMP_MUTE;
10200 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10201 HDA_AMP_MUTE, mute);
10202 if (speaker_nid && speaker_nid != line_nid)
10203 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10204 HDA_AMP_MUTE, mute);
10207 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10209 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10210 struct snd_ctl_elem_value *ucontrol)
10212 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10213 struct alc_spec *spec = codec->spec;
10214 int val = !!*ucontrol->value.integer.value;
10216 if (val == spec->master_sw)
10218 spec->master_sw = val;
10219 alc262_hippo_master_update(codec);
10223 #define ALC262_HIPPO_MASTER_SWITCH \
10225 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10226 .name = "Master Playback Switch", \
10227 .info = snd_ctl_boolean_mono_info, \
10228 .get = alc262_hippo_master_sw_get, \
10229 .put = alc262_hippo_master_sw_put, \
10232 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10233 ALC262_HIPPO_MASTER_SWITCH,
10234 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10235 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10236 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10237 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10238 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10239 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10240 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10241 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10242 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10243 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10244 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10245 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10249 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10250 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10251 ALC262_HIPPO_MASTER_SWITCH,
10252 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10253 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10254 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10255 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10257 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10258 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10259 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10260 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10261 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10265 /* mute/unmute internal speaker according to the hp jack and mute state */
10266 static void alc262_hippo_automute(struct hda_codec *codec)
10268 struct alc_spec *spec = codec->spec;
10269 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10270 unsigned int present;
10272 /* need to execute and sync at first */
10273 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10274 present = snd_hda_codec_read(codec, hp_nid, 0,
10275 AC_VERB_GET_PIN_SENSE, 0);
10276 spec->jack_present = (present & 0x80000000) != 0;
10277 alc262_hippo_master_update(codec);
10280 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10282 if ((res >> 26) != ALC880_HP_EVENT)
10284 alc262_hippo_automute(codec);
10287 static void alc262_hippo_setup(struct hda_codec *codec)
10289 struct alc_spec *spec = codec->spec;
10291 spec->autocfg.hp_pins[0] = 0x15;
10292 spec->autocfg.speaker_pins[0] = 0x14;
10295 static void alc262_hippo1_setup(struct hda_codec *codec)
10297 struct alc_spec *spec = codec->spec;
10299 spec->autocfg.hp_pins[0] = 0x1b;
10300 spec->autocfg.speaker_pins[0] = 0x14;
10304 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10305 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10306 ALC262_HIPPO_MASTER_SWITCH,
10307 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10308 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10309 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10310 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10314 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10315 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10316 ALC262_HIPPO_MASTER_SWITCH,
10317 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10320 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10321 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10325 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10326 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10327 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10328 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10329 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10330 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10331 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10332 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10333 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10334 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10335 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10336 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10337 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10341 static struct hda_verb alc262_tyan_verbs[] = {
10342 /* Headphone automute */
10343 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10344 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10345 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10347 /* P11 AUX_IN, white 4-pin connector */
10348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10349 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10350 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10351 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10356 /* unsolicited event for HP jack sensing */
10357 static void alc262_tyan_setup(struct hda_codec *codec)
10359 struct alc_spec *spec = codec->spec;
10361 spec->autocfg.hp_pins[0] = 0x1b;
10362 spec->autocfg.speaker_pins[0] = 0x15;
10366 #define alc262_capture_mixer alc882_capture_mixer
10367 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10370 * generic initialization of ADC, input mixers and output mixers
10372 static struct hda_verb alc262_init_verbs[] = {
10374 * Unmute ADC0-2 and set the default input to mic-in
10376 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10378 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10379 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10380 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10381 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10383 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10385 * Note: PASD motherboards uses the Line In 2 as the input for
10386 * front panel mic (mic 2)
10388 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10391 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10392 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10393 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10396 * Set up output mixers (0x0c - 0x0e)
10398 /* set vol=0 to output mixers */
10399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10400 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10401 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10402 /* set up input amps for analog loopback */
10403 /* Amp Indices: DAC = 0, mixer = 1 */
10404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10405 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10406 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10407 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10408 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10409 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10413 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10414 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10415 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10416 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10418 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10419 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10420 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10421 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10422 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10424 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10425 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10427 /* FIXME: use matrix-type input source selection */
10428 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10429 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10430 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10431 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10432 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10433 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10435 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10436 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10437 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10438 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10440 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10441 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10442 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10443 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10448 static struct hda_verb alc262_eapd_verbs[] = {
10449 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10450 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10454 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10455 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10456 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10457 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10459 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10460 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10464 static struct hda_verb alc262_sony_unsol_verbs[] = {
10465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10466 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10467 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10469 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10474 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10475 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10476 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10477 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10479 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10483 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10484 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10487 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10488 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10489 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10490 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10491 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10495 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10497 struct alc_spec *spec = codec->spec;
10499 spec->autocfg.hp_pins[0] = 0x15;
10500 spec->autocfg.speaker_pins[0] = 0x14;
10501 spec->ext_mic.pin = 0x18;
10502 spec->ext_mic.mux_idx = 0;
10503 spec->int_mic.pin = 0x12;
10504 spec->int_mic.mux_idx = 9;
10505 spec->auto_mic = 1;
10511 * 0x16 = internal speaker
10512 * 0x18 = external mic
10515 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10516 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10517 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10519 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10520 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10521 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10523 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10524 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10528 static struct hda_verb alc262_nec_verbs[] = {
10529 /* Unmute Speaker */
10530 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10533 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10536 /* External mic to headphone */
10537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10538 /* External mic to speaker */
10539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10545 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10546 * 0x1b = port replicator headphone out
10549 #define ALC_HP_EVENT 0x37
10551 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10552 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10554 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10555 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10559 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10560 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10561 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10565 static struct hda_input_mux alc262_fujitsu_capture_source = {
10569 { "Int Mic", 0x1 },
10574 static struct hda_input_mux alc262_HP_capture_source = {
10578 { "Front Mic", 0x1 },
10585 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10589 { "Front Mic", 0x2 },
10595 /* mute/unmute internal speaker according to the hp jacks and mute state */
10596 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10598 struct alc_spec *spec = codec->spec;
10601 if (force || !spec->sense_updated) {
10602 unsigned int present;
10603 /* need to execute and sync at first */
10604 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10605 /* check laptop HP jack */
10606 present = snd_hda_codec_read(codec, 0x14, 0,
10607 AC_VERB_GET_PIN_SENSE, 0);
10608 /* need to execute and sync at first */
10609 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10610 /* check docking HP jack */
10611 present |= snd_hda_codec_read(codec, 0x1b, 0,
10612 AC_VERB_GET_PIN_SENSE, 0);
10613 if (present & AC_PINSENSE_PRESENCE)
10614 spec->jack_present = 1;
10616 spec->jack_present = 0;
10617 spec->sense_updated = 1;
10619 /* unmute internal speaker only if both HPs are unplugged and
10620 * master switch is on
10622 if (spec->jack_present)
10623 mute = HDA_AMP_MUTE;
10625 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10626 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10627 HDA_AMP_MUTE, mute);
10630 /* unsolicited event for HP jack sensing */
10631 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10634 if ((res >> 26) != ALC_HP_EVENT)
10636 alc262_fujitsu_automute(codec, 1);
10639 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10641 alc262_fujitsu_automute(codec, 1);
10644 /* bind volumes of both NID 0x0c and 0x0d */
10645 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10646 .ops = &snd_hda_bind_vol,
10648 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10649 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10654 /* mute/unmute internal speaker according to the hp jack and mute state */
10655 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10657 struct alc_spec *spec = codec->spec;
10660 if (force || !spec->sense_updated) {
10661 unsigned int present_int_hp;
10662 /* need to execute and sync at first */
10663 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10664 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10665 AC_VERB_GET_PIN_SENSE, 0);
10666 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10667 spec->sense_updated = 1;
10669 if (spec->jack_present) {
10670 /* mute internal speaker */
10671 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10672 HDA_AMP_MUTE, HDA_AMP_MUTE);
10673 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10674 HDA_AMP_MUTE, HDA_AMP_MUTE);
10676 /* unmute internal speaker if necessary */
10677 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10678 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10679 HDA_AMP_MUTE, mute);
10680 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10681 HDA_AMP_MUTE, mute);
10685 /* unsolicited event for HP jack sensing */
10686 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10689 if ((res >> 26) != ALC_HP_EVENT)
10691 alc262_lenovo_3000_automute(codec, 1);
10694 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10695 int dir, int idx, long *valp)
10699 for (i = 0; i < 2; i++, valp++)
10700 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10702 *valp ? 0 : HDA_AMP_MUTE);
10706 /* bind hp and internal speaker mute (with plug check) */
10707 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10708 struct snd_ctl_elem_value *ucontrol)
10710 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10711 long *valp = ucontrol->value.integer.value;
10714 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10715 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10717 alc262_fujitsu_automute(codec, 0);
10721 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10722 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10724 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10725 .name = "Master Playback Switch",
10726 .info = snd_hda_mixer_amp_switch_info,
10727 .get = snd_hda_mixer_amp_switch_get,
10728 .put = alc262_fujitsu_master_sw_put,
10729 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10731 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10732 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10733 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10734 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10735 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10736 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10737 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10738 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10742 /* bind hp and internal speaker mute (with plug check) */
10743 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10744 struct snd_ctl_elem_value *ucontrol)
10746 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10747 long *valp = ucontrol->value.integer.value;
10750 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10752 alc262_lenovo_3000_automute(codec, 0);
10756 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10757 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10759 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10760 .name = "Master Playback Switch",
10761 .info = snd_hda_mixer_amp_switch_info,
10762 .get = snd_hda_mixer_amp_switch_get,
10763 .put = alc262_lenovo_3000_master_sw_put,
10764 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10766 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10767 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10768 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10771 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10772 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10773 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10777 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10778 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10779 ALC262_HIPPO_MASTER_SWITCH,
10780 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10782 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10783 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10784 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10785 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10789 /* additional init verbs for Benq laptops */
10790 static struct hda_verb alc262_EAPD_verbs[] = {
10791 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10792 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10796 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10797 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10798 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10800 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10801 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10805 /* Samsung Q1 Ultra Vista model setup */
10806 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10807 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10808 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10809 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10810 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10811 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10812 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10816 static struct hda_verb alc262_ultra_verbs[] = {
10818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10823 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10824 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10825 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10827 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10828 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10829 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10830 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10831 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10833 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10835 /* ADC, choose mic */
10836 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10837 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10838 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10839 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10840 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10841 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10842 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10843 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10844 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10845 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10849 /* mute/unmute internal speaker according to the hp jack and mute state */
10850 static void alc262_ultra_automute(struct hda_codec *codec)
10852 struct alc_spec *spec = codec->spec;
10856 /* auto-mute only when HP is used as HP */
10857 if (!spec->cur_mux[0]) {
10858 unsigned int present;
10859 /* need to execute and sync at first */
10860 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10861 present = snd_hda_codec_read(codec, 0x15, 0,
10862 AC_VERB_GET_PIN_SENSE, 0);
10863 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10864 if (spec->jack_present)
10865 mute = HDA_AMP_MUTE;
10867 /* mute/unmute internal speaker */
10868 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10869 HDA_AMP_MUTE, mute);
10870 /* mute/unmute HP */
10871 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10872 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10875 /* unsolicited event for HP jack sensing */
10876 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10879 if ((res >> 26) != ALC880_HP_EVENT)
10881 alc262_ultra_automute(codec);
10884 static struct hda_input_mux alc262_ultra_capture_source = {
10888 { "Headphone", 0x7 },
10892 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10893 struct snd_ctl_elem_value *ucontrol)
10895 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10896 struct alc_spec *spec = codec->spec;
10899 ret = alc_mux_enum_put(kcontrol, ucontrol);
10902 /* reprogram the HP pin as mic or HP according to the input source */
10903 snd_hda_codec_write_cache(codec, 0x15, 0,
10904 AC_VERB_SET_PIN_WIDGET_CONTROL,
10905 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10906 alc262_ultra_automute(codec); /* mute/unmute HP */
10910 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10911 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10912 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10914 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10915 .name = "Capture Source",
10916 .info = alc_mux_enum_info,
10917 .get = alc_mux_enum_get,
10918 .put = alc262_ultra_mux_enum_put,
10923 /* We use two mixers depending on the output pin; 0x16 is a mono output
10924 * and thus it's bound with a different mixer.
10925 * This function returns which mixer amp should be used.
10927 static int alc262_check_volbit(hda_nid_t nid)
10931 else if (nid == 0x16)
10937 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
10938 const char *pfx, int *vbits)
10943 vbit = alc262_check_volbit(nid);
10946 if (*vbits & vbit) /* a volume control for this mixer already there */
10950 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
10952 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
10953 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
10956 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
10964 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
10966 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
10967 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
10970 /* add playback controls from the parsed DAC table */
10971 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10972 const struct auto_pin_cfg *cfg)
10978 spec->multiout.num_dacs = 1; /* only use one dac */
10979 spec->multiout.dac_nids = spec->private_dac_nids;
10980 spec->multiout.dac_nids[0] = 2;
10982 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
10984 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
10988 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
10991 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
10994 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
10998 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
10999 alc262_check_volbit(cfg->speaker_pins[0]) |
11000 alc262_check_volbit(cfg->hp_pins[0]);
11001 if (vbits == 1 || vbits == 2)
11002 pfx = "Master"; /* only one mixer is used */
11003 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11008 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11011 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11015 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11022 #define alc262_auto_create_input_ctls \
11023 alc880_auto_create_input_ctls
11026 * generic initialization of ADC, input mixers and output mixers
11028 static struct hda_verb alc262_volume_init_verbs[] = {
11030 * Unmute ADC0-2 and set the default input to mic-in
11032 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11033 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11034 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11035 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11036 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11037 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11039 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11041 * Note: PASD motherboards uses the Line In 2 as the input for
11042 * front panel mic (mic 2)
11044 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11047 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11048 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11049 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11052 * Set up output mixers (0x0c - 0x0f)
11054 /* set vol=0 to output mixers */
11055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11059 /* set up input amps for analog loopback */
11060 /* Amp Indices: DAC = 0, mixer = 1 */
11061 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11062 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11063 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11064 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11065 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11066 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11068 /* FIXME: use matrix-type input source selection */
11069 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11070 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11072 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11073 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11074 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11076 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11077 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11078 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11079 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11081 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11082 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11089 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11091 * Unmute ADC0-2 and set the default input to mic-in
11093 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11094 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11095 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11096 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11097 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11098 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11100 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11102 * Note: PASD motherboards uses the Line In 2 as the input for
11103 * front panel mic (mic 2)
11105 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11106 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11115 * Set up output mixers (0x0c - 0x0e)
11117 /* set vol=0 to output mixers */
11118 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11119 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11120 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11122 /* set up input amps for analog loopback */
11123 /* Amp Indices: DAC = 0, mixer = 1 */
11124 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11125 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11126 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11127 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11128 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11129 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11131 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11132 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11133 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11135 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11136 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11138 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11139 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11141 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11142 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11143 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11144 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11145 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11147 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11148 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11149 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11150 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11151 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11152 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11155 /* FIXME: use matrix-type input source selection */
11156 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11157 /* Input mixer1: only unmute Mic */
11158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11159 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11160 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11161 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11162 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11163 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11164 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11165 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11166 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11168 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11169 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11170 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11171 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11172 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11173 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11175 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11176 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11180 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11181 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11182 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11183 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11184 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11186 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11188 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11193 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11195 * Unmute ADC0-2 and set the default input to mic-in
11197 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11198 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11199 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11200 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11201 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11202 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11204 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11206 * Note: PASD motherboards uses the Line In 2 as the input for front
11207 * panel mic (mic 2)
11209 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11210 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11211 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11212 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11213 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11214 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11215 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11217 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11219 * Set up output mixers (0x0c - 0x0e)
11221 /* set vol=0 to output mixers */
11222 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11223 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11224 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11226 /* set up input amps for analog loopback */
11227 /* Amp Indices: DAC = 0, mixer = 1 */
11228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11229 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11230 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11231 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11232 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11233 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11237 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11238 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11239 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11240 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11241 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11242 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11244 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11245 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11247 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11248 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11250 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11252 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11253 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11254 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11255 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11257 /* FIXME: use matrix-type input source selection */
11258 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11259 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11260 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11261 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11262 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11264 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11265 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11268 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11269 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11270 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11271 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11272 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11273 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11274 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11276 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11277 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11278 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11279 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11280 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11281 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11282 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11284 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11289 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11291 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11292 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11293 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11295 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11296 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11297 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11298 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11300 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11301 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11302 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11307 #ifdef CONFIG_SND_HDA_POWER_SAVE
11308 #define alc262_loopbacks alc880_loopbacks
11311 /* pcm configuration: identical with ALC880 */
11312 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11313 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11314 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11315 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11318 * BIOS auto configuration
11320 static int alc262_parse_auto_config(struct hda_codec *codec)
11322 struct alc_spec *spec = codec->spec;
11324 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11326 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11330 if (!spec->autocfg.line_outs) {
11331 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11332 spec->multiout.max_channels = 2;
11333 spec->no_analog = 1;
11336 return 0; /* can't find valid BIOS pin config */
11338 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11341 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11345 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11348 if (spec->autocfg.dig_outs) {
11349 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11350 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11352 if (spec->autocfg.dig_in_pin)
11353 spec->dig_in_nid = ALC262_DIGIN_NID;
11355 if (spec->kctls.list)
11356 add_mixer(spec, spec->kctls.list);
11358 add_verb(spec, alc262_volume_init_verbs);
11359 spec->num_mux_defs = 1;
11360 spec->input_mux = &spec->private_imux[0];
11362 err = alc_auto_add_mic_boost(codec);
11366 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11371 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11372 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11373 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11374 #define alc262_auto_init_input_src alc882_auto_init_input_src
11377 /* init callback for auto-configuration model -- overriding the default init */
11378 static void alc262_auto_init(struct hda_codec *codec)
11380 struct alc_spec *spec = codec->spec;
11381 alc262_auto_init_multi_out(codec);
11382 alc262_auto_init_hp_out(codec);
11383 alc262_auto_init_analog_input(codec);
11384 alc262_auto_init_input_src(codec);
11385 if (spec->unsol_event)
11386 alc_inithook(codec);
11390 * configuration and preset
11392 static const char *alc262_models[ALC262_MODEL_LAST] = {
11393 [ALC262_BASIC] = "basic",
11394 [ALC262_HIPPO] = "hippo",
11395 [ALC262_HIPPO_1] = "hippo_1",
11396 [ALC262_FUJITSU] = "fujitsu",
11397 [ALC262_HP_BPC] = "hp-bpc",
11398 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11399 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11400 [ALC262_HP_RP5700] = "hp-rp5700",
11401 [ALC262_BENQ_ED8] = "benq",
11402 [ALC262_BENQ_T31] = "benq-t31",
11403 [ALC262_SONY_ASSAMD] = "sony-assamd",
11404 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11405 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11406 [ALC262_ULTRA] = "ultra",
11407 [ALC262_LENOVO_3000] = "lenovo-3000",
11408 [ALC262_NEC] = "nec",
11409 [ALC262_TYAN] = "tyan",
11410 [ALC262_AUTO] = "auto",
11413 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11414 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11415 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11416 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11418 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11420 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11422 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11423 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11424 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11425 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11426 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11427 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11428 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11429 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11430 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11431 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11432 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11433 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11434 ALC262_HP_TC_T5735),
11435 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11436 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11437 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11438 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11439 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11440 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11441 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11442 ALC262_SONY_ASSAMD),
11443 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11444 ALC262_TOSHIBA_RX1),
11445 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11446 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11447 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11448 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11449 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11451 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11452 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11453 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11454 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11455 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11459 static struct alc_config_preset alc262_presets[] = {
11461 .mixers = { alc262_base_mixer },
11462 .init_verbs = { alc262_init_verbs },
11463 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11464 .dac_nids = alc262_dac_nids,
11466 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11467 .channel_mode = alc262_modes,
11468 .input_mux = &alc262_capture_source,
11471 .mixers = { alc262_hippo_mixer },
11472 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11473 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11474 .dac_nids = alc262_dac_nids,
11476 .dig_out_nid = ALC262_DIGOUT_NID,
11477 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11478 .channel_mode = alc262_modes,
11479 .input_mux = &alc262_capture_source,
11480 .unsol_event = alc262_hippo_unsol_event,
11481 .setup = alc262_hippo_setup,
11482 .init_hook = alc262_hippo_automute,
11484 [ALC262_HIPPO_1] = {
11485 .mixers = { alc262_hippo1_mixer },
11486 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11487 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11488 .dac_nids = alc262_dac_nids,
11490 .dig_out_nid = ALC262_DIGOUT_NID,
11491 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11492 .channel_mode = alc262_modes,
11493 .input_mux = &alc262_capture_source,
11494 .unsol_event = alc262_hippo_unsol_event,
11495 .setup = alc262_hippo1_setup,
11496 .init_hook = alc262_hippo_automute,
11498 [ALC262_FUJITSU] = {
11499 .mixers = { alc262_fujitsu_mixer },
11500 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11501 alc262_fujitsu_unsol_verbs },
11502 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11503 .dac_nids = alc262_dac_nids,
11505 .dig_out_nid = ALC262_DIGOUT_NID,
11506 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11507 .channel_mode = alc262_modes,
11508 .input_mux = &alc262_fujitsu_capture_source,
11509 .unsol_event = alc262_fujitsu_unsol_event,
11510 .init_hook = alc262_fujitsu_init_hook,
11512 [ALC262_HP_BPC] = {
11513 .mixers = { alc262_HP_BPC_mixer },
11514 .init_verbs = { alc262_HP_BPC_init_verbs },
11515 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11516 .dac_nids = alc262_dac_nids,
11518 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11519 .channel_mode = alc262_modes,
11520 .input_mux = &alc262_HP_capture_source,
11521 .unsol_event = alc262_hp_bpc_unsol_event,
11522 .init_hook = alc262_hp_bpc_automute,
11524 [ALC262_HP_BPC_D7000_WF] = {
11525 .mixers = { alc262_HP_BPC_WildWest_mixer },
11526 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11527 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11528 .dac_nids = alc262_dac_nids,
11530 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11531 .channel_mode = alc262_modes,
11532 .input_mux = &alc262_HP_D7000_capture_source,
11533 .unsol_event = alc262_hp_wildwest_unsol_event,
11534 .init_hook = alc262_hp_wildwest_automute,
11536 [ALC262_HP_BPC_D7000_WL] = {
11537 .mixers = { alc262_HP_BPC_WildWest_mixer,
11538 alc262_HP_BPC_WildWest_option_mixer },
11539 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11540 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11541 .dac_nids = alc262_dac_nids,
11543 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11544 .channel_mode = alc262_modes,
11545 .input_mux = &alc262_HP_D7000_capture_source,
11546 .unsol_event = alc262_hp_wildwest_unsol_event,
11547 .init_hook = alc262_hp_wildwest_automute,
11549 [ALC262_HP_TC_T5735] = {
11550 .mixers = { alc262_hp_t5735_mixer },
11551 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11552 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11553 .dac_nids = alc262_dac_nids,
11555 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11556 .channel_mode = alc262_modes,
11557 .input_mux = &alc262_capture_source,
11558 .unsol_event = alc_automute_amp_unsol_event,
11559 .setup = alc262_hp_t5735_setup,
11560 .init_hook = alc_automute_amp,
11562 [ALC262_HP_RP5700] = {
11563 .mixers = { alc262_hp_rp5700_mixer },
11564 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11565 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11566 .dac_nids = alc262_dac_nids,
11567 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11568 .channel_mode = alc262_modes,
11569 .input_mux = &alc262_hp_rp5700_capture_source,
11571 [ALC262_BENQ_ED8] = {
11572 .mixers = { alc262_base_mixer },
11573 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11574 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11575 .dac_nids = alc262_dac_nids,
11577 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11578 .channel_mode = alc262_modes,
11579 .input_mux = &alc262_capture_source,
11581 [ALC262_SONY_ASSAMD] = {
11582 .mixers = { alc262_sony_mixer },
11583 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11584 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11585 .dac_nids = alc262_dac_nids,
11587 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11588 .channel_mode = alc262_modes,
11589 .input_mux = &alc262_capture_source,
11590 .unsol_event = alc262_hippo_unsol_event,
11591 .setup = alc262_hippo_setup,
11592 .init_hook = alc262_hippo_automute,
11594 [ALC262_BENQ_T31] = {
11595 .mixers = { alc262_benq_t31_mixer },
11596 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11597 alc_hp15_unsol_verbs },
11598 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11599 .dac_nids = alc262_dac_nids,
11601 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11602 .channel_mode = alc262_modes,
11603 .input_mux = &alc262_capture_source,
11604 .unsol_event = alc262_hippo_unsol_event,
11605 .setup = alc262_hippo_setup,
11606 .init_hook = alc262_hippo_automute,
11609 .mixers = { alc262_ultra_mixer },
11610 .cap_mixer = alc262_ultra_capture_mixer,
11611 .init_verbs = { alc262_ultra_verbs },
11612 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11613 .dac_nids = alc262_dac_nids,
11614 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11615 .channel_mode = alc262_modes,
11616 .input_mux = &alc262_ultra_capture_source,
11617 .adc_nids = alc262_adc_nids, /* ADC0 */
11618 .capsrc_nids = alc262_capsrc_nids,
11619 .num_adc_nids = 1, /* single ADC */
11620 .unsol_event = alc262_ultra_unsol_event,
11621 .init_hook = alc262_ultra_automute,
11623 [ALC262_LENOVO_3000] = {
11624 .mixers = { alc262_lenovo_3000_mixer },
11625 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11626 alc262_lenovo_3000_unsol_verbs },
11627 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11628 .dac_nids = alc262_dac_nids,
11630 .dig_out_nid = ALC262_DIGOUT_NID,
11631 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11632 .channel_mode = alc262_modes,
11633 .input_mux = &alc262_fujitsu_capture_source,
11634 .unsol_event = alc262_lenovo_3000_unsol_event,
11637 .mixers = { alc262_nec_mixer },
11638 .init_verbs = { alc262_nec_verbs },
11639 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11640 .dac_nids = alc262_dac_nids,
11642 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11643 .channel_mode = alc262_modes,
11644 .input_mux = &alc262_capture_source,
11646 [ALC262_TOSHIBA_S06] = {
11647 .mixers = { alc262_toshiba_s06_mixer },
11648 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11649 alc262_eapd_verbs },
11650 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11651 .capsrc_nids = alc262_dmic_capsrc_nids,
11652 .dac_nids = alc262_dac_nids,
11653 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11654 .num_adc_nids = 1, /* single ADC */
11655 .dig_out_nid = ALC262_DIGOUT_NID,
11656 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11657 .channel_mode = alc262_modes,
11658 .unsol_event = alc_sku_unsol_event,
11659 .setup = alc262_toshiba_s06_setup,
11660 .init_hook = alc_inithook,
11662 [ALC262_TOSHIBA_RX1] = {
11663 .mixers = { alc262_toshiba_rx1_mixer },
11664 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11665 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11666 .dac_nids = alc262_dac_nids,
11668 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11669 .channel_mode = alc262_modes,
11670 .input_mux = &alc262_capture_source,
11671 .unsol_event = alc262_hippo_unsol_event,
11672 .setup = alc262_hippo_setup,
11673 .init_hook = alc262_hippo_automute,
11676 .mixers = { alc262_tyan_mixer },
11677 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11678 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11679 .dac_nids = alc262_dac_nids,
11681 .dig_out_nid = ALC262_DIGOUT_NID,
11682 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11683 .channel_mode = alc262_modes,
11684 .input_mux = &alc262_capture_source,
11685 .unsol_event = alc_automute_amp_unsol_event,
11686 .setup = alc262_tyan_setup,
11687 .init_hook = alc_automute_amp,
11691 static int patch_alc262(struct hda_codec *codec)
11693 struct alc_spec *spec;
11697 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11701 codec->spec = spec;
11703 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11708 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11709 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11710 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11711 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11715 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11717 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11721 if (board_config < 0) {
11722 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11724 board_config = ALC262_AUTO;
11727 if (board_config == ALC262_AUTO) {
11728 /* automatic parse from the BIOS config */
11729 err = alc262_parse_auto_config(codec);
11735 "hda_codec: Cannot set up configuration "
11736 "from BIOS. Using base mode...\n");
11737 board_config = ALC262_BASIC;
11741 if (!spec->no_analog) {
11742 err = snd_hda_attach_beep_device(codec, 0x1);
11749 if (board_config != ALC262_AUTO)
11750 setup_preset(codec, &alc262_presets[board_config]);
11752 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11753 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11755 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11756 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11758 if (!spec->adc_nids && spec->input_mux) {
11760 /* check whether the digital-mic has to be supported */
11761 for (i = 0; i < spec->input_mux->num_items; i++) {
11762 if (spec->input_mux->items[i].index >= 9)
11765 if (i < spec->input_mux->num_items) {
11766 /* use only ADC0 */
11767 spec->adc_nids = alc262_dmic_adc_nids;
11768 spec->num_adc_nids = 1;
11769 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11771 /* all analog inputs */
11772 /* check whether NID 0x07 is valid */
11773 unsigned int wcap = get_wcaps(codec, 0x07);
11776 wcap = get_wcaps_type(wcap);
11777 if (wcap != AC_WID_AUD_IN) {
11778 spec->adc_nids = alc262_adc_nids_alt;
11779 spec->num_adc_nids =
11780 ARRAY_SIZE(alc262_adc_nids_alt);
11781 spec->capsrc_nids = alc262_capsrc_nids_alt;
11783 spec->adc_nids = alc262_adc_nids;
11784 spec->num_adc_nids =
11785 ARRAY_SIZE(alc262_adc_nids);
11786 spec->capsrc_nids = alc262_capsrc_nids;
11790 if (!spec->cap_mixer && !spec->no_analog)
11791 set_capture_mixer(codec);
11792 if (!spec->no_analog)
11793 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11795 spec->vmaster_nid = 0x0c;
11797 codec->patch_ops = alc_patch_ops;
11798 if (board_config == ALC262_AUTO)
11799 spec->init_hook = alc262_auto_init;
11800 #ifdef CONFIG_SND_HDA_POWER_SAVE
11801 if (!spec->loopback.amplist)
11802 spec->loopback.amplist = alc262_loopbacks;
11804 codec->proc_widget_hook = print_realtek_coef;
11810 * ALC268 channel source setting (2 channel)
11812 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11813 #define alc268_modes alc260_modes
11815 static hda_nid_t alc268_dac_nids[2] = {
11820 static hda_nid_t alc268_adc_nids[2] = {
11825 static hda_nid_t alc268_adc_nids_alt[1] = {
11830 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11832 static struct snd_kcontrol_new alc268_base_mixer[] = {
11833 /* output mixer control */
11834 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11835 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11836 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11837 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11838 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11839 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11840 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11844 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11845 /* output mixer control */
11846 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11847 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11848 ALC262_HIPPO_MASTER_SWITCH,
11849 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11850 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11851 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11855 /* bind Beep switches of both NID 0x0f and 0x10 */
11856 static struct hda_bind_ctls alc268_bind_beep_sw = {
11857 .ops = &snd_hda_bind_sw,
11859 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11860 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11865 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11866 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11867 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11871 static struct hda_verb alc268_eapd_verbs[] = {
11872 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11873 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11877 /* Toshiba specific */
11878 static struct hda_verb alc268_toshiba_verbs[] = {
11879 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11883 /* Acer specific */
11884 /* bind volumes of both NID 0x02 and 0x03 */
11885 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11886 .ops = &snd_hda_bind_vol,
11888 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11889 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11894 /* mute/unmute internal speaker according to the hp jack and mute state */
11895 static void alc268_acer_automute(struct hda_codec *codec, int force)
11897 struct alc_spec *spec = codec->spec;
11900 if (force || !spec->sense_updated) {
11901 unsigned int present;
11902 present = snd_hda_codec_read(codec, 0x14, 0,
11903 AC_VERB_GET_PIN_SENSE, 0);
11904 spec->jack_present = (present & 0x80000000) != 0;
11905 spec->sense_updated = 1;
11907 if (spec->jack_present)
11908 mute = HDA_AMP_MUTE; /* mute internal speaker */
11909 else /* unmute internal speaker if necessary */
11910 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11911 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11912 HDA_AMP_MUTE, mute);
11916 /* bind hp and internal speaker mute (with plug check) */
11917 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11918 struct snd_ctl_elem_value *ucontrol)
11920 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11921 long *valp = ucontrol->value.integer.value;
11924 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11926 alc268_acer_automute(codec, 0);
11930 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11931 /* output mixer control */
11932 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11934 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11935 .name = "Master Playback Switch",
11936 .info = snd_hda_mixer_amp_switch_info,
11937 .get = snd_hda_mixer_amp_switch_get,
11938 .put = alc268_acer_master_sw_put,
11939 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11941 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11945 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11946 /* output mixer control */
11947 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11949 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11950 .name = "Master Playback Switch",
11951 .info = snd_hda_mixer_amp_switch_info,
11952 .get = snd_hda_mixer_amp_switch_get,
11953 .put = alc268_acer_master_sw_put,
11954 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11956 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11957 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11958 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11962 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11963 /* output mixer control */
11964 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11966 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11967 .name = "Master Playback Switch",
11968 .info = snd_hda_mixer_amp_switch_info,
11969 .get = snd_hda_mixer_amp_switch_get,
11970 .put = alc268_acer_master_sw_put,
11971 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11973 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11974 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11978 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11979 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11980 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11981 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11982 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11983 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11984 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11988 static struct hda_verb alc268_acer_verbs[] = {
11989 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11990 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11991 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11992 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11993 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11994 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11995 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11999 /* unsolicited event for HP jack sensing */
12000 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12001 #define alc268_toshiba_setup alc262_hippo_setup
12002 #define alc268_toshiba_automute alc262_hippo_automute
12004 static void alc268_acer_unsol_event(struct hda_codec *codec,
12007 if ((res >> 26) != ALC880_HP_EVENT)
12009 alc268_acer_automute(codec, 1);
12012 static void alc268_acer_init_hook(struct hda_codec *codec)
12014 alc268_acer_automute(codec, 1);
12017 /* toggle speaker-output according to the hp-jack state */
12018 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12020 unsigned int present;
12021 unsigned char bits;
12023 present = snd_hda_codec_read(codec, 0x15, 0,
12024 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12025 bits = present ? AMP_IN_MUTE(0) : 0;
12026 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12027 AMP_IN_MUTE(0), bits);
12028 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12029 AMP_IN_MUTE(0), bits);
12032 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12035 switch (res >> 26) {
12036 case ALC880_HP_EVENT:
12037 alc268_aspire_one_speaker_automute(codec);
12039 case ALC880_MIC_EVENT:
12040 alc_mic_automute(codec);
12045 static void alc268_acer_lc_setup(struct hda_codec *codec)
12047 struct alc_spec *spec = codec->spec;
12048 spec->ext_mic.pin = 0x18;
12049 spec->ext_mic.mux_idx = 0;
12050 spec->int_mic.pin = 0x12;
12051 spec->int_mic.mux_idx = 6;
12052 spec->auto_mic = 1;
12055 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12057 alc268_aspire_one_speaker_automute(codec);
12058 alc_mic_automute(codec);
12061 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12062 /* output mixer control */
12063 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12064 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12065 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12066 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12068 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12072 static struct hda_verb alc268_dell_verbs[] = {
12073 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12074 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12075 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12076 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12080 /* mute/unmute internal speaker according to the hp jack and mute state */
12081 static void alc268_dell_setup(struct hda_codec *codec)
12083 struct alc_spec *spec = codec->spec;
12085 spec->autocfg.hp_pins[0] = 0x15;
12086 spec->autocfg.speaker_pins[0] = 0x14;
12087 spec->ext_mic.pin = 0x18;
12088 spec->ext_mic.mux_idx = 0;
12089 spec->int_mic.pin = 0x19;
12090 spec->int_mic.mux_idx = 1;
12091 spec->auto_mic = 1;
12094 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12095 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12096 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12097 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12099 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12100 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12101 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12102 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12106 static struct hda_verb alc267_quanta_il1_verbs[] = {
12107 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12108 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12112 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12114 struct alc_spec *spec = codec->spec;
12115 spec->autocfg.hp_pins[0] = 0x15;
12116 spec->autocfg.speaker_pins[0] = 0x14;
12117 spec->ext_mic.pin = 0x18;
12118 spec->ext_mic.mux_idx = 0;
12119 spec->int_mic.pin = 0x19;
12120 spec->int_mic.mux_idx = 1;
12121 spec->auto_mic = 1;
12125 * generic initialization of ADC, input mixers and output mixers
12127 static struct hda_verb alc268_base_init_verbs[] = {
12128 /* Unmute DAC0-1 and set vol = 0 */
12129 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12130 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12133 * Set up output mixers (0x0c - 0x0e)
12135 /* set vol=0 to output mixers */
12136 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12137 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12139 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12140 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12142 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12143 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12144 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12145 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12146 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12147 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12148 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12149 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12151 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12152 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12153 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12154 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12155 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12157 /* set PCBEEP vol = 0, mute connections */
12158 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12159 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12160 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12162 /* Unmute Selector 23h,24h and set the default input to mic-in */
12164 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12165 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12166 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12167 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12173 * generic initialization of ADC, input mixers and output mixers
12175 static struct hda_verb alc268_volume_init_verbs[] = {
12176 /* set output DAC */
12177 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12178 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12180 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12181 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12182 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12183 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12184 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12186 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12187 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12188 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12190 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12191 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12193 /* set PCBEEP vol = 0, mute connections */
12194 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12195 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12196 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12201 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12202 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12203 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12207 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12208 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12209 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12214 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12215 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12216 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12217 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12218 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12223 static struct hda_input_mux alc268_capture_source = {
12227 { "Front Mic", 0x1 },
12233 static struct hda_input_mux alc268_acer_capture_source = {
12237 { "Internal Mic", 0x1 },
12242 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12246 { "Internal Mic", 0x6 },
12251 #ifdef CONFIG_SND_DEBUG
12252 static struct snd_kcontrol_new alc268_test_mixer[] = {
12253 /* Volume widgets */
12254 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12255 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12256 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12257 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12258 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12259 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12260 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12261 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12262 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12263 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12264 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12265 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12266 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12267 /* The below appears problematic on some hardwares */
12268 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12269 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12270 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12271 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12272 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12274 /* Modes for retasking pin widgets */
12275 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12276 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12277 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12278 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12280 /* Controls for GPIO pins, assuming they are configured as outputs */
12281 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12282 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12283 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12284 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12286 /* Switches to allow the digital SPDIF output pin to be enabled.
12287 * The ALC268 does not have an SPDIF input.
12289 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12291 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12292 * this output to turn on an external amplifier.
12294 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12295 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12301 /* create input playback/capture controls for the given pin */
12302 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12303 const char *ctlname, int idx)
12319 if (spec->multiout.dac_nids[0] != dac &&
12320 spec->multiout.dac_nids[1] != dac) {
12321 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12322 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12326 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12330 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12331 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12333 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12334 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12340 /* add playback controls from the parsed DAC table */
12341 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12342 const struct auto_pin_cfg *cfg)
12347 spec->multiout.dac_nids = spec->private_dac_nids;
12349 nid = cfg->line_out_pins[0];
12352 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12356 err = alc268_new_analog_output(spec, nid, name, 0);
12361 nid = cfg->speaker_pins[0];
12363 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12364 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12368 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12372 nid = cfg->hp_pins[0];
12374 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12379 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12381 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12382 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12389 /* create playback/capture controls for input pins */
12390 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12391 const struct auto_pin_cfg *cfg)
12393 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12396 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12397 hda_nid_t nid, int pin_type)
12401 alc_set_pin_output(codec, nid, pin_type);
12402 if (nid == 0x14 || nid == 0x16)
12406 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12409 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12411 struct alc_spec *spec = codec->spec;
12412 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12414 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12415 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12419 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12421 struct alc_spec *spec = codec->spec;
12424 pin = spec->autocfg.hp_pins[0];
12426 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12427 pin = spec->autocfg.speaker_pins[0];
12429 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12432 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12434 struct alc_spec *spec = codec->spec;
12435 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12436 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12437 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12438 unsigned int dac_vol1, dac_vol2;
12440 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12441 snd_hda_codec_write(codec, speaker_nid, 0,
12442 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12443 /* mute mixer inputs from 0x1d */
12444 snd_hda_codec_write(codec, 0x0f, 0,
12445 AC_VERB_SET_AMP_GAIN_MUTE,
12447 snd_hda_codec_write(codec, 0x10, 0,
12448 AC_VERB_SET_AMP_GAIN_MUTE,
12451 /* unmute mixer inputs from 0x1d */
12452 snd_hda_codec_write(codec, 0x0f, 0,
12453 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12454 snd_hda_codec_write(codec, 0x10, 0,
12455 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12458 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12459 if (line_nid == 0x14)
12460 dac_vol2 = AMP_OUT_ZERO;
12461 else if (line_nid == 0x15)
12462 dac_vol1 = AMP_OUT_ZERO;
12463 if (hp_nid == 0x14)
12464 dac_vol2 = AMP_OUT_ZERO;
12465 else if (hp_nid == 0x15)
12466 dac_vol1 = AMP_OUT_ZERO;
12467 if (line_nid != 0x16 || hp_nid != 0x16 ||
12468 spec->autocfg.line_out_pins[1] != 0x16 ||
12469 spec->autocfg.line_out_pins[2] != 0x16)
12470 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12472 snd_hda_codec_write(codec, 0x02, 0,
12473 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12474 snd_hda_codec_write(codec, 0x03, 0,
12475 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12478 /* pcm configuration: identical with ALC880 */
12479 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12480 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12481 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12482 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12485 * BIOS auto configuration
12487 static int alc268_parse_auto_config(struct hda_codec *codec)
12489 struct alc_spec *spec = codec->spec;
12491 static hda_nid_t alc268_ignore[] = { 0 };
12493 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12497 if (!spec->autocfg.line_outs) {
12498 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12499 spec->multiout.max_channels = 2;
12500 spec->no_analog = 1;
12503 return 0; /* can't find valid BIOS pin config */
12505 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12508 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12512 spec->multiout.max_channels = 2;
12515 /* digital only support output */
12516 if (spec->autocfg.dig_outs) {
12517 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12518 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12520 if (spec->kctls.list)
12521 add_mixer(spec, spec->kctls.list);
12523 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12524 add_mixer(spec, alc268_beep_mixer);
12526 add_verb(spec, alc268_volume_init_verbs);
12527 spec->num_mux_defs = 2;
12528 spec->input_mux = &spec->private_imux[0];
12530 err = alc_auto_add_mic_boost(codec);
12534 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12539 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12541 /* init callback for auto-configuration model -- overriding the default init */
12542 static void alc268_auto_init(struct hda_codec *codec)
12544 struct alc_spec *spec = codec->spec;
12545 alc268_auto_init_multi_out(codec);
12546 alc268_auto_init_hp_out(codec);
12547 alc268_auto_init_mono_speaker_out(codec);
12548 alc268_auto_init_analog_input(codec);
12549 if (spec->unsol_event)
12550 alc_inithook(codec);
12554 * configuration and preset
12556 static const char *alc268_models[ALC268_MODEL_LAST] = {
12557 [ALC267_QUANTA_IL1] = "quanta-il1",
12558 [ALC268_3ST] = "3stack",
12559 [ALC268_TOSHIBA] = "toshiba",
12560 [ALC268_ACER] = "acer",
12561 [ALC268_ACER_DMIC] = "acer-dmic",
12562 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12563 [ALC268_DELL] = "dell",
12564 [ALC268_ZEPTO] = "zepto",
12565 #ifdef CONFIG_SND_DEBUG
12566 [ALC268_TEST] = "test",
12568 [ALC268_AUTO] = "auto",
12571 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12572 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12573 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12574 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12575 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12576 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12577 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12578 ALC268_ACER_ASPIRE_ONE),
12579 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12580 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12581 /* almost compatible with toshiba but with optional digital outs;
12582 * auto-probing seems working fine
12584 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12586 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12587 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12588 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12589 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12590 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12591 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12595 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12596 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12597 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12598 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12599 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12604 static struct alc_config_preset alc268_presets[] = {
12605 [ALC267_QUANTA_IL1] = {
12606 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12607 alc268_capture_nosrc_mixer },
12608 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12609 alc267_quanta_il1_verbs },
12610 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12611 .dac_nids = alc268_dac_nids,
12612 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12613 .adc_nids = alc268_adc_nids_alt,
12615 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12616 .channel_mode = alc268_modes,
12617 .unsol_event = alc_sku_unsol_event,
12618 .setup = alc267_quanta_il1_setup,
12619 .init_hook = alc_inithook,
12622 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12623 alc268_beep_mixer },
12624 .init_verbs = { alc268_base_init_verbs },
12625 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12626 .dac_nids = alc268_dac_nids,
12627 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12628 .adc_nids = alc268_adc_nids_alt,
12629 .capsrc_nids = alc268_capsrc_nids,
12631 .dig_out_nid = ALC268_DIGOUT_NID,
12632 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12633 .channel_mode = alc268_modes,
12634 .input_mux = &alc268_capture_source,
12636 [ALC268_TOSHIBA] = {
12637 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12638 alc268_beep_mixer },
12639 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12640 alc268_toshiba_verbs },
12641 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12642 .dac_nids = alc268_dac_nids,
12643 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12644 .adc_nids = alc268_adc_nids_alt,
12645 .capsrc_nids = alc268_capsrc_nids,
12647 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12648 .channel_mode = alc268_modes,
12649 .input_mux = &alc268_capture_source,
12650 .unsol_event = alc268_toshiba_unsol_event,
12651 .setup = alc268_toshiba_setup,
12652 .init_hook = alc268_toshiba_automute,
12655 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12656 alc268_beep_mixer },
12657 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12658 alc268_acer_verbs },
12659 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12660 .dac_nids = alc268_dac_nids,
12661 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12662 .adc_nids = alc268_adc_nids_alt,
12663 .capsrc_nids = alc268_capsrc_nids,
12665 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12666 .channel_mode = alc268_modes,
12667 .input_mux = &alc268_acer_capture_source,
12668 .unsol_event = alc268_acer_unsol_event,
12669 .init_hook = alc268_acer_init_hook,
12671 [ALC268_ACER_DMIC] = {
12672 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12673 alc268_beep_mixer },
12674 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12675 alc268_acer_verbs },
12676 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12677 .dac_nids = alc268_dac_nids,
12678 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12679 .adc_nids = alc268_adc_nids_alt,
12680 .capsrc_nids = alc268_capsrc_nids,
12682 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12683 .channel_mode = alc268_modes,
12684 .input_mux = &alc268_acer_dmic_capture_source,
12685 .unsol_event = alc268_acer_unsol_event,
12686 .init_hook = alc268_acer_init_hook,
12688 [ALC268_ACER_ASPIRE_ONE] = {
12689 .mixers = { alc268_acer_aspire_one_mixer,
12691 alc268_capture_nosrc_mixer },
12692 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12693 alc268_acer_aspire_one_verbs },
12694 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12695 .dac_nids = alc268_dac_nids,
12696 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12697 .adc_nids = alc268_adc_nids_alt,
12698 .capsrc_nids = alc268_capsrc_nids,
12700 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12701 .channel_mode = alc268_modes,
12702 .unsol_event = alc268_acer_lc_unsol_event,
12703 .setup = alc268_acer_lc_setup,
12704 .init_hook = alc268_acer_lc_init_hook,
12707 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12708 alc268_capture_nosrc_mixer },
12709 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12710 alc268_dell_verbs },
12711 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12712 .dac_nids = alc268_dac_nids,
12713 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12714 .adc_nids = alc268_adc_nids_alt,
12715 .capsrc_nids = alc268_capsrc_nids,
12717 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12718 .channel_mode = alc268_modes,
12719 .unsol_event = alc_sku_unsol_event,
12720 .setup = alc268_dell_setup,
12721 .init_hook = alc_inithook,
12724 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12725 alc268_beep_mixer },
12726 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12727 alc268_toshiba_verbs },
12728 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12729 .dac_nids = alc268_dac_nids,
12730 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12731 .adc_nids = alc268_adc_nids_alt,
12732 .capsrc_nids = alc268_capsrc_nids,
12734 .dig_out_nid = ALC268_DIGOUT_NID,
12735 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12736 .channel_mode = alc268_modes,
12737 .input_mux = &alc268_capture_source,
12738 .setup = alc268_toshiba_setup,
12739 .init_hook = alc268_toshiba_automute,
12741 #ifdef CONFIG_SND_DEBUG
12743 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12744 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12745 alc268_volume_init_verbs },
12746 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12747 .dac_nids = alc268_dac_nids,
12748 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12749 .adc_nids = alc268_adc_nids_alt,
12750 .capsrc_nids = alc268_capsrc_nids,
12752 .dig_out_nid = ALC268_DIGOUT_NID,
12753 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12754 .channel_mode = alc268_modes,
12755 .input_mux = &alc268_capture_source,
12760 static int patch_alc268(struct hda_codec *codec)
12762 struct alc_spec *spec;
12764 int i, has_beep, err;
12766 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12770 codec->spec = spec;
12772 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12776 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12777 board_config = snd_hda_check_board_codec_sid_config(codec,
12778 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12780 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12781 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12783 board_config = ALC268_AUTO;
12786 if (board_config == ALC268_AUTO) {
12787 /* automatic parse from the BIOS config */
12788 err = alc268_parse_auto_config(codec);
12794 "hda_codec: Cannot set up configuration "
12795 "from BIOS. Using base mode...\n");
12796 board_config = ALC268_3ST;
12800 if (board_config != ALC268_AUTO)
12801 setup_preset(codec, &alc268_presets[board_config]);
12803 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12804 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12805 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12807 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12810 for (i = 0; i < spec->num_mixers; i++) {
12811 if (spec->mixers[i] == alc268_beep_mixer) {
12818 err = snd_hda_attach_beep_device(codec, 0x1);
12823 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12824 /* override the amp caps for beep generator */
12825 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12826 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12827 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12828 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12829 (0 << AC_AMPCAP_MUTE_SHIFT));
12832 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12833 /* check whether NID 0x07 is valid */
12834 unsigned int wcap = get_wcaps(codec, 0x07);
12838 wcap = get_wcaps_type(wcap);
12839 if (spec->auto_mic ||
12840 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12841 spec->adc_nids = alc268_adc_nids_alt;
12842 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12843 if (spec->auto_mic || spec->input_mux->num_items == 1)
12844 add_mixer(spec, alc268_capture_nosrc_mixer);
12846 add_mixer(spec, alc268_capture_alt_mixer);
12848 spec->adc_nids = alc268_adc_nids;
12849 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12850 add_mixer(spec, alc268_capture_mixer);
12852 spec->capsrc_nids = alc268_capsrc_nids;
12853 /* set default input source */
12854 for (i = 0; i < spec->num_adc_nids; i++)
12855 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12856 0, AC_VERB_SET_CONNECT_SEL,
12857 i < spec->num_mux_defs ?
12858 spec->input_mux[i].items[0].index :
12859 spec->input_mux->items[0].index);
12862 spec->vmaster_nid = 0x02;
12864 codec->patch_ops = alc_patch_ops;
12865 if (board_config == ALC268_AUTO)
12866 spec->init_hook = alc268_auto_init;
12868 codec->proc_widget_hook = print_realtek_coef;
12874 * ALC269 channel source setting (2 channel)
12876 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12878 #define alc269_dac_nids alc260_dac_nids
12880 static hda_nid_t alc269_adc_nids[1] = {
12885 static hda_nid_t alc269_capsrc_nids[1] = {
12889 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12893 #define alc269_modes alc260_modes
12894 #define alc269_capture_source alc880_lg_lw_capture_source
12896 static struct snd_kcontrol_new alc269_base_mixer[] = {
12897 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12898 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12899 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12900 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12902 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12903 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12904 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12905 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12906 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12907 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12908 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12912 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12913 /* output mixer control */
12914 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12916 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12917 .name = "Master Playback Switch",
12918 .info = snd_hda_mixer_amp_switch_info,
12919 .get = snd_hda_mixer_amp_switch_get,
12920 .put = alc268_acer_master_sw_put,
12921 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12923 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12924 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12925 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12926 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12927 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12928 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12932 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12933 /* output mixer control */
12934 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12937 .name = "Master Playback Switch",
12938 .info = snd_hda_mixer_amp_switch_info,
12939 .get = snd_hda_mixer_amp_switch_get,
12940 .put = alc268_acer_master_sw_put,
12941 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12943 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12944 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12945 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12946 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12947 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12948 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12949 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12950 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12951 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12955 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12956 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12957 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12958 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12959 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12963 /* capture mixer elements */
12964 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12965 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12966 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12967 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12972 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12974 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12975 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12976 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12977 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12978 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12979 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12980 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12984 static struct hda_verb alc269_lifebook_verbs[] = {
12985 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12986 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12987 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12989 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12990 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12991 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12992 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12993 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12994 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12998 /* toggle speaker-output according to the hp-jack state */
12999 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13001 unsigned int present;
13002 unsigned char bits;
13004 present = snd_hda_codec_read(codec, 0x15, 0,
13005 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13006 bits = present ? AMP_IN_MUTE(0) : 0;
13007 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13008 AMP_IN_MUTE(0), bits);
13009 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13010 AMP_IN_MUTE(0), bits);
13012 snd_hda_codec_write(codec, 0x20, 0,
13013 AC_VERB_SET_COEF_INDEX, 0x0c);
13014 snd_hda_codec_write(codec, 0x20, 0,
13015 AC_VERB_SET_PROC_COEF, 0x680);
13017 snd_hda_codec_write(codec, 0x20, 0,
13018 AC_VERB_SET_COEF_INDEX, 0x0c);
13019 snd_hda_codec_write(codec, 0x20, 0,
13020 AC_VERB_SET_PROC_COEF, 0x480);
13023 /* toggle speaker-output according to the hp-jacks state */
13024 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13026 unsigned int present;
13027 unsigned char bits;
13029 /* Check laptop headphone socket */
13030 present = snd_hda_codec_read(codec, 0x15, 0,
13031 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13033 /* Check port replicator headphone socket */
13034 present |= snd_hda_codec_read(codec, 0x1a, 0,
13035 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13037 bits = present ? AMP_IN_MUTE(0) : 0;
13038 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13039 AMP_IN_MUTE(0), bits);
13040 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13041 AMP_IN_MUTE(0), bits);
13043 snd_hda_codec_write(codec, 0x20, 0,
13044 AC_VERB_SET_COEF_INDEX, 0x0c);
13045 snd_hda_codec_write(codec, 0x20, 0,
13046 AC_VERB_SET_PROC_COEF, 0x680);
13048 snd_hda_codec_write(codec, 0x20, 0,
13049 AC_VERB_SET_COEF_INDEX, 0x0c);
13050 snd_hda_codec_write(codec, 0x20, 0,
13051 AC_VERB_SET_PROC_COEF, 0x480);
13054 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13056 unsigned int present_laptop;
13057 unsigned int present_dock;
13059 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
13060 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13062 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
13063 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13065 /* Laptop mic port overrides dock mic port, design decision */
13067 snd_hda_codec_write(codec, 0x23, 0,
13068 AC_VERB_SET_CONNECT_SEL, 0x3);
13069 if (present_laptop)
13070 snd_hda_codec_write(codec, 0x23, 0,
13071 AC_VERB_SET_CONNECT_SEL, 0x0);
13072 if (!present_dock && !present_laptop)
13073 snd_hda_codec_write(codec, 0x23, 0,
13074 AC_VERB_SET_CONNECT_SEL, 0x1);
13077 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13080 switch (res >> 26) {
13081 case ALC880_HP_EVENT:
13082 alc269_quanta_fl1_speaker_automute(codec);
13084 case ALC880_MIC_EVENT:
13085 alc_mic_automute(codec);
13090 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13093 if ((res >> 26) == ALC880_HP_EVENT)
13094 alc269_lifebook_speaker_automute(codec);
13095 if ((res >> 26) == ALC880_MIC_EVENT)
13096 alc269_lifebook_mic_autoswitch(codec);
13099 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13101 struct alc_spec *spec = codec->spec;
13102 spec->ext_mic.pin = 0x18;
13103 spec->ext_mic.mux_idx = 0;
13104 spec->int_mic.pin = 0x19;
13105 spec->int_mic.mux_idx = 1;
13106 spec->auto_mic = 1;
13109 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13111 alc269_quanta_fl1_speaker_automute(codec);
13112 alc_mic_automute(codec);
13115 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13117 alc269_lifebook_speaker_automute(codec);
13118 alc269_lifebook_mic_autoswitch(codec);
13121 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13122 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13123 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13124 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13125 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13126 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13127 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13128 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13132 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13133 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13134 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13135 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13136 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13137 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13138 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13142 /* toggle speaker-output according to the hp-jack state */
13143 static void alc269_speaker_automute(struct hda_codec *codec)
13145 unsigned int present;
13146 unsigned char bits;
13148 present = snd_hda_codec_read(codec, 0x15, 0,
13149 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13150 bits = present ? AMP_IN_MUTE(0) : 0;
13151 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13152 AMP_IN_MUTE(0), bits);
13153 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13154 AMP_IN_MUTE(0), bits);
13157 /* unsolicited event for HP jack sensing */
13158 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13161 switch (res >> 26) {
13162 case ALC880_HP_EVENT:
13163 alc269_speaker_automute(codec);
13165 case ALC880_MIC_EVENT:
13166 alc_mic_automute(codec);
13171 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13173 struct alc_spec *spec = codec->spec;
13174 spec->ext_mic.pin = 0x18;
13175 spec->ext_mic.mux_idx = 0;
13176 spec->int_mic.pin = 0x12;
13177 spec->int_mic.mux_idx = 5;
13178 spec->auto_mic = 1;
13181 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13183 struct alc_spec *spec = codec->spec;
13184 spec->ext_mic.pin = 0x18;
13185 spec->ext_mic.mux_idx = 0;
13186 spec->int_mic.pin = 0x19;
13187 spec->int_mic.mux_idx = 1;
13188 spec->auto_mic = 1;
13191 static void alc269_eeepc_inithook(struct hda_codec *codec)
13193 alc269_speaker_automute(codec);
13194 alc_mic_automute(codec);
13198 * generic initialization of ADC, input mixers and output mixers
13200 static struct hda_verb alc269_init_verbs[] = {
13202 * Unmute ADC0 and set the default input to mic-in
13204 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13206 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13207 * analog-loopback mixer widget
13208 * Note: PASD motherboards uses the Line In 2 as the input for
13209 * front panel mic (mic 2)
13211 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13212 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13213 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13214 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13215 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13219 * Set up output mixers (0x0c - 0x0e)
13221 /* set vol=0 to output mixers */
13222 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13223 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13225 /* set up input amps for analog loopback */
13226 /* Amp Indices: DAC = 0, mixer = 1 */
13227 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13229 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13230 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13231 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13232 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13236 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13237 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13238 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13239 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13240 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13242 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13244 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13245 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13246 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13247 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13248 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13250 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13251 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13253 /* FIXME: use matrix-type input source selection */
13254 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13255 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13256 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13257 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13258 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13259 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13262 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13263 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13267 #define alc269_auto_create_multi_out_ctls \
13268 alc268_auto_create_multi_out_ctls
13269 #define alc269_auto_create_input_ctls \
13270 alc268_auto_create_input_ctls
13272 #ifdef CONFIG_SND_HDA_POWER_SAVE
13273 #define alc269_loopbacks alc880_loopbacks
13276 /* pcm configuration: identical with ALC880 */
13277 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13278 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13279 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13280 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13282 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13286 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13287 /* NID is set in alc_build_pcms */
13289 .open = alc880_playback_pcm_open,
13290 .prepare = alc880_playback_pcm_prepare,
13291 .cleanup = alc880_playback_pcm_cleanup
13295 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13299 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13300 /* NID is set in alc_build_pcms */
13304 * BIOS auto configuration
13306 static int alc269_parse_auto_config(struct hda_codec *codec)
13308 struct alc_spec *spec = codec->spec;
13310 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13312 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13317 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13320 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13324 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13326 if (spec->autocfg.dig_outs)
13327 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13329 if (spec->kctls.list)
13330 add_mixer(spec, spec->kctls.list);
13332 add_verb(spec, alc269_init_verbs);
13333 spec->num_mux_defs = 1;
13334 spec->input_mux = &spec->private_imux[0];
13335 /* set default input source */
13336 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13337 0, AC_VERB_SET_CONNECT_SEL,
13338 spec->input_mux->items[0].index);
13340 err = alc_auto_add_mic_boost(codec);
13344 if (!spec->cap_mixer && !spec->no_analog)
13345 set_capture_mixer(codec);
13347 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13352 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13353 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13354 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13357 /* init callback for auto-configuration model -- overriding the default init */
13358 static void alc269_auto_init(struct hda_codec *codec)
13360 struct alc_spec *spec = codec->spec;
13361 alc269_auto_init_multi_out(codec);
13362 alc269_auto_init_hp_out(codec);
13363 alc269_auto_init_analog_input(codec);
13364 if (spec->unsol_event)
13365 alc_inithook(codec);
13369 * configuration and preset
13371 static const char *alc269_models[ALC269_MODEL_LAST] = {
13372 [ALC269_BASIC] = "basic",
13373 [ALC269_QUANTA_FL1] = "quanta",
13374 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13375 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13376 [ALC269_FUJITSU] = "fujitsu",
13377 [ALC269_LIFEBOOK] = "lifebook",
13378 [ALC269_AUTO] = "auto",
13381 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13382 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13383 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13384 ALC269_ASUS_EEEPC_P703),
13385 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13386 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13387 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13388 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13389 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13390 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13391 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13392 ALC269_ASUS_EEEPC_P901),
13393 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13394 ALC269_ASUS_EEEPC_P901),
13395 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13396 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13397 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13401 static struct alc_config_preset alc269_presets[] = {
13403 .mixers = { alc269_base_mixer },
13404 .init_verbs = { alc269_init_verbs },
13405 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13406 .dac_nids = alc269_dac_nids,
13408 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13409 .channel_mode = alc269_modes,
13410 .input_mux = &alc269_capture_source,
13412 [ALC269_QUANTA_FL1] = {
13413 .mixers = { alc269_quanta_fl1_mixer },
13414 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13415 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13416 .dac_nids = alc269_dac_nids,
13418 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13419 .channel_mode = alc269_modes,
13420 .input_mux = &alc269_capture_source,
13421 .unsol_event = alc269_quanta_fl1_unsol_event,
13422 .setup = alc269_quanta_fl1_setup,
13423 .init_hook = alc269_quanta_fl1_init_hook,
13425 [ALC269_ASUS_EEEPC_P703] = {
13426 .mixers = { alc269_eeepc_mixer },
13427 .cap_mixer = alc269_epc_capture_mixer,
13428 .init_verbs = { alc269_init_verbs,
13429 alc269_eeepc_amic_init_verbs },
13430 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13431 .dac_nids = alc269_dac_nids,
13433 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13434 .channel_mode = alc269_modes,
13435 .unsol_event = alc269_eeepc_unsol_event,
13436 .setup = alc269_eeepc_amic_setup,
13437 .init_hook = alc269_eeepc_inithook,
13439 [ALC269_ASUS_EEEPC_P901] = {
13440 .mixers = { alc269_eeepc_mixer },
13441 .cap_mixer = alc269_epc_capture_mixer,
13442 .init_verbs = { alc269_init_verbs,
13443 alc269_eeepc_dmic_init_verbs },
13444 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13445 .dac_nids = alc269_dac_nids,
13447 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13448 .channel_mode = alc269_modes,
13449 .unsol_event = alc269_eeepc_unsol_event,
13450 .setup = alc269_eeepc_dmic_setup,
13451 .init_hook = alc269_eeepc_inithook,
13453 [ALC269_FUJITSU] = {
13454 .mixers = { alc269_fujitsu_mixer },
13455 .cap_mixer = alc269_epc_capture_mixer,
13456 .init_verbs = { alc269_init_verbs,
13457 alc269_eeepc_dmic_init_verbs },
13458 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13459 .dac_nids = alc269_dac_nids,
13461 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13462 .channel_mode = alc269_modes,
13463 .unsol_event = alc269_eeepc_unsol_event,
13464 .setup = alc269_eeepc_dmic_setup,
13465 .init_hook = alc269_eeepc_inithook,
13467 [ALC269_LIFEBOOK] = {
13468 .mixers = { alc269_lifebook_mixer },
13469 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13470 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13471 .dac_nids = alc269_dac_nids,
13473 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13474 .channel_mode = alc269_modes,
13475 .input_mux = &alc269_capture_source,
13476 .unsol_event = alc269_lifebook_unsol_event,
13477 .init_hook = alc269_lifebook_init_hook,
13481 static int patch_alc269(struct hda_codec *codec)
13483 struct alc_spec *spec;
13487 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13491 codec->spec = spec;
13493 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13495 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13499 if (board_config < 0) {
13500 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13502 board_config = ALC269_AUTO;
13505 if (board_config == ALC269_AUTO) {
13506 /* automatic parse from the BIOS config */
13507 err = alc269_parse_auto_config(codec);
13513 "hda_codec: Cannot set up configuration "
13514 "from BIOS. Using base mode...\n");
13515 board_config = ALC269_BASIC;
13519 err = snd_hda_attach_beep_device(codec, 0x1);
13525 if (board_config != ALC269_AUTO)
13526 setup_preset(codec, &alc269_presets[board_config]);
13528 if (codec->subsystem_id == 0x17aa3bf8) {
13529 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13530 * fix the sample rate of analog I/O to 44.1kHz
13532 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13533 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13535 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13536 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13538 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13539 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13541 spec->adc_nids = alc269_adc_nids;
13542 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13543 spec->capsrc_nids = alc269_capsrc_nids;
13544 if (!spec->cap_mixer)
13545 set_capture_mixer(codec);
13546 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13548 spec->vmaster_nid = 0x02;
13550 codec->patch_ops = alc_patch_ops;
13551 if (board_config == ALC269_AUTO)
13552 spec->init_hook = alc269_auto_init;
13553 #ifdef CONFIG_SND_HDA_POWER_SAVE
13554 if (!spec->loopback.amplist)
13555 spec->loopback.amplist = alc269_loopbacks;
13557 codec->proc_widget_hook = print_realtek_coef;
13563 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13567 * set the path ways for 2 channel output
13568 * need to set the codec line out and mic 1 pin widgets to inputs
13570 static struct hda_verb alc861_threestack_ch2_init[] = {
13571 /* set pin widget 1Ah (line in) for input */
13572 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13573 /* set pin widget 18h (mic1/2) for input, for mic also enable
13576 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13578 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13580 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13581 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13587 * need to set the codec line out and mic 1 pin widgets to outputs
13589 static struct hda_verb alc861_threestack_ch6_init[] = {
13590 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13591 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13592 /* set pin widget 18h (mic1) for output (CLFE)*/
13593 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13595 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13596 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13598 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13600 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13601 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13606 static struct hda_channel_mode alc861_threestack_modes[2] = {
13607 { 2, alc861_threestack_ch2_init },
13608 { 6, alc861_threestack_ch6_init },
13610 /* Set mic1 as input and unmute the mixer */
13611 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13612 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13613 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13616 /* Set mic1 as output and mute mixer */
13617 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13618 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13619 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13623 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13624 { 2, alc861_uniwill_m31_ch2_init },
13625 { 4, alc861_uniwill_m31_ch4_init },
13628 /* Set mic1 and line-in as input and unmute the mixer */
13629 static struct hda_verb alc861_asus_ch2_init[] = {
13630 /* set pin widget 1Ah (line in) for input */
13631 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13632 /* set pin widget 18h (mic1/2) for input, for mic also enable
13635 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13637 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13639 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13640 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13644 /* Set mic1 nad line-in as output and mute mixer */
13645 static struct hda_verb alc861_asus_ch6_init[] = {
13646 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13647 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13648 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13649 /* set pin widget 18h (mic1) for output (CLFE)*/
13650 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13651 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13652 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13653 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13655 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13657 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13658 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13663 static struct hda_channel_mode alc861_asus_modes[2] = {
13664 { 2, alc861_asus_ch2_init },
13665 { 6, alc861_asus_ch6_init },
13670 static struct snd_kcontrol_new alc861_base_mixer[] = {
13671 /* output mixer control */
13672 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13673 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13674 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13675 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13676 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13678 /*Input mixer control */
13679 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13680 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13681 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13682 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13683 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13684 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13686 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13687 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13688 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13693 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13694 /* output mixer control */
13695 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13696 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13697 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13698 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13699 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13701 /* Input mixer control */
13702 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13703 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13704 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13705 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13706 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13707 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13709 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13710 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13711 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13714 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13715 .name = "Channel Mode",
13716 .info = alc_ch_mode_info,
13717 .get = alc_ch_mode_get,
13718 .put = alc_ch_mode_put,
13719 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13724 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13725 /* output mixer control */
13726 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13727 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13728 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13733 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13734 /* output mixer control */
13735 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13736 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13737 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13738 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13739 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13741 /* Input mixer control */
13742 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13743 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13744 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13745 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13746 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13747 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13749 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13750 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13751 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13754 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13755 .name = "Channel Mode",
13756 .info = alc_ch_mode_info,
13757 .get = alc_ch_mode_get,
13758 .put = alc_ch_mode_put,
13759 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13764 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13765 /* output mixer control */
13766 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13767 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13768 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13769 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13770 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13772 /* Input mixer control */
13773 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13774 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13775 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13776 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13777 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13778 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13780 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13781 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13782 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13785 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13786 .name = "Channel Mode",
13787 .info = alc_ch_mode_info,
13788 .get = alc_ch_mode_get,
13789 .put = alc_ch_mode_put,
13790 .private_value = ARRAY_SIZE(alc861_asus_modes),
13795 /* additional mixer */
13796 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13797 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13798 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13803 * generic initialization of ADC, input mixers and output mixers
13805 static struct hda_verb alc861_base_init_verbs[] = {
13807 * Unmute ADC0 and set the default input to mic-in
13809 /* port-A for surround (rear panel) */
13810 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13811 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13812 /* port-B for mic-in (rear panel) with vref */
13813 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13814 /* port-C for line-in (rear panel) */
13815 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13816 /* port-D for Front */
13817 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13818 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13819 /* port-E for HP out (front panel) */
13820 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13821 /* route front PCM to HP */
13822 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13823 /* port-F for mic-in (front panel) with vref */
13824 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13825 /* port-G for CLFE (rear panel) */
13826 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13827 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13828 /* port-H for side (rear panel) */
13829 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13830 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13832 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13833 /* route front mic to ADC1*/
13834 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13835 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13837 /* Unmute DAC0~3 & spdif out*/
13838 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13839 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13840 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13841 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13844 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13845 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13846 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13847 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13848 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13850 /* Unmute Stereo Mixer 15 */
13851 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13852 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13853 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13856 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13857 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13858 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13859 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13860 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13861 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13862 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13863 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13864 /* hp used DAC 3 (Front) */
13865 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13866 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13871 static struct hda_verb alc861_threestack_init_verbs[] = {
13873 * Unmute ADC0 and set the default input to mic-in
13875 /* port-A for surround (rear panel) */
13876 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13877 /* port-B for mic-in (rear panel) with vref */
13878 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13879 /* port-C for line-in (rear panel) */
13880 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13881 /* port-D for Front */
13882 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13883 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13884 /* port-E for HP out (front panel) */
13885 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13886 /* route front PCM to HP */
13887 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13888 /* port-F for mic-in (front panel) with vref */
13889 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13890 /* port-G for CLFE (rear panel) */
13891 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13892 /* port-H for side (rear panel) */
13893 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13895 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13896 /* route front mic to ADC1*/
13897 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13898 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13899 /* Unmute DAC0~3 & spdif out*/
13900 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13901 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13902 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13903 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13906 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13907 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13908 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13909 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13910 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13912 /* Unmute Stereo Mixer 15 */
13913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13914 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13915 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13916 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13918 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13919 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13920 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13921 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13922 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13923 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13924 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13925 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13926 /* hp used DAC 3 (Front) */
13927 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13928 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13932 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13934 * Unmute ADC0 and set the default input to mic-in
13936 /* port-A for surround (rear panel) */
13937 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13938 /* port-B for mic-in (rear panel) with vref */
13939 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13940 /* port-C for line-in (rear panel) */
13941 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13942 /* port-D for Front */
13943 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13944 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13945 /* port-E for HP out (front panel) */
13946 /* this has to be set to VREF80 */
13947 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13948 /* route front PCM to HP */
13949 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13950 /* port-F for mic-in (front panel) with vref */
13951 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13952 /* port-G for CLFE (rear panel) */
13953 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13954 /* port-H for side (rear panel) */
13955 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13957 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13958 /* route front mic to ADC1*/
13959 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13960 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13961 /* Unmute DAC0~3 & spdif out*/
13962 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13963 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13964 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13965 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13968 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13969 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13970 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13971 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13972 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13974 /* Unmute Stereo Mixer 15 */
13975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13977 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13978 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13980 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13981 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13982 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13983 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13984 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13985 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13986 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13987 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13988 /* hp used DAC 3 (Front) */
13989 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13990 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13994 static struct hda_verb alc861_asus_init_verbs[] = {
13996 * Unmute ADC0 and set the default input to mic-in
13998 /* port-A for surround (rear panel)
13999 * according to codec#0 this is the HP jack
14001 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14002 /* route front PCM to HP */
14003 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14004 /* port-B for mic-in (rear panel) with vref */
14005 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14006 /* port-C for line-in (rear panel) */
14007 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14008 /* port-D for Front */
14009 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14010 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14011 /* port-E for HP out (front panel) */
14012 /* this has to be set to VREF80 */
14013 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14014 /* route front PCM to HP */
14015 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14016 /* port-F for mic-in (front panel) with vref */
14017 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14018 /* port-G for CLFE (rear panel) */
14019 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14020 /* port-H for side (rear panel) */
14021 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14023 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14024 /* route front mic to ADC1*/
14025 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14026 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14027 /* Unmute DAC0~3 & spdif out*/
14028 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14029 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14030 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14031 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14033 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14034 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14035 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14036 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14037 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14039 /* Unmute Stereo Mixer 15 */
14040 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14042 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14043 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14045 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14046 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14047 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14048 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14049 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14050 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14051 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14052 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14053 /* hp used DAC 3 (Front) */
14054 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14055 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14059 /* additional init verbs for ASUS laptops */
14060 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14061 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14062 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14067 * generic initialization of ADC, input mixers and output mixers
14069 static struct hda_verb alc861_auto_init_verbs[] = {
14071 * Unmute ADC0 and set the default input to mic-in
14073 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14074 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14076 /* Unmute DAC0~3 & spdif out*/
14077 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14078 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14079 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14080 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14083 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14084 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14085 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14086 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14087 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14089 /* Unmute Stereo Mixer 15 */
14090 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14092 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14093 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14095 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14096 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14097 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14098 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14099 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14100 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14101 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14102 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14104 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14105 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14106 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14107 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14108 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14109 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14110 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14111 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14113 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14118 static struct hda_verb alc861_toshiba_init_verbs[] = {
14119 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14124 /* toggle speaker-output according to the hp-jack state */
14125 static void alc861_toshiba_automute(struct hda_codec *codec)
14127 unsigned int present;
14129 present = snd_hda_codec_read(codec, 0x0f, 0,
14130 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14131 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14132 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14133 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14134 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14137 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14140 if ((res >> 26) == ALC880_HP_EVENT)
14141 alc861_toshiba_automute(codec);
14144 /* pcm configuration: identical with ALC880 */
14145 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14146 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14147 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14148 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14151 #define ALC861_DIGOUT_NID 0x07
14153 static struct hda_channel_mode alc861_8ch_modes[1] = {
14157 static hda_nid_t alc861_dac_nids[4] = {
14158 /* front, surround, clfe, side */
14159 0x03, 0x06, 0x05, 0x04
14162 static hda_nid_t alc660_dac_nids[3] = {
14163 /* front, clfe, surround */
14167 static hda_nid_t alc861_adc_nids[1] = {
14172 static struct hda_input_mux alc861_capture_source = {
14176 { "Front Mic", 0x3 },
14183 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14185 struct alc_spec *spec = codec->spec;
14186 hda_nid_t mix, srcs[5];
14189 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14191 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14194 for (i = 0; i < num; i++) {
14196 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14197 if (type != AC_WID_AUD_OUT)
14199 for (j = 0; j < spec->multiout.num_dacs; j++)
14200 if (spec->multiout.dac_nids[j] == srcs[i])
14202 if (j >= spec->multiout.num_dacs)
14208 /* fill in the dac_nids table from the parsed pin configuration */
14209 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14210 const struct auto_pin_cfg *cfg)
14212 struct alc_spec *spec = codec->spec;
14214 hda_nid_t nid, dac;
14216 spec->multiout.dac_nids = spec->private_dac_nids;
14217 for (i = 0; i < cfg->line_outs; i++) {
14218 nid = cfg->line_out_pins[i];
14219 dac = alc861_look_for_dac(codec, nid);
14222 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14227 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14228 hda_nid_t nid, unsigned int chs)
14230 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14231 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14234 /* add playback controls from the parsed DAC table */
14235 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14236 const struct auto_pin_cfg *cfg)
14238 struct alc_spec *spec = codec->spec;
14239 static const char *chname[4] = {
14240 "Front", "Surround", NULL /*CLFE*/, "Side"
14245 if (cfg->line_outs == 1) {
14246 const char *pfx = NULL;
14249 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14252 nid = spec->multiout.dac_nids[0];
14253 return alc861_create_out_sw(codec, pfx, nid, 3);
14257 for (i = 0; i < cfg->line_outs; i++) {
14258 nid = spec->multiout.dac_nids[i];
14263 err = alc861_create_out_sw(codec, "Center", nid, 1);
14266 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14270 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14278 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14280 struct alc_spec *spec = codec->spec;
14287 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14288 nid = alc861_look_for_dac(codec, pin);
14290 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14293 spec->multiout.hp_nid = nid;
14299 /* create playback/capture controls for input pins */
14300 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14301 const struct auto_pin_cfg *cfg)
14303 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14306 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14308 int pin_type, hda_nid_t dac)
14310 hda_nid_t mix, srcs[5];
14313 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14315 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14317 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14319 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14322 for (i = 0; i < num; i++) {
14324 if (srcs[i] == dac || srcs[i] == 0x15)
14325 mute = AMP_IN_UNMUTE(i);
14327 mute = AMP_IN_MUTE(i);
14328 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14333 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14335 struct alc_spec *spec = codec->spec;
14338 for (i = 0; i < spec->autocfg.line_outs; i++) {
14339 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14340 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14342 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14343 spec->multiout.dac_nids[i]);
14347 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14349 struct alc_spec *spec = codec->spec;
14352 pin = spec->autocfg.hp_pins[0];
14354 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14355 spec->multiout.hp_nid);
14356 pin = spec->autocfg.speaker_pins[0];
14358 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14359 spec->multiout.dac_nids[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(codec, &spec->autocfg);
14394 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14397 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14400 err = alc861_auto_create_input_ctls(codec, &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(codec);
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: %s: BIOS auto-probing.\n",
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(codec, &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_setup(struct hda_codec *codec)
15043 struct alc_spec *spec = codec->spec;
15044 spec->autocfg.hp_pins[0] = 0x1b;
15045 spec->autocfg.speaker_pins[0] = 0x14;
15048 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15050 alc_automute_amp(codec);
15051 alc861vd_lenovo_mic_automute(codec);
15054 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15057 switch (res >> 26) {
15058 case ALC880_MIC_EVENT:
15059 alc861vd_lenovo_mic_automute(codec);
15062 alc_automute_amp_unsol_event(codec, res);
15067 static struct hda_verb alc861vd_dallas_verbs[] = {
15068 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15069 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15070 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15071 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15073 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15075 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15076 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15077 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15078 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15079 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15080 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15082 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15083 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15084 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15085 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15086 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15087 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15088 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15089 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15091 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15092 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15093 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15094 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15095 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15096 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15097 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15098 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15105 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15106 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15107 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15112 /* toggle speaker-output according to the hp-jack state */
15113 static void alc861vd_dallas_setup(struct hda_codec *codec)
15115 struct alc_spec *spec = codec->spec;
15117 spec->autocfg.hp_pins[0] = 0x15;
15118 spec->autocfg.speaker_pins[0] = 0x14;
15121 #ifdef CONFIG_SND_HDA_POWER_SAVE
15122 #define alc861vd_loopbacks alc880_loopbacks
15125 /* pcm configuration: identical with ALC880 */
15126 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15127 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15128 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15129 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15132 * configuration and preset
15134 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15135 [ALC660VD_3ST] = "3stack-660",
15136 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15137 [ALC660VD_ASUS_V1S] = "asus-v1s",
15138 [ALC861VD_3ST] = "3stack",
15139 [ALC861VD_3ST_DIG] = "3stack-digout",
15140 [ALC861VD_6ST_DIG] = "6stack-digout",
15141 [ALC861VD_LENOVO] = "lenovo",
15142 [ALC861VD_DALLAS] = "dallas",
15143 [ALC861VD_HP] = "hp",
15144 [ALC861VD_AUTO] = "auto",
15147 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15148 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15149 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15150 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15151 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15152 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15153 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15154 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15155 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15156 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15157 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15158 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15159 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15160 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15161 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15162 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15166 static struct alc_config_preset alc861vd_presets[] = {
15168 .mixers = { alc861vd_3st_mixer },
15169 .init_verbs = { alc861vd_volume_init_verbs,
15170 alc861vd_3stack_init_verbs },
15171 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15172 .dac_nids = alc660vd_dac_nids,
15173 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15174 .channel_mode = alc861vd_3stack_2ch_modes,
15175 .input_mux = &alc861vd_capture_source,
15177 [ALC660VD_3ST_DIG] = {
15178 .mixers = { alc861vd_3st_mixer },
15179 .init_verbs = { alc861vd_volume_init_verbs,
15180 alc861vd_3stack_init_verbs },
15181 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15182 .dac_nids = alc660vd_dac_nids,
15183 .dig_out_nid = ALC861VD_DIGOUT_NID,
15184 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15185 .channel_mode = alc861vd_3stack_2ch_modes,
15186 .input_mux = &alc861vd_capture_source,
15189 .mixers = { alc861vd_3st_mixer },
15190 .init_verbs = { alc861vd_volume_init_verbs,
15191 alc861vd_3stack_init_verbs },
15192 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15193 .dac_nids = alc861vd_dac_nids,
15194 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15195 .channel_mode = alc861vd_3stack_2ch_modes,
15196 .input_mux = &alc861vd_capture_source,
15198 [ALC861VD_3ST_DIG] = {
15199 .mixers = { alc861vd_3st_mixer },
15200 .init_verbs = { alc861vd_volume_init_verbs,
15201 alc861vd_3stack_init_verbs },
15202 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15203 .dac_nids = alc861vd_dac_nids,
15204 .dig_out_nid = ALC861VD_DIGOUT_NID,
15205 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15206 .channel_mode = alc861vd_3stack_2ch_modes,
15207 .input_mux = &alc861vd_capture_source,
15209 [ALC861VD_6ST_DIG] = {
15210 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15211 .init_verbs = { alc861vd_volume_init_verbs,
15212 alc861vd_6stack_init_verbs },
15213 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15214 .dac_nids = alc861vd_dac_nids,
15215 .dig_out_nid = ALC861VD_DIGOUT_NID,
15216 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15217 .channel_mode = alc861vd_6stack_modes,
15218 .input_mux = &alc861vd_capture_source,
15220 [ALC861VD_LENOVO] = {
15221 .mixers = { alc861vd_lenovo_mixer },
15222 .init_verbs = { alc861vd_volume_init_verbs,
15223 alc861vd_3stack_init_verbs,
15224 alc861vd_eapd_verbs,
15225 alc861vd_lenovo_unsol_verbs },
15226 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15227 .dac_nids = alc660vd_dac_nids,
15228 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15229 .channel_mode = alc861vd_3stack_2ch_modes,
15230 .input_mux = &alc861vd_capture_source,
15231 .unsol_event = alc861vd_lenovo_unsol_event,
15232 .setup = alc861vd_lenovo_setup,
15233 .init_hook = alc861vd_lenovo_init_hook,
15235 [ALC861VD_DALLAS] = {
15236 .mixers = { alc861vd_dallas_mixer },
15237 .init_verbs = { alc861vd_dallas_verbs },
15238 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15239 .dac_nids = alc861vd_dac_nids,
15240 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15241 .channel_mode = alc861vd_3stack_2ch_modes,
15242 .input_mux = &alc861vd_dallas_capture_source,
15243 .unsol_event = alc_automute_amp_unsol_event,
15244 .setup = alc861vd_dallas_setup,
15245 .init_hook = alc_automute_amp,
15248 .mixers = { alc861vd_hp_mixer },
15249 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15250 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15251 .dac_nids = alc861vd_dac_nids,
15252 .dig_out_nid = ALC861VD_DIGOUT_NID,
15253 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15254 .channel_mode = alc861vd_3stack_2ch_modes,
15255 .input_mux = &alc861vd_hp_capture_source,
15256 .unsol_event = alc_automute_amp_unsol_event,
15257 .setup = alc861vd_dallas_setup,
15258 .init_hook = alc_automute_amp,
15260 [ALC660VD_ASUS_V1S] = {
15261 .mixers = { alc861vd_lenovo_mixer },
15262 .init_verbs = { alc861vd_volume_init_verbs,
15263 alc861vd_3stack_init_verbs,
15264 alc861vd_eapd_verbs,
15265 alc861vd_lenovo_unsol_verbs },
15266 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15267 .dac_nids = alc660vd_dac_nids,
15268 .dig_out_nid = ALC861VD_DIGOUT_NID,
15269 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15270 .channel_mode = alc861vd_3stack_2ch_modes,
15271 .input_mux = &alc861vd_capture_source,
15272 .unsol_event = alc861vd_lenovo_unsol_event,
15273 .setup = alc861vd_lenovo_setup,
15274 .init_hook = alc861vd_lenovo_init_hook,
15279 * BIOS auto configuration
15281 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15282 const struct auto_pin_cfg *cfg)
15284 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15288 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15289 hda_nid_t nid, int pin_type, int dac_idx)
15291 alc_set_pin_output(codec, nid, pin_type);
15294 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15296 struct alc_spec *spec = codec->spec;
15299 for (i = 0; i <= HDA_SIDE; i++) {
15300 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15301 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15303 alc861vd_auto_set_output_and_unmute(codec, nid,
15309 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15311 struct alc_spec *spec = codec->spec;
15314 pin = spec->autocfg.hp_pins[0];
15315 if (pin) /* connect to front and use dac 0 */
15316 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15317 pin = spec->autocfg.speaker_pins[0];
15319 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15322 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15324 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15326 struct alc_spec *spec = codec->spec;
15329 for (i = 0; i < AUTO_PIN_LAST; i++) {
15330 hda_nid_t nid = spec->autocfg.input_pins[i];
15331 if (alc_is_input_pin(codec, nid)) {
15332 alc_set_input_pin(codec, nid, i);
15333 if (nid != ALC861VD_PIN_CD_NID &&
15334 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15335 snd_hda_codec_write(codec, nid, 0,
15336 AC_VERB_SET_AMP_GAIN_MUTE,
15342 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15344 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15345 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15347 /* add playback controls from the parsed DAC table */
15348 /* Based on ALC880 version. But ALC861VD has separate,
15349 * different NIDs for mute/unmute switch and volume control */
15350 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15351 const struct auto_pin_cfg *cfg)
15353 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15354 hda_nid_t nid_v, nid_s;
15357 for (i = 0; i < cfg->line_outs; i++) {
15358 if (!spec->multiout.dac_nids[i])
15360 nid_v = alc861vd_idx_to_mixer_vol(
15362 spec->multiout.dac_nids[i]));
15363 nid_s = alc861vd_idx_to_mixer_switch(
15365 spec->multiout.dac_nids[i]));
15369 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15371 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15375 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15377 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15381 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15383 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15387 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15389 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15395 if (cfg->line_outs == 1 &&
15396 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15403 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15404 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15408 if (cfg->line_outs == 1 &&
15409 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15411 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15412 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15421 /* add playback controls for speaker and HP outputs */
15422 /* Based on ALC880 version. But ALC861VD has separate,
15423 * different NIDs for mute/unmute switch and volume control */
15424 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15425 hda_nid_t pin, const char *pfx)
15427 hda_nid_t nid_v, nid_s;
15433 if (alc880_is_fixed_pin(pin)) {
15434 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15435 /* specify the DAC as the extra output */
15436 if (!spec->multiout.hp_nid)
15437 spec->multiout.hp_nid = nid_v;
15439 spec->multiout.extra_out_nid[0] = nid_v;
15440 /* control HP volume/switch on the output mixer amp */
15441 nid_v = alc861vd_idx_to_mixer_vol(
15442 alc880_fixed_pin_idx(pin));
15443 nid_s = alc861vd_idx_to_mixer_switch(
15444 alc880_fixed_pin_idx(pin));
15446 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15447 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15450 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15451 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15454 } else if (alc880_is_multi_pin(pin)) {
15455 /* set manual connection */
15456 /* we have only a switch on HP-out PIN */
15457 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15458 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15465 /* parse the BIOS configuration and set up the alc_spec
15466 * return 1 if successful, 0 if the proper config is not found,
15467 * or a negative error code
15468 * Based on ALC880 version - had to change it to override
15469 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15470 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15472 struct alc_spec *spec = codec->spec;
15474 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15476 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15480 if (!spec->autocfg.line_outs)
15481 return 0; /* can't find valid BIOS pin config */
15483 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15486 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15489 err = alc861vd_auto_create_extra_out(spec,
15490 spec->autocfg.speaker_pins[0],
15494 err = alc861vd_auto_create_extra_out(spec,
15495 spec->autocfg.hp_pins[0],
15499 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15503 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15505 if (spec->autocfg.dig_outs)
15506 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15508 if (spec->kctls.list)
15509 add_mixer(spec, spec->kctls.list);
15511 add_verb(spec, alc861vd_volume_init_verbs);
15513 spec->num_mux_defs = 1;
15514 spec->input_mux = &spec->private_imux[0];
15516 err = alc_auto_add_mic_boost(codec);
15520 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15525 /* additional initialization for auto-configuration model */
15526 static void alc861vd_auto_init(struct hda_codec *codec)
15528 struct alc_spec *spec = codec->spec;
15529 alc861vd_auto_init_multi_out(codec);
15530 alc861vd_auto_init_hp_out(codec);
15531 alc861vd_auto_init_analog_input(codec);
15532 alc861vd_auto_init_input_src(codec);
15533 if (spec->unsol_event)
15534 alc_inithook(codec);
15537 static int patch_alc861vd(struct hda_codec *codec)
15539 struct alc_spec *spec;
15540 int err, board_config;
15542 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15546 codec->spec = spec;
15548 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15552 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15553 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15555 board_config = ALC861VD_AUTO;
15558 if (board_config == ALC861VD_AUTO) {
15559 /* automatic parse from the BIOS config */
15560 err = alc861vd_parse_auto_config(codec);
15566 "hda_codec: Cannot set up configuration "
15567 "from BIOS. Using base mode...\n");
15568 board_config = ALC861VD_3ST;
15572 err = snd_hda_attach_beep_device(codec, 0x23);
15578 if (board_config != ALC861VD_AUTO)
15579 setup_preset(codec, &alc861vd_presets[board_config]);
15581 if (codec->vendor_id == 0x10ec0660) {
15582 /* always turn on EAPD */
15583 add_verb(spec, alc660vd_eapd_verbs);
15586 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15587 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15589 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15590 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15592 if (!spec->adc_nids) {
15593 spec->adc_nids = alc861vd_adc_nids;
15594 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15596 if (!spec->capsrc_nids)
15597 spec->capsrc_nids = alc861vd_capsrc_nids;
15599 set_capture_mixer(codec);
15600 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15602 spec->vmaster_nid = 0x02;
15604 codec->patch_ops = alc_patch_ops;
15606 if (board_config == ALC861VD_AUTO)
15607 spec->init_hook = alc861vd_auto_init;
15608 #ifdef CONFIG_SND_HDA_POWER_SAVE
15609 if (!spec->loopback.amplist)
15610 spec->loopback.amplist = alc861vd_loopbacks;
15612 codec->proc_widget_hook = print_realtek_coef;
15620 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15621 * configuration. Each pin widget can choose any input DACs and a mixer.
15622 * Each ADC is connected from a mixer of all inputs. This makes possible
15623 * 6-channel independent captures.
15625 * In addition, an independent DAC for the multi-playback (not used in this
15628 #define ALC662_DIGOUT_NID 0x06
15629 #define ALC662_DIGIN_NID 0x0a
15631 static hda_nid_t alc662_dac_nids[4] = {
15632 /* front, rear, clfe, rear_surr */
15636 static hda_nid_t alc272_dac_nids[2] = {
15640 static hda_nid_t alc662_adc_nids[2] = {
15645 static hda_nid_t alc272_adc_nids[1] = {
15650 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15651 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15655 /* FIXME: should be a matrix-type input source selection */
15656 static struct hda_input_mux alc662_capture_source = {
15660 { "Front Mic", 0x1 },
15666 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15674 static struct hda_input_mux alc663_capture_source = {
15678 { "Front Mic", 0x1 },
15683 #if 0 /* set to 1 for testing other input sources below */
15684 static struct hda_input_mux alc272_nc10_capture_source = {
15687 { "Autoselect Mic", 0x0 },
15688 { "Internal Mic", 0x1 },
15689 { "In-0x02", 0x2 },
15690 { "In-0x03", 0x3 },
15691 { "In-0x04", 0x4 },
15692 { "In-0x05", 0x5 },
15693 { "In-0x06", 0x6 },
15694 { "In-0x07", 0x7 },
15695 { "In-0x08", 0x8 },
15696 { "In-0x09", 0x9 },
15697 { "In-0x0a", 0x0a },
15698 { "In-0x0b", 0x0b },
15699 { "In-0x0c", 0x0c },
15700 { "In-0x0d", 0x0d },
15701 { "In-0x0e", 0x0e },
15702 { "In-0x0f", 0x0f },
15710 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15717 static struct hda_verb alc662_3ST_ch2_init[] = {
15718 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15719 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15720 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15721 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15728 static struct hda_verb alc662_3ST_ch6_init[] = {
15729 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15730 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15731 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15732 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15733 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15734 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15738 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15739 { 2, alc662_3ST_ch2_init },
15740 { 6, alc662_3ST_ch6_init },
15746 static struct hda_verb alc662_sixstack_ch6_init[] = {
15747 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15748 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15749 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15756 static struct hda_verb alc662_sixstack_ch8_init[] = {
15757 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15758 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15759 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15763 static struct hda_channel_mode alc662_5stack_modes[2] = {
15764 { 2, alc662_sixstack_ch6_init },
15765 { 6, alc662_sixstack_ch8_init },
15768 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15769 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15772 static struct snd_kcontrol_new alc662_base_mixer[] = {
15773 /* output mixer control */
15774 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15775 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15776 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15777 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15778 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15779 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15780 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15781 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15782 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15784 /*Input mixer control */
15785 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15786 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15787 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15788 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15789 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15790 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15791 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15792 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15796 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15797 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15798 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15799 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15800 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15801 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15802 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15803 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15805 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15806 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15807 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15811 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15812 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15813 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15814 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15815 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15816 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15817 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15818 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15819 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15820 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15821 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15822 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15823 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15824 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15825 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15826 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15827 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15828 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15832 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15833 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15834 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15835 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15836 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15837 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15838 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15839 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15840 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15841 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15845 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15846 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15847 ALC262_HIPPO_MASTER_SWITCH,
15849 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15850 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15851 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15853 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15854 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15855 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15859 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15860 ALC262_HIPPO_MASTER_SWITCH,
15861 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15862 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15863 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15864 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15865 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15866 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15867 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15868 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15869 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15873 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15874 .ops = &snd_hda_bind_vol,
15876 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15877 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15882 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15883 .ops = &snd_hda_bind_sw,
15885 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15886 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15891 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15892 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15893 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15895 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15899 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15900 .ops = &snd_hda_bind_sw,
15902 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15903 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15904 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15909 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15910 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15911 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15914 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15915 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15920 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15921 .ops = &snd_hda_bind_sw,
15923 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15924 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15925 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15930 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15931 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15932 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15933 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15934 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15935 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15936 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15940 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15941 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15942 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15943 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15944 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15945 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15946 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15947 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15951 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15952 .ops = &snd_hda_bind_vol,
15954 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15955 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15960 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15961 .ops = &snd_hda_bind_sw,
15963 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15964 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15969 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15970 HDA_BIND_VOL("Master Playback Volume",
15971 &alc663_asus_two_bind_master_vol),
15972 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15973 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15974 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15975 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15976 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15980 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15981 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15982 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15983 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15984 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15985 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15986 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15990 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15991 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15992 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15993 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15994 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15995 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15999 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16000 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16004 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16005 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16006 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16011 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16012 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16013 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16014 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16018 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16021 .name = "Channel Mode",
16022 .info = alc_ch_mode_info,
16023 .get = alc_ch_mode_get,
16024 .put = alc_ch_mode_put,
16029 static struct hda_verb alc662_init_verbs[] = {
16030 /* ADC: mute amp left and right */
16031 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16032 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16033 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16041 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16042 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16044 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16045 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16046 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16048 /* Front Pin: output 0 (0x0c) */
16049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16050 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16052 /* Rear Pin: output 1 (0x0d) */
16053 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16054 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16056 /* CLFE Pin: output 2 (0x0e) */
16057 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16058 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16060 /* Mic (rear) pin: input vref at 80% */
16061 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16062 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16063 /* Front Mic pin: input vref at 80% */
16064 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16065 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16066 /* Line In pin: input */
16067 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16068 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16069 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16070 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16071 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16072 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16073 /* CD pin widget for input */
16074 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16076 /* FIXME: use matrix-type input source selection */
16077 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16080 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16082 /* always trun on EAPD */
16083 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16084 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16089 static struct hda_verb alc662_sue_init_verbs[] = {
16090 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16091 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16095 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16096 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16097 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16101 /* Set Unsolicited Event*/
16102 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16103 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16104 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16109 * generic initialization of ADC, input mixers and output mixers
16111 static struct hda_verb alc662_auto_init_verbs[] = {
16113 * Unmute ADC and set the default input to mic-in
16115 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16116 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16118 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16120 * Note: PASD motherboards uses the Line In 2 as the input for front
16121 * panel mic (mic 2)
16123 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16124 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16125 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16126 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16131 * Set up output mixers (0x0c - 0x0f)
16133 /* set vol=0 to output mixers */
16134 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16135 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16136 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16138 /* set up input amps for analog loopback */
16139 /* Amp Indices: DAC = 0, mixer = 1 */
16140 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16141 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16142 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16143 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16144 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16145 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16148 /* FIXME: use matrix-type input source selection */
16149 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16151 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16152 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16156 /* additional verbs for ALC663 */
16157 static struct hda_verb alc663_auto_init_verbs[] = {
16158 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16159 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16163 static struct hda_verb alc663_m51va_init_verbs[] = {
16164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16165 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16166 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16167 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16168 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16169 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16170 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16171 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16172 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16176 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16177 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16178 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16179 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16180 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16181 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16182 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16183 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16187 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16188 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16189 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16190 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16191 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16194 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16195 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16199 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16202 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16205 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16206 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16210 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16211 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16212 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16213 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16214 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16215 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16216 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16217 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16220 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16221 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16222 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16226 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16227 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16228 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16229 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16230 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16231 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16232 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16233 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16234 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16235 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16236 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16237 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16238 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16242 static struct hda_verb alc663_g71v_init_verbs[] = {
16243 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16244 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16245 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16247 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16248 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16249 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16251 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16252 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16253 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16257 static struct hda_verb alc663_g50v_init_verbs[] = {
16258 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16259 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16260 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16262 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16263 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16267 static struct hda_verb alc662_ecs_init_verbs[] = {
16268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16269 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16270 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16271 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16275 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16276 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16277 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16278 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16279 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16280 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16281 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16282 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16283 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16284 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16285 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16286 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16290 static struct hda_verb alc272_dell_init_verbs[] = {
16291 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16292 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16295 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16296 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16297 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16300 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16301 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16305 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16306 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16307 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16311 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16312 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16313 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16317 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16319 unsigned int present;
16320 unsigned char bits;
16322 present = snd_hda_codec_read(codec, 0x14, 0,
16323 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16324 bits = present ? HDA_AMP_MUTE : 0;
16325 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16326 HDA_AMP_MUTE, bits);
16329 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16331 unsigned int present;
16332 unsigned char bits;
16334 present = snd_hda_codec_read(codec, 0x1b, 0,
16335 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16336 bits = present ? HDA_AMP_MUTE : 0;
16337 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16338 HDA_AMP_MUTE, bits);
16339 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16340 HDA_AMP_MUTE, bits);
16343 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16346 if ((res >> 26) == ALC880_HP_EVENT)
16347 alc662_lenovo_101e_all_automute(codec);
16348 if ((res >> 26) == ALC880_FRONT_EVENT)
16349 alc662_lenovo_101e_ispeaker_automute(codec);
16352 /* unsolicited event for HP jack sensing */
16353 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16356 if ((res >> 26) == ALC880_MIC_EVENT)
16357 alc_mic_automute(codec);
16359 alc262_hippo_unsol_event(codec, res);
16362 static void alc662_eeepc_setup(struct hda_codec *codec)
16364 struct alc_spec *spec = codec->spec;
16366 alc262_hippo1_setup(codec);
16367 spec->ext_mic.pin = 0x18;
16368 spec->ext_mic.mux_idx = 0;
16369 spec->int_mic.pin = 0x19;
16370 spec->int_mic.mux_idx = 1;
16371 spec->auto_mic = 1;
16374 static void alc662_eeepc_inithook(struct hda_codec *codec)
16376 alc262_hippo_automute(codec);
16377 alc_mic_automute(codec);
16380 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16382 struct alc_spec *spec = codec->spec;
16384 spec->autocfg.hp_pins[0] = 0x14;
16385 spec->autocfg.speaker_pins[0] = 0x1b;
16388 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16390 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16392 unsigned int present;
16393 unsigned char bits;
16395 present = snd_hda_codec_read(codec, 0x21, 0,
16396 AC_VERB_GET_PIN_SENSE, 0)
16397 & AC_PINSENSE_PRESENCE;
16398 bits = present ? HDA_AMP_MUTE : 0;
16399 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16400 AMP_IN_MUTE(0), bits);
16401 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16402 AMP_IN_MUTE(0), bits);
16405 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16407 unsigned int present;
16408 unsigned char bits;
16410 present = snd_hda_codec_read(codec, 0x21, 0,
16411 AC_VERB_GET_PIN_SENSE, 0)
16412 & AC_PINSENSE_PRESENCE;
16413 bits = present ? HDA_AMP_MUTE : 0;
16414 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16415 AMP_IN_MUTE(0), bits);
16416 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16417 AMP_IN_MUTE(0), bits);
16418 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16419 AMP_IN_MUTE(0), bits);
16420 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16421 AMP_IN_MUTE(0), bits);
16424 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16426 unsigned int present;
16427 unsigned char bits;
16429 present = snd_hda_codec_read(codec, 0x15, 0,
16430 AC_VERB_GET_PIN_SENSE, 0)
16431 & AC_PINSENSE_PRESENCE;
16432 bits = present ? HDA_AMP_MUTE : 0;
16433 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16434 AMP_IN_MUTE(0), bits);
16435 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16436 AMP_IN_MUTE(0), bits);
16437 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16438 AMP_IN_MUTE(0), bits);
16439 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16440 AMP_IN_MUTE(0), bits);
16443 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16445 unsigned int present;
16446 unsigned char bits;
16448 present = snd_hda_codec_read(codec, 0x1b, 0,
16449 AC_VERB_GET_PIN_SENSE, 0)
16450 & AC_PINSENSE_PRESENCE;
16451 bits = present ? 0 : PIN_OUT;
16452 snd_hda_codec_write(codec, 0x14, 0,
16453 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16456 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16458 unsigned int present1, present2;
16460 present1 = snd_hda_codec_read(codec, 0x21, 0,
16461 AC_VERB_GET_PIN_SENSE, 0)
16462 & AC_PINSENSE_PRESENCE;
16463 present2 = snd_hda_codec_read(codec, 0x15, 0,
16464 AC_VERB_GET_PIN_SENSE, 0)
16465 & AC_PINSENSE_PRESENCE;
16467 if (present1 || present2) {
16468 snd_hda_codec_write_cache(codec, 0x14, 0,
16469 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16471 snd_hda_codec_write_cache(codec, 0x14, 0,
16472 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16476 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16478 unsigned int present1, present2;
16480 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16481 AC_VERB_GET_PIN_SENSE, 0)
16482 & AC_PINSENSE_PRESENCE;
16483 present2 = snd_hda_codec_read(codec, 0x15, 0,
16484 AC_VERB_GET_PIN_SENSE, 0)
16485 & AC_PINSENSE_PRESENCE;
16487 if (present1 || present2) {
16488 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16489 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16490 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16491 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16493 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16494 AMP_IN_MUTE(0), 0);
16495 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16496 AMP_IN_MUTE(0), 0);
16500 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16503 switch (res >> 26) {
16504 case ALC880_HP_EVENT:
16505 alc663_m51va_speaker_automute(codec);
16507 case ALC880_MIC_EVENT:
16508 alc_mic_automute(codec);
16513 static void alc663_m51va_setup(struct hda_codec *codec)
16515 struct alc_spec *spec = codec->spec;
16516 spec->ext_mic.pin = 0x18;
16517 spec->ext_mic.mux_idx = 0;
16518 spec->int_mic.pin = 0x12;
16519 spec->int_mic.mux_idx = 1;
16520 spec->auto_mic = 1;
16523 static void alc663_m51va_inithook(struct hda_codec *codec)
16525 alc663_m51va_speaker_automute(codec);
16526 alc_mic_automute(codec);
16529 /* ***************** Mode1 ******************************/
16530 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16531 #define alc663_mode1_setup alc663_m51va_setup
16532 #define alc663_mode1_inithook alc663_m51va_inithook
16534 /* ***************** Mode2 ******************************/
16535 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16538 switch (res >> 26) {
16539 case ALC880_HP_EVENT:
16540 alc662_f5z_speaker_automute(codec);
16542 case ALC880_MIC_EVENT:
16543 alc_mic_automute(codec);
16548 #define alc662_mode2_setup alc663_m51va_setup
16550 static void alc662_mode2_inithook(struct hda_codec *codec)
16552 alc662_f5z_speaker_automute(codec);
16553 alc_mic_automute(codec);
16555 /* ***************** Mode3 ******************************/
16556 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16559 switch (res >> 26) {
16560 case ALC880_HP_EVENT:
16561 alc663_two_hp_m1_speaker_automute(codec);
16563 case ALC880_MIC_EVENT:
16564 alc_mic_automute(codec);
16569 #define alc663_mode3_setup alc663_m51va_setup
16571 static void alc663_mode3_inithook(struct hda_codec *codec)
16573 alc663_two_hp_m1_speaker_automute(codec);
16574 alc_mic_automute(codec);
16576 /* ***************** Mode4 ******************************/
16577 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16580 switch (res >> 26) {
16581 case ALC880_HP_EVENT:
16582 alc663_21jd_two_speaker_automute(codec);
16584 case ALC880_MIC_EVENT:
16585 alc_mic_automute(codec);
16590 #define alc663_mode4_setup alc663_m51va_setup
16592 static void alc663_mode4_inithook(struct hda_codec *codec)
16594 alc663_21jd_two_speaker_automute(codec);
16595 alc_mic_automute(codec);
16597 /* ***************** Mode5 ******************************/
16598 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16601 switch (res >> 26) {
16602 case ALC880_HP_EVENT:
16603 alc663_15jd_two_speaker_automute(codec);
16605 case ALC880_MIC_EVENT:
16606 alc_mic_automute(codec);
16611 #define alc663_mode5_setup alc663_m51va_setup
16613 static void alc663_mode5_inithook(struct hda_codec *codec)
16615 alc663_15jd_two_speaker_automute(codec);
16616 alc_mic_automute(codec);
16618 /* ***************** Mode6 ******************************/
16619 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16622 switch (res >> 26) {
16623 case ALC880_HP_EVENT:
16624 alc663_two_hp_m2_speaker_automute(codec);
16626 case ALC880_MIC_EVENT:
16627 alc_mic_automute(codec);
16632 #define alc663_mode6_setup alc663_m51va_setup
16634 static void alc663_mode6_inithook(struct hda_codec *codec)
16636 alc663_two_hp_m2_speaker_automute(codec);
16637 alc_mic_automute(codec);
16640 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16642 unsigned int present;
16643 unsigned char bits;
16645 present = snd_hda_codec_read(codec, 0x21, 0,
16646 AC_VERB_GET_PIN_SENSE, 0)
16647 & AC_PINSENSE_PRESENCE;
16648 bits = present ? HDA_AMP_MUTE : 0;
16649 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16650 HDA_AMP_MUTE, bits);
16651 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16652 HDA_AMP_MUTE, bits);
16655 static void alc663_g71v_front_automute(struct hda_codec *codec)
16657 unsigned int present;
16658 unsigned char bits;
16660 present = snd_hda_codec_read(codec, 0x15, 0,
16661 AC_VERB_GET_PIN_SENSE, 0)
16662 & AC_PINSENSE_PRESENCE;
16663 bits = present ? HDA_AMP_MUTE : 0;
16664 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16665 HDA_AMP_MUTE, bits);
16668 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16671 switch (res >> 26) {
16672 case ALC880_HP_EVENT:
16673 alc663_g71v_hp_automute(codec);
16675 case ALC880_FRONT_EVENT:
16676 alc663_g71v_front_automute(codec);
16678 case ALC880_MIC_EVENT:
16679 alc_mic_automute(codec);
16684 #define alc663_g71v_setup alc663_m51va_setup
16686 static void alc663_g71v_inithook(struct hda_codec *codec)
16688 alc663_g71v_front_automute(codec);
16689 alc663_g71v_hp_automute(codec);
16690 alc_mic_automute(codec);
16693 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16696 switch (res >> 26) {
16697 case ALC880_HP_EVENT:
16698 alc663_m51va_speaker_automute(codec);
16700 case ALC880_MIC_EVENT:
16701 alc_mic_automute(codec);
16706 #define alc663_g50v_setup alc663_m51va_setup
16708 static void alc663_g50v_inithook(struct hda_codec *codec)
16710 alc663_m51va_speaker_automute(codec);
16711 alc_mic_automute(codec);
16714 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16715 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16716 ALC262_HIPPO_MASTER_SWITCH,
16718 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16719 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16720 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16722 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16723 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16724 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16728 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16729 /* Master Playback automatically created from Speaker and Headphone */
16730 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16731 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16732 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16733 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16735 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16736 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16737 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16739 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16740 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16741 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16745 #ifdef CONFIG_SND_HDA_POWER_SAVE
16746 #define alc662_loopbacks alc880_loopbacks
16750 /* pcm configuration: identical with ALC880 */
16751 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16752 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16753 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16754 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16757 * configuration and preset
16759 static const char *alc662_models[ALC662_MODEL_LAST] = {
16760 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16761 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16762 [ALC662_3ST_6ch] = "3stack-6ch",
16763 [ALC662_5ST_DIG] = "6stack-dig",
16764 [ALC662_LENOVO_101E] = "lenovo-101e",
16765 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16766 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16767 [ALC662_ECS] = "ecs",
16768 [ALC663_ASUS_M51VA] = "m51va",
16769 [ALC663_ASUS_G71V] = "g71v",
16770 [ALC663_ASUS_H13] = "h13",
16771 [ALC663_ASUS_G50V] = "g50v",
16772 [ALC663_ASUS_MODE1] = "asus-mode1",
16773 [ALC662_ASUS_MODE2] = "asus-mode2",
16774 [ALC663_ASUS_MODE3] = "asus-mode3",
16775 [ALC663_ASUS_MODE4] = "asus-mode4",
16776 [ALC663_ASUS_MODE5] = "asus-mode5",
16777 [ALC663_ASUS_MODE6] = "asus-mode6",
16778 [ALC272_DELL] = "dell",
16779 [ALC272_DELL_ZM1] = "dell-zm1",
16780 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16781 [ALC662_AUTO] = "auto",
16784 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16785 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16786 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16787 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16788 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16789 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16790 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16791 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16792 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16793 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16794 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16795 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16796 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16797 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16798 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16799 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16800 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16801 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16802 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16803 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16804 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16805 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16806 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16807 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16808 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16809 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16810 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16811 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16812 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16813 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16814 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16815 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16816 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16817 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16818 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16819 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16820 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16821 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16822 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16823 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16824 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16825 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16826 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16827 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16828 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16829 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16830 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16831 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16832 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16833 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16834 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16835 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16836 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16837 ALC662_3ST_6ch_DIG),
16838 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
16839 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16840 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16841 ALC662_3ST_6ch_DIG),
16842 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16843 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16844 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16845 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16846 ALC662_3ST_6ch_DIG),
16847 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16852 static struct alc_config_preset alc662_presets[] = {
16853 [ALC662_3ST_2ch_DIG] = {
16854 .mixers = { alc662_3ST_2ch_mixer },
16855 .init_verbs = { alc662_init_verbs },
16856 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16857 .dac_nids = alc662_dac_nids,
16858 .dig_out_nid = ALC662_DIGOUT_NID,
16859 .dig_in_nid = ALC662_DIGIN_NID,
16860 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16861 .channel_mode = alc662_3ST_2ch_modes,
16862 .input_mux = &alc662_capture_source,
16864 [ALC662_3ST_6ch_DIG] = {
16865 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16866 .init_verbs = { alc662_init_verbs },
16867 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16868 .dac_nids = alc662_dac_nids,
16869 .dig_out_nid = ALC662_DIGOUT_NID,
16870 .dig_in_nid = ALC662_DIGIN_NID,
16871 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16872 .channel_mode = alc662_3ST_6ch_modes,
16874 .input_mux = &alc662_capture_source,
16876 [ALC662_3ST_6ch] = {
16877 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16878 .init_verbs = { alc662_init_verbs },
16879 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16880 .dac_nids = alc662_dac_nids,
16881 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16882 .channel_mode = alc662_3ST_6ch_modes,
16884 .input_mux = &alc662_capture_source,
16886 [ALC662_5ST_DIG] = {
16887 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16888 .init_verbs = { alc662_init_verbs },
16889 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16890 .dac_nids = alc662_dac_nids,
16891 .dig_out_nid = ALC662_DIGOUT_NID,
16892 .dig_in_nid = ALC662_DIGIN_NID,
16893 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16894 .channel_mode = alc662_5stack_modes,
16895 .input_mux = &alc662_capture_source,
16897 [ALC662_LENOVO_101E] = {
16898 .mixers = { alc662_lenovo_101e_mixer },
16899 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16900 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16901 .dac_nids = alc662_dac_nids,
16902 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16903 .channel_mode = alc662_3ST_2ch_modes,
16904 .input_mux = &alc662_lenovo_101e_capture_source,
16905 .unsol_event = alc662_lenovo_101e_unsol_event,
16906 .init_hook = alc662_lenovo_101e_all_automute,
16908 [ALC662_ASUS_EEEPC_P701] = {
16909 .mixers = { alc662_eeepc_p701_mixer },
16910 .init_verbs = { alc662_init_verbs,
16911 alc662_eeepc_sue_init_verbs },
16912 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16913 .dac_nids = alc662_dac_nids,
16914 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16915 .channel_mode = alc662_3ST_2ch_modes,
16916 .unsol_event = alc662_eeepc_unsol_event,
16917 .setup = alc662_eeepc_setup,
16918 .init_hook = alc662_eeepc_inithook,
16920 [ALC662_ASUS_EEEPC_EP20] = {
16921 .mixers = { alc662_eeepc_ep20_mixer,
16922 alc662_chmode_mixer },
16923 .init_verbs = { alc662_init_verbs,
16924 alc662_eeepc_ep20_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_6ch_modes),
16928 .channel_mode = alc662_3ST_6ch_modes,
16929 .input_mux = &alc662_lenovo_101e_capture_source,
16930 .unsol_event = alc662_eeepc_unsol_event,
16931 .setup = alc662_eeepc_ep20_setup,
16932 .init_hook = alc662_eeepc_ep20_inithook,
16935 .mixers = { alc662_ecs_mixer },
16936 .init_verbs = { alc662_init_verbs,
16937 alc662_ecs_init_verbs },
16938 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16939 .dac_nids = alc662_dac_nids,
16940 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16941 .channel_mode = alc662_3ST_2ch_modes,
16942 .unsol_event = alc662_eeepc_unsol_event,
16943 .setup = alc662_eeepc_setup,
16944 .init_hook = alc662_eeepc_inithook,
16946 [ALC663_ASUS_M51VA] = {
16947 .mixers = { alc663_m51va_mixer },
16948 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16949 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16950 .dac_nids = alc662_dac_nids,
16951 .dig_out_nid = ALC662_DIGOUT_NID,
16952 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16953 .channel_mode = alc662_3ST_2ch_modes,
16954 .unsol_event = alc663_m51va_unsol_event,
16955 .setup = alc663_m51va_setup,
16956 .init_hook = alc663_m51va_inithook,
16958 [ALC663_ASUS_G71V] = {
16959 .mixers = { alc663_g71v_mixer },
16960 .init_verbs = { alc662_init_verbs, alc663_g71v_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 .unsol_event = alc663_g71v_unsol_event,
16967 .setup = alc663_g71v_setup,
16968 .init_hook = alc663_g71v_inithook,
16970 [ALC663_ASUS_H13] = {
16971 .mixers = { alc663_m51va_mixer },
16972 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16973 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16974 .dac_nids = alc662_dac_nids,
16975 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16976 .channel_mode = alc662_3ST_2ch_modes,
16977 .unsol_event = alc663_m51va_unsol_event,
16978 .init_hook = alc663_m51va_inithook,
16980 [ALC663_ASUS_G50V] = {
16981 .mixers = { alc663_g50v_mixer },
16982 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16983 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16984 .dac_nids = alc662_dac_nids,
16985 .dig_out_nid = ALC662_DIGOUT_NID,
16986 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16987 .channel_mode = alc662_3ST_6ch_modes,
16988 .input_mux = &alc663_capture_source,
16989 .unsol_event = alc663_g50v_unsol_event,
16990 .setup = alc663_g50v_setup,
16991 .init_hook = alc663_g50v_inithook,
16993 [ALC663_ASUS_MODE1] = {
16994 .mixers = { alc663_m51va_mixer },
16995 .cap_mixer = alc662_auto_capture_mixer,
16996 .init_verbs = { alc662_init_verbs,
16997 alc663_21jd_amic_init_verbs },
16998 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17000 .dac_nids = alc662_dac_nids,
17001 .dig_out_nid = ALC662_DIGOUT_NID,
17002 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17003 .channel_mode = alc662_3ST_2ch_modes,
17004 .unsol_event = alc663_mode1_unsol_event,
17005 .setup = alc663_mode1_setup,
17006 .init_hook = alc663_mode1_inithook,
17008 [ALC662_ASUS_MODE2] = {
17009 .mixers = { alc662_1bjd_mixer },
17010 .cap_mixer = alc662_auto_capture_mixer,
17011 .init_verbs = { alc662_init_verbs,
17012 alc662_1bjd_amic_init_verbs },
17013 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17014 .dac_nids = alc662_dac_nids,
17015 .dig_out_nid = ALC662_DIGOUT_NID,
17016 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17017 .channel_mode = alc662_3ST_2ch_modes,
17018 .unsol_event = alc662_mode2_unsol_event,
17019 .setup = alc662_mode2_setup,
17020 .init_hook = alc662_mode2_inithook,
17022 [ALC663_ASUS_MODE3] = {
17023 .mixers = { alc663_two_hp_m1_mixer },
17024 .cap_mixer = alc662_auto_capture_mixer,
17025 .init_verbs = { alc662_init_verbs,
17026 alc663_two_hp_amic_m1_init_verbs },
17027 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17029 .dac_nids = alc662_dac_nids,
17030 .dig_out_nid = ALC662_DIGOUT_NID,
17031 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17032 .channel_mode = alc662_3ST_2ch_modes,
17033 .unsol_event = alc663_mode3_unsol_event,
17034 .setup = alc663_mode3_setup,
17035 .init_hook = alc663_mode3_inithook,
17037 [ALC663_ASUS_MODE4] = {
17038 .mixers = { alc663_asus_21jd_clfe_mixer },
17039 .cap_mixer = alc662_auto_capture_mixer,
17040 .init_verbs = { alc662_init_verbs,
17041 alc663_21jd_amic_init_verbs},
17042 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17044 .dac_nids = alc662_dac_nids,
17045 .dig_out_nid = ALC662_DIGOUT_NID,
17046 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17047 .channel_mode = alc662_3ST_2ch_modes,
17048 .unsol_event = alc663_mode4_unsol_event,
17049 .setup = alc663_mode4_setup,
17050 .init_hook = alc663_mode4_inithook,
17052 [ALC663_ASUS_MODE5] = {
17053 .mixers = { alc663_asus_15jd_clfe_mixer },
17054 .cap_mixer = alc662_auto_capture_mixer,
17055 .init_verbs = { alc662_init_verbs,
17056 alc663_15jd_amic_init_verbs },
17057 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17059 .dac_nids = alc662_dac_nids,
17060 .dig_out_nid = ALC662_DIGOUT_NID,
17061 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17062 .channel_mode = alc662_3ST_2ch_modes,
17063 .unsol_event = alc663_mode5_unsol_event,
17064 .setup = alc663_mode5_setup,
17065 .init_hook = alc663_mode5_inithook,
17067 [ALC663_ASUS_MODE6] = {
17068 .mixers = { alc663_two_hp_m2_mixer },
17069 .cap_mixer = alc662_auto_capture_mixer,
17070 .init_verbs = { alc662_init_verbs,
17071 alc663_two_hp_amic_m2_init_verbs },
17072 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17074 .dac_nids = alc662_dac_nids,
17075 .dig_out_nid = ALC662_DIGOUT_NID,
17076 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17077 .channel_mode = alc662_3ST_2ch_modes,
17078 .unsol_event = alc663_mode6_unsol_event,
17079 .setup = alc663_mode6_setup,
17080 .init_hook = alc663_mode6_inithook,
17083 .mixers = { alc663_m51va_mixer },
17084 .cap_mixer = alc272_auto_capture_mixer,
17085 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17086 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17087 .dac_nids = alc662_dac_nids,
17088 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17089 .adc_nids = alc272_adc_nids,
17090 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17091 .capsrc_nids = alc272_capsrc_nids,
17092 .channel_mode = alc662_3ST_2ch_modes,
17093 .unsol_event = alc663_m51va_unsol_event,
17094 .setup = alc663_m51va_setup,
17095 .init_hook = alc663_m51va_inithook,
17097 [ALC272_DELL_ZM1] = {
17098 .mixers = { alc663_m51va_mixer },
17099 .cap_mixer = alc662_auto_capture_mixer,
17100 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17101 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17102 .dac_nids = alc662_dac_nids,
17103 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17104 .adc_nids = alc662_adc_nids,
17106 .capsrc_nids = alc662_capsrc_nids,
17107 .channel_mode = alc662_3ST_2ch_modes,
17108 .unsol_event = alc663_m51va_unsol_event,
17109 .setup = alc663_m51va_setup,
17110 .init_hook = alc663_m51va_inithook,
17112 [ALC272_SAMSUNG_NC10] = {
17113 .mixers = { alc272_nc10_mixer },
17114 .init_verbs = { alc662_init_verbs,
17115 alc663_21jd_amic_init_verbs },
17116 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17117 .dac_nids = alc272_dac_nids,
17118 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17119 .channel_mode = alc662_3ST_2ch_modes,
17120 /*.input_mux = &alc272_nc10_capture_source,*/
17121 .unsol_event = alc663_mode4_unsol_event,
17122 .setup = alc663_mode4_setup,
17123 .init_hook = alc663_mode4_inithook,
17129 * BIOS auto configuration
17132 /* convert from MIX nid to DAC */
17133 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17137 else if (nid >= 0x0c && nid <= 0x0e)
17138 return nid - 0x0c + 0x02;
17143 /* get MIX nid connected to the given pin targeted to DAC */
17144 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17150 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17151 for (i = 0; i < num; i++) {
17152 if (alc662_mix_to_dac(mix[i]) == dac)
17158 /* look for an empty DAC slot */
17159 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17161 struct alc_spec *spec = codec->spec;
17165 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17168 for (i = 0; i < num; i++) {
17169 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17172 for (j = 0; j < spec->multiout.num_dacs; j++)
17173 if (spec->multiout.dac_nids[j] == nid)
17175 if (j >= spec->multiout.num_dacs)
17181 /* fill in the dac_nids table from the parsed pin configuration */
17182 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17183 const struct auto_pin_cfg *cfg)
17185 struct alc_spec *spec = codec->spec;
17189 spec->multiout.dac_nids = spec->private_dac_nids;
17190 for (i = 0; i < cfg->line_outs; i++) {
17191 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17194 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17199 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17200 hda_nid_t nid, unsigned int chs)
17202 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17203 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17206 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17207 hda_nid_t nid, unsigned int chs)
17209 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17210 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17213 #define alc662_add_stereo_vol(spec, pfx, nid) \
17214 alc662_add_vol_ctl(spec, pfx, nid, 3)
17215 #define alc662_add_stereo_sw(spec, pfx, nid) \
17216 alc662_add_sw_ctl(spec, pfx, nid, 3)
17218 /* add playback controls from the parsed DAC table */
17219 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17220 const struct auto_pin_cfg *cfg)
17222 struct alc_spec *spec = codec->spec;
17223 static const char *chname[4] = {
17224 "Front", "Surround", NULL /*CLFE*/, "Side"
17226 hda_nid_t nid, mix;
17229 for (i = 0; i < cfg->line_outs; i++) {
17230 nid = spec->multiout.dac_nids[i];
17233 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17238 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17241 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17244 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17247 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17252 if (cfg->line_outs == 1 &&
17253 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17260 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17263 if (cfg->line_outs == 1 &&
17264 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17266 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17274 /* add playback controls for speaker and HP outputs */
17275 /* return DAC nid if any new DAC is assigned */
17276 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17279 struct alc_spec *spec = codec->spec;
17280 hda_nid_t nid, mix;
17285 nid = alc662_look_for_dac(codec, pin);
17287 /* the corresponding DAC is already occupied */
17288 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17289 return 0; /* no way */
17290 /* create a switch only */
17291 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17292 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17295 mix = alc662_dac_to_mix(codec, pin, nid);
17298 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17301 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17307 /* create playback/capture controls for input pins */
17308 #define alc662_auto_create_input_ctls \
17309 alc880_auto_create_input_ctls
17311 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17312 hda_nid_t nid, int pin_type,
17318 alc_set_pin_output(codec, nid, pin_type);
17319 /* need the manual connection? */
17320 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17323 for (i = 0; i < num; i++) {
17324 if (alc662_mix_to_dac(srcs[i]) != dac)
17326 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17331 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17333 struct alc_spec *spec = codec->spec;
17334 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17337 for (i = 0; i <= HDA_SIDE; i++) {
17338 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17340 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17341 spec->multiout.dac_nids[i]);
17345 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17347 struct alc_spec *spec = codec->spec;
17350 pin = spec->autocfg.hp_pins[0];
17352 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17353 spec->multiout.hp_nid);
17354 pin = spec->autocfg.speaker_pins[0];
17356 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17357 spec->multiout.extra_out_nid[0]);
17360 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17362 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17364 struct alc_spec *spec = codec->spec;
17367 for (i = 0; i < AUTO_PIN_LAST; i++) {
17368 hda_nid_t nid = spec->autocfg.input_pins[i];
17369 if (alc_is_input_pin(codec, nid)) {
17370 alc_set_input_pin(codec, nid, i);
17371 if (nid != ALC662_PIN_CD_NID &&
17372 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17373 snd_hda_codec_write(codec, nid, 0,
17374 AC_VERB_SET_AMP_GAIN_MUTE,
17380 #define alc662_auto_init_input_src alc882_auto_init_input_src
17382 static int alc662_parse_auto_config(struct hda_codec *codec)
17384 struct alc_spec *spec = codec->spec;
17386 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17388 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17392 if (!spec->autocfg.line_outs)
17393 return 0; /* can't find valid BIOS pin config */
17395 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17398 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17401 err = alc662_auto_create_extra_out(codec,
17402 spec->autocfg.speaker_pins[0],
17407 spec->multiout.extra_out_nid[0] = err;
17408 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17413 spec->multiout.hp_nid = err;
17414 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17418 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17420 if (spec->autocfg.dig_outs)
17421 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17423 if (spec->kctls.list)
17424 add_mixer(spec, spec->kctls.list);
17426 spec->num_mux_defs = 1;
17427 spec->input_mux = &spec->private_imux[0];
17429 add_verb(spec, alc662_auto_init_verbs);
17430 if (codec->vendor_id == 0x10ec0663)
17431 add_verb(spec, alc663_auto_init_verbs);
17433 err = alc_auto_add_mic_boost(codec);
17437 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17442 /* additional initialization for auto-configuration model */
17443 static void alc662_auto_init(struct hda_codec *codec)
17445 struct alc_spec *spec = codec->spec;
17446 alc662_auto_init_multi_out(codec);
17447 alc662_auto_init_hp_out(codec);
17448 alc662_auto_init_analog_input(codec);
17449 alc662_auto_init_input_src(codec);
17450 if (spec->unsol_event)
17451 alc_inithook(codec);
17454 static int patch_alc662(struct hda_codec *codec)
17456 struct alc_spec *spec;
17457 int err, board_config;
17459 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17463 codec->spec = spec;
17465 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17467 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17470 if (board_config < 0) {
17471 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17473 board_config = ALC662_AUTO;
17476 if (board_config == ALC662_AUTO) {
17477 /* automatic parse from the BIOS config */
17478 err = alc662_parse_auto_config(codec);
17484 "hda_codec: Cannot set up configuration "
17485 "from BIOS. Using base mode...\n");
17486 board_config = ALC662_3ST_2ch_DIG;
17490 err = snd_hda_attach_beep_device(codec, 0x1);
17496 if (board_config != ALC662_AUTO)
17497 setup_preset(codec, &alc662_presets[board_config]);
17499 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17500 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17502 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17503 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17505 if (!spec->adc_nids) {
17506 spec->adc_nids = alc662_adc_nids;
17507 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17509 if (!spec->capsrc_nids)
17510 spec->capsrc_nids = alc662_capsrc_nids;
17512 if (!spec->cap_mixer)
17513 set_capture_mixer(codec);
17514 if (codec->vendor_id == 0x10ec0662)
17515 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17517 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17519 spec->vmaster_nid = 0x02;
17521 codec->patch_ops = alc_patch_ops;
17522 if (board_config == ALC662_AUTO)
17523 spec->init_hook = alc662_auto_init;
17524 #ifdef CONFIG_SND_HDA_POWER_SAVE
17525 if (!spec->loopback.amplist)
17526 spec->loopback.amplist = alc662_loopbacks;
17528 codec->proc_widget_hook = print_realtek_coef;
17536 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17537 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17538 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17539 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17540 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17541 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17542 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17543 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17544 .patch = patch_alc861 },
17545 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17546 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17547 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17548 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17549 .patch = patch_alc882 },
17550 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17551 .patch = patch_alc662 },
17552 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17553 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17554 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17555 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17556 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17557 .patch = patch_alc882 },
17558 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17559 .patch = patch_alc882 },
17560 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17561 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17562 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17563 .patch = patch_alc882 },
17564 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17565 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17566 {} /* terminator */
17569 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17571 MODULE_LICENSE("GPL");
17572 MODULE_DESCRIPTION("Realtek HD-audio codec");
17574 static struct hda_codec_preset_list realtek_list = {
17575 .preset = snd_hda_preset_realtek,
17576 .owner = THIS_MODULE,
17579 static int __init patch_realtek_init(void)
17581 return snd_hda_add_codec_preset(&realtek_list);
17584 static void __exit patch_realtek_exit(void)
17586 snd_hda_delete_codec_preset(&realtek_list);
17589 module_init(patch_realtek_init)
17590 module_exit(patch_realtek_exit)